Lego 4x4 Keypad Matrix

by EducatedAce in Circuits > Arduino

3812 Views, 27 Favorites, 0 Comments

Lego 4x4 Keypad Matrix

pict20200419_010318_0.JPG
pict20200419_010134_0.JPG

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.

Supplies

  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

Print the Parts

pict20200418_165611_0.jpg

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

Place the Buttons

pict20200418_182523_0.jpg

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

Solder the Buttons in Place

pict20200418_234918_0.jpg

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.

Solder the Rows and Columns

pict20200419_003348_0.jpg

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.

Build Up Housing

pict20200419_003751_0.jpg
pict20200419_004221_0.jpg
pict20200419_004756_0.jpg

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.

Drop in the 2x2 Bricks

pict20200419_010039_0.JPG

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

Writing the Code

Screen Shot 2020-04-18 at 6.54.52 PM.png

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.

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.