On the road to make the Zeeland I keyboard, I was hit with the huge sticker shock of the flex PCB. I temporarily put that project on hold to make a flat keyboard to test out my PCB design ideas and plugins instead. This project was the motivation for my HierarchicalPCB and KLEPlacement plugins.

All source files for the keyboard are on my GitHub. The eventual goal is to make this a split keyboard with this layout:

Its a staggered-row split keyboard with rotated thumb clusters, loosely inspired by the Kinesis Freestyle Edge that I’ve used for the last six years. I strongly prefer staggered keyboards (whether row- or column-) to ortholinear keyboards, an opinion that most keyboard enthusiasts are surprisingly hostile to.

Now that we have the layout as an almost-JSON file, we need to place the switches in the correct positions. That’s where the KLEPlacement plugin comes in.

KLEPlacement Plugin

There are plenty of keyboard layout plugins for KiCad, but I wasn’t quite happy with any one of them. Existing plugins either don’t accept KLE json directly, or have some other hurdle that prevents me from using them for rapid iterative design.

In particular, I wanted these properties:

  1. Accept KLE json directly, including support for rotations. It’s not standard JSON, requires a state-machine to decode correctly, and is undocumented, so doing this right is complicated.
  2. Can be repeatedly run quickly (so caches your previous input).
  3. Swappability: I should be able to switch the positions of two keys by moving them to their approximate correct positions and re-running the script.
  4. Idempotence: when I run the script a second time, keys that are not changed should not be moved.

Swappability is necessary because any keyboard schematic implicitly carries with it a relative layout of switches. Swapping switch positions is necessary to make the routing consistent with the schematic. Idempotence makes this viable for iterative design – I can run the script, look at the result, and then run it again without worrying about the positions of keys that I haven’t changed. If I want to change the positions of two keys for ease of routing traces, I don’t want to have to re-route the entire keyboard.

The plugin is dead simple to use. Paste in the KLE json, select the prefix of the footprints you wish to position, and run it. That’s it. The plugin will place the footprints in the correct positions.

If you need to swap the positions of two keys, just move them approximately near the position of the other, and run the plugin again. It will remember the previous settings, and will only move the displaced plugins. Dead simple.