Building a Keyboard: Part 2

An explanation of what I'm trying to do by writing this up

When I started in on this project, I was a complete electronics newbie. I had no memory of holding a soldering iron. (Though as soon as that rosin core got hot, I recognized the smell. I'm pretty sure I must have soldered as a kid or in a past life or something.) I made…a number of mistakes as I built my first keyboard, but in the end I have a fully working keyboard. I'm attempting to recount, from memory, everything I did. Especially everything I did wrong. If you know what you're doing, you probably laughed or cried a fair bit as you read part 1 of this writeup. If you don't know what you're doing, it's my hope that this writeup shows you just how easy it is to build something that you might otherwise consider out of reach.

Wiring up the left hand side for testing

As I finished off Part 1 yesterday, I'd just managed to get the matrix on the left hand side of the keyboard wired up. From there, I wired up some temporary leads to the rows and columns on the left side. I used adapted breadboard wires from Adafruit. These have the advantage of plugging directly into the pins on the Teensy++ microcontroller. If I was working from a PCB, this wouldn't be necessary, but, since I didn't have a PCB to work from I was doing this freehand.

Once I got the rows and columns connected to the Teensy, I found some bad solder joints. I used the solder sucker to undo my bad joints and redid them.

Weird interference issues

Even once I'd debugged the bad solder joints, I was still seeing…weird behavior. Some areas of the keyboard weren't generating keystrokes. My first assumption was that I just had a few bad solder joints in a row. So I redid them. That didn't really help. Sometimes, it changed the failures a bit, but it didn't actually fix things. "I know what this is! I must have toasted some of the diodes by shorting or melting them during some of my ham-fisted soldering." So I replaced the diodes. Nope.

I unplugged the keyboard from the Teensy and started poking around with the multimeter. I couldn't find anything wrong at all. I went back and tested the "bad" diodes with the multimeter (like I should have done in the first place). They were all fine.

I plugged the left hand back into the Teensy. A different region of the keyboard was now misbehaving. Finally, I realized that certain leads from the matrix to the Teensy were misbehaving when they were plugged in next to each other. What was going on is likely obvious to anyone who understands electricity. My assumption is *mumble* *mumble* interference *mumble* shoddy wiring *mumble*. Rejiggering the wires made the problem go away. Not exactly a shining example of root cause analysis, I know.

At this point, it was time to try to wire the two halves of the keyboard together. I just needed to find a 13 wire cable.

Explanation of my keyboard matrix

13 wires, you ask?

Yes. 13 wires. On my wiring of the ErgoDox shells, I have 5 rows of up to 8 columns.

Keyboard-matrix

Normal keyboards are typically wired in something like a 6×18 matrix. Because the ErgoDox is a split layout, it's effectively wired as two separate mini-keyboards. The "real" ErgoDox design sticks an IO Expander on one of the hands' PCB so it can be connected to the other one by an 1/8 inch headphone-style cable. That's slightly more advanced than I'm capable of at this point, so I went for the hacky solution – just back-hauling the entire matrix from the left hand over to the right hand side where the Teensy lives.

There was just one small problem. Finding a 13 wire cable.

Trying to find a 13 conductor cable

An 8 connector cable is no problem. Easy to find. You can even go up a bit from there. But try as I might, I couldn't find a reasonable cable with enough wires for me. Then I hit upon an idea.

HDMI!

Big, thick, heavy HDMI cables. They have lots of pins, right? And lots of conductors inside. A quick check of wikipedia confirmed that there were enough wires inside for me. I briefly looked at adding HDMI ports to each side of the keyboard, but couldn't find female HDMI ports with suitable solderable headers. (They're generally fiddly little surface mount components designed to be placed and soldered by a machine, rather than a 30-something just learning basic soldering technique.)

So I pulled out my wire cutters and *snip*, I had a 13+ connector cable that I could solder to both sides of my keyboard.

In the end, I actually soldered the matrix on the left hand side of the keyboard directly to the formerly-HDMI cable. On the righthand side, I soldered each wire of the cable to a strand of the breadboard patch cable I bought from Adafruit. (The female ends on each strand of the patch cables comfortably seats one pin from the Teensy and means I don't have to mess around much when I realize I've screwed up and need to rewire things.)

