Introduction: Lego 4x4 Keypad Matrix

While I have been stuck in the house for the last few weeks, I have finally gotten around to finishing up some projects that have been swirling around in my head. I have been using Lego as the foundation for most of my projects in the last few weeks. I finally put my Google AIY kit together with legos, I also built a custom Apple Pencil holder using custom lego pieces. So it was time to move on to something a bit more challenging. I really wanted to use pieces that I have in the house and the legos were perfect. The only thing I had to order for the build was an Arduino Micro. I tried with other boards but this is honestly the best solution. It is plug and play. It was worth waiting a couple of days.

This week I tackled one of the projects I have been thinking about for a while. A 4x4 keypad matrix to script shortcuts for my computer. I have been also doing some work in photoshop and I wanted the be able to navigate back and forth a little easier. So I broke out the tools and got to work. I am going to disassemble this later to order bricks to make it a uniform color. But for now, here we go.


  1. Arduino Micro
  2. 16 tactile buttons
  3. Solder
  4. Soldering Iron
  5. Flux
  6. Micro Usb Cable
  7. Lot of Legos
  8. Button Holder*
  9. Base Plate *
  10. Arduino Micro Lego Holder*

*Requires 3d printer

Step 1: Print the Parts

You need to 3d print the parts and prep them for the build.

Step 2: Place the Buttons

Place the tactile buttons on the Bottom baseboard and solder them into place.

Step 3: Solder the Buttons in Place

Using the matrix diagram I soldered the buttons into place using a zigzag pattern for the rows. The goal was to just connect the rows across and the columns down.

Step 4: Solder the Rows and Columns

I started by soldering the 4 red wires and 4 black wires to the Arduino Micro. Then soldered each of the wires to the columns and rows paying close attention to going in the right direction. The Arduino Micro was hot glued to the custom 3d printed Lego part.

Step 5: Build Up Housing

I used a variety of 1x bricks to build up the housing. There are no bricks under the keypad. It attaches to the perimeter. Bricks are placed on top and in the center just to provide more stability.

Step 6: Drop in the 2x2 Bricks

The 2x2 bricks act as the actual buttons and fit perfectly over the tactile buttons.

Step 7: Writing the Code

The code for the project was pretty easy. I followed some code I found on Github. I did have to make some changes to the rows and columns but it is up and running perfectly. Directions for the library are on the Arduino CC website.

Step 8: Enjoy

I am super excited about creating art now with this keyboard because I can use the shortcuts I have created. I am thinking about how I am going to script each of the 14 keys.

I am excited about posting an update after I order a consistent color scheme of bricks.