Skip to content

Using an Atari 800 XL as a USB Keyboard

by pixelpracht on Februar 1st, 2015

I’m writing these lines on an old Atari 800 XL. Or rather, it looks like one from the outside. But everything beneath the surface has been removed and replaced by a stamp-sized 20$ microcontroller that – plugged into a PC – pretends successfully to be a USB keyboard.


I don’t even remember what got me into mechanical keyboards. Maybe the news that Notch wrote Minecraft on a IBM Model M? It’s not the first time I heard that particular keyboard being mentioned and finally I gave in and bought one for myself. I wasn’t aware how much of a difference the choice of keyboard makes. In hindsight that’s just ignorant – now that I’ve typed on decent keyboards I’ll never be content with typing on a mushy OEM device again. The Model M, however? It feels great, but a little too heavy and loud for everyday use. I’m typing on much lighter Cherry MX Reds now. But it will always remain the keyboard that introduced me to the world of mechanical keyboards and it was the reason why – some rainy day last fall – I was browsing a local flee market for used keyboards.

I had no luck with that, but I found an Atari 800XL for 20€ that was in great external condition and I figured I could try to turn it into a keyboard instead.

At home I opened it and found the keyboard to employ some kind of circuit printed on thin transparent plastic sheets which was directly plugged into a connector on the main board.


It wasn’t too hard to figure out how this worked. The plastic sheet is folded so that the circuit traces would touch in various places were it not for an extra seperator sheet in the middle, seperating the top and bottom half. This seperating sheet has a small hole underneath each key.


If you press the key a spring presses a small part of the top sheet down on the bottom sheet. Now with each key press a unique pair of pins at the connector get to conduct electricity. To find out if a specific key is pressed apply current to one of it’s associated pins and probe the other if the current can flow freely.

Now you just have to figure out the pair of pins for each key on the keyboard. Luckily I found the Atari 800 XL’s keyboard matrix documented online.



Because I couldn’t find an identical connector to purchase online I figured I could just desolder it from the PCB. Well, turns out I couldn’t. To get it free you probably need to heat up all 20-something pins at the same time which I couldn’t figure out how to do with the simple soldering iron I had. So I bought a fretsaw and once I had the connector removed from the board without any desoldering (*cough*) I got rid of the PCB piece by piece!


I bought a Teensy 2.0 microcontroller, soldered a bunch of pinheaders to it…


…and a complementary bunch of pinheaders to the connector I hijacked from the PCB. Then connected both with a ribbon cable. Atar800xl_04

From now on it was basically a coding job. The Teensy is well documented with good tutorials to get started and there’s also a plugin for the popular Arduino IDE. All you have to do is to apply some voltage to a pin and check all other pins if there’s some measurable current. Then you know what keys are currently pressed and you can communicate the changed state via the handy Keyboard API.

It still took me a while to come up with a program that would allow me to map all buttons correctly because the keyboard layout is far from standard. And I still haven’t figured out what the button in the lower right corner is supposed to mean!

But after a few evenings I got it all working. Here’s the full code of the “firmware”.

The only major hurdle was that right from the start there was a short circuit. The keyboard behaved like the Escape key was being pressed all the time. But by carfully seperating the foil with the circuits and cleaning it in that area that problem was quickly resolved.

The bad news is that now that I got it working I know that it isn’t exactly what I went to the flea market for: a nice mechanical keyboard fit for every day use. I’ll never get used to that layout. And while the caps are beautiful and sturdy typing feels a little weird on it. So it’s a typical Pixelpracht project: fun but totally useless. ;)

From → Hardware Hacking

  1. Chris permalink

    This is a great article. I have a spare 800XL I’d like to try this with, but I’m not sure how the ground for each key is connected in this setup. I see that you have the ground pin connected, is there a specific pin on the 800XL ribbon that is a common ground?

  2. Chris permalink

    Excellent article! Thank you.

    I have a 600XL, into which I am replacing the mobo with a Raspberry Pi Model B (running RetroPi). I am intending to convert the keyboard to work with the Pi, thus your article is of great interest. I have a few questions:

    The Teensy (2.0) appears to have enough inputs to satisfy the 23 lines from the keyboard. Is this true? It appears that between the keyboard and the POKEY in the 600XL are a couple of multiplexer ICs. I’d like to avoid additional circuitry if possible. The keyboard also appears to send its lines through some resistors prior to the multiplexer ICs. Are you interfacing directly with the Teensy? Because you’re only showing the top side of the board, I didn’t see initially that you are interfacing to the other digital inputs.

    I’ve recently seen an article on reprogramming a stock Arduino to be a USB HID keyboard and while that looks interesting, I’m back to the issue of not having enough digital inputs and thus, having to use additional multiplexer circuitry.

    Thanks in advance. I plan to detail all the conversion steps, as I’ve discovered many people would like to do similarly!


    • pixelpracht permalink

      Yes, I interface directly with the teensy. That’s why I bought the 2.0 version. ;)

  3. Hello! I wonder if you might take a look at this and tell me what I may be doing wrong. I’ve been unable to get your code to compile.

    Thanks in advance!


    • pixelpracht permalink

      I installed the official Arduino version (I used 1.0.5) and then ran the Teensyduino installer ( that adds files to the Arduino IDE so you can build and run sketches on Teensy.

      If you try to compile the code and it says “KEY_PAUSE” was not declared in this scope make sure you go to Tools -> Board and select Teensy 2.0.

      Hope this helps!

  4. Thank you. Since my last comment, I reinstalled the Arduino IDE and Teensy extensions. I had been using the Arduino IDE install from the Ubuntu repository and apparently, the Teensy code will only correctly install into the Arduino IDE if it is the code obtained from the Arduino site itself. So now I see the Teensy 2.0 option.

    I will perhaps this week pick up where I left off and see what happens.

    Thanks again!


  5. nobox permalink

    I have a few comments to your code. You are setting the rows of the keyboard matrix which you are not scanning to Output / High (In line 129) , its better to use INPUT_PULLUP for that. Otherwise you wont be able to detect Shift AND Control pressed.

    The statement in line 127 should be before line 125, otherwise you are detcting the modifier keys to late (with the next keypress).

    line 159 should be: > if(state == LOW) setKey(0, modifier); <

    And your pin map is bigger then your are using. If you do size_a=9 and with different pinmap order and key_codes table, one could use option, start, select and reset keys to (as function keys, for example)

    I would map the Invers key to Modifier_Alt, not Gui. Gui is the same like CTRL ESC.

    And pin 8 must set constant to low for the LED.

  6. nobox permalink

    ok the form got a prob with braces

    Line 159-162 should be:

    if(state == LOW)
    setKey(keyCode, modifier);
    setKey(0, modifier);

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS