← Back to Kevin's newslettersPublished: 2021 Mar 7

Put down the keyboards!

There’s a fancy furniture shop in my neighborhood with a huge window slogan, “Art is never finished, only abandoned”. This about sums up my feelings on the past year I’ve spent goofing around with keyboards.

Not that I’d describe any of it as “art” — to be honest, I don’t have strong aesthetic feelings about keyboards — but I have enjoyed learning from the many technical and craft explorations.

Plus, I did end up making quite a bit of (unfinished) stuff:

An collage of many keyboard-ish things Kevin made over the past year

Back in April I wrote

by now you should know that I won’t spend 2 hours and $100 on [a keyboard] if I could have instead spend an unbounded amount of time and money on multiple design iterations and deeps dives into technical esoterica.

Now that I’ve come up on a year of exploration, I’ve decided to wrap things up.

For a more detailed diary on all things electrical engineering, machining, firmware, materials, etc., etc., see my notes from a year of building keyboards.

Rust and Zig

The keyboard firmware has been my most complex and demanding Rust project, and while I managed to get it working, I never quite managed to have fun writing Rust.

Despite being a few years into Rust and having built a few useful applications (notably, Finda), the language still doesn’t feel comfy. In the back of my mind, I’m always wondering, “Am I using this correctly, or am I going to hit a wall and need to rewrite everything?”. (And, in the front of my mind, I’m pawing through Rust’s docs trying to read lines from a file or other seemingly simple task.)

This unease only came to the my conscious attention after I wrote a few short programs in Zig, a much smaller, simpler language. With the help and encouragement of Jamie Brandon, I rewrote my entire keyboard firmware in Zig over just a few hours.

This entire process felt wonderful compared to the months I spent struggling with fractally-complex Rust esoterica. Rust felt like driving on stop-and-go California freeways broken up by inner-city parallel parking, while Zig felt like hopping on a bicycle and casually cruising around a quiet neighborhood. Sure the latter might not be technically as safe or scalable, but aesthetically it feels much more my style.

I wrote up my thoughts on the particular objective qualities that make the two languages feel so different. Partly as introspection, but also to promote Zig after my positive experience with the language.

Rust was my first introduction to “systems programming”, just as cars were my (as an American) first introduction to the idea of “transportation”. While there are contexts in which these technologies absolutely make sense, I’m glad to have more pleasant alternatives for casual nice-weather trips across the neighborhood and low-stakes “lets drink a beer and blink the LEDs” evening programming situations.

Computer problems follow up

Last time we discussed two “this should be easy to do with a computer, right?” problems: extracting geometric coordinates from a bitmap image and selecting an optimal set of resistors.

Alec Resnic’s solutions were most impressive: not only did he send them in a day after I posed the problems, he also published his solutions online.

Seeing his solutions makes me think Mathematica suffers the same problem of classic literature — you’re exposed to it in school and lack the life experience to fathom just how incredible it is.

Another reader pointed out that Altium ($3,000/year PCB design software) includes a flood fill tool for converting bitmap graphics into regions (including copper). My favorite part of this solution is the, uh, pragmatism of the official documentation:

Note that not all image editors place the image data into the clipboard as metafile data. One approach to ensure this happens is to first paste the image into Microsoft Word then copy it from there and paste it into your Altium Designer software.

Yet another reader recorded a demo video of a semi-manual open source solution involving using a Gimp flood-fill selection tool to export regions as SVG, whence coordinates can be extracted.

For the resistor problem, Joe pointed out a blog post on the specific electrical problem and another reader found a limited calculator, though I didn’t find either of these as compelling as the Mathematica solutions, since the spirit of the question is to find a more general computing tool. (Sadly, I suspect most programmers faced with this “easy” problem would still have to spend 10 hours brute forcing or testing out optimization libraries like OR Tools.)

Misc. stuff