Hacker News new | ask | show | jobs
by hakfoo 1123 days ago
I wanted to do a custom keyboard, at one point I tried to write some PHP code to parse a JSON definition of the layout, and generate a disposable Python script to feed into the KiCAD console to position the switches and diodes to order. (Mostly because I far comfier with PHP tooling) It sort of fell apart because I couldn't quite get the diodes to lay out where I wanted them.
1 comments

There is extremely lazy way to do it.

Pick a switch footprint and add diode footprint to it, save as new footprint.

The problem is that this often isn't physically possible.

Keyboards are rarely fully grid-like, so you have to take into account that there is a row/column shift. Modern keyboards have features like per-key RGB and hotswap sockets, which eat up a lot of valuable space. And then you also have to fit half a dozen traces in between two switches for the key matrix connectivity.

An approach like that might work for a trivial macropad, but it quickly falls apart on a full-size keyboard.

Right. We're talking about someone making a one off that's simple enough to mostly auto place with a script.

> And then you also have to fit half a dozen traces in between two switches for the key matrix connectivity.

...I guess you never designed a PCB? there is loads of space on keyboard sized design.

The interesting thing about scripting layout is how quickly you need an autorouter. There's usually plenty of room, but if things aren't laid out extremely regularly with no variation, it rare to be able to just write out the correct component positions and copper shapes.
Keyswitches are like 20x20mm...there's an abundance of room for a little ~2x1mm diode within the footprint.
It's a bit harder if you go through-hole. When you can't fit it "under" the switch footprint, it becomes harder to auto-route it-- there might not be a space specifically where you want-- maybe you want to move some diodes around to shave a couple millimetres off the PCB footprint to save a nickel, or maybe you need to rotate a switch (for example, the + and enter on the numeric pad) and end up with the 'standard' position fouling some other part of the layout.

It takes an evening or two to manually route a big battleship board, when you're not worried about RGB or having to do clever stuff with USB.