How can I squeeze two USB ports into the smallest arduino space possible?

Geeks are frequently jumping from one computer to another at work - it's part of what we do. Unfortunately, there's a small band of us at work who are Dvorak users. (We don't have our keyboards laid out in the usual QWERTY fashion. QWERTY for me is ',.pyf )

It's a pain in the ass to move to someone else's machine for an hour - I either have to remap their keyboard in the OS, bring my own keyboard, or try to remember how QWERTY works, which usually involves a hunt-and-peck nightmare.

So I need to build a device that I can carry in a pocket. When I get to someone else's machine, I'd plug the keyboard into the arduino and the arduino into their computer. Running on USB power, the arduino would translate qwerty keystrokes to Dvorak. This means that I need to be a USB host and provide a USB host. What's the most compact way of achieving this? I started by looking for USB keylogger DIYs, but most were PS/2 keyboard types or turned out to be simple keyboard emulators that played back a stream of keystrokes. None implemented the two-USB socket design.

I'm guessing that the arduino is not capable of implementing USB, wired directly to its IO pins, though I'll probably wire a keyboard to an arduino tonight just to see what I can read.


There are PS/2 keyboard examples for the Arduino.

I vaguely recall that, when USB was first introduced, it was possible to buy PS/2 to USB converters. If that's true, I suspect that the converters could now be found for pennies.

Why not use a USB host chip? It should actually be pretty simple, you should be able to transparently pass the descriptors and requests back and forth, while intercepting the data on endpoint 3, manipulate it, and pass it on.

I describe a way to do this with an Uno and a USB host shield here: Arduino USB keyboard passthrough. The Uno's atmega8u2 chip is reprogrammed to be a USB HID keyboard so when you plug it into a PC it behaves like a keyboard (see the other posts on my blog for details).