Building a Handwired Keyboard

by burnt-sushi in Circuits > Electronics

5465 Views, 13 Favorites, 0 Comments

Building a Handwired Keyboard

IMG_4510.jpg
IMG_4513.jpg

I've been using mechanical keyboards for the past couple years, during which I have discovered there are other people who are even deeper into this hobby built keyboards without PCBs. Instead of purchasing an all-in-one kit, these people use wires and diodes to connect the switches to the controller.

As such, for this guide, I decided to try following other people's blog posts and tutorials to handwire a keyboard that one can also use as a macro pad.

NOTE: This project assumes you know how to solder. If you are not familiar with soldering, here are some guides to help you get started:

Supplies

IMG_3973.jpg

Here are the parts of our keyboard:

  • A planck plate.
  • I'm using the Planck Lo-Pro switch plate from Laserboost: https://www.laserboost.com/plates-planck/.
  • The plate 3D model can also be found here: https://github.com/olkb/olkb_parts/blob/master/planck/lo-pro-plate-mx-2x2u.stl.
  • x50 MX style switches. I'm using Alpaca V2s for this project.
  • x1 Arduino Pro Micro. You can use other types of USB controllers such as Elite C, etc.
  • Electric wire (24 AWG). Suggest using solid core wires as it holds its shape when we are stripping the insulation.
  • x60 diodes. Suggest using 1N4148 diodes as it is dirt cheap and fits perfectly for our usage.

You will also need the following tools:

  • Soldering iron & solder.
  • Wire stripper & cutter. I'm using this all in one stripper and cutter from amazon.
  • Multimeter. Used for testing whether the wire was soldered on correctly.

Placing the Switches

IMG_3974.jpg

Put all switches firmly onto the plate. Make sure the switches are facing south (LED hole facing the bottom of the keyboard).

Bending the Diodes

IMG_3982.jpg
IMG_3984-1.jpg

Next, solder the diodes onto the switch pins. Since both the diodes and the switch pins are bare metal wires making it rather hard for the solder to hold onto, we have to bend the diodes into a small loop so the solder will flow into the hole and form a strong solder joint.

After creating the loop, place it over the pin and tighten the loop by pulling on both sides of the diode before clipping the excess wire at the end. Tightening the loop makes the solder looks cleaner in the next step.

Since electric current can only flow from the anode to the cathode in a diode, make sure the loop is on the side without the black mark on the diode. See the following image for reference.

Repeat this step for every diodes, every switch should have one diode.

Soldering the Diodes

IMG_3989.jpg

Once all diodes are prepared, put the diode loops on each of the switch pins and solder the loop and switch pin together.

Make sure to put the diodes on the "higher" switch pin. See the following image for reference.

Wiring the Rows

IMG_3995.jpg

Solder all rows together using a long wire. First mark all the points that overlaps the diodes, then use the wire stripping tool and strip the parts that will be connected to the diodes.

I wouldn't suggest cutting the wire into multiple pieces and solder each one individually onto the diodes as it is harder to hold the wires in place.

After the row wire is properly stripped, place it on the keyboard and use the diode legs to "hook" the row wire firmly in place and solder them together. Clip the excess diode legs after the soldering is done.

Repeat this for the rest of the rows.

Wiring the Columns

IMG_4010.jpg
IMG_4006-1.jpg

Wire the columns uses the same exact technique as the rows, except we need to use the wire itself to loop through the switch pins instead of using a diode.

The key is to do them one by one and solder each immediately before proceeding to the next loop. See the images for reference.

After which you can then use the multimeter to check the columns are correctly wired, where no rows are electrically connected to any columns.

Connecting the Microcontroller

IMG_4513.jpg
pro-micro-to-qmk-pins.png
EXCEL_UDt8JAUrVe.png

After connecting all switches into rows and columns, we need to connect all 4 rows and 12 columns onto the micro controller. In total there should be 16 wires connecting to the controller.

You can wire the rows and columns to whatever pins starting with a "P" showed on the above Pro Micro pinout diagram. My wiring diagram is also shown table above.

Note 1:

  • Top most row is row 0; Bottom most row is row 3.
  • With keyboard keycaps facing up, left most column (normally where ESC key is) is column 0; Right most column (normally where BACKSPACE key is) is column 11.

Note 2: The diagram is for Arduino Pro Micro only. I would suggest look into this guide if you are using other micro controllers: How to use a Pro Micro as a cheap controller/converter.

QMK Firmware Configuration

chrome_HbxHnAWkxz.png
chrome_ziZLo7SgyO.png
chrome_VvpJtPCcfa.png
chrome_1kdhIhfNym.png

A QMK Firmware is responsible for two major things:

  1. Detect which key is being pressed by the user.
  2. Output the corresponding keystroke to the computer.


Here are the following steps in creating the firmware:

  1. Navigate to https://kbfirmware.com/.
  2. Match the pins that are connected to each row and column. Refer to the Pro Micro diagram for the pin numbers. My pin settings are shown in the above image.
  3. Edit the keymaps, this is the keys that the keyboard will tell the computer whenever you pressed a key. Note you can have multiple layers using layer keys. My board has two layer keys with each next to the space key.
  4. Navigate to the "Compile" tab, and download the .hex file. This is the firmware that will go into our Pro Micro.


Attached Files:

  • planck-new.hex - The compiled firmware based on my pinout and key layouts. This is the file that will go onto the Pro Micro. You can use this if you connected the rows and columns to the same pins as I did.

Downloads

Flashing Pro Micro Controller

qmk_toolbox_UtqNOYMbRg.png

After you have configured the firmware for your keyboard

  1. Download and open QMK Toolbox from GitHub.
  2. Select the .hex firmware file from step 7 in "Local File" in QMK Toolbox.
  3. Make sure the MCU is selected as "atmega32u4" in QMK Toolbox.
  4. Short the GND(ground) and RST(reset) pins of the Pro Micro using a wire or tweezer.
  5. Connect the Pro Micro with your computer using Type C or Micro USB.
  6. Upon connection, the device will appear in the output window in QMK Toolbox.
  7. Click "Flash". Note Pro Micro will disconnect within 10 seconds from the computer if you did not click "Flash". Make sure you have quick hands!

See this example video from Esse Woods for demonstration: https://www.youtube.com/watch?v=GwqlT5Xy4Ng.

Done!

IMG_4510.jpg

I have added some M2 standoffs from Amazon to the plate so the wires are not touching the table directly. You can also 3D print a case using the dimensions provided in the official Planck GitHub repository.