Virtual USB Keyboard

Communicating with a host computer can allow a simple Arduino-based system to gain access to a wide variety of devices and information. Most people link an Arduino to a host using serial communications across a USB connection with custom code running on the host to send information to the Arduino or receive it in return, but giving your Arduino the ability to pretend to be a keyboard or mouse opens up a whole world of possibilities because it means your Arduino can interact with software that was never intended for external control. That could be desktop software such as a game or a web browser: your Arduino could "type" into a web form and submit it on your behalf, or act as a custom controller for a game!

Or you could use an Arduino to connect a custom input device to your computer so that it emulates a regular keyboard or joystick. The custom input device could be a chording keyboard, a virtual keyboard, or even something like a virtual reality glove or head tracking system controlling your pointer by emulating a joystick.

Parts Required

Qty Description
1 Arduino Duemilanove, Arduino Pro, Seeeduino, or equivalent
1 Prototyping shield
1 PCB-mount female USB "B" connector
1 USB A-to-B cable (commonly used as a printer cable and for Arduino)
2 3.6V Zener diodes (must be rated at 0.5W or less, 1W won't work)
1 2K2 resistor
1%: red-red-black-brown-brown
5%: red-red-red-gold
2 68R resistors
1%: blue-gray-black-gold-brown
5%: blue-gray-black-gold
4 SPST (single pole, single throw) pushbuttons (optional)

Virtual USB Keyboard Schematic

Source Code

github.com/practicalarduino/VirtualUsbKeyboard

www.arduino.cc/playground/Main/PS2Keyboard

Resources

code.rancidbacon.com/ProjectLogArduinoUSB (NOTE: currently offline, use link below in the meantime)

code.google.com/p/vusb-for-arduino/

Kit Suppliers

Toys Down Under: toysdownunder.com/arduino-virtual-usb-keyboard-kit.html

Errata

No corrections reported yet for this project. If you find one please let us know.

Gallery

Have you built this project or something inspired by it? Please let us know and we'll put a picture of it here!

Erdem's "Google Reader" Keyboard

Erdem Yildirimer has extended the Virtual USB Keyboard project out to 9 keys, added hardware de-bounce, and fitted it all into a Sparkfun cardboard packing box for the ultimate in geek style. Learn more at his blog (in Turkish, but Google Translate does a passable job of converting to English) at http://freeduino.gen.tr/2010/01/googlereader-klavyesi/