Breaking Down The USB Keyboard Interface With Old-Fashioned Pen And Paper

What is better for gaming, old PS/2 style keyboards, or modern USB devices? [Ben Eater] sets out to answer this question, but along the way he ends up breaking down the entire USB keyboard interface.

It turns out that PS/2 and USB are very, very different. A PS/2 keyboard sends your keystroke every time you press a key, as long as it has power. A USB keyboard is more polite, it won’t send your keystrokes to the PC until it asks for them.

To help us make sense of USB’s more complicated transactions, [Ben] prints out the oscilloscope trace of a USB exchange between a PC and keyboard and deciphers it using just a pen and the USB specification. We were surprised to see that USB D+ and D- lines are not just a differential pair but also have more complicated signaling behavior. To investigate how USB handles multi-key rollover, [Ben] even borrowed a fancy oscilloscope that automatically decodes the USB data packets.

It turns out that newer isn’t always better—the cheap low-speed USB keyboard [Ben] tested is much slower than his trusty PS/2 model, and even a much nicer keyboard that uses the faster full-speed USB protocol is still only just about as fast as PS/2.

If you’d like to delve deeper into keyboard protocols, check out [Ben]’s guide to the PS/2 keyboard interface, complete with a breadboarded hardware decoder. If these keyboards have too many keys for your taste, you might consider this USB Morse code keyboard. Thanks to Peter Martin for the Tip!

Finally, Someone Has Found The Any Key


keyboard and any key device

“Where’s the any key?” Well, it’s right here. After running into trouble with the STM platform, [lukasz.iwaszkiewicz] went with the Texas Instrument C Series Launchpad to construct his “Any Key” HID device. He was able to make use of the TI TM4C123G LaunchPad’s extensive USB library which is laid out into four tiers – the very top tier being Device Class API. This gives the programmer the ability to implement simple devices with just a few lines of code. [lukasz.iwaszkiewicz] points out that ST does not have this option available.

The Any Key uses a host PC program that allows the user to enter keystrokes into a virtual keyboard. This information is then passed to the Any Key device. When it is pressed, it will push the recorded keystrokes back to the host PC. Simple, but effective!

The project is completely open source, and all files and code are available. Be sure to check out the video after the break demonstrating the Any Key in action.

Continue reading “Finally, Someone Has Found The Any Key”

DIY ‘PS3 Sixaxis’ Controller

[max] lets us know about this DIY ‘PS3 SIXAXIS’ style programmable controller. It’s a USB device that uses an accelerometer to provide an interactive human interface. They put one inside a model airplane and use it with a flight-sim. (I’d like to see them add some gyros to add some realistic resistance to the plane interface.)