The Sun type-3 keyboard

I am picky about computer keyboards.

I've used fairly few keyboards I actually like. The best one (ie, the one I like most) I've ever used is a Symbolics Lisp Machine keyboard; I don't know its model number or proper name, nor any other good way to describe it that distinguishes it from any other keyboards Symbolics might have made.

But the second best, and the one I use most, is the Sun type-3. This is a 95-key keyboard; the details are not really very relevant here, but the curious can (at least as of this writing) find photos, albeit slightly out-of-focus photos, of a type-3 (next to other computer stuff) here and here.

In my experience, the type-3 has been a real Timex of a keyboard: it takes a licking but keeps on ticking. I've had type-3s that didn't work well, because they sometimes develop mechanical issues that make it difficult for keys to slide smoothly (these manifest worst on the large keys, such as Shift and Control). But I've never had one actually stop working entirely.

Until a few weeks ago. I was typing along and the keyboard abruptly stopped sending the host anything—right in the middle of a word, I think, even. Further investigation indicated that it was probably a failure of the electronics in the keyboard.

So I took it apart. (I've done this before, out of curiosity, but not often, because I don't like to risk damaging a good keyboard.) There's the keyboard proper, with two ribbon-ish cables (plastic substrates with thin printed conductive layers) running to sockets on a PCB. The PCB contains one `big chip' (a 40-pin DIP part), three small common logic chips (two 74LS145 and one 7406), and assorted other parts (resistors, capacitors, a four-winding RF choke, a beeper, a switch bank in a DIP form factor, etc). It's also a single-layer PCB, effectively. (It might have been made as a double-sided PCB, but only one side is used other than as a ground plane, even to the extent of having some 15 or so wire jumpers to carry signals across etch runs.) This makes it easy to trace the circuit.

It's straightforward. The `big chip' drives the '145s with six signals (the '145 is a decimal decoder/driver; the two low bits are common, with each chip getting its own two high bits). The '145 outputs drive 20 lines on one of the ribbon-ish cables; the other cable has 8 lines, which have pullups and then go directly back to the `big chip'. (The 7406 is used on the other side of the big chip, to clean up signals to/from the host.)

Since I had nothing to lose from playing with this keyboard, I started hacking around with it. Unplugging the cables from the PCB and taking an ohmmeter to them, I found at least a few keys still worked from that point of view. I then cut a few etch runs and snipped a few wire jumpers to isolate the '145s from the rest of the board.

I then soldered in wires running to a solderless breadboard and put together my own scanning hardware. I leveraged the existing '145s on the theory they were probably OK (which they were) and I'd rather run six wires to the breadboard than twenty.

I now have a 555 generating a clock, a 74HCT4017 turning that into a multi-phase clock (I'm using only two phases at present, but wanted to have plenty available), one phase driving a 74LS190 counting in BCD, half a 7474 maintaining a one-bit counter with the overflow from the '190, and a 74LS32 turning the counter-plus-one-bit into the patterns appropriate to feed to the keyboard PCB's '145s. Then, on the output side, I have a 74LS133 checking for any of the 8 lines going low (I positioned my etch run cuts so as to leave the pullup resistors in circuit on the keyboard's PCB); this is ANDed (74LS08) with another clock phase to clock a 74LS373 latch to latch the six bits being output to the keyboard. There's then a 7404 converting the '373 outputs from active-high to active-low, which then drive six LEDs-and-resistors directly. There are also 8 LEDs wired to light when the lines from the keyboard go active.

The upshot of all this is that I can press a key and the six LEDs give me a code indicating which of the 20 driving matrix lines the key is on, with one of the 8 LEDs flickering (at the scan frequency) to indicate which of the driven matrix lines it is on. (If multiple keys are down, the six LEDs aren't very useful, but for sussing out the keyboard matrix that doesn't matter.) A little experimenting and I've worked out the keyswitch matrix.

Unfortunately, it also turns out Sun cheaped out and skipped the diodes in series with the keyswitches. This means that whenever you have three keys down that form three corners of a rectangle in the matrix, it's impossible to tell whether the key at the fourth corner is down. For example, if L1, L2, and L3 are down it's impossible to tell whether L4 is also down, because the relevant two driving and two driven matrix lines are all shorted together.

I'm not sure where I'm going to go with this. Here's the keyboard matrix I worked out (which I hope your UA renders in a fixed-width font, or it's going to look horrible, and I'm not up to trying to figure out HTML tables at the moment):

    |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8
----+-----+-----+-----+-----+-----+-----+-----+-----
10  |     |     |     |     |LShft|     |     |
11  |     |     |     |     |Ctrl |     |     |
12  | F1  | Esc | Tab |  A  |  Z  | R13 | R14 | R15
13  | F2  | 1!  |  Q  |  S  |  X  | R10 | R11 | R12
14  | F3  | 2@  |  W  |  D  |  C  | R7  | R8  | R9
----+-----+-----+-----+-----+-----+-----+-----+-----
15  | 3#  |  E  |  F  |  V  |Space| R4  | R5  | R6
16  | 4$  |  R  |  G  |  B  |LnFd | R1  | R2  | R3
17  |     |     |     |     |Caps |     |     |
18  | L2  | L4  | L6  | L8  | L10 |     |     |
19  | L1  | L3  | L5  | L7  | L9  |     |     |
----+-----+-----+-----+-----+-----+-----+-----+-----
20  | F4  | 5%  |  T  |  H  |  N  | Del | Ret | /?
21  | F5  | 6^  |  Y  |  J  |  M  | ]}  | '"  | .>
22  | 7&  |  U  |  K  |  L  | ;:  | `~  | [{  | ,<
23  | F6  | 8*  |  I  |  O  |  P  |BkSp | F9  | \|
24  | F7  | F8  | 9(  | 0)  | -_  |     |     | +=
----+-----+-----+-----+-----+-----+-----+-----+-----
25  |     |     |     |     |RShft|     |     |
26  |     |     |     |     |Right|     |     |
27  |     |     |     |     |     |     |     |
28  |     |     |     |     |Altnt|     |     |
29  |     |     |     |     |Left |     |     |

Some of the key labels are abbreviated, but if you look at the table with a type-3 at hand, it should be fairly easy to figure out what's what.

Sun was not entirely stupid, by any stretch. For example, some keys, keys commonly used as modifiers (both Shifts, Control, Caps, Left, Right, and Alternate), are the only keys on their rows and thus can always be sensed accurately regardless of what else might be down.

There is a lot of space in the grid. Indeed, one of the 20 driving matrix lines is completely unused.

I own a tube of MC68HC908QY4s which I would like to use to build a replacement scan-and-encode board. But after moving repeatedly over the last few years I no longer know where that tube of chips is. The circuit I sketched above was built from the parts it was because those were what I had on hand, ie, what I could find quickly.

I'd like to add diodes to the keyswitches, to get true N-key rollover out of the silly thing. But it is difficult to get the keyboard far enough apart to do that without completely wrecking it. I might risk it if I ever have a type-3 that's too badly damaged to use even this way, but, so far, that's off the table.

So, since I've got plenty of working type-3s, this will probably remain a curiosity unless/until I find my tube of MC68HC908QY4s (I will be looking for it). But it's been fun to work out the keyboard matrix, and it's satisfying my desire (building over the last year-plus) for digital electronics hackery.

I have an IRC acquaintance who apparently has some experience doing one-off keyboards. I may see if I can get a better (for some suitable value of `better') keyboard by that route. There isn't much to improve on the type-3, for my taste, though; add full N-key rollover and maybe another bank of function keys and that's about all I want that I'm likely to be able to afford. (If money were no object, I'd put small displays on the keycaps, rather than physical legends. But I'd be surprised if a keyboard capable of that came in under a grand, and two or three strikes me as more likely. And, while in a sense I may have a couple grand, I don't have it for something as relatively frivolous as such a keyboard.)

Main