Posted on 4 augustus 2011
Recently I was asked to develop a custom solution which allowed an artist to use a joystick input device in an installation with the electronics simulating a regular keyboard.
The artist in question was Prayas Abhinav, from India, to whom I got introduced through Eelco. The installation, a modified space invaders game, is called "Even war has its limits".
For the hardware, I found a nice joystick on Farnell which I ordered. It turned out a bit smaller than I had expected from the picture, but it's very cute and sturdy, so perfectly usable. For the buttons, I shouted out to the META mailinglist (since Farnell has thousands of different pushbuttons...), and Diederik was so kind to source me some arcade-style pushbuttons he had used for a project earlier. The Arduinos and prototype shields I got from the cute www.duinos.nl webshop.
As for the software of it all, it turned out that the Uno makes emulating a USB keyboard very, very simple. With this new Arduino board, the platform has gained a powerful new feature, namely that it can be programmed to mimic any USB device out there. The old FTDI chip got replaced by a programmable atmel chip which takes care of the USB handling. And thanks to Arduino being open source and all, a great library has been developed for this chip, LUFA, which is a full USB stack.
So after some Googling, I found this existing arduino keyboard driver, and modified the code to work with a more recent LUFA version. The result is, of course, on Github.
The actual Arduino program is there as well: reading from 5 inputs and sending key down / key up events to the computer through the special keyboard firmware.
« Previous artikel Next artikel »