Building a 5$ macropad
- a piece of cardboard (for the plate)
- Pro Micro microcontroller (for less than 3$ from aliexpress)
- 6*switches (10pcs starting from 1.5$ on ali) Any switch will do. You can aim for the cheapest. Don't overthink this part now. Do you have people around? Choose brown (tactile but not clicky). Are you alone? Choose blue (clicky) switch. Here is my swich guide for beginners if you want to dig deeper.
- 6*1N4148 diodes - through hole ones (you get 200 diodes for 1$ from aliexpress)
- some wire (I used an old HDD ribbon cable for my next build, but a somewhat thicker wire is easier to handle. I use 26-28 AWG wires nowadays).
- optional: 6*hotswap sockets - while these are cheap (0.1$/pc), shipping cost me a fortune. (You don't need this at all.)
- caps? They are not necessary for this test, but I went with blank DSA keycaps from aliexpress: 3$/20pcs.
Tools neededYou can find my more detailed list of tools here, but a quick list to keep it short:
- soldering iron (Well, any iron will do the job. A pointy tip helps.)
- wire cutter (2$ from ali)
- exacto knife (1$ from ali)
- tweezer helps too (metal or something what doesn't melt near a hot soldering iron)
- needle/pin to mark the cutouts
Buy or order the stuff listed above. If you have to order it from abroad spend the next weeks with reading, learning and planning. Or you can start with making the plate in the meantime.
We have to secure our switches to something. This is the plate. No need to invest in a fancy acrylic or steel plate yet, a piece of cardboard laying around is just perfect. Btw, I found cardboard superior to acrylic in many ways.
Plate thickness is usually 1.5 mm. I used this cardboard thing which came with some clothing, maybe a shirt, and while it was thinner, it worked perfectly. Shoe boxes are great too as you can see in my cardboard prototyping guide.
CutoutsTo put the switches into place, we have to make cutouts in the plate. Two important measures: the switches fit in a 14x14 mm square and the cutouts are arranged usually in a 19x19 mm grid. This means there is a gap of 5 mm between the cutouts and there is a 19 mm distance from square center to center and edge to edge.
Plate SVGYou can take a pencil and ruler and sketch up the squares on the cardboard plate or you can seemingly overcomplicate this part like I did. (The vector drawing way comes handy later for laser cutting.) I started the design in KLE and imported its row data to the plate builder. While this works, I ended up using Inkscape exclusively: Draw a square. Input 14 mm for its dimensions. Duplicate the square a few times and arrange them 19 mm apart. (You can set up a custom grid or simply move each one by 19 mm.) It's worth practicing some Inkscape, but you can download the result here: macropad SVG.
I printed this elaborated plate plan in 1:1 on a sheet of A4 paper. Then I laid this over my piece of cardboard and marked the squares' edges by piercing through them by a needle, leaving dot marks on the cardboard.
Soldering timeTurn your little keyboard on its back. I used hotswap sockets (you don't need them) so I had to solder to the sockets. But you can solder directly to the switch contacts. If you are new to soldering, wires and switch contacts are the perfect practice field. Nothing to screw up. But you may read about soldering, watch videos and practice on simple wires first. My basic soldering crash course may help too.
Grid aka matrixTo keep this short, you need to solder the switches together forming rows and columns. Additionally, you have to add a diode for each switch. We do this to help the controller to avoid some ambiguous cases while detecting which key was pressed. You can read about this in my keyboard matrix guide if you are interested. You wouldn't need a matrix for 6 keys but we do it anyway to practice.
DiodesDiodes let electricity flow in one direction only. Their polarity (direction) is crucial. You have to solder them in the same direction across the whole board, looking for the tiny black ring mark. I soldered them with the black ring downwards. (You can solder them the other way too, but you have to be consistent and set the direction in QMK's config.h later.)
Preparing and soldering the diodesBending one diode leg and cutting the other leg shorter in advance helps later while soldering. I made this loop with a plier, but this is an overkill. This is how I've done it with my next board.
Solder the diodes to the switch/socket contacts.
Making the rowsSolder the diode legs together to form the rows - wires are not necessary in this direction. Yeah, this is a very poor soldering job on the pic below. I'm sure you will be better.
Making the columnsI prepared the wires before soldering the columns by cutting gaps in the insulation. Keep this gaps short, because shorting rows and colums later (touching bare wires) is not a good idea. I used red wires for the columns and black for the rows. Colors are not necessary, however, they can help with managing complicated matrices.
The microcontrollerThis project was intended to test things, so I made the controller part on a breadboard. The 28 AWG wire used for the matrix worked great as jumper wire too. Of course you can solder the row and column wires directly to the Pro Micro. (Mine had a pin row soldered on the board since it was salvaged from a previous Arduino project.) On the picture there is a reset button set up, but you can simply short the RST pin with GND to restart the Pro Micro in bootloader mode.
ProgrammingQMK is a popular firmware choice. It may be overwhelming first, but they have good documentation and guides for beginners. Start with preparing your environment according to this QMK guide. Once done, edit the configuration files (diode direction, pins used, layout, keymap). Remember that QMK needs the AVR pin numbers, not those indicated on the Pro Micro PCB. Here is a pinout reference I've put together showing both pin names.
Build the firmware by issuing the command:
If there are no errors, your macropad should work fine. Congratulations!
With only 5$ spent for parts and materials you have a working macropad and hopefully learned everything you'll need to build more sophisticated boards. If you have the parts around, move your ass and start building. If you are still waiting for stuff to arrive, check my other build log on how the S.Torm46 was done.