When you discover you can eventually figure out most anything, you know, like, "I can replace the transmission in my car," you start going down serious rabbit holes.

I like rabbit holes. The problem is that though you can do most anything, it's still often difficult to actually pull something tangible off. For instance, it seems pretty easy to make an audio cassette player. Schematics are out there. And I bet with a good enough motor, you wouldn't need a flywheel to regulate play speed. You certainly learn some cool stuff -- exhibit analog computers, for instance, was something my cassette player rabbit hole turned up as part of an intermediate cMoy amplifier rabbit hole.

But there's often still a barrier to true productivity after the euphoria of researching a new topic that's probably a bit too high to easily deliver concrete results without enlisting some "real" expert help.

(This is also the difference between replacing a transmission, which I've pulled of a few times, and an engine, where I think I 90% succeeded, but still took to a shop to finally get the installation debugged & fired up.)

Anyhow, my latest rabbit hole has been custom keyboards, and it's one where I think any reasonable schmoe can achieve productive, concrete results. I mean, it's a very popular geek pastime, and the domain is pretty straightforward.

  1. Put power into a circuit full of switches
  2. Detect when switches close (aka, power goes through them)
  3. Communicate those closures with a listener.

Apparently PS/2 is super simple, but we've still been using microprocessors to read the circuits for some time. From wikipedia.org:

The first computer keyboards were for mainframe computer data terminals and used discrete electronic parts. The first keyboard microprocessor was introduced in 1972 by General Instruments, but keyboards have been using the single-chip 8048 microcontroller variant since it became available in 1978.[41] The keyboard switch matrix is wired to its inputs, it converts the keystrokes to key codes, and, for a detached keyboard, sends the codes down a serial cable (the keyboard cord) to the main processor on the computer motherboard

So on its face, a very simple proposition, repeated a number of times, and you've got a keyboard, which we always knew in theory was just a lot of buttons each like the battery-powered buzzers we might have played with years ago, but there's nothing like studying the innards for that to really, practically make sense.

Anyhow, that's too much preamble. I'm not writing a book. Here, in good web-log style, are some good links to information about keyboards that I've run into during the rabbit hole exploration...

(Warning, like other giant log dumps, this post wasn't proofread even as well as my typical post, which is pretty bad...)



The parts of a keyboard

The quick overview from Wikipedia, above, is actually nice and succinct:

The keyboard switch matrix is wired to [the keyboard controller's] inputs, it converts the keystrokes to key codes, and, for a detached keyboard, sends the codes down a serial cable

So we need to figure out three things:

  1. How to make the circuit (keyboard switch matrix)
  2. How to add switches
  3. How to add the controller (microprocessor)

This three-part series, "Designing a keyboard from scratch", is a pretty in-depth conversation about all the steps put together, if you're less of a weblog reader and more a TL;DRer, though, plot twist, there's a lot of reading.


#1, The Matrix

For #1, you have two choices:

  1. Hand-wire a keyboard
  2. Use a PCB.

Here's a little on hand-wiring, which I might do for fun with my WASD Keyboards switch test taster [sic], but wouldn't do, I don't think, for a full-sized keyboard.

That said, as we saw in the "Designing a keyboard from scratch" series, using a PCB is probably a better idea, and certainly makes it easier to share your creations.


#2, The switches

There's not much to say here. We want mechanical switches.

Most keyboards today are those weird membranes. They're cheap and small. From computerworld.com:

But cost cutting gave way to newer ways of suspending the key by IBM and other manufacturers. Rubber domes, which work with the same snapping principle as a toilet plunger, and scissor switches, which also have a rubber dome but use a scissoring mechanism attached to the key top to push down the dome, came to prominence in the late '80s and early '90s.

...

These designs were also cheaper to produce, pushing keyboards to commodity status, according to [Craig Gates, CEO of KeyTronicEMS], and these two types of springs still underpin most of the computer keyboards on the market. Today the low-profile scissor-switch keys are typically found in notebooks and thin keyboards, including the chiclet-style keyboards on Apple's laptops. The taller rubber-dome keys are typically found in standard desktop keyboards and use an interlocking "chimney" structure in place of a scissors to stabilize the key travel.

But they aren't multi-use designs. That is, you can't pull the membrane for your keyboard out of your laptop and easily rearrange the keys or layout (though there are some neat guides like this one on how to pull a laptop keyboard, give it a new processor, and use it like any other external, wired keyboard).

So membranes we don't want to do. It's not feasible for hobbyists because it requires high volume and prevents experimentation.

Instead, we use the kewl one-off switches, as many as we need to make our keyboard. The reason these things enable so much customization is because they're very simple. They have two wires sticking out of their back. Power goes into one side and doesn't come out of the other until the switch is closed, just like a light switch, except that these are spring loaded to "unswitch" when you lift your finger. You know, just like those battery-powered buzzers you might have played with when you were younger. There are no inter-key depdencies. Hack them up however you want.

I mean, I guess I should talk about different switch types, but that's really down to personal preference. That said, here's a pretty good general rundown of mechanical switches on the market today from matt3o.com as an intro:

You need about $60 in switches for a medium sized keyboard equipped with original Cherry MX. Cherry has become the de-facto standard in mechanical keyboards but in recent years many clones are surfacing. Viable alternatives come fromย Gateronย andย Kailhย and they usually cost half of an original Cherry counterpart.

If you likeย Alps switchesย instead, Matias produces fineย Alps clonesย that go for $50 every 200 pieces or of course you can dismantle an old keyboard.

If you don't already know your preference, that WASD Keyboards switch test taster isn't a horrible idea. I've got one. Better is to steal your friends' keyboard to try them out, however!


#3, Controllers

There are lots of choices here. The conventional answer seems to be to use Teensy microcontrollers with a keyboard library like TMK or QMK.

But Teensys are $20 a pop and I already had a Raspberry Pi Pico sitting around. Those run $4.

I wondered if I couldn't use one of those instead. I mean, we're just detecting closed circuits and reporting via USB, right? And at first I tried to see if I could handle it all "myself" on the pi's CPU (the keyphrase is "bit banging" -- here are some results), but then I figured out how stupid that was. The pi already supports USB interfaces! I was thinking I needed that USB port to debug and program -- and I do -- but apparently it can also be used to perform USB out, no PS/2 bit banging and USB wire mapping required.

The TL;DR is to watch this video, "CircuitPython with Raspberry Pi Pico - Getting Started". It's not making a full keyboard, but the PoC is all there.

That's where I'm going to start, I believe. Note that it also talks about turning a joystick into a mouse, which I discuss a little more down belong under the "windmills" section (the pie-in-the-sky personal goals where I want to add a trackpoint to a keyboard).

Here's some more info on controllers I've run over:


Personal windmills

Okay, cards on the table, here's what's driving my rabbit hole:

MS Natural Keyboard Pro

I've been using Microsoft Natural Keyboard Pro for, sheesh, over twenty years. It's comfortable, and I've nearly muscle memoried it to the point I'm not quite as fast anywhere else (though I use Lenovo ThinkPad Bluetooth Keyboard on laptops with ease).

There are four problems with this keyboard, however.

  1. The "10-key" keypad makes getting my right hand to my mouse stupidly difficult.
  2. There's no keycap backlighting
  3. They haven't been made in forever & are getting really hard to find new.
  4. The ThinkPad keyboards have me addicted to TrackPoints.

My perfect keyboard would, then, keep an ergonomic feel close to/inspired by the Natural Keyboard Pro, would drop the keypad, would be backlit, and have a trackpoint for mouseless driving when I wanted. That's some work, but it's good to have goals, right?

For point 4, this from hackaday.com is kinda neat:

[Some hacker] decided that maybe giving up on the Lenovo keyboards was the best idea. A quick stop at a local store scored a fill-in mechanical keyboard, but in the back of [the hacker]โ€™s mind the need for a trackpoint remained. Maybe one could be frankensteined in to the keyboard that was just purchased?

More on trackpoint customization:

Backlight:


Rabbit hole fringe benefits

Speaking of finding interesting things, how about this one-handed ergonomic keyboard from the 1980s!

From Microsoft Research's Buxton Collection:

As Stephen Hobday wrote to me:

โ€ฆ the single handed units were first made and offered as part of our range in 1989. Since then there have been some changes to the design but essentially the concept is the same.โ€ฆ.At Stevenson College Edinburgh, one of the early users was a student who had only one hand. She had endured many years of frustration but found that she quickly learned to key on her single handed keyboard, and subsequently got a Job ahead of some 50 other applicants. Many thousands of these keyboards have now been supplied to users in all parts of the world.

Labels: ,