Teensy HID Midi Controller

Background

Until recently, I had used an Arduino to output readings from potentiometers over serial USB, convert it to MIDI in Pure Data and then send it to Ableton Live. This convoluted setup has one clear drawback: you always have to have PD running to convert the serial to MIDI. I wanted something that wouldn’t rely on any other software; not least because it becomes increasingly difficult to configure MIDI settings in PD once you’ve had some Dutch courage prior to your set.

In order to simplify things, I set out to make a class compliant HID midi controller. A simple, and cheap, way I found was to use the Teensy microcontroller. What’s even better is that you can also you use the Arduino IDE to build and upload sketches using the Teensyduino add-on.

I recently got a Teensy microcontroller as part of a Build Brighton group buy. It can be purchased directly from the manufacturer but those living in Europe might find it cheaper to purchase from Floris.

Hardware

Connecting potentiometers to the Teensy is fairly easy and they have a great tutorial on their website. Simply connect your potentiometers to +5v, ground and to the Teensy’s analog inputs (A0, A1, A2, A3, A4 & A5).

Software

Use the tutorial here to get up to speed with how to use the Teensy. It provides details on how to upload sketches, install the Teensyduino add-on etc. Now, back to business, make sure you’ve selected MIDI from Tools > USB. This will allow your device to be recognised as an HID device, without requiring any other drivers. Neat, huh? Now, upload the sketch below.

The sketch above was written for my controller, which has six potentiometers. So, if you’ve got four, three or eight pots, you’ll have to change the code slightly to reflect this. Check the comments in the code, it isn’t really hard to do; unless you’ve got more pots than analog pins. Then things become more complicated. If this sounds like you, try investigating something called multiplexing.

Conclusion

You should now have a class compliant HID MIDI controller that wont require any additional drivers, software, etc. Go forth and twiddle some knobs.