A 16-key keypad can be a useful addition to any embedded project, possibly acting as a code input device for opening a door or as a general input to any project requiring the input of multiple values, like alarm circuits, games, puzzles, DTMF generators.
Remove these ads by
Signing UpStep 1Equipment List
You'll need the following:
- AVR microcontroller and a programmer. Arduino, Bare Bones Kit, Freeduino, Boarduino, and all the other clones work just fine. Of course, your custom own ghetto setup will suffice too. Just for the record, the firmware was written for an ATmega328p, so it should run well on that class of AVR's and probably many others with little to no modification.
- Something to compile your code.
- A 16-key keypad. The leading outlets carry them but they can tend to be spendy, so maybe try Jameco.com or do a search for "16-key keypad" on google. It shouldn't run you more than $6-7
- Solderless breadboard
- hookupwire, soldering iron, wire cutters, etc
- 4 10k resistors
Optional
These parts aren't necessary for you to figure out how it works, but this instructable shows several different ways to connect this keypad and read data from it, so depending on the parts you want to do, you may or may not need the following.- 74C922 IC. This is a 16-key encoder. You can pick them up from mouser.com or digikey.com for around $5. I got a handful at my local electronics shop for $0.95 each.
- 2 x 0.1 uF tantalum capacitors. You can probably get away with ceramic if you have them already.
- DLO7135 Dot matrix LED. This is one SWEEET component. They sell for over $10-15 each online, but, again, I picked up 10 of these at my local electronics shop for $1.50 each.
- 8 pin right-angle header and matching female header for the keypad
| « Previous Step | Download PDFView All Steps | Next Step » |













































Thanks. I've written it for an ATmega328P. You will need to edit the Makefile and change MCU to atmega88 and F_CPU to whatever speed at which you have your '88 running. You may need to change the AVRDUDE settings in the Makefile to reflect your programmer and port. Further, note which pins I have things on and either match those in your setup or change them in the code to match yours.
Also, if you're going to read the key value, you will need to make some sort of translation table or compare how the values are sent when checking a keycode. That's because the actual value of the key (ie 1 or 3 or B) doesn't get sent, but instead a number (hex) starting from 0 at key 1 and ending at F at key D. Make sense? The keypad values vs the value sent from a keypress is like this:
So you'll need to make sure you're translating/comparing the right maps.
Good luck!
Could sell some to me?
Good luck!
The diagram shown above confuses more than it helps, as the IC is setup differently - at least the datasheet tells me this: Column X1 + X2 is NOT on the left side. Or in general: the layout of the IC is not comparable to the layout above.
Just a friendly reminder to others :)
- cool name by the way! :)
I am starting out a project tomorrow, using the 74C922 IC.
Would it be possible to use this IC on a 12 keypad-setup?
And is it difficult to translate your code to arduino-readable code?
I really could like to use this IC, as I need as many I/O ports as possible.