Image for post
Image for post

Building my first keyboard (and you can too)

starting with knowing absolutely nothing about building keyboards

This keyboard building guide and saga started off with me simply wanting an adorable keyboard…

The body

First, you’ll need to decide what kind of body you want your keyboard to have. There are lots of options ranging anywhere from a typical flat keyboard to a split ergonomic one and everything in between.

Image for post
Image for post
right hand of dactyl body with switches inserted

The switches

Switches are possibly the most important part of your keyboard. They are the mechanism underneath your actual keys that moves down when you press a key.

The keycaps

Most keycaps won’t have much of an effect on how you type, but they can give your keyboard a different look and feel. You can customize colors, fonts, or even have blank keys.

Image for post
Image for post
cotton candy colors

The microcontroller(s)

You will need one or possibly two microcontrollers so your keyboard knows what to do. Which microcontrollers you choose can impact which firmware you use and how things get wired.

The wiring

I decided to handwire my keyboard. The other option is to have a PCB (printable circuit board) printed.

Tools

If you are handwiring your keyboard, you’ll likely need the following things:

  • solder — if you’re handwiring, you’ll need to solder different parts of your keyboard together. Soldering uses a soldering iron to heat metal and create a little metal “joints” that helps hold things in place and is also conductive. Lead based solder works best as its melting point is much lower than non-lead based alternatives. For beginners (like me!), it’s easier to use lead based solder, but be sure to work in a well ventilated area when soldering.
  • soldering iron —the tool that will actually heat the solder. I’m not a soldering expert, but the general idea is to heat the metal you want the solder to melt onto, not the solder itself.
  • electrical tape — it’s important that certain parts of your keyboard don’t touch each other, and the easiest way to insulate those parts is probably with electrical tape.
  • diodes —diodes are like a one way street for electricity by only letting the current flow in but not out. They help your microcontroller know which key you’ve pressed. You’ll need as many diodes as you have keys.
  • TRRS cable — TRRS (or tip ring ring sleeve) is commonly known as an audio cable and will be used to transfer information between the two hands of your keyboard.
  • TRRS mount — This is what your TRRS cable will be plugged into. You’ll need two of these (one to connect to each microcontroller on each hand).
  • Micro USB-to-USB cable — This is what will connect your keyboard to your computer. For fun, you can actually build your own cable. I did this and it was a bit nerve wracking, but in the end I had an adorable pink cable I built myself so 🤷‍.
  • multimeterthis will help test connections for your keys.

Switches

First, you’ll need to shove all of your switches into all of the holes in the top part of your keyboard. The part that you can push down will go on the top of your keyboard (that’s where the keycap will go). There should be a little slit in each switch. This slit should be oriented to be at the top.

Image for post
Image for post
all together now

Wiring

Now comes the wiring. There aren’t a lot of guides or information out there for wiring, so I made a few diagrams to make things easier.

Image for post
Image for post
stripped wire used for columns
Image for post
Image for post
Image for post
Image for post
left: switch diagram of pins, right: Pro Micro pin layout
Image for post
Image for post
row wiring diagram
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
left: a diode with a loop for easy soldering, middle: diodes arranged on the silver pin for wiring rows, right: diodes soldered to silver pins and looped around wire in prep for soldering
Image for post
Image for post
continuity and diode symbols is the mode for testing connections
testing connections after wiring to the Pro Micro
Image for post
Image for post
column wiring diagram
Image for post
Image for post
Image for post
Image for post
left: fully wired rows and (almost) fully wired columns right: closeup of freshly wired columns
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
left: Pro Micro pin labels, middle: Pro Micro prepped for soldering, right: row wires running to Pro Micro with electrical tape insulation
Image for post
Image for post
Image for post
Image for post
left: wiring diagram for TRRS pins to Pro Micro pins, right: TRRS mount with wires prepped for soldering

Firmware

Now that everything is wired, it’s time to make the keys do something.

brew tap osx-cross/avr
brew tap PX4/homebrew-px4
brew install libusb
brew link --force avr-gcc@7
brew install dfu-programmer
brew install gcc-arm-none-eabi
brew install avrdude
Image for post
Image for post
main layer
Image for post
Image for post
sub layer accessed by tapping the TOGGLE LAYER key
it’s alliivveee

Keycaps

All that’s left now put on all of your keycaps. Gently but firmly push the keycaps onto the top part of each switch. And don’t forget to screw on the back of your keyboard!

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
😍😍😍

P.S.

Building anything takes a lot of time, trial, and error. Things don’t go perfectly the first time. I broke many a wire when trying to strip the coating off, glued switches the wrong way, and I even snapped off the micro-USB end of a Pro Micro when plugging in a cable AFTER MY KEYBOARD WAS TOTALLY FINISHED. I had to order a new Pro Micro, which I found out was defective after I re-soldered it, so I had to order YET ANOTHER ONE and re-solder that.

Written by

software engineer @twitter, previously @medium. doing scala + graphql. pokemon gym leader. potato compatible. @sachee

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store