Keypad connected with only 3 wires to Arduino.
Background:
A matrix keypad can be connected to an Arduino board so that numerical data can be entered by the user.
Instructions exist in various forums on how to do this. The main problem is that this usually uses up a total of 7 of your digital input/output pins.
The problem:
For me this is a big problem as I want these pins free to control external devices such as solenoid valves and actuators. I also need some to send data to a serial LCD display.
Options are either
a) Use an Arduino Mega with lots more pins or
b) Find a way of interfacing a keypad using less input pins.
Solution:
By using ONE single analog input pin and a grid of resistors, we can wire up the buttons on the keypad such that when each is pressed a different voltage is sent to the analog input pin.
Although it is a hassle wiring up all the resistors, the big advantage is that all your digital pins remain free to be used for other things.
This has been described before on AVR forums but I have adapted it for Arduino and written some code for you to get started.
Remove these ads by
Signing UpStep 1: Identify the keypad pins
Keypad can be considered to have 3 "columns" and 4 "rows" - see photo.
First step is to work out which solder terminal represents each row and which represents each column. Write everything down as you go along, very easy to mix everything up.
This has been described and you need to follow the instructions on how to do this given in this Arduino keypad tutorial:
http://www.arduino.cc/playground/Main/KeypadTutorial









































Visit Our Store »
Go Pro Today »




its a wet and windy Sunday here in the UK and nothing else to do?
And the resistors? how did you calculate the sizes?
The resistor values were borrowed from a post on similar topic on the AVR forums.
Best wishes
John
If you turn it over you see that several of the apparent solder terminals don't do anything and there are 7 active terminals.
I have changed the diagram to 15000 Ohm.
Best wishes
John