Keypad - 12 Button

A basic 12 button keypad for user input. The buttons are setup in a matrix format. This allows a microcontroller to 'scan' the 7 output pins to see which of the 12 buttons is being pressed.

Check the Documents tab examples and hookup guides.

Keypad - 12 Button Product Help and Resources

SX1509 I/O Expander Breakout Hookup Guide

September 24, 2015

Learn how you can use the SX1509 to control 16 LEDs or up to 64 buttons with just two pins.

Core Skill: Soldering

This skill defines how difficult the soldering is on a particular product. It might be a couple simple solder joints, or require special reflow tools.

2 Soldering

Skill Level: Rookie - The number of pins increases, and you will have to determine polarity of components and some of the components might be a bit trickier or close together. You might need solder wick or flux.
See all skill levels


Core Skill: Electrical Prototyping

If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.

3 Electrical Prototyping

Skill Level: Competent - You will be required to reference a datasheet or schematic to know how to use a component. Your knowledge of a datasheet will only require basic features like power requirements, pinouts, or communications type. Also, you may need a power supply that?s greater than 12V or more than 1A worth of current.
See all skill levels


Comments

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • anthrolume / about 8 years ago / 1

    I basically remanufactured this thing to have near-zero resistance by soldering jumpers over the conductive paint paths on the board, and by affixing aluminum tape caps to the insides of the button membrane. Was it worth it? Well necessity is the mother of invention.

    Picture of the jumper job: jumpers Picture of the aluminized caps: caps Picture of the completed mods: mods

    You get what you pay for.

  • Member #81485 / about 13 years ago * / 6

    Upon further thinking and research, I've (and a friend) devised the best plan to use this thing while taking only ONE (yes 1) analog input. You make a resistor ladder of sorts (see picture 1 below) between the pads and sample the last pad with respect to gnd with one analog input. The nature of what pads short out and how they short makes this non-trivial. I ran a simulation with 1,000,000 different combinations of resistors to optimize the different readings on the analog input. The resistor values and expected analog input readings are given on the second image.
    Circuit Schematic
    Excel Sheet
    edit:
    Picture of Resistors (SMD 603s) on the Pads: the red wire is +5V, purple is analog out, black is ground.

    • BluesFan44 / about 11 years ago / 1

      So what I'm taking from this is that using one analog pin, you can attach a series of buttons in serial, and depending on the resistance they give, determine which button was pressed.

      Am I correct?

    • Member #410558 / about 12 years ago * / 1

      I think there is a simpler way to get an evenly spaced analog output without much computation to determine resistor values. This method doesn't use a resistor ladder. I don't have this keypad, but I assume that one output pin is connected to each key column and one pin is connected to each key row to make three column pins and 4 row pins. I haven't figured out how to attach a schematic, so here is a text description of the circuit:
      1. Connect R6 to the voltage reference then to the key "1" row pin.
      2. Connect the key "1" row pin to R5 then to the key "4" row pin.
      3. Connect the key "1" row pin to R4 then to the key "7" row pin.
      4. Connect the key "1" row pin to R3 then to the key "*" row pin.
      5. Connect the key "1" column pin to ground.
      6. Connect the key "2" column pin to R1 then to ground.
      7. Connect the key "3" column pin to R2 then to ground.

      The voltage output is taken from the key "1" row pin. This circuit sets up a simple voltage divider from Vref through R6 then to an equivalent resistance, Re, to ground. Resistors R1 through R5 are expressed as multiples of R1 as follows:
      R1=R1
      R2=2R1
      R5=3R1
      R4=6R1
      R3=9R1
      This results in the Re for each key as follows:
      Key, Re
      1, 0
      2, R1
      3, 2R1
      4, 3R1
      5, 4R1
      6, 5R1
      7, 6R1
      8, 7R1
      9, 8R1
      *, 9R1
      0, 10R1
      "#", 11R1
      no keypress, infinity

      R6 can be set to whatever you want. The voltage output is then:
      Vout = Vref * Re/(R6 + Re)

      This circuit can be easily modified to work with any number of rows and columns. If the leftmost column is column 0 and the topmost row is row 0, then the column resistors are in the ratios of 0, 1, 2, ... n and the row resistors are in the ratios of 0, n+1, 2(n+1), 3(n+1), etc.

    • pga / about 13 years ago * / 1

      There are a couple of improvements to be made to this resistor ladder technique.

      • The resistor ladders discussed so far are tapped at "Pin 7", where there is relatively little possible variation in voltage. It should be tapped somewhere in the middle, so that the voltage can swing nearly rail-to-rail with different button pushes.

      • The combinatorics haven't been done quite right by either example. The 24-choose-7 = ~350,000 combinations assumes every value can be used only once, whereas in fact repeats are allowed. This pushes the number of combinations into the billions, where an exhaustive search is impractical.

      Nevertheless, much better separation can be achieved. Using a random-sampling approach on 500,000 combinations from the set of resistor values [220 470 560 3300 3900 4300 4700 5600 6800 8200] (based on a sample-pack of surface mount resistors I had, limited to values large enough to keep the current reasonably low), the following set of resistors works much better (P==Pin, R==Resistor):

      ** +Vs--P0--R470--P1--R5600--P2--R8200--P3/TAP--R3300--P4--R5600--P5--R8200--P6--R3900--P7--R220--P8--GND**

      Tap it to the A/D at "Pin 3".

      The minimum voltage difference between button pushes is 3.4% of Vsupply. That's 35 digital levels of a 10-bit (1024 level) A/D converter. That should be more robust to variations in contact resistance of the buttons.

      Here are a couple other good combinations with similar results:

      [560, 5600, 8200, 3300, 3300, 6800, 3300, 4700], tapped at "Pin 4". Minimum of 3.2% of Vsupply (33 digital levels of 10-bit A/D).

      [3300, 6800, 8200, 4300, 3300, 4700, 3300, 4700], tapped at "Pin 4". Minimum of 2.3% of Vsupply (24 digital levels of 10-bit A/D). Note the higher values here - good for lower current.

      [220, 3300, 8200, 4700, 3900, 8200, 4300, 560], tapped at "Pin 4". Minimum of 2.7% of Vsupply (28 digital levels of 10-bit A/D).

      I've been using that last one, and the data returned are pretty reliable. The lowest difference I've observed in practice was 18 digital levels, lower than spec because my VSupply is just a GPIO, and it's still drawing too much current when you push button "5" (shorts pins 1-7; resulting resistance 780 ohm; current ~4.2mA). You might want to multiply them all by 10 to prevent that problem, or use one of the other options above.

      Hope that helps.

      • rhinoman / about 13 years ago / 1

        My optimal combination is as follows

        GND-220-P1-3300-P2-10000-P3/TAP-220-P4-3000-P5-5100-P6-1800-P7-300-Vs

        The minimum difference is ~7.1% which equates to about 73 digital levels at a min.

        • rhinoman / about 13 years ago / 1

          After a hundred trillion plus calculations(34^8 checks ~ 1.7 trillion * 80 calculations per check) I was able to find even better results. The theoretical maximum minimum spread is ~85 digital levels. With using only 34 resistor values ( I could have used many more values say 40 or 50 but I feel that the result would have been similar and took another day or more to calculate I was able to find 2 results with a minimum spread of ~78 digital levels. The resistor values are:

          1) 390 3900 9100 510 5100 8200 2700 39

          2) 390 3900 9100 560 5100 8200 2700 39

          you can multiply these values by 10 or 100 and get the same result. The 34 resistor values I used were as follows:

          39 47 51 68 82 100 150 180 220 270 300 390 470 510 560 680 820 1000 1200 1500 1800 2200 2700 3000 3300 3900 4700 5100 5600 6800 8200 9100 10000 12000

          • rhinoman / about 13 years ago / 1

            Doing further analysis with a larger number of values has yielded some slightly better results. The best being

            560 8200 18000 910 9100 15000 5100 51

            This result has a minimum spread of 80!

            This test was based on the following 98 resistor values:

            1 2 3 3.9 5.1 6.2 8.2 9.1 10 11 12 13 15 16 18 20 22 24 27 30 33 36 39 43 47 51 56 62 68 75 82 91 100 110 120 130 150 160 180 200 220 240 270 300 330 360 390 430 470 510 560 620 680 750 820 910 1000 1100 1200 1300 1500 1600 1800 2000 2200 2400 2700 3000 3200 3300 3600 3900 4300 4700 5100 5600 6200 6600 7500 8200 9100 10000 11000 12000 13000 15000 16000 18000 20000 22000 24000 27000 30000 33000 36000 39000 43000 47000

            • pga / about 12 years ago / 1

              Sweet work with the cluster computation. Have you built it and found it to work?

              I would only caution against the smaller values due to current, per above (i.e., at some point is that 51 Ohm or the 39 Ohm above it the only resistor in the circuit? If so, then high current!). But if it works it works.

            • Loki Brennr / about 13 years ago / 1

              Can you share the exact method you're using for the calculations? It'd be nice to find the best combinations based on a given set of resistors...

              • rhinoman / about 13 years ago / 1

                I am doing it with simple math and a beowulf cluster of computers(you can do it with a pc but it will take a long time). The math is as follows:

                where "a" is the left most resistor and "h" the farthest on the right. Ground or - is on the left and Vcc or + is on the right. So my previous result would read like this

                GND --> 560(a) --> pin1 --> 8200(b) --> pin2 --> 18000(c) --> pin3(this pin is connected to an analog pin of a micro controller) --> 910(d) --> pin4 --> 9100(e) --> pin5 --> 15000(f) --> pin6 --> 5100(g) --> pin7 --> 51(h) --> Vcc where "-->" is a connection between the two.

                button 1: 1024 * ( a + b ) / ( a + b + d + e + f + g + h ) button 2: 1024 * ( a + c ) / ( a + c + d + e + f + g + h ) button 3: 1024 * ( a + b ) / ( a + b + f + g + h )
                button 4: 1024 * ( a + b + c ) / ( a + b + c + h ) button 5: 1024 * ( a ) / ( a + h ) button 6: 1024 * ( a + b + c ) / ( a + b + c + d + e + h ) button 7: 1024 * ( a + b + c ) / ( a + b + c + g + h ) button 8: 1024 * ( a ) / ( a + g + h ) button 9: 1024 * ( a + b + c ) / ( a + b + c + d + e + g + h ) button 10: 1024 * ( a + b + c ) / ( a + b + c + e + f + g + h ) button 11: 1024 * ( a ) / ( a + e + f + g + h ) button 12: 1024 * ( a + b + c ) / ( a + b + c + d + f + g + h )

                For further study do a google search on "Voltage resistor ladder" or "voltage resistor divider"

                • Loki Brennr / about 13 years ago / 1

                  heh, I have cluster power, hence why I was interested. Essentially then you are just brute force checking all possible combinations? There has to be a faster way of doing this.

                  • Loki Brennr / about 13 years ago / 1

                    I have some python code for calculating the optimal combination based on a given set of resistor values up in a bitbucket repo

                    I'm porting this over to a hadoop job at some point - I'd like to find the best combination for the E12 series, as those are easiest to find.

                    So far, with 46 digital levels, the best E12 series I've found is: [1000, 1200, 10000, 1500, 4700, 8200, 1800, 2200]

                    You can see this in circuitlab

      • LouisT / about 13 years ago * / 1

        Your solution makes me think that I may be fundamentally misunderstanding the keypad...

        Doesn't pressing button 5 create a short between pads 1 and 7? Thus sampling anywhere other than 1 and 7 will give ambiguous readings. If you sample at pad 4, pressing button 5 (short 1 to 7) and button 3 (short 2 to 5) will both give a floating voltage read.

        Similarly, suppose you used the same resistor value for R1 and R2, when you press button 2 (short around R1) and button 1 (short around R2) you will get readings.

        However, I never got my keypad to work because the readings were dancing around too much (I was thinking of using a cap and/or an op amp to get a better signal) - but the behavior wasn't drastically different than I expected...

        You do have a point about using higher resistor values (I'll edit my solution), but I was implying kOhms and was using smaller numbers just for readability.

        • pga / about 13 years ago / 1

          Your understanding of the board is correct, you just forgot that with pin 1 shorted to pin 7, the readings from pins between 1 and 7 will all be the same, not ambiguous.

          That is, with V1 == V7, you get no current through the resistor ladder between them, so the implication is that V1==V2==V3==V4==V5==V6==V7.

          So tapping at e.g. Pin 4 and pressing Button 5 (short pin1 and pin7), V1 through V7 all have a voltage reading coming from a simple voltage divider of the first (left of pin1) and last (right of pin7) resistors in the ladder.

          As for the equal values problem on e.g. R1 and R2, you're right. But that's the very problem that motivates the combinatorics - finding the combination that optimally spaces the output voltages.

          Give it a shot, the way I'm using it has been working well and reliably, and the noise is not a problem because the readings are so far apart!

    • fundorin / about 13 years ago / 1

      If I'll ask you kindly, could you do the same calculation for 4x4 keypad, which have 8 outs? Raw outs are 3 5 6 7 and column are 8 1 2 4, counting from left to right and up to down. Thank you.

      Me, by myself, came to the variant which uses 2 analog inputs (didn't counted it yet), but your variant is nuch better.

    • LouisT / about 13 years ago * / 1

      Thank you for this great idea! However, what exactly were you trying to optimize? I thought this was a really interesting problem and was wondering if our solutions would match.

      Given your solution, I assume that you took the common resistor values to be your universe of possible resistors: 10,12,15,18,22,27,33,39,47,56,68,82, and all their multiples of 10. That's 24 different values and we pick 7, which gives us less than 350,000 combinations (Maybe you were making their multiples of 100 too? Doing so did not change my result)..

      I figured that what we wanted was to space out the Vout/Ain Return for each button as much as possible; that is, maximize the minimum distance between any two possible readings.

      The following sequence of resistors did this optimally for me: 39, 82, 120, 150, 180, 220, 680 (in K OHMS)

      It gives a minimum difference between two possible readings of 11.7 instead of 6.5 from your ladder (this is in the Arduino's 1024 res). I'm pretty happy with the improvement but perhaps you intended to optimize something else?

      • fundorin / about 13 years ago / 1

        If I’ll ask you kindly, could you do the same calculation for 4x4 keypad, which have 8 outs? Raw outs are 3 5 6 7 and column are 8 1 2 4, counting from left to right and up to down. Thank you.

        Me, by myself, came to the variant which uses 2 analog inputs (didn’t counted it yet), but your variant is nuch better.

        • LouisT / about 13 years ago / 1

          I found the following resistor ladder for 4x4: (12, 15, 39, 56, 82, 100, 150, 180)

          The minimum difference is only 4.9 however.

  • EricS. / about 16 years ago / 3

    Looking at the top of the board, the pinout from left to right is:
    No connection
    Column 1
    Row 0
    Column 0
    Row 3
    Column 2
    Row 2
    Row 1
    No connection

  • I've made a Python Package that works with this keypad as well as 4x4 ones. It is made for the RaspberryPi for now but could be ported over to work on the beaglebone as well once I get one to mess with. It supports both the RPi's GPIO aswell as support for the I2C chip family MCP230xx

    http://crumpspot.blogspot.com/p/keypad-matrix-python-package.html https://pypi.python.org/pypi/matrix_keypad

  • kuzyt / about 13 years ago / 2

    Damn wish you guys carried a 4x4 keypad !

  • Member #142093 / about 13 years ago / 2

    It's very odd but there is no 12 button keypad with included status red/green LEDs available. If anyone has seen one, please tell, where? Also, is there a mounting face plate for this 12 key unit? Again, where? Seems a missing product opportunity; 12 keys, 2 leds, face plate. Such a simple idea yet no one makes it.

    Any ideas? Thanks

  • Member #142093 / about 13 years ago / 2

    It's very odd but there is no 12 button keypad with included status red/green LEDs available. If anyone has seen one, please tell, where? Also, is there a mounting face plate for this 12 key unit? Again, where? Seems a missing product opportunity; 12 keys, 2 leds, face plate. Such a simple idea yet no one makes it.

    Any ideas? Thanks

  • Member #142093 / about 13 years ago / 2

    It's very odd but there is no 12 button keypad with included status red/green LEDs available. If anyone has seen one, please tell, where? Also, is there a mounting face plate for this 12 key unit? Again, where? Seems a missing product opportunity; 12 keys, 2 leds, face plate. Such a simple idea yet no one makes it.

    Any ideas? Thanks

  • Member #142093 / about 13 years ago / 2

    It's very odd but there is no 12 button keypad with included status red/green LEDs available. If anyone has seen one, please tell, where? Also, is there a mounting face plate for this 12 key unit? Again, where? Seems a missing product opportunity; 12 keys, 2 leds, face plate. Such a simple idea yet no one makes it.

    Any ideas? Thanks

  • Member #142093 / about 13 years ago / 2

    It's very odd but there is no 12 button keypad with included status red/green LEDs available. If anyone has seen one, please tell, where? Also, is there a mounting face plate for this 12 key unit? Again, where? Seems a missing product opportunity; 12 keys, 2 leds, face plate. Such a simple idea yet no one makes it.

    Any ideas? Thanks

  • Member #142093 / about 13 years ago / 2

    It's very odd but there is no 12 button keypad with included status red/green LEDs available. If anyone has seen one, please tell, where? Also, is there a mounting face plate for this 12 key unit? Again, where? Seems a missing product opportunity; 12 keys, 2 leds, face plate. Such a simple idea yet no one makes it.

    Any ideas? Thanks

  • Twizted / about 15 years ago / 2

    For anyone needing it you can follow the Keypad tutorial and get the library here: http://www.arduino.cc/playground/Code/Keypad
    And if you want to use the example sketch they provide on the page you would connect the keypad as follows
    Looking at the top of the keypad (key side) with the pins at the bottom from left to right you have pins 1-9 with pins 1 and 9 being null (not connected)
    Ard - Keypad
    2 - 5
    3 - 7
    4 - 8
    5 - 3
    6 - 6
    7 - 2
    8 - 4

  • Member #601988 / about 10 years ago / 1

    Can anyone help? I've been pulling my hair out trying to figure out what I've messed up here. I wired the keypad exactly as noted below in previous comments: Ard - Keypad 2 - 5 3 - 7 4 - 8 5 - 3 6 - 6 7 - 2 8 - 4 (Including the resistors suggested in this article: http://bildr.org/2011/05/arduino-keypad/ And used the code in that article, which matches up with the code in the arduino page here: http://www.arduino.cc/playground/Code/Keypad

    But when I check my work, I get the following outputs: Keypad entry -- Output 1 -- 1 2 -- 2 3 -- 3 4 -- 4 5 -- 5 6 -- 4 7 -- 4 8 -- 5 9 -- 6 * -- * 0 -- 0

    --

    I thought maybe I just got a defective piece, so I bought another one, and I got the same problem. Can anyone figure out why?

    Thanks!

  • Hivoltage / about 10 years ago / 1

    I created an awesome 3 digit sign for a club and Used this keypad with the arduino library. Worked very nice. buying another one to work with a remote control unit. Picture of the sign.

  • Spokkam / about 10 years ago / 1

    The spacing between the cheap pads are frustratingly small, meaning it's incredibly easy to short when soldering. Even with using pin headers I've had little luck in soldering this adequately.

  • If you buy this piece of garbage, you're definitely going to want to solder on pin headers. If you try to use wire, you're going to life those cheap solder pads almost instantly. I've gone through 3. Just use headers.

  • johnsondavies / about 11 years ago * / 1

    See my blog for an example of interfacing this keypad to a single I/O pin: http://www.technoblogy.com/show?NGM

  • Will the COM-10856 resistor network work for this?

  • Member #481555 / about 11 years ago / 1

    A problem with the R-ladder is that with no button pressed, the "idle voltage" is too near one of the actual "key voltages". So, here's another approach.

    Given the narrow spread between voltages, I've opted for using 1% resistors for this. They are available at Mouser.

    Hookup: Connect a 27.4K resistor from pad 3 to GND Connect pad 3 to pad 1 with a 60.4K resistor Connect pad 1 to pad 5 with a 210K resistor Connect a 309K resistor from pad 2 to V+ Connect a 154K resistor from pad 7 to V+ Connect a 66.5K resistor from pad 6 to V+ Connect a 10.0K resistor from pad 4 to V+ Connect pad 3 to an analog input on the Arduino (or any 1024-bit ADC)

    With this, the expected digital readings for the various keys are:

    1: 82 ~ 85 4: 152 ~ 157 2: 223 ~ 230 7: 295 ~ 303 5: 367 ~ 377 3: 497 ~ 509 8: 576 ~ 590 6: 667 ~ 683 *: 742 ~ 759 9: 828 ~ 846 0: 909 ~ 929

    : 980 ~ 1002

    with a reading of zero if no key is pressed. The minimum gap between any two key reading ranges is 51.

  • Just as a help, I don't know if it is fully functional with this specific keypad, but their is a matrix keypad library and tutorial available in the Arduino playgroud

  • Chandhooguy / about 12 years ago / 1

    Anyone know when this will come back in stock?

  • Dindi / about 12 years ago / 1

    For those having problems, and not wanting to have many cable crossings: Using the arduino keypad tutorial (with the keypad library), you can do a straight connection from pin 2 on keypad, pin 12 on arduino, then the last pin (pin 7) on keypad would go to arduino pin 6. (2 ends are NC)..

    In this case the proper setup lines are: byte rowPins[ROWS] = { 11, 6, 7, 9 }; byte colPins[COLS] = { 10, 12, 8 };

    If you want to start on pin 2, you would shift by 4 pins (pin 6->2, 7->3 .... 12 -> 8) .. Hope this helps, spent the last 30 minutes mapping this out :)

  • Member #270948 / about 12 years ago / 1

    hello. I ordered a few of theese keypads via Robonor, Norway.

    3 OF 4 doesnt work.

    Key functions have been measured using a multimeter.

    Is this a known problem?

    Regards Jan Eikeland

    • joran / about 11 years ago / 1

      I found these to work great with an arduino (AVR Atmega328) ... however I cant get it to work reliably with an uno32(pic32 processor) ... you may just be using a chip thats too fast or something ... it wouldnt matter howlong I debounced stuff for I could not get it to work reliably with the pic32

    • MikeGrusin / about 12 years ago / 1

      Note that when pressed, these keys may still show over 100 Ohms resistance (they are not switches so much as conductive rubber pads). This works perfectly fine for logic circuits, but they may not "beep" for a multimeter on the continuity setting. If you're using continuity, try measuring the resistance instead. Hope this helps!

      • Dindi / about 12 years ago / 1

        Correct, they do not beep, but they show different resistance. I thought for a second that I got a dead keypad, but the other did the same thing. Works fine with an arduino :)

    • Hi Jan! Sorry to hear you are seeing problems with the keypads. Please contact us at techsupport@sparkfun.com so we can troubleshoot and help you out! It is not common for these to be bad. Please email us! :)

  • Tekati / about 12 years ago / 1

    Anyone know when these are expected back in stock or anyone else who carries them?

  • Sacman / about 13 years ago / 1

    Got one of these today.

    Soldering is a bit tricky since the pads are so close together but with a little solder wick, I had it going on the first try. The sample code I used failed to set pin 13 to an output so I thought I was having problems when the led would not change state. Once I fixed that it was perfect. This thing would not survive an industrial environment for long but I was pleasantly surprised at both how quickly I was up and running and the fact that it is reasonably well constructed for $4.

    Happy today with this and the other stuff I got!

  • Ted M / about 13 years ago / 1

    How about a hexadecimal version, please?

  • abers13 / about 13 years ago / 1

    I wish you had a cheap 4x4 pad and was a little bigger then this.... like number pad on a computer

  • liudr / about 13 years ago / 1

    Why not carrying membrane keypads? Cheap and sticks to a hard surface, such as an enclosure. They are way easier to understand regarding the connection.

  • Member #239529 / about 13 years ago / 1

    Keypad I've received does not work at all... Metered it out: 4 buttons in total work :-(. Shipping it back oversees probably costs more than buying a more expensive one somewhere more closeby :-(

    • cloantita / about 13 years ago * / 1

      Hello. I have the same problem, I bought one of this and when I mounted in in project I found that bottons 4-5-6 not working. Sparkfun sent another one, I just finish it to mount the new keypad in my project and found the same, ramdoly botton 1 and 7 not work. Possible a bad lot.

      • jwinkler71 / about 13 years ago / 1

        I think part of the problem is the very cheap soldering pads on this. I lifted 2 pins while soldering and didn't notice. Took me awhile to figure out why a row of numbers was not working. From the comments it appears some others are having the same issues with the pads.

  • @maxboender / about 13 years ago / 1

    When will this be back in stock?
    I need it for a project

  • Member #81485 / about 13 years ago * / 1

    I haven't seen anyone else talk about interfacing this with a PLD, so I thought I'd suggest it. You can get a PLD like the "ATF16V8BQL-15PU" for $1.60. Use the 7 outs of the keypad as ins for the PLD, make a truth table, and have the PLD output a 4 bit (HEX) number for each (Carnaugh maps may help, but I'm just gonna use maxterms). This would be much simpler to interface with an arduino than using another MCU in the middle. Here's code that I wrote that I haven't tested yet, but it should work. You do need a IC programmer.
    Ok, it's late, and I realized that I'm going to have to write it out and look check it and what not to make sure it works, I'll reply to this later. I really do think this is the best method to decode this keypad though. It's a static decode, thus logic circuits should be used, not MCUs. Problems will arise if two buttons are pressed, but whatever.

    • Member #81485 / about 13 years ago * / 1

      So, looks like it'll be easier inverting the output, using negative logic (note the slash in front of the outs). These are the outputs, 0=0000, 1=0001... 9=1001, *=1010, #=1011. And otherwise (no buttons being pressed) = 1111. I'll be checking this in awhile, but I checked the hand work several times and believe this to be right.
      edit: due to the formatting, I can't write it correctly. Replace the ' " ' with shift+8, the multiply symbol.
      CHIP ID ATF16V8BQL;
      Pin 1 Clk ; Clock pin
      Pin 2 p1 ; pad 1
      Pin 3 p2 ; pad 2
      Pin 4 p3 ; pad 3
      Pin 5 p4 ; pad 4
      Pin 6 p5 ; pad 5
      Pin 7 p6 ; pad 6
      Pin 8 p7 ; pad 7
      Pin 12 /out0 ; output 0
      Pin 13 /out1 ; output 1
      Pin 14 /out2 ; output 2
      Pin 15 /out3 ; output 3
      EQUATIONS
      out0 = p1"p4 + p1"p2 + p3"p7 + p5"p7 + p1"p6 + p3"p4
      out1 = p1"p4 + p2"p3 + p3"p7 + p1"p7 + p1"p6 + p5"p6
      out2 = p1"p4 + p2"p3 + p1"p2 + p2"p5 + p1"p6 + p5"p6 + p3"p4 + p4"p5
      out3 = p1"p4 + p2"p3 + p1"p2 + p2"p5 + p3"p7 + p1"p7 + p5"p7 + p3"p6

  • baum / about 13 years ago / 1

    If you press two or more buttons on this thing, will you get ghost keys? Or is the matrix designed otherwise?

  • kadams / about 14 years ago / 1

    Had this working in a few hours, but ran into an issue where holding two more more buttons would cause unusual behavior. For some combinations, it would register the wrong button, other combinations it would do nothing. Undefined behavior is never desirable, so debugged it for a few hours and found the solution.
    If you set all the columns to be "INPUTS", and use pull-down resistors, then set all the rows to be "OUTPUTS", with switching diodes, allowing those pins to transmit high, but not ground a low signal, then it is possible to identify the state of each individual button, even if more then one button is pushed at a time. Then the algorithm is basically to set all the rows LOW, then one by one, set each one HIGH and then back down to LOW. While its HIGH, check each of the column pins to see which button in that column is registering a HIGH (that button is pushed).
    A few interesting notes:
    * Depending on the pressure you put on the button, the resistance between the two connected pins will change. In other words, the less you push the button, the higher the resistance. I was not able to get a solid resistance free connection, even with tons of pressure (but it is very low resistance)
    * When you push a button, it will fluctuate between connected and not connected for a few nanoseconds. As such, you will need to time the button and make sure its been depressed for somewhere around 30ms before you register it as a push. Otherwise you end up seeing the button get pushed a few times for every individual push.

  • asselinpaul / about 14 years ago / 1

    In case anyone is looking for a good tutorial, I wrote one !
    A lot is covered along with how to use it with the Password library.
    http://bildr.org/2011/05/arduino-keypad/

    • thegreatyonini / about 13 years ago / 1

      Hi asselinpaul,
      I have become very frustrated while trying to build the project "What's the password? Arduino + Keypad". I did everything exactly as specified but when I downloaded the provided code, and then tried to compile it, this is the error that I received:
      secret_keypad.cpp.o: In function __static_initialization_and_destruction_0': secret_keypad.cpp:20: undefined reference toPassword::Password(char)'
      secret_keypad.cpp:37: undefined reference to Keypad::Keypad(char*, unsigned char*, unsigned char*, unsigned char, unsigned char)' secret_keypad.cpp.o: In functioncheckPassword()':
      secret_keypad.cpp:64: undefined reference to Password::evaluate()' secret_keypad.cpp.o: In functionkeypadEvent(char)':
      secret_keypad.cpp:51: undefined reference to Keypad::getState()' secret_keypad.cpp:57: undefined reference toPassword::reset()'
      secret_keypad.cpp:58: undefined reference to Password::append(char)' secret_keypad.cpp.o: In functionloop':
      secret_keypad.cpp:46: undefined reference to Keypad::getKey()' secret_keypad.cpp.o: In functionsetup':
      secret_keypad.cpp:42: undefined reference to `Keypad::addEventListener(void (
      )(char))'
      I have no clue how to fix this, maybe you can help.
      Thanks

  • Member #151952 / about 14 years ago / 1

    Dear all,
    the first time i plugged the keypad to my circuit it worked. After testing it, 10 minutes later, the col3 didnt want to work. Later on i opened it and check out all the connections inside. I found out that this is a very basic and cheap model, but worht for 4$. After all i noticed that it is very sensitive on solder connections.
    what i mean is that if you use more that 15W to solder then it might be possible to burn the pins.
    I use one with 12W. Then i solder some pins in 1 to 7.
    I have noticed and something else. The connections from 1 to 7 are very close. Even if you carefuly solder in there the pins, the keypad is very sensitive and can be sorted some pins.
    Not real solder but the solderine out of the metal. that can cause a sort circuit. I havent found that before but yesterday i was playing and testing the keypad.
    Now after a day my circuit works and the keypad is stable.

  • GJN / about 14 years ago / 1

    A very good discussion of this keyboard along with a well-documented sketch showing its use is provided on pages 149-152 of "Arduino Cookbook" by Michael Margolis.

  • Member #71937 / about 14 years ago / 1

    This keypad works. However it took some time getting it to work. There's a lot of wrong information on the internet. My biggest mistake was involving pin 13, which has an LED on it on the Duemilinove and thus leaked to ground which resulted in oscilating readings.
    I wired it up as follows:
    keypad -> arduino
    1 6
    2 7
    3 8
    4 9
    5 10
    6 11
    8 5 (bear in mind you could connect it to 12 but my RF unit was set to that)
    The code uses the KeyPad library:

    include

    const byte ROWS = 4; //four rows
    const byte COLS = 3; //four columns
    //define the cymbols on the buttons of the keypads
    char hexaKeys[ROWS][COLS] = {
    {'1','2','3'},
    {'4','5','6'},
    {'7','8','9'},
    {'*','0','#'}
    };
    byte rowPins[ROWS] = {7,5,11,9}; //This order is important if you use pin 12 instead of 5 change the 5 into 12
    byte colPins[COLS] = {8,6,10}; //The order is important
    //initialize an instance of class NewKeypad
    Keypad cusomKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
    void setup(){
    Serial.begin(9600);
    }
    void loop(){
    char customKey = cusomKeypad.getKey();
    if (customKey != NO_KEY){
    Serial.println(customKey);
    }
    }

  • Bruce The Hoon / about 14 years ago * / 1

    I have created a datasheet that is LIKELY correct. I located a keypad that this is either a clone of or close enough that it is kinda silly. It appears to be an Accord Co. AK-304-N series keypad.
    Big informative datasheet:
    http://www.tenrod.com.au/pdf/accord/keypads.pdf
    The datasheet I made (because the only images online were AWFUL) can be found here: COM-08653 Datasheet
    The SVG I created can be found here:
    COM-08653 SVG
    I hope this is helpful to someone and PLEASE email me (email in the PDF) if I've made any mistakes! Oh, and if Sparkfun doesn't like this, I'll take it down.

  • SomeGuy123 / about 14 years ago * / 1

    I use this on a door with a small solenoid lock. It's a nice keypad.

  • CaseyGross / about 14 years ago / 1

    Why does this product not have a datasheet? I'm trying to laser cut an enclosure but it has no info on the exact dimensions. At least give the company name so i can find a datasheet on their website.

  • Joe2 / about 14 years ago / 1

    Twizted:<br />
    <br />

    For anyone needing it you can follow the Keypad tutorial and get the library here: http://www.arduino.cc/playground/Code/Keypad
    <br />
    <br />
    Thanks, it kind of annoying to be referred to the instructables web site where you can't get anything with signing up.

  • Blue Tooth / about 14 years ago / 1

    It is not clear for me how it can be connected to a computer? Is it a regular laptop numeric keypad?

    • It is not meant for connecting to a computer. Think of it as a lot of individual buttons. When you press '3', you need something on the other end to read the pins to see that it was '3' that was pressed. You will need some sort of microcontroller to read which pins are connected to determine which button gets pressed. For instance, if 2 and 3 are connected, you should be reading a '1'.

  • Bjorn / about 14 years ago / 1

    I just got this keypad and wired it up to an Arduino Duemilanove. I followed the instructable linked above (http://bit.ly/dkpYCY) and am having some weird problems.
    I'm using the sample code provided in the instructable that outputs the characters of any button pressed to serial. It often prints two characters for a button that I only press once. For example, if I press each button once it should print out 1234567890# but it might print 1234456778990#. It doesn't seem to be a specific button, as I can sometimes push each button and get the correct output, but usually there are some errors. I can get duplicate characters with any button, too. The duplicate character, when it shows up, seems to come from releasing the button.
    I've tried wiring it up using 1k resistors between pins 4, 6, 7, and 8 on the keypad as directed in the instructable and without and resistors, and I get the same behavior. Do I need resistors? I'm not exactly an electronics expert, but I'm slowly learning.
    Does anyone have any ideas what might be wrong?
    Thanks!

    • Patrick D / about 14 years ago / 1

      Make sure the button is stabilized.
      This is what I use: (keypad1 to PA1, keypad2 to PA3 ...)
      don't forget that Pin0 and Pin7 on keypad do not lead anywhere.
      void initKeypad()
      {
      DDRA = 0b0101010; // keypad columns set as output
      PORTA =0b1010101;
      }
      uint8_t getKey()
      {
      uint8_t n=0;
      PORTA = 0b11011110;
      n=PINA >> 1;
      if (n!=111) return n;
      PORTA = 0b11110110;
      n=PINA >>1;
      if (n!=123) return n;
      PORTA = 0b11111100;
      n=PINA >> 1;
      if (n!=126) return n;
      return 0;
      }

      • Patrick D / about 14 years ago / 1

        sorry, Pin0 and Pin9

      • Patrick D / about 14 years ago / 1

        uint8_t readKey()
        {
        uint8_t k,tmp,i;
        i=0;
        k=0;
        while (i<20)
        {
        k=getKey();
        if (k==lastKeypadChar) return 0;
        if (k==tmp)
        {
        i++;
        } else {
        i=0;
        }
        tmp = k;
        }
        lastKeypadChar = k;
        if (k==134) return 0;
        if (k==121) return '1';
        if (k==124) return '2';
        if (k==109) return '3';
        if (k==59) return '4';
        if (k==62) return '5';
        if (k==47) return '6';
        if (k==91) return '7';
        if (k==94) return '8';
        if (k==79) return '9';
        if (k==115) return '*';
        if (k==118) return '0';
        if (k==103) return '#';
        return 0;
        }

  • Grody / about 15 years ago / 1

    http://www.corby.com/product/pricelst.php (Scroll down to the 7130 products)
    I haven't bought this keypad assembly, so I can't say for sure, but it looks like it uses the same keypad as the one offered here. It's installed in a single-gang bezel with red, yellow, and green LED's, but doesn't include any sort of electronic brain - you have to provide your own. Perfect for a DIY alarm system! They also have versions with two LED's, eight LED's, and a few others.

  • fmc / about 15 years ago / 1

    A bezel or case for this would be nice. It'd be even nicer if the case included a hole for a lcd :D

  • Grody / about 15 years ago / 1

    I can confirm that the cover plate used for this item is designed to fit this keypad...
    http://www.homedepot.com/webapp/wcs/stores/servlet/ProductDisplay?productId=100396591
    Not only does it fit, it snaps into place and stays there. The question is, is it possible to just get the cover plate? I'd love to have a few more keypads for my Arduino-based alarm system :-}}

    • c.alexander / about 14 years ago / 1

      I found out that Home Depot links require a store ID, a language ID and a catalog ID. If you don't have it in cache or cookie it will error:
      You should be able to get to it here:
      http://www.homedepot.com/webapp/wcs/stores/servlet/ProductDisplay?storeId=10051&productId=100396591&langId=-1&catalogId=10053&

    • fmc / about 15 years ago / 1

      That link doesn't go anywhere for me, do you know the name of the plate? or a working link?

      • bdin / about 14 years ago / 1

        I had the same problem, but if you go to www.homedepot.com and in the search bar type the product id number he has listed, "100396591" the product comes right up.

      • Grody / about 15 years ago / 1

        The link still works for me.

  • RaymondBotha / about 15 years ago / 1

    When will this be in stock?

  • Chiel / about 15 years ago / 1

    ive had no problems so far working with this keypad.
    ive hooked it to a picaxe-14M which decodes the keypad and then sends the pressed key to my arduino through a Xbee link. i havent had a single time that a button did not respond so im very happy with this little cheap keypad.

    • hobgoblin612 / about 14 years ago / 1

      can i get any more info on how you did this as i want to do something similar.

  • I got one of these from www.allelectronics.com, but I had to pay $4.50 more there, although the design was admittedly better quality than this one.

  • bitos2002 / about 16 years ago / 1

    Hello all,
    I've just bought one keyPad for connect this to Arduino. Well, after having many problems, I have tested all the combinations with the pins, and i think that my KeyPad is not working properly, the problem is that my rows 1 and 2 doesn't respond to no keys pressed.
    Have anyone had this type of problem.
    My tests with a continuity tester has been the folowing
    KeyPad
    col 0 3
    col 1 1
    col 2 5
    row 0 2
    row 1 7
    row 2 6
    row 3 4
    I undestand that when a press the '4 key, I'll have a closed circuit between 3 and 7 pins of keypad, doesn't it.
    Can Help me anyone.
    Thanks.

  • trl / about 16 years ago / 1

    Has anybody found a ready-made case for this (or similar keypad)? It's pretty labor-intensive making the case from scratch.

Customer Reviews

3.2 out of 5

Based on 9 ratings:

Currently viewing all customer reviews.

1 of 1 found this helpful:

fragile

If you can figure out how to keep it from coming apart, you'll be golden. For a few dollars though, not bad. Mentioned before but put headers on it so you won't need to resolder it and maybe some hot glue on the back to help the little rivet like posts hold it together.

2 of 2 found this helpful:

You get what you pay for

This thing is cheap, and that's the best thing it's got going for it. A few caveats:

  • It is unlikely to work well for long wire runs, esp. if you're using 3.3V logic
  • The device presents significant resistance due to the use of resistive paint inside
  • The buttons are like calculator buttons - the plastic caps press down on silicon spring forms that ultimately make connections on the circuit board, so the keypress feedback feels about the same as a calculator.

In order to get this thing to work for my application, I had to significantly (and tediously) remanufacture it. Specifically, I replaced the three conductive paint jumpers on the board with actual wire jumpers to remove their ~84 ohms resistance. And even more tediously, I put aluminum tape caps on the insides of the silicone spring forms, so that the buttons themselves would also have near-zero resistance. Then I had to superglue the thing back together, because it is heat-welded and not meant to ever be disassembled.

If my application were different, I would likely have been able to use this keypad out of the box. It's not bad, but the decision to save $0.25 by not either a) having a double-sided circuit board, or b) soldering three jumpers onto the board really did cause problems for me.

As for programming, it is trivial. I used 7 GPIOs on a Pi, driving the columns with three outputs and polling the rows with four inputs. No external components required.

I gave the thing a three-star rating because I largely disagree with the corners that were cut in its manufacturing (which are not technically Sparkfun's fault - this is an off-the-shelf part). But for simple applications, physically close to the microcontroller, this part will work fine.

2 of 2 found this helpful:

Quality must have improved

I didn't have any of the issues that other reviewers had. This worked perfectly out of the box. I don't have to press the buttons too hard.

1 of 1 found this helpful:

Good for the price

I used this for a custom number sign. Worked fine. Word of caution do not use a cold soldering iron on this as it will fry the traces. :)

2 of 2 found this helpful:

Works fine, after some fixing...

Look at the diagram of the PCB, see the black traces? They are conductive paint (or something) and on mine at least, they don't conduct. I was able to fix it by cutting off the melted plastic that keeps the case closed, carefully sanding off the black stuff until the underlying pads at each end were exposed, and then soldering fine wire between the three pairs of pads. While you are in there, gently sand the exposed metal where the keys are supposed to press down, or half the keys will need to be pressed REALLY hard to register. Put it all back together and apply superglue where the melted plastic was on the back of the case. NOW it works like it should have out-of-the-box.

Sorry for all the extra trouble. These should work better out of the box. If you get one that gives you trouble, please let us know. https://www.sparkfun.com/returns

1 of 1 found this helpful:

Button Mashing Still Required: September 2015

Like someone else said, these buttons work by pushing down a connection on some electrical paint on the circuit. Just pushing the buttons is inadequate.

You must mash the buttons deep into the next dimension to get a clean reading (or in my case, any reading).

2 of 2 found this helpful:

Adequate

For the price it works okay, its still a conductive pad type of keypad, no frank, satisfying click when you press a button and most of them need to be pressed quite a bit to get a decent reading. I found that some of the buttons had over 50 and even up to 100 ohm of resistance on the line even when pressed, so take that into account if, say, you use a voltage divider in front of some pins and are expecting a precise reading.

Great little keypad

Once I soldered some pins and figured out how to hook it up properly to my PIC18F4550 it worked great! Solid little keypad.

Works great, so far!

So far, works like a beauty. However, this DOES NOT have headers pre-soldered. I would recommend products/115 or 553.