Introduction: Arduino Mechanical Keypad

I needed a pin pad for another project, so I decided to make a keypad with parts I had at home.

Supplies

  • 1u Keycaps:
    • 1 to 9
    • DELETE
  • 2u Keycaps:
    • 0
    • ENTER
  • 12 key switches (I used Cherry yellows but any will Cherrys will work!)
  • Arduino Uno
  • 3D printed switch plate (see Step 1)

Step 1: Design Keypad Layout

If you want to make your keypad with the same size keys as me, you can download and 3D print my STL file directly, and skip to Step 4!

But if you need to design your own using keyboard-layout-editor :

Delete the welcome message by clicking on it and using the Delete Key button.

To get the layout you want, you can adjust each key under the Properties taband set the Height and Width (1 = 1u, 1.5 = 1.5u and so on). You can move keys around with your arrow keys.

When your design is ready, go to the Raw Data tab and copy the code there.

Step 2: Build SVG File

You'll turn your design into an SVG file with swilkb :

Paste the code you copied into Plate Layout

Pick your switch type (I suggest MX_t:1 because it'll be easier to print)

Pick stabilizer type - I chose Cherry + Costar {_s:1} but didn't end up needing or using stabilizers.

Edge padding is how big the border around all of your keys will be (I used 10mm all around)

Leave the rest of the options off

Hit Draw My CAD. Click the SVG button, and save the file (you'll have to CTRL-S or right click on the image).

Step 3: Build 3D Model

Log into Tinkercad and start a new project.

Import your SVG file; tinkercad will automatically add thickness. The default is 10mm - way too thick for a switch plate! Set the thickness (the square in the middle) to 3.00mm.

Export your project as an STL and you're ready to 3D print!

Step 4: Solder and Assemble

The keys are connected along columns and rows.

I originally designed the circuit with diodes to prevent false key presses. The Arduino code takes care of that, so save yourself some work and skip the diodes!

Attach rows to pins 0, 1, 2

Attach columns to pins 10, 11, 12, 13

Step 5: Code

I used the Keypad library which you'll need to download

Go to Sketch -> Include Library -> Manage Libraries.. and search for "Keypad" and click Install

If you designed your own keypad, adjust the 2D array of keys.

Upload to your Arduino and you're done!