I²C Keypad Backpack Board

Description

This project is a backpack board that sits on the back of matrix style keypads (4×4, 4×3, etc.), and it interfaces the keypad to the I²C bus for easy connection to many microcontrollers. A software library is available that works with Arduino, Particle and Raspberry Pi boards.

Keypads are widely available and are very reasonably priced. They come in different configurations (4×4, 4×3, etc.) and in many physical sizes . Nearly all electronic suppliers sell them, and you can even get them on Amazon and eBay.

Keypads typically require a lot of pins from the microcontroller to operate, but this board interfaces to keypads with the two pin I²C interface. This project consists of a board that sits on the back of the keypad, and provides two Qwiic type I²C connectors for easy connection to a microcontroller. This board also has the I²C pullup resistors (enabled with solder jumpers) and jumpers to select the I²C address. The board will operate on either 3.3 or 5 volts. The board only has one chip on it (MCP23008). The total parts cost is under five dollars.

The keypads need to be a “matrix” style keypad, where there is one pin for each row and one pin for each column of keys. For example, a keypad with 4 rows of keys and three columns of keys will have 7 pins on it. When a key is pressed, it produces a shorted connection between the row and column pins. This backpack board will work with keypads that have a maximum of 8 pins (and 16 keys is the maximum supported size, 4×4).

I²C Keypad Backpack “bare” pc boards are available from OSH Park.

To make it easy to use this board and keypad, I wrote software libraries for the Arduino, Particle and Raspberry Pi microcontrollers.

Files

The schematic and pcb layout files (Eagle and pdf) are available at this Github repository.

Parts

This project does not require many parts, and most are available from Mouser. Bare PC Boards are available from OSH Park.

Qty Part Value Package Vendor Part Number
1 C1 .1uF 0805 Mouser.com 80-C0805C104M5R
1 C2 10uF 0805 Mouser.com 647-F921A106MPA
2 J1,J2 4 pin smd Qwiic connector mouser.com 485-4208
1 J3 8 pins .1 Header Pins Mouser.com 855-M20-9991645
1 J4 2 pins .1 Header Pins Mouser.com 855-M20-9991645
3 R1-3 10K 0805 Mouser.com 71-CRCW0805-10K-E3
2 R4,R5 4.75K 0805 Mouser.com 71-CRCW0805-4.75K-E3
1 U1 MCP23008 SSOP20 Mouser.com 579-MCP23008-E/SS
1 PC Board OSH Park Order Link

You can purchase keypads from many sources including Mouser, Amazon and eBay. The keypad must be a matrix style keypad where this is a pin for each row of keys and a pin for each column of keys.

I²C Keypad Backpack “bare” pc boards are available from OSH Park.

Assembly

As you probably noticed, this board uses surface mount components, so you will need some skill in dealing with these small parts. Sparkfun has an excellent series of tutorials if you want to brush up your knowledge on soldering these small parts.

Depending on your keypad, you may not need the J3 connector pins, as the backpack board can be soldered directly to a keypad. You probably won’t need J4, unless you are using interrupts to detect when a key is pressed on the keypad. The library routines that I wrote do not use interrupts.

Hookup

Most keypads have a row of .1 inch spaced pins. Slip the backpack board over this row of pins and solder the board in place.

Using a 4 pin Qwiic type cable, attach the backpack board to a microcontroller that has a I²C Qwiic type connector on it. This will power the display and connect the SDA and SCL lines to the microcontroller.

Jumpers

There are five solder jumpers near the center of the backpack board. To “close” a jumper, carefully solder a bridge across the two pads using a small amount of solder.

SJ1, SJ2, and SJ3 control the I²C address of the board. The following table shows the possible address combinations.

SJ3 SJ2 SJ1 I²C address
closed closed closed 20 hex
closed closed open 21 hex
closed open closed 22 hex
closed open open 23 hex
open closed closed 24 hex
open closed open 25 hex
open open closed 26 hex
open open open 27 hex

If you solder across SJ4 and SJ5 you can enable pull up resistors on the signals SDA and SCL (respectively). At least one pull up resistor is required on these lines somewhere on your various hardware boards.

Software

For Arduino, Particle and Raspberry Pi users, the I2cKeypad library provides functions that make it easy to read the keys as they are pressed on the keypad. An included demo program shows the usage of the functions. These links give the details.

Miscellaneous

Qwiic cables in various lengths are available from Adafruit, Sparkfun, Mouser, Digikey and Amazon.

License Information

Our License Information is here.



2 comments on “I²C Keypad Backpack Board
  1. Andrew Johnson says:

    Hi Gary,
    I can’t tell you how happy you have made me now I have found your I2cKeypadDemo.ino. It is
    I have a project which demands I2C and I have wasted hours on old Arduino stuff using a PCF 8574 to connect to a keypad. I guess for innocents like myself there needs to be some cleaning out, or at least some warnings, of using Arduino libraries which don’t work now under the Arduino 1.8.8 ISP.
    I programmed a bit of C 30 years back but now have to rely on others work. Electronics is no problem so can you direct me to a circuit diagram of the the MCP23008 and keypad? I have looked at your dcity.org link but could not see one.
    Many thanks, Andrew Johnson. andrew.johnson@uwa.edu.au

  2. gary@dcity.org says:

    Hi Andrew,
    The schematic for the circuit that I build is here: https://github.com/dcityorg/i2c-keypad-backpack/blob/master/I2C-Keypad-Backpack.pdf
    It uses the MCP23008 chip. Boards are available from oshpark.com. Links and more details are on this page above.
    Most any matrix keypad will work with this circuit. On these keypads when you press a key, it shorts the row pin with the column pin, and the chip can recognize the keypress.
    Good luck with your project.
    Gary

Leave a Reply

Your email address will not be published. Required fields are marked *

*