Vous êtes sur la page 1sur 1

Tired of using normal push buttons as input to your system?

You should consider


including a matrix keypad. Matrix keypad is widely use in our daily life. Often,
matrix keypad is available in 34 or 44. For your information, matrix keypad is a
good substitution to normal push button. Matrix keypad offers more input to the
microcontroller with lesser I/O pins required as compared to buttons. Consider y
our system needs 16 inputs, you requires only 8 I/O pins with keypad instead of
16 I/O pins. So you can actually use the extra 8 pins for other functions.A 44 ma
trix keypads consists of 4 rows and 4 columns. This is roughly how the keypads l
ooks like:
There is a switch connecting each row and column. So the combinations of rows an
d columns makes up the 16 inputs.
So, try to imagine this. Initially all the switch are open (not connected). When
you pressed either one buttons, the switch is now closed (connected). As you ca
n see, now there is a connection between the row and column.
Okay, now we know how a matrix keypad works, but how do we relate it with our mi
crocontroller? So we connect the first 4 pins to the column as INPUT. The other
4 pins is connected to the row as OUTPUT. The input meant that is the input to t
he microcontroller while output is the output from the microcontroller. Note tha
t the input to the microcontroller has to connect to pull high resistor, or you
can use the internal pull up from Arduino itself.Now let us look on how to inter
face with the hardware before moving on the the software part. For a 44 matrix ke
ypad, usually it has 8 pins on it. How do we know which pins are associate to wh
ich rows and columns? A digital multimeter (DMM) would ease your job.
Turn your DMM to connectivity mode. Now put one of your meter probe to the first
pin and the other one to the fifth pin. Try to press the button and see which b
utton would gives you the beep sound. Next, try to probe to the sixth pin and pres
s other button. Keep trying and you would understand the connection behind the k
eypad.
Finally we have reached to the software part. To use a keypad with Arduino, its
pretty simple with the help of Keypad.h library. You can download the library a
t here.
Note that when you are using this library, you don t need to connect any external
resistor as it has been internally pull high in Arduino.
Hardware connection with Arduino:

Vous aimerez peut-être aussi