Custom Hotkey Keypad Project

  • Keypad on desk 3
  • Keypad on desk #4

This spring, as I was perusing the engineering building’s “free” pile for goodies, I found a gem – an all-in-one cash register! It had all sorts of great stuff in it: A keypad with mechanical switches, Vacuum Flourescent Displays, and even a turnkey switch. I just had to have it, so I lugged it to my evening lab session and then across campus to my car. I couldn’t take the chance of someone else nabbing it!

After ripping it into its base components, I finally had access to the part I wanted to play with – the keypad. It had plastic covers over small pieces of paper, so my imagination sparked as I realized I could replace the icons with whatever I wanted. However, I still had to figure out how to make it do something useful.

  • Cash register
  • Cash register
  • cash_register_3

Reverse engineering

After about two hours of painful probing with a multimeter and careful documentation, I had a layout of which two wires became connected when a given button was pressed. Reverse engineering isn’t always as fun as it sounds! Now, I had a layout which I could use to code some initial tests with an Arduino clone.

keypad PCB
Close-up view of the PCB that the keys were attached to.

The circuit layout

To determine what key was pressed at a given time, I used a double-layered Switch statement, which is essentially a lookup table. The two inputs to the lookup table are which output is currently toggled HIGH, and what input was registered at HIGH. The below animation beautifully demonstrates how this works.

This excellent animation explains how the microcontroller can detect when a key is pressed. The outputs sequentially toggle on/off, and the inputs are read to see which lines are high.
Source: http://pcbheaven.com/wikipages/How_Key_Matrices_Works/

One problem is that the Arduino Pro Micro only has 16 total I/O pins (excluding serial pins), but this matrix requires 10 outputs and 8 inputs (due to the way it was wired by the manufacturer). That would be 2 more than the amount of I/O pins that we have to work with.
Thankfully, we have our friend the Shift Register (74HC595), which allows us to turn three pins (clock, latch, and data) into 8 outputs. We can even chain shift registers together, essentially allowing an infinite number of outputs for only three inputs!

In this case, we use the 8 outputs provided by the shift register + two outputs directly from the microcontroller to get our 10 required outputs. The total amount of I/O pins is then 13 (8 input, 2 direct output, 3 to control the shift register). This leaves us with 3 extra I/O pins to use for whatever we want!

# of Input pins from keypad # of Output pins to keypad
Microcontroller 8 2 (+3 for shift register)
Shift Register N/A 8

Technical Note: If we wanted to save even more I/O pins, we could daisy-chain a second shift register to the first, and reclaim those two direct output pins for a total of 5 free I/O pins. (We could not however do the reverse, using an 8-3 encoder IC to encode the input signals into a smaller amount of pins. More than one input pin may be High at any given time if more than one button is being pressed, which would result in the microcontroller only detecting one key being pressed. This is due to an 8-3 encoder’s priority of inputs.)

<Fancy Circuit Diagram to go here eventually>

The Code

While researching how to make this keypad work with a computer, I learned that the Arduino Pro Micro is one of the few Arduino microcontrollers that can be used to simulate keyboard presses via USB to a computer. I initially started with the Keyboard library provided by the Arduino team, then later switched to the original source (HID-Project by NicoHood), as it had had the ability to use media keys (volume controls, etc). Using my programmed lookup table, I now added functionality to the project: A single press of one of the keys could emulate a sequence of key presses, allowing shortcuts to be executed.

After some searching for useful shortcuts, I realized that one of the tedious parts of my engineering lab reports is inserting Greek letters for variables. I decided to use ALT keycodes to type special letters that are normally not found on a keyboard. I also added a few other shortcuts, specifically for using Microsoft Word (superscript/subscript, increase/decrease font size).

For more technical information on the code, check out my GitHub repository: https://github.com/fwacer/hotkeyboard

Click to show/hide code


Functional layout of keypad:

ABCDEFG
1Superscript (Word)Piezo tune
2Subscript (Word)MuteVolume downVolume upAlphaBetaChange font to Symbol (Word)
3Default formatting (Word)Start/stop recordingRecord last 30 secondsDelta(uppercase)DeltaDegree symbol
4Increase font size (Word)GammaLambdaDel (partial derivative)
5Decrease font size (Word)789MuNuEpsilon
6Scientific format (Excel)456PiRhoOmega
7Currency format (Excel)123ThetaPhiSigma (uppercase)
8Add borders to cell (Excel)000.SigmaTau


