Picture of Using a keypad with Raspberry Pi
I got two keypads from that I wanted to use with my Raspberry Pi.  Turns out it's quite easy, as long as you know what the pinout structure is for the keypad.

This instructable will take you through the steps I had to go through to discover the pinout on my keypads, and how I hooked it up to my Raspberry Pi.  I'll include the code I'm currently using to "drive" my keypad, and then offer some "next step" type insights into what can be done better, and what could be done next.

Finally, this instructable will really be a sub-instructable that will be part of something I'm calling Voiceberry Pi.
Remove these adsRemove these ads by Signing Up

Step 2: Tracing the leads

IMG_6457 - Copy (2)_small.jpg
IMG_6457 - Copy (3)_small.jpg
IMG_6457 - Copy (4)_small.jpg
IMG_6457 - Copy (5)_small.jpg
IMG_6457 - Copy (6)_small.jpg
IMG_6457 - Copy (7)_small.jpg
I've got 10 leads, but no idea how they lead to the 12 different buttons.  So I have to trace the leads.  The images below trace my particular keypad using red lines.  Dashed lines follow the jumpers in the back.

Pins are either rows or columns.  Rows cover two or more buttons horizontally, and columns cover one or more buttons vertically (even though one key could be a row or a column).  Results of tracing are as follows:

Rows: 1,2,3, and 9
Columns: 4,5,6,7,8, and 10

Button- Row - Col
1  - 1 - 5
2 - 1 - 6
3 - 1 - 7
4 - 2 - 5
5 - 2- 6
6 - 2 - 7
7 - 4 - 5
8 - 4 - 6
9 - 3 - 7
0 - 4 - 7
* - 9 - 8
# - 9 - 10

km6cg1 year ago
I found a discussion of GPIO interrupts at

I haven't tried it yet, but it seems that this could allow one to suspend execution until a key was pressed.

My idea for the keyboard is, combine it with a two line display and a wifi adapter and hook up a set of speakers. I'd write a program to load and shuffle music from my DLNA server and put the whole thing in the kitchen. I could also get it to pull and play NPR for me.
jcksparr0w2 years ago
For idea #1, how about a lock of some type?
#2, Maybe some computer shortcuts.
#3, I bet you could control something like your house's lighting and electrical outlets somehow.
The possibilities are endless. The sky's the limit and all those metaphors.
Could you imagine using a RasPi to unlock your house!?
great ideas!
chefwear2 years ago
You have some really great instructables!
mrmath (author)  chefwear2 years ago
Thank you so much! I'm blushing!
mrmath (author)  dubstepmaker2 years ago
Thank you!
sail4sea2 years ago
I am thinking maybe using a keypad to set the ip address of the pi. Sounds useful for a headless system.
The thing to remember about keypads is that the vast majority share the same pinout, for simplicity; you appear to have one of the very few exceptions, since it has more than seven pins.