3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Hacking a USB Keyboard

Step 3A note on pin layouts and shift registers

A note on pin layouts and shift registers
«
  • lookup.jpg
  • lookup_m.jpg
  • lookup_i.jpg
Basically a keyboard is a specialized shift register. It takes in a lot of inputs and sends out one output to the computer (that being a an ASCII code or control command).

When a switch is closed, the shift register processes which two pins are connected and interprets it as one particular output.

So, if you had ten pins going to each plastic sheet, then you would have one-hundred possible combinations. This is because every single pin on one sheet can be comined with every single pin on the other side. This would produce ten rows of ten possible combinations. In other words, you have just produced a "10 X 10" 2-dimensional array.

For instance, if you connect "Pin 4" on SIDE A and "Pin 6" on SIDE B you will produce the letter "M" on the computer (see picture).

If you connect "Pin 8" on SIDE A and "Pin 7" on SIDE B you will produce the letter "I" on the computer (see picture).

It's really quite simple.
« Previous StepDownload PDFView All StepsNext Step »
9 comments
Oct 29, 2011. 2:07 PMcspoelstra says:
Thanx man, I was wondering for a wile to make such a thing as a cheap replacement for a midi controller for my DJ setup.. How about the switches you can use, is there an resistance problem ?
May 12, 2011. 8:33 PMsmoak says:
I'm trying to put this into a custom controller. Simply using 12 keys, random if need be. Which side is side A and which is side B. My guess is that the top layer is side A and bottom later is side B. Would I be right to assume this? I'm hoping it would save me the trouble of having to trace, I have terrible eyes.
Apr 4, 2011. 9:11 PMdimitrisa10 says:
what will happen if you connect three pins will it display 2 characters because i'm making a hand-top out of a pico itx board and im wondering if i can use this to make a thumb keyboard
Apr 7, 2011. 8:23 PMdimitrisa10 says:
thx for the info do you think it would work though for a tiny keyboard
Jan 5, 2011. 6:01 PMcurrently_awake says:
keyboards send two scan codes for each key hit. One for each key press, a second for the key release. (the second has a bit set to mark it as a release). All the keys on the keyboard work this way, even shift and control.
Jul 22, 2009. 12:10 PMmrsayao says:
is it safe to assume the shift keys work the same way? I'm trying to incorporate this into a typewriter to text file project... shift is held down for special characters, then key is pressed. I have to take a look at the keys on the typewriter, but I assume mapping the special characters (like punctuation) are the same right?
Aug 17, 2008. 8:46 AMjochem says:
Do you have any idea what will (generally) happen when you connect two pins that aren't normally connectible? Will the keyboard send a different control code to the PC, or will it just do nothing?

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
2344
Followers
200
Author:randofo(Randy Sarafan loves you!)
I am the Technology Editor here at Instructables. I am also the author of the books 'Simple Bots,' and '62 Projects to Make with a Dead Computer'. Subscribing to me = fun and excitement!