Visual layout of keypad icons:

Keypad logo layout

Most of the icons were made by me, but a few were made by others. Expand the tab to see attributions to the authors.

Click to show/hide icon source links

Volume icons made by https://www.flaticon.com/authors/maxim-basinski from www.flaticon.com
   Volume Mute Volume Mute source: https://www.flaticon.com/free-icon/volume_291245
   Volume Down Volume Down source: https://www.flaticon.com/free-icon/volume_291244
   Volume Up Volume Up source: https://www.flaticon.com/free-icon/volume_291243

Magic hat and circular arrow icons were made by https://www.freepik.com/ from www.flaticon.com
   Magic hat Magic hat source: https://www.flaticon.com/free-icon/hat-and-magic-wand_68284
   Circular arrow Circular arrow source: https://www.flaticon.com/free-icon/refresh-left-arrow_61838

Music icon was made by https://www.flaticon.com/authors/bogdan-rosu from www.flaticon.com
   Music note Music note source: https://www.flaticon.com/free-icon/quaver-outline_69447

Half Life (video game) lambda icon made by https://half-life.fandom.com/wiki/User:Klow
   Half Life icon Half Life logo source: https://half-life.fandom.com/wiki/File:Lambda_logo.svg

Everything else was made by me, and is hereby released under Creative Commons Attribution 4.0 International License.Creative Commons License

Cleaning it up

The keypad was pretty dirty from the years of being used as a cash register. I took off all of the key caps and their covers, and washed each one individually, as well as the base chassis. This process felt like polishing a diamond that was found in the rough.

The Enclosure

Making the box was a new experience for me, and I wanted to make sure that it looked good, so I put a lot of time and effort into making sure it enhanced the overall project.

I chose to make it out of 1/8″ MDF, since it is easily workable with both powered tools and hand tools. For the face plate that fits around the keys, I initially used a router to make slots, but due to my measurements being off, the slots were angled slightly. I chose to do the rest of the slots with a drill press get rid of larger amounts of material, and then used a chisel to carve out square holes. After some sandpaper, the face plate fit nicely between the keys.

Initially, the face plate sat a bit low on the keys, so I simply added some spacers to make the keys sit a bit more flush. After, I glued edge pieces together to make the sides of the box, with the help of a ratcheting strap and some plastic corner helpers. I had to make sure not to tighten it too much, or the wood would start to bow.

I then drilled holes for the speaker volume potentiometer and the micro USB cable, which I should have done before I glued the box together.

After gluing the bottom piece to the sides, some more sanding and filing to make the bottom, sides, and top fit nicely together, I drilled a series of holes for mounting the keypad chassis to the bottom of the box. I also drilled concentric holes from the top through the bottom in each of the four corners for screws to hold the lid on.

I used countersunk brass finishing screws that connected to countersunk nuts on the bottom side of the bottom. This was tricky to do with only 1/8″ material! Due to the length of screw I selected, the machine screw and nut were just barely able to mate.

Finally, it was painting time. After testing on some cutoffs of MDF, I realized that the black satin spray paint I had turned out very blotchy, after drying. This could be partly due to the linseed oil stains that you can see on the front. I determined that I needed to use a sealer before painting, so I picked up some shellac & primer spray paint.
( Note: I did have to scrape the paint out of my countersunk holes in order to make sure the screws and nuts would be able to reach each other! )

After that, I painted it with my black spray paint, and then finished it off with a clear sealer to give it resistance to scratching. After glueing a layer of black carpet/foam craft material to the bottom, I call this project complete!.

Painting. I used black satin spray paint over a shellac primer and sealer. It gave a much better finish than without the sealer. Without the sealer, my test piece came out blotchy.

This was really fun and I learned a lot about what it takes to not just make a product that works, but that looks good too. See below for more pictures of the finished product. I hope you enjoyed learning about my building experience!

Update 2019-08-11: This project has been featured on Hackaday and Hackster! Thank you Kristina and Jeremy for your nice writeups. 🙂
https://hackaday.com/2019/08/08/cash-register-hotkey-board-is-on-the-money/
https://blog.hackster.io/cash-register-transformed-into-custom-shortcut-keypad-7c0ddee50bdb

  • Keypad on desk #4
  • Keypad on desk 2
  • Keypad on desk 1
  • Keypad on desk 3




See below for a summary album of the build.