3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

16-key Keypad Decoding with an AVR MCU

16-key Keypad Decoding with an AVR MCU
This instructable will show you how to interface a 16-key keypad to your AVR microcontroller and read the key when a key is pressed. I'll introduce the keypad first, then the 74HC922 16-key decoder IC as a pin-saving mechanism, then finally how to take the data and massage it so that you get the correct number for the keypress.

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 adsRemove these ads by Signing Up
 

Step 1Equipment List

Equipment List
This instructable doesn't have (m)any expensive components if you already have an AVR setup. You can buy everything online, although I've found if you check your local electronic warehouse/shop (if you have one) you will be able to pick up everything considerably cheaper, though.

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

I think that's about it. Let's get building!

« Previous StepDownload PDFView All StepsNext Step »
6 comments
Aug 23, 2009. 1:51 PMhuubje says:
Hello, Nice project and code I think : was just looking for something like this for making a code lock. My question: for what type of AVR have you written the C-code ? Can I use it without changes for my ATMega88 ?
Mar 22, 2012. 8:03 AMarturmariojr says:
Please, do you have some of these IC 74C922 yet?
Could sell some to me?
Jul 11, 2011. 1:21 AMmbroesby-olsen says:
If anyone else is interested in using the MM74C922 IC, I have to warn you:

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 :)
Jul 11, 2011. 1:07 AMmbroesby-olsen says:
Hey Nevdull
- 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.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
62
Followers
22
Author:nevdull(The Bold Scientist)
Gian is the VP Research & Development at Open Design Strategies and holds a BA in Molecular/Cellular Biology and an MS in Computer Science. He has a collection of 8-bit microcontrollers and a room fu...
more »