Foot pedals

From Trammell Hudson's Projects

I've recently switched to a standing desk from Geek Desk and wanted to be able to free my hands for more important things, like drinking coffee. The foot pedals are a cast off Behringer FCB1010 MIDI foot controller, which outputs events as MIDI messages. To make it work with any computer without requiring additional software, I wrote a combination MIDI to USB HID mouse and keyboard converter that runs on a Teensy 2.0.

The Teensy translates the pedal events into various mouse or keyboard events (Escape to return to command mode in vi, Shift-Insert to paste the X11 cut buffer, mouse wheel events for the pedals, etc). Full source is available to build your own and configure your own mappings. Read on for some details on the hardware interface.

The right way to interface with MIDI is using an opto-coupler to convert the current loop into TTL, but that would require additional hardware. As a quick hack I used a 220 Ohm resistor on the signaling line and tied the grounds together. Since the ATMega32u4 has a hardware UART, I configured it to read the 31250 N81 MIDI signal.

Since the device is pretending to be both a mouse and a keyboard, the sample code from pjrc needed quite a few hacks to implement both USB endpoints. I've been slowly reworking this code to use structs rather than arrays of bytes for the descriptors to make it easier to read; this device is a hacked up version of my USB Morse code keyboard.

If you were interested in learning how to make USB input devices with the ATMegas, we had a USB HID class at NYC Resistor in the Fall of 2012. Maybe we'll have another one.