Picture of Using the sparkfun 12 Button keypad, with the arduino
 Hi guys, well bought this keypad, and wasn't exactly sure how to wire it up, because the pins aren't in order!

well, I will give you a schematic, and code to have it up and running in no time...

Step 1: Wiring

Picture of Wiring
The image says it all...
the resistors can be anything betwen 1Kohm, and 10Kohm.
they go from pin 3, 5, 6 and 7 to +5V.

jcameron-12 years ago
Thank you for this tutorial. I'm a Arduino newbie, so it was exactly what I was looking for to continue my vending project for my son. I was wondering if you had any examples of how to make a servo rotate if a correct "code" is put into the keypad? I've been searching like crazy but haven't come across any examples.
hi! have you found the answer? I can help you, just email me: samukafranco@gmail.com
amando96 (author)  jcameron-12 years ago
Put the keys into an array, compare the array to a predefined array of the "correct" code with an if statement, if equal then rotate servo, if not beep or whatever, take things by parts, break down big algorithms into small algorithms and you have no trouble doing anything.
network415 years ago
I know little electronics than I should for what I'm doing but why do you say to wire contacts 3, 5, 6, 7 to resistors then 5v when you also say to connect them to pins on the Arduino. Surely you don't mean to connect it like that? I'd be much appreciated if you could clear my confusion.
hello, I'm wondering did you get this question answered? plug it into arduino pin and 5 volts? how?
amando96 (author)  network415 years ago
Aye, look: http://www.arduino.cc/en/Tutorial/Button A resistor is needed, it might work without resistors, but they are keeping all the buttons high, without them the buttons will float and caus bad readings.
cavingboy923 years ago
I have a problem where the arduino program says, 'byte' does not name a type. If you know, how can I fix this problem?
amando96 (author)  cavingboy923 years ago
Which board/program version do you have? probably something that changed, try uint8_t instead of byte
I have the Arduino UNO SMD board. The arduino program that I have is Arduino 1.0.
nlepka4 years ago
on my keypad the pullup resistors are placed on 2, 4, 6, and 7... not 3, 5, 6, and 7
the keypads look identical, but after examining the circuitboard itself, it's clear to see where the resistors should be placed...

even though I managed to get power into my keypad, I still can't make my microprocessor react to it...

any idea why?
ble2nk4 years ago
excuse me, datasheet show that key 2:1+2 and 0:1+4, with your pull-up connection both of that keys (2 and 0) will not connected to pull-up, what do you think?
dcloud1024 years ago
How did you know to put the resistor in the pins that you mentioned? Why not from pin 1 to 7? Thanks.
amando96 (author)  dcloud1024 years ago
not exactly sure what I was thinking at the time, but it seems okay, keypads tend to be wired like this: http://www.o-digital.com/uploads/2179/2191-1/12_Key_Membrane_Switch_Keypad_848.jpg

so pins 3, 5, 6 and 7 are for the horizontal connections, so no matter what button I press it will always have a resistor, I could have put the resistors on the vertical connection side, it would work, It even worked without resistors, but you never know, it's not good to leave floating pins.
Thanks for the help Amando96. Working great now.
dcloud1024 years ago
I have question, so how did you know to connect the resistors to pin 3,5,6 and 7? Why not pin 1,2,3,4,5,6, and 7? What is the logic to putting the resistor in place where it is?
shyguy5675 years ago
This is probably a stupid question, but Pins 3, 5, 6, and 7 should be connected to the 5V power supply and the Arduino or will the Arduino supply the power?
amando96 (author)  shyguy5675 years ago
The arduino will read which one has a resistance of 0ohm(not 0ohm, it's not a super conductor, but yeah) If they where connected to 5v the readings would be wrong.