You'll need a total of 24 "12mm" through-hole tactile switches, one piece of 7x9CM perfboard, and preferably two colors of wire. If you buy 4 sets of Adafruit's colorful assortment, you'll have enough caps of a single color to do all the digits, with some left over for your next project.

Begin by snipping the small plastic pins off of the bottom of each key. These are great if you're doing a custom PCB, don't hurt if you are using a protoboard, but just don't fit in the perfboard. You don't have to get them flush, just do the best you can with a pair of flush cutters.

The pins will fly off if you're not careful, so doing this directly in a small wastebasket is highly recommended!

Use eye protection when using diagonal cutters and soldering to avoid eye injury.

Identify which side of the perfboard is the bottom—this is the side with the copper pads. We're going to stick the keys through from the top, non-copper side.

Insert the keys in the perfboard in a "4x6" (4 columns, 6 rows) pattern, with the pins sticking out the left and right sides. Use the very first row of holes (this will become the bottom of the keypad), and place everything as close as possible. This should leave you with an unused row at the top where we will later add the connecting header.

Flip the board over, the next task is to complete the "row wiring". There is already an internal connection between pins 1 and 2, and pins 3 and 4 that will be taken advantage of. (then, when the switch closes, all of 1, 2, 3, and 4 are momentarily connected)

The "row wiring" needs to connect pins 1 and 2 of every key on the same row. This can be accomplished by bending pin 1 of one switch towards pin 2 of the next switch, then soldering them together. As you complete each row, use your multimeter in continuity test mode between the far left and right ends of the row to make sure everything is soldered.

When you proceed to the next row of keys, make sure to skip over a row of pins—We'll be soldering to pins 3 and 4 when it's time to do the "column wiring".

For the column wiring, I like to use a diagonal wire, from pin 3 of one button to pin 4 of this next one. This lets me place small pieces of wire, stripped at each end, and only solder one wire (not two) to each pin. The length of each wire in this case is about 2/3" or 16mm.

If, after soldering, the wire sticks beyond the end of the pin, trim it with flush cutters. As you complete each column, use your meter in continuity test mode to check that the connections are good from the top to bottom of the column.

Finally, we need to add a 10-pin header and connect each row and each column to it. No GND or VCC connection is needed.

Your calculator will look tidiest if you solder a right angle male header on the bottom (copper) side of the board, pointing out the top. Use the very topmost row of the perfboard.

Next, solder the first 6 positions with a connection from a "pin 3" or "pin 4" of each row.

Finally solder the other 4 positions with a connection from "pin 1" or "pin 2" of each row.

Phew!  That was a lot of wiring!  Now, for a final test get out your meter, make sure it's still set to continuity mode, and clip your probes to one row pin and one column pin. At first it will read open circuit, but when you press the button at that row and column it will beep for continuity. Check this for a few keys until you're satisfied the keyboard works properly. The microcontroller will do this rapidly for each combination of row and column when it "scans the matrix".

This guide was first published on Oct 21, 2020. It was last updated on Oct 21, 2020.

This page (Soldering the Keyboard Matrix) was last updated on Aug 20, 2020.

Text editor powered by tinymce.