I connected both halves of my keyboard to the Teensy and plugged the Teensy into my desktop machine. I hit some keys on the right hand. Everything looked fine. I hit some keys on the left side. And…nothing. Nothing at all.

All wires are not the same

It turns out that HDMI cables are made of twisted pairs of various gauges of wires. That fail for this application in exactly the same way as my own twisted rats' nest of cabling did.

In the end, I took some of the jumper wire I got from Adafruit and just used it as a ribbon cable. I tried chaining it, so I could have a 20" cable rather than an 8" cable, but things started misbehaving.

I threaded the jumper cable from the left hand to the right and got it connected to the Teensy. What I had at this point wasn't ideal, but it did work.

Time to put together the keyboard

It was time for final assembly. That sounded so nice. "final". Ha ha ha. No. At a guess, I ended up taking the keyboard shell apart and putting it back together about 20 times after this point.

So, I grabbed the back halves of the keyboard shell and carefully aligned them on top of the front halves. I grabbed some screws I had lying about and….they didn't fit. The screw heads were just a little bit too big to fit in the screw holes printed into the back shell of the ErgoDox.

In Part 1, I described the SLS (Selective Laser Sintering) process Shapeways used to 3D print my keyboard shell. What I ended up with is just white plastic — It's fairly easy to customize. In this case, I started my customization by picking up my Leatherman and starting to carve out the edges of the screw holes one at a time. This technique was good enough to get the right hand side of the keyboard fully put together. During my initial final assembly, I managed to over-tighten one of the screws causing the plastic on the bottom side of the case to snap, leaving me down one screw hole. Thankfully, Dox (and/or his co-conspirators) nicely over-provisioned the keyboard shell with screws. Being down one screw isn't a significant hardship.

I flipped the keyboard over and connected it up to my desktop and started testing each of the keys….and found that I had a few new key failures. I unscrewed all the screws I'd just managed to tighten and set to work with the multimeter and soldering iron. Mostly, it seems I managed to stress the solder joints connecting the column wires to the keyswitches. A little bit of work with the solder sucker and soldering iron and I was ready for reassembly. I managed to repeat this process a few times. I'm now…rather better at freehand solder joints than I was when I started this project. None of this would have been an issue with a PCB to mount my keyswitches in.

Now that the right hand was behaving, I was ready to screw the left side together. My screws still didn't fit in the holes I needed to sink them into.
The correct solution would have been to wait until the next morning and walk down to the hardware store and buy properly sized screws. As you can tell from what I've already written, I haven't exactly done everything…correctly.

Rather than whittle out the screw holes on the left side, I hit upon a technique that seemed to work for me, but is probably quite dangerous and prone to catastrophe. Kids, don't try this at home until and unless an expert weighs in and says I'm just being overly dramatic.

The shell of my keyboard is made from plastic. Sure, it's not injection-molded like most plastic you'll find in a commercial product, but it has most of the properties of regular plastic. I already described how it snaps when it's subjected to too much stress. It also melts when it gets hot. Perhaps you see where I'm going?

I carefully aligned the back shell of the left hand on top of the front shell. I picked up one of my slightly-too-big screws. I placed the screw in the hole I wanted to secure. It did not seat itself properly because the screw head had a larger diameter than the hole I intended it to fill. I turned the temperature of my soldering iron way up. (As I said in the previous paragraph: Kids, don't try this at home.) I rested the tip of the soldering iron on the screw I hoped to sink. I applied a small amount of pressure with the soldering iron. As it became warm, the screw began to sink into the plastic. As it became warm, the plastic began to emit a noxious odor. When the screw appeared to be properly seated, I removed the soldering iron. This seemed to work quite well and I used the same technique for the remainder of the screws.

I can't press the reset button

I think I mentioned earlier that the way one uploads new firmware to the Teensy is by tapping a little black reset button.

That button drops the Teensy into upload mode so you can blow new firmware into its tiny little brain. When you're using a Teensy on a breadboard, this is nice and easy. You can use a finger or a small screwdriver or a tweezer or just about anything to tap that little black button. When it's sealed away inside your keyboard, it's a little bit harder to press. I really, really, really didn't want to have to disassemble my keyboard every time I wanted to reprogram it. So I took advantage of one of the properties of plastic I've already written about. I did something that would probably get me kicked out of electronics class, especially if it's not done in a well ventilated area.

One should never plunge one's soldering iron into plastic. One should never then hold one's soldering iron inside a piece of plastic and slowly melt out a groove of plastic. When one is finished doing things one should never do, one should carefully clean one's soldering iron while it's still hot.

That completed, I could now easily tap the Teensy's reset button with the keyboard fully assembled.

Time to switch to the production firmware!

I carefully tapped each key on my keyboard. Finally, every key registered. Each key only registered once. I was ready to switch the Humble Hacker firmware from "matrix discovery mode" to keyboard mode. That way, rather than each key telling me its coordinates in the matrix, it would instead, you know, generate a keystroke. I'm told this is a desirable property in a keyboard.

Keys aren't registering. WTF?

I realize I should step back a bit and describe the firmware build environment, at least a little bit.

Getting the keyboard firmware built was fairly straightforward, though it did involve a bit of cobbling things together. The Humble Hacker firmware seemed to be the most flexible option for "new keyboard, new matrix" (as opposed to "upgrade an old keyboard"), though there were a number of other options available. At some point, the author broke apart a single "keyboard" repository into a set of repositories – "firmware", "hardware", "remapper" and "kspec". I actually had the most luck following the instructions from the "keyboard" repository which is marked as "DEAD".

In addition to the Humble Hacker source, I needed to install the Teensy Loader in order to blow firmware into the Teensy.

To build that firmware, I needed a crosscompiler toolchain. The last time I needed a cross-compiler toolchain, I had to commit unspeakable acts involving multiple bootstrapping builds of gcc, insane sets of shell scripts and a summoning grid. It was bad enough that I ended up just installing a compiler on a Nokia N800 and building things there.

Thankfully, things are easier these days.

I downloaded an installable cross-compiler toolchain. It took about 10 minutes. No lurking horrors needed to be placated with the offering of a child-to-be-born. No contracts in blood. No bootstrap compiler. Not even a shell script.

I recall a little bit of futzing around to try to get the kspec tool to build from the Humble Hacker repository. In the end I just used a prebuilt version.

So, back to the keyboard build-out.

I turned off the "matrix discovery mode" in the humble hacker firmware. I did the bare minimum I needed to get the "Q" key to print a "Q" on screen. I rebuilt the firmware, tapped the little black button on the Teensy with a screwdriver and flashed the new firmware.

Ready for glory, I tapped "Q" and…nothing.

I reflashed the firmware and tried again. Nothing.

I turned matrix discovery mode back on. Everything was great.

I reflashed the firmware and tried again. Nothing.

UTSL

I opened up the source to the Humble Hacker firmware and started reading code. Apparently, it's more common to wire your diodes on the columns, rather than the rows.

Oops.

At this point, I was pretty good at rewiring the keyboard. I was also pretty sick of rewiring the keyboard. But there was an easier way.

Lie to the firmware

Why yes, Mr. Firmware. My keyboard does have 10 columns and 14 rows. (Astute readers will note that doesn't jibe very well with my claim of an a 5×8 matrix on each hand. It turned out to be a little bit easier to give each hand 5×7 to itself and then to double up on one "row".)

Success.

My "Q" registered just fine.

I filled in more of the kspec matrix.

Keyboard:Doxy
Matrix:
/*  F4      F3      F7      F5      F6      D4      D3      D2      D1      D0                  */
/*  0       1       2       3       4       5       6       7       8       9                   */
Row:  EQUAL   TAB     CAPS    LSHIFT  BLQ     --      --      RALT    PGUP    PGDN      /*  0  C7 */
Row:  1       Q       A       Z       LBRKT   --      --      --      --      --        /*  1  C3 */
Row:  2       W       S       X       RBRKT   --      --      --      --      --        /*  2  C4 */
Row:  3       E       D       C       LFING1  --      --      --      --      --        /*  3  C6 */
Row:  4       R       F       V       LFING2  --      --      --      --      --        /*  4  C5 */
Row:  5       T       G       B       BKSP    --      --      --      --      --        /*  5  C1 */
Row:  HOME    LIDX2   LIDX3   LCTRL   DELETE  --      --      --      --      --        /*  6  C0 */
Row:  --      --      LORDER  LGRN2   LFUNC   --      --      --      --      --        /*  6  C2 */
Row:  --      --      --      --      --      RIDX1   RIDX2   RIDX3   RCTRL   ENTER     /*  7  B1 */
Row:  --      --      --      --      --      6       Y       H       N       SPACE     /*  8  B2 */
Row:  --      --      --      --      --      7       U       J       M       LARROW    /*  9  B4 */
Row:  --      --      --      --      --      8       I       K       COMMA   DARROW    /*  10 B3 */
Row:  --      --      --      --      --      9       O       L       PERIOD  UARROW    /*  11 B5 */
Row:  --      --      --      --      --      0       P       SEMI    SLASH   RARROW    /*  12 B7 */
Row:  --      --      --      --      --      MINUS   BSLASH  QUOTE   RSHIFT  INS       /*  13 B0 */
/*       0   1   2   3   4   5   6   7   8   9   */
ColPins:PF4 PF3 PF7 PF5 PF6 PD4 PD3 PD2 PD1 PD0
/*       0   1   2   3   4   5   6   7   8   9   10  11  12  13  14 */
RowPins:PC7 PC3 PC4 PC6 PC5 PC1 PC0 PC2 PB1 PB2 PB4 PB3 PB5 PB7 PB0

I filled in the matrix-to-keys table. I'll spare you the bulk of that table, but to give you the flavor of things, it looks like this:

  Key:Q Map:q_and_Q                                    tl:"Q"
Key:W Map:w_and_W                                    tl:"W"
Key:E Map:e_and_E                                    tl:"E"
Key:R Map:r_and_R                                    tl:"R"
Key:T Map:t_and_T                                    tl:"T"
Key:Y Map:y_and_Y                                    tl:"Y"

The Humble Hacker firmware has support for multiple (toggleable) keyboard layers. You can do just about anything you want. Native Dvorak keyboard? No problem. Native Colemak keyboard? Sure thing. Design your own. You can do that if you want. You can't reprogram the keyboard without installing a firmware update, but there's no reason you couldn't write firmware that could do that.

Keycaps I ordered from WASD

Knowing (hoping) that I would eventually have a keyboard I needed to type on, I had ordered a set of keycaps from WASD Keyboards earlier in the year. I'd ordered, basically, "one keyboard" of keys.

Keycap shapes

I set about placing the right keycaps on the right keys. Just click em in place, right? Not so much. If you look at most modern keyboards (other than laptop or ultra-thin keyboards), you'll see that the keys have a pleasing sculpted shape. Each row has its own shape.

The ErgoDox shape isn't exactly the same as your typical desktop keyboard. Nor does it have all the same keys. It needs a couple weird-shaped vertical keys and a whole slew of slightly-wider-than-normal keys. Once I got a full set of keys on the keyboard, it felt…weird. The shapes just didn't fit.

Now, where have I seen this layout before?

I hadn't payed incredibly close attention to the layout of the ErgoDox – It had some properties I really cared about (like keys aligned in columns and clusters of keys designed to be pressed with your thumbs). Past that, it was just the first thing that looked even vaguely plausible.

Once I actually thought about it, I realized where I'd seen a layout like that before. It was, in fact, glaringly obvious. I just hadn't realized how glaringly obvious it was.

The ErgoDox Keyboard

The Kinesis Contoured Keyboard

It just so happened that I had an old, dead Kinesis lying around. (Everybody does, right?) I harvested its keycaps and started pulling the keys I'd bought from WASD off of the ErgoDox. As I did so, I managed to yank one of the keyswitches up. After a small detour to the soldering station, I was back in business. (While I had the keyboard open, I locked down most of the keys by painting the edges of the keyswitches with superglue.)I was rather more careful as I pulled the remaining keycaps. I'd been using my fingers for the first few.

 

After the accident, I switched to a key-puller. Yep, there's a specialized tool for pulling keys off a keyboard. A basic key-puller looks like this:

 

That's what I started with. As I continued, I managed to dislodge another few keys, so I dug out a higher-end key-puller that WASD had sent me free with my keycap order:

Finally, the working keyboard

Thanksgiving

I spent Thanksgiving in northern Virginia with family. I'd brought along my new keyboard. TSA at Logan were….curious about my keyboard. And surprised I don't work at MIT. But totally comfortable with weird hardware with lots of bad solder joints.

Shortly after getting to Virginia, I noticed that my "A" key was frequently generating two "A" characters each time I tapped it. I wasn't 100% sure what was wrong, but based on past experience, I was willing to go with my gut. I would have been willing to bet money that it was a bad solder joint.

My father-in-law was quite accommodating and I soon found myself at the kitchen table warming up his soldering rig.

Five minutes later, I had an A key that generated only a single "A".

All told, It took me nearly 40 hours of work

How do I know how long this took, you ask? I spent a number of years in consulting and am careful to run a timer for everything I do so I can charge appropriately. No, wait. That's not it. I've never been much good at time accounting. I didn't think very hard about how long it was taking me to build my first keyboard. I didn't really want to think very hard about it. I sort of wish I didn't know how long it took. But I do.

Remember how, back in Part 1, I said that as I sat down for my first soldering experiment I started the pilot of Community on Hulu? Well, as I was futzing with the firmware, I ran out of Community to watch. That'd be 71 half-hour episodes. To have _something_ on as I was finishing up, I put on the pilot of Modern Family. I…did not enjoy that and will not be repeating the mistake.

So, do I like it?

Yes. It's not quite my ideal keyboard or keyboard layout and is different enough than everything I've ever spent time typing on that I'm still getting somewhat fatigued using it for more than a short period if time, but I'm getting better.

It's nicely portable. I quite like being able to fold it in half and tuck it away for transport.

I know how it works. A friend commented that this is one keyboard I'd hate to spill something into. Thinking about it, I realized that I'm actually less worried about something bad happening to this keyboard. I'm confident that, given minimal (and fairly ubiquitous) tools I could repair it without too much effort.

Where am I headed next?

I have…ideas for some novel keyboard designs that I'd like to try out. When I'm back from holiday travel, I'm going to start in on an original design. I'm not 100% sure what I'm going to build, but it might be something with a layout like this:

Building a Keyboard: Part 2

Building a Keyboard: Part 1

In early 2012, I ran across a fascinating project on the keyboard forums at geekhack.org. The ErgoDox is a project by some gifted hobbyists to build a split ergonomic keyboard inspired by the Key64 Project. The Key64, in turn, counts the µTron, TypeMatrix, Maltron and Kinesis keyboards among its influences. The right place to read up on the ErgoDox is probably this thread on deskthority.net, since ergodox.org is still fairly spartan.

As soon as I saw it, I signed up to buy an ErgoDox kit when the folks designing it were ready to start the group-buy process. Being somewhat mechanically disinclined (I'm a software guy), I said that I'd pay extra to have someone else solder it together for me. And then I waited. And waited. And waited. Don't get me wrong — It's a free, open-source project. My impatience is not a reason for someone else to work any faster. But I was excited.


Right away, I ordered roughly 80 Cherry "blue-stem" MX keyswitches and 1N4148 diodes from Digikey or Mouser. I don't recall which. Both are great vendors. (Generally, I find that I prefer keyboards with brown-stem Cherry keyswitches, but I was curious about the clickier-sounding blues. They're not bad, but from here on in, I'm back to brown-stem switches.)

I went out and bought a Weiler WES51 soldering iron. (Disclosure: That's an Amazon affiliate link. I earn money when you buy things through it.) At the same time, I picked up some solder, a pair of pliers, some de-soldering braid, a brass-wire sponge soldering iron cleaner and some helping hands.

I bought a pair of Teensy++ microcontrollers from PJRC. Initially, I opted for the ones with pins. I later regretted that. Still later, I unregretted it. The Teensy is a tiny little circuit board built around an 8bit Amtel AVR processor and a MiniUSB port. It has an Arduino compatibility mode, but I've only worked with it in its native personality. PJRC provides Mac, Linux and Windows versions of a tool to install new firmware onto the Teensy over USB. You just hit the "reset" button and the Teensy reboots into program mode.

Over the course of a week, everything showed up at my doorstep. I played a little bit with the soldering iron. I wired up four keyswitches to a breadboard, loaded the sample "USB Keyboard demo" firmware from PJRC's website onto the teensy and made letters show up on the screen. Neat! I then put everything on the shelf and didn't really touch it for months.

In September, I noticed that 3D designs for a prototype shell for the keyboard had shown up on ergodox.org. Designs for the PCBs were (intentionally) absent. For a variety of reasons, the project's creators didn't want to ship PCB designs before they were ready. Nonetheless, I downloaded the .stl files for the keyboard's shell and made my way over to Shapeways. I uploaded the .stl files and a few minutes later, Shapeways told me that if I chose their standard laser-sintered white plastic, I was looking at a cost of about $230. This was…slightly pricier than I'd expected. Because I wasn't actually sure that I was going to be able to do anything useful without those PCBs, I only ordered the top sides of the keyboards. I made a deal with myself: If I managed to wire up at least one side of the keyboard and get it to output characters, I'd buy the bottoms, too.

Still, the folks designing the ErgoDox (mostly Dox himself) hadn't released their PCB designs, though they'd done an initial run of prototype boards to validate their design. But I was impatient.

Two weeks later, I got a package in the mail from Shapeways containing the top halves of an ErgoDox shell. They were…dusty. (The way Shapeways' 3D printing tech of choice works is that they fire a laser mounted on a plotter into a big tub of plastic dust. It traces one (very, very thin) layer of your design in the plastic dust. Then platform holding the object being printed drops a tiny, tiny bit into the bin and the laser melts the next layer of dust onto your design.) I rinsed off the shells and started popping 70-odd keyswitches into 70-odd 4mm x 4mm holes. Then I put keycaps on top of the keyswitches. I had an incredibly high-quality non-working fake plastic keyboard!

It took another week or two, but I decided I wasn't going to wait for the ErgoDox team. I set up a soldering station at my desk, pulled out the right-hand side of the keyboard. Inspired by lowpoly's Apple M0110 Today, I decided I'd try to wire the keyboard freehand. That sounds fairly hardcore. It's not. (It's nowhere near as hardcore as designing a PCB.)

It turns out that Keyboards are really, really simple. A keyboard is just a matrix of keys. You wire up the rows to one set of analog lines on a microcontroller. You wire up the columns to another set. If your rows are A,B,C,D and E, your columns will be 1,2,3,4,5 and so on. Typically, "Esc" is in the upper left-hand corner of your keyboard. That'd be the A1 position in your matrix. When you tap Esc, the keyswitch momentarily connects the "A" IO to the "1" IO. On some keyboards, you'll find the "Tab" key. That's connected to B and to 1. The "1" key would be connected to A and to 2. The astute reader might now ask "So, what if I hit 1 and "Tab" at the same time. Is that going to generate a spurious "Esc"? Or maybe a "Q"? Yep. Well, it will if you've wired up your matrix without diodes. That's called "ghosting". I remember making my Apple //e ghost when I'd finally learned to type fast enough that I was sometimes hitting keys at almost the same time. Rather than attempt to explain how diodes let you build a matrix that doesn't ghost, I'll refer you to someone who actually understands how this works.

I got out my pliers and my diodes and my keyswitches. It was at this point that I realized that I didn't actually have any wire to wire my keyboard with. So, I did what any self-respecting geek would do. If it were 1985. I walked into a Radio Shack. Voluntarily. It turns out that behind the Beats By Dre®, displays full of Blackberries®, and low quality iPhone® accessories, they still sell some DIY supplies. I could have bought my diodes there. For only a few orders of magnitude more money than they're worth. They even sell Arduino kits now. I picked up a spool of copper wire and was on my way back home within a few minutes.

Once at home, I made a few startling discoveries. 1) I did not own wire cutters. 2) The wire I'd bought was way, way too stiff to work with very easily. As I was getting settled, I started up the pilot of Community on Hulu. (I'd never seen it.) and started wiring the diodes in series across the rows of keyswitches. It took a while, but I got all the keys on the right-hand wired up. After that, I started cutting tiny little lengths of wire and stripping the ends with a pair of nail clippers. I wired up all the columns of keys with tiny little hops of green wire. And horrible, horrible drippy solder joints.

I stuck the Teensy into a breadboard and wired up a couple rows and columns to a few of its IO pins. I grabbed the best, most flexible USB Keyboard driver I could find for the Teensy — The firmware for the Humble Hacker Keyboard. It's designed to support multiple "layers" of keys you can access by holding down modifiers. It's fully programmable. It's well commented. And it has a "matrix discovery" mode. You don't need to actually know what pins you've wired things up to. You just connect your rows and columns to the Teensy's various IO ports (The ports have letter+number identifiers like A1 and F6. Those aren't the same as the examples I used in the keyboard matrix earlier. Then you hit a key and it will print things like (A1,E2). Then you know that that key's row is connected to the A1 IO line and its column is connected to the E2 line.

At least, that's how it's supposed to work.

Once I got the Humble Hacker firmware installed on the Teensy, I was able to hit a key and have it register as a keypress. Sometimes. I started to triage what was going wrong. Many of my problems were just bad solder joints. As I repaired those, I started to notice that I was only able to generate keypress events for half the keyboard or so. I eventually figured out what I'd done wrong. I'd wired my diodes in series. They're supposed to be wired in parallel. If I actually understood anything about electronics, this would have been blisteringly obvious.

I desoldered everything, using copper braid to try to suck up my waste solder.

Then I started again. I wired up the diodes in parallel — Each key connected to one side of a diode and the other side of each diode bridged to its neighbors in the row. Rather than using little wires to hop from key to key on the columns, I stripped longer lengths of wire and bent it so that I could solder one length of wire to each key in a column. This proved much less fiddly to solder and much, much more robust.

Now the matrix barely worked at all. I'd managed to misidentify which direction the diodes should be connected in.(Diodes are directional)

So I undid everything and started again. I ordered a bunch more diodes. They're cheap and I was clearly not very good at this.

Keyboard-matrix

Eventually, I was able to get every single key on the right hand side to generate a keypress event. That was good enough for me to go ahead and order the bottom shells for the keyboard. I also ordered a bunch of very useful stuff from Adafruit. I bought some very nice tweezers, which made wiring up the diodes a lot easier. I bought proper wire strippers. I bought good pliers. I bought ribbon cable with breadboard-compatible pins on the end. And I bought a Solder Sucker. Best $5 I've spent in a long time. Rather than trying to sop up excess solder with copper braid, the Solder Sucker just…vacuums up the hot solder. I also bought a multimeter, which made finding wiring faults much easier. (I'd previously been using an LED soldered to a pair of wires and a battery. Not recommended.

I started in on the second half of the keyboard. The basic matrix wiring went much quicker. I still screwed it up and redid the entire matrix at least once. I was finally ready to wire the two halves of the keyboard together.

To be continued

Building a Keyboard: Part 1

Keyboards

I’ve been typing since 2rd grade or so, when my parents bought an Apple ][e. I started taking notes on a laptop in 8th grade. I tried to take a keyboarding class in 9th grade, since I’d never learned to type properly. Unfortunately, I typed well enough that I actually got kicked out of class.

These days, I spend a lot of my time writing software. When I’m not doing that, I spend my time making trouble on the Internet. To say that I spend much of my time at a keyboard would be somewhat of an understatement.

 

For many, many years, I was a happy user of the Microsoft Natural Elite keyboards. I say “keyboards” rather than “keyboard” because that particular model is…somewhat inexpensively constructed. It’s the only keyboard I’ve ever met with water-soluble traces. That is to say that getting even a small amount of moisture into it would result in permanent hardware failure. Its saving grace was that replacements were cheap. Particularly if you bought them in 5-packs. Attempting to find a reasonable link to Amazon, it appears that these keyboards may finally have been discontinued.

I was visiting family during the week between Christmas and the New Year – and ran across this post by Jeff Atwood on the Keyboard Cult. From there, I found my way to geekhack.org and eventually to deskthority.net.

Colemak

It turns out there’s a huge keyboard otaku subculture. People fetishize their favorite obscure keyboard or hyperoptimized key layout. I’d like to claim that I mined their FAQs for recommendations and went on my merry way. But I can’t. I got sucked in. I spent months learning about keyboards. In my bid for typing nirvana, I’ve amassed a fair collection of obscure keyboards. Some of them could easily be mistaken for “normal” keyboards but feature interesting keyswitches or some specialized bit of technology. A few of them are genuinely special.

 

 

Early this spring, I met a Taiwanese keyboard designer and got to play with his latest prototypes while sitting on the polished marble floor of Academica Sinica in Taipei. What I saw there was one of his designs, the VorTex “Pure” 60% keyboard. I’m typing this on a Pure I cajoled out of him shortly thereafter. The Pure uses brown-stemmed Cherry mechanical keyswitches. Unlike the keys on your laptop or a typical modern desktop keyboard, you don’t have to bottom out Cherry keyswitches. They have a subtle “bump” about 2/3 of the way down as you depress them. Once you’ve felt the bump, you can let go. The keys don’t feel as good as an IBM M-series keyboard, but they’re still so much nicer on my hands than most of what I’ve been typing on for the last several decades. The Pure is what’s known as a “60%” keyboard – It has full size keys, but is 60% of the width of a standard 104-key desktop keyboard. It doesn’t have a number pad or a separate section for arrow keys. (If you want arrow keys but no number pad, you’re looking for a “tenkeyless” or “TKL” keyboard.) The Pure, like the Happy Hacking, puts many of the keys you’d normally reach for on a second layer you access by holding down a function key. For example, the arrows live under the O/J/K/L keys.

Because many of today’s high-quality keyboards are targeted at the gamer market, they have a few features that I’d ordinarily pass on…but secretly enjoy. For example, my Pure has a mode where every single key is lit up with a purple LED backlight. The Pure is a damn fine keyboard. And Justin, its designer, is hard at work on what sounds to be an even nicer successor. But it’s not quite my ideal keyboard. Its layout is startlingly traditional and, like most keyboards, forces my hands to contort in a slightly unnatural way as I type.

Sometime in May or June, I hunted down a 20-year old IBM M-15 adjustable split keyboard. The M-15 is just like those big old IBM keyboards that sound like machine guns. Except it’s split down the middle — held together with a ball joint that lets you set the two halves at whatever angle you want. You can split it like a butterfly. You can tent the two halves. With a couple more turns of the knob, you can actually split the two halves and type with your hands in much more natural resting positions. It feels stellar to type on, but it’s loud. Loud enough that you can’t use one in public. It’s also heavier than my laptop. (Admittedly, I have a very light laptop.) It’s also nearly unobtainable – They only made it for two years in the mid-1990s and it wasn’t terribly popular. When it was new, you could buy one from IBM for $179. These days, the few used M15s that show up on eBay sell for between $400 and $900.

In September, I found myself on the 14th floor of a Tokyo office building paying rather a large amount of cash for an incredibly obscure µTron ergonomic keyboard. The µTron is the most lovingly designed keyboards I’ve ever seen. It uses the same Topre keyswitches as the famous Happy Hacking keyboard. Unlike the HHKB, it’s got a split “symmetric” staggered layout that’s much less harsh on your left hand than the keyboards you’re used to. It adds a few extra keys designed to be pressed with your thumbs. The thumb keys have sculpted edges — The keys you hit on the side have sculpted sides. The keys you hit from the bottom have gently sloping bottom edges. The keys you hit at an angle have a gentle slope originating _on a corner_. When I asked why the µTron is so hard to buy – Why it’s not really sold in stores or outside Japan – the answer I got back was a nice formulation of Catch-22: “Well, it’s very expensive because it’s not mass-produced, so not many people will buy it.”

I’ve skipped over the Kinesis, the Maltron, the Access-IS POS keyboard, the TypeMatrix (which, even before the Coding Horror blog post, primed me to start thinking about keyboards), the TrulyErgonomic, the KBT Race and the KBC Poker. Each is interesting in its own right and each has a story, but none are the story I’m trying to get to. Tune in next time for “How I came to find myself buying keyswitches and diodes in bulk, ordering 3D prints from ShapeWays and learning to solder freehand.”

Keyboards