Capacitive Sensing And Old IBM Keyboards

The pen is mightier than the sword, but the IBM Model M keyboard, properly applied, can knock teeth in. There are a few more IBM keyboards even better suited to blunt force trauma – the extremely vintage beam spring keyboards made for terminals and desktop publishers. Being so very old, there’s no easy way to connect these keyboards to a modern system, so when [xwhatsit] wanted to make his work, he needed to build his own controller.

The beam spring keyboards use capacitive switches, and with 122 keys, the usual method of reading capacitance – putting a capacitor in an oscillator – would be far too slow to be of any use in a keyboard. There is another method of reading capacitance: measuring the current going through the capacitive switch. This can easily be accomplished with an LM339 comparator.

[xwhatsit]’s keyboard controller uses this capacitive sensing circuit to read the four rows of keys, with a few shift registers taking care of the columns. An ATMega32u2 is the brains of the outfit, running LUFA to translate the key presses to USB.

If you’re lucky enough to have one of these ancient keyboards, [xwhatsit] is selling a few over on the usual mechanical keyboard forums. There’s also a controller for the Model F keyboard using the same basic circuit. If you need one just drop him a line or grab the gerbers and roll your own.

12 thoughts on “Capacitive Sensing And Old IBM Keyboards

  1. Would this work with similar keyboards such as ones from old 520’s?
    I have one here someplace, seems a shame to waste it.

    Also relevant, this same circuit can be used to read an array of thermally sensitive (ie 1N4148) diodes for biometric sensing.
    Applications include monitoring athletes for “hot spots” suggesting muscle strain.

    1. What’s a 520? All I can find is really modern stuff with that model number, certainly not Model F buckling springs or beamsprings. If you mean 5250, then yes; I don’t think you even need my controller, you can just use Soarer’s converter if you want to make life easier for yourself.

  2. Why not just get one of the early PC/AT keyboards with this type of tech, then use an AT to PS/2 adapter, plugged into a PS/2 to USB adapter? It works and it’s all off the shelf parts.

    I’d like to see if one of these keyboards could withstand a shotgun blast. The bottom plate is steel and there’s two or three layers of steel plate inside.

    It’s easy to find which keys will have problems simply by listening. Any that don’t have a sharp click and a twang won’t work. The spring isn’t snapping the plastic flap down just right. If cleaning and flipping the spring end for end and/or rotating it 180 degrees doesn’t restore correct action the spring has to be replaced. Easy enough if you have 2 or more keyboards.

    Other than the springs getting weak there’s not much that can go wrong.

    1. For the Model Fs, you’re right, you can get a PC-AT (which I have) or use Soarer’s converter (linked to in article). But the beamsprings (which is pictured up top) predate any of that; there was never a AT or even XT protocol version, they were all used on minicomputer terminals etc.

      Plus—hate to have to say this—this is Hackaday, you really have to ask *why*? :P

      1. Right. I’m typing this on a model M right now, it’s an easy off-the-shelf adaptation, and quite a nice feeling keyboard. However, in the old days, I spent many hours at an IBM 3278 terminal, which used a beam spring keyboard similar to the one shown in this article.

        The beam spring keyboard was even heavier and more solid than the venerable model M, and had an even nicer feel, IMO. The exposed surfaces were all metal, and a bit cold to the touch. It had a flip-open tray with instructions, which were interesting to read while you were waiting for a program to compile. The beam spring keyboard was also quieter than a model M (unless the clicker was turned on, which would happen automatically as a feedback cue when the terminal was unable to accept input).

        While the model M is good enough for me, I do appreciate and admire this hack, and can understand why one would be motivated to attempt it. Bravo!

  3. Just how big of a capacitance are we talking about here? Surely the cited 150µs would be far more than enough?
    The linked patent says 0.4pF→4pF, so measuring charge time through a 1kΩ resistor should take 400ns vs. 4µs, give or take?
    Not that an excuse to use a partially analog solution here isn’t fun…

    1. I found the charge-time method really variable, experimentally I had to take many samples before I could get a reliable result. It makes sense, as a microcontroller input isn’t really a proper comparator or schmitt trigger, so the low-to-high point is not terribly precise. So to do it in a handful of charge cycles (remember there’s 23 columns, and you have to drain the capacitors each time before the next charge cycle), you’d want to use something like a comparator, and then you’ve basically got the same circuit anyway except you need a resistor on each column.

      Perhaps I was doing something wrong, but I found it a bit finicky, so I read IBMs patents and copied their methods and found the result to be pretty repeatable.

  4. “There is another method of reading capacitance: measuring the current going through the capacitive switch.”

    This is also why you could eavesdrop keyboards wirelessly.

    Passing an AC signal through a variable capacitor is essentially a rudimentary form of amplitude modulation, and with signal leakage and variation in the capacitance values of individual keys, you could determine from the resulting waveform which key was pressed.

Leave a Reply to rue_mohrCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.