Mapping the Innards of a Keyboard




Introduction: Mapping the Innards of a Keyboard

About: I make things.


This is an instructable about how to map the innards of a keyboard. More specifically, we're going to try to find which contacts connect with each other to create each unique keypress. For those less versed in how keyboard's internals work, the next step will be a quick explanation, with some links for further reading. If you already know how membrane keyboards work, feel free to skip it.

I'm not sure why you'd want to do this, but my reason was just to have the option of using the mapping data in a future project - and I wanted to break open an old keyboard I had lying around. You may be able to use this mapping and the circuit board to make your own game controller or similar interface, though it would likely be much easier to do it some other way.

Step 1: Keyboard Internals Details

Most keyboards these days are membrane keyboards. They're cheap and easy to mass produce, and chances are you're using one right now.

Membrane keyboards work by using a matrix of open switches. Each time you press a key, it depresses a small rubber dome. When this dome is squished, it presses down on the membrane. Each spot with a key has this dome, and likewise the membrane has a small gap inside. As seen in the first image, there's a few layers to the membrane. When the key is pressed, the top layer and the bottom layer get pushed together, closing the switch. When the keyboard sees these two contacts have touched, it knows that key was pressed.

Here are some links for further reading - and if you have any questions, feel free to leave a comment.

Section 3 of this article:

This one is talking about keyboard ghosting, which is closely related to this. We can see later how the designers of my keyboard set the keyboard up to prevent ghosting.

Step 2: Disassemble Your Keyboard

First a word of warning. DO NOT do this with the keyboard you use for your computer. You will very likely not be able to put it back together. That said, not all keyboards cooperate with this project, although most models should allow some variant. If you're having issues, leave a comment with some detailed pictures of your keyboard and I'll see if I can help you out. Lastly, if you've only got an expensive keyboard, go get a cheap one to play with, and don't use it for this instructable unless it's already broken.

Back to the fun bit.

First, remove all the screws from the back of the keyboard, then carefully take the back off. Often, the little rubber caps will be loose inside the case (held in place by pressure), so make sure they don't escape. Next, free up the membrane. With most cheap keyboards, this is just a few thin pieces of plastic. Don't try to remove it, just make sure you can lift it up. If you can't easily do this your model of keyboard may not work, but feel free to keep reading.

Step 3: Mark the Pins

I separated my pins by which layer of the membrane they were attached to, along with which grouping they were part of. The top layer was Y and Z, and the bottom layer was A and B. I used this notation to keep track of which pins went to which keys.

Step 4: Mark the Membrane

After marking the pins, use the top of the keyboard to mark where each key pressed on the membrane. You should be able to use the top part of the keyboard with the key caps as a sort of pattern to see which contact matches which key. I wrote with a pen on the clear plastic - it's barely visible in the picture. If there's multiple contacts that look like they go to the same key, look for a small amount of wear around the contacts. The one that matches up with the key should have worn down a bit, while the others should be untouched (unless they go to other keys).

Step 5: Trace the Traces

Now is the hard/time consuming part. It took me around 2 hours to trace all the paths. Before you start, set up a table like the one in the second picture. It's a bit messy, but the general idea is there. Each column was a different top pin, and each row was a different bottom pin.

Keen eyes may have seen that I used a series of dots and dashes on each trace (the lines). Each trace had its own unique set of dashes and dots. Every few centimeters, I marked this series. This helped tremendously with keeping up with which traces are which when there's 8 in parallel. There are some more examples of my traces in the other pictures.

On the left side, I marked which keys were on the trace for which pin, along with my unique dash/dot set. As you can see in the image, B, G, V, F, R, T, 4, and 5 (not actually marked here, I missed it the first time around) were all attached to the first B pin, B1. The left arrow, up arrow, end button, and home button were attached to B2, and so on.

Once done with the bottom pins, I started tracing the top pins. When I found a key on that trace, I marked it in the corresponding cell.

Step 6: Clean Up Your Notes!

Once all the traces have been traced, and all keys have been keyed, transcribe them to a nice neat piece of graph paper. This will help you see more clearly which keys match with which combo of pins.

Step 7: All Done!

You're done! You've now successfully mapped your keyboard! All that's left is to find something to do with your newfound knowledge. Maybe make your own game controller. Use it as an interface for an arduino. If you're feeling really ambitious, make a gaming glove like the peregrine

Have fun!

Be the First to Share


    • Mason Jar Speed Challenge

      Mason Jar Speed Challenge
    • Bikes Challenge

      Bikes Challenge
    • Remix Contest

      Remix Contest

    7 Discussions


    4 years ago

    I used this for my arcade machine, so that I can control it much easier. It helps to play the PC games on the arcade machine without any extra key changing software


    6 years ago on Step 7

    I scan the plastic sheets with the traces, then just use a fill bucket in photoshop to color each differently then overlay a picture of the key layout. makes tracking the buttons much easier.


    Reply 6 years ago on Step 7

    I had considered doing it that way, but my sheets were fuses together at the center. It's definitely easier to do it like that though.


    Reply 4 years ago

    Yeah I kinda had the same problem when i did mine so what I did was un-fuse them with a knife.


    Reply 6 years ago on Introduction

    That scanner trick works well with entire circuit boards too -- A4 flatbed scanner, scan both sides of the board as straight and flat as you can at 1200dpi, import both into something like GIMP/Photoshop, mirror flip the tracks side (easiest) to match the component side (normal way round), and line them up on two layers. Now you can see both sides of the board at a keystroke, and track trace by eye. I use the hand-draw tools to plot my way along tracks as I pick up each component leg, painting the tracks to bright green on a 3rd layer! You can see where you've missed bits, no problem. You can zoom in fantastically close at 1200 dpi to trace very fine tracks.


    4 years ago

    see now we've got the rule of fives i've done this before and what i did was i used a continuity tester on the pin outputs on the clear part and depressed the keys it worked pretty well just depress the particular key you want and search for the only two pins that connect easy I used it here if your interested