I was talking recently with my nephew, an undergraduate in the Computer Engineering department at Ohio State, and someone who generally likes to build stuff. He mentioned how he’d always wanted to do one of those choreographed Christmas light displays but couldn’t imagine the amount of work involved. I started to explain that all one needs is a bunch of MIDI controlled switches and some MIDI sequencing software, and quickly realized that he understood MIDI only in terms of general MIDI synths and cheesy sounding music.
This realization was reinforced several weeks later when I spoke to the Ohio State Open Source Club. As part of that talk, I rigged up a simple microcontroller (Cypress PSoC) with a MIDI input, a hobby servo with a long wand and an LED at the end. (It was a big lecture hall and I needed something that could be seen from the back of the room.) I programmed the microcontroller to assign a MIDI note to the LED and a MIDI controller to the servo. Pretty basic stuff.
During the talk, I opened up Cakewalk Sonar and loaded music into an audio track, armed a MIDI track, hit record, and then proceeded to make the wand wave and the LED blink in time to the music by turning a knob and playing a key on my little M-Audio Oxygen8 keyboard. Stop, rewind, play… and you’d have thought that I pulled a rabbit out of a hat.
So, with apologies to those who already know this, here’s a brief review.

Simple MIDI input for the Arduino
MIDI is a physical serial communications specification and a byte-oriented message protocol. That’s it. The physical component is a 20mA current loop, one for each direction, with 8-bit asynchronous data transfers at 31.250kbaud, easily implemented with a UART. The message protocol was originally designed to support real-time music performance data from input devices (keyboards, wind controllers, etc) to output devices that produce musical sounds. Most MIDI messages are 3 bytes in length, consisting of an address and command byte, a note or controller number and a data byte. There are exceptions and ways to handle bulk data transfers, but it’s all very well documented.
The key point is that MIDI, specifically the serial communications specification, has become an industry standard, supported by all manner of useful hardware and software. Furthermore, there’s nothing to prevent you from taking advantage of all this useful hardware and software by using MIDI for things other than intended, i.e. other than musical sounds.
Case in point: Years ago at Walt Disney Imagineering we were experimenting with air-launched fireworks, and built a series of microprocessor controlled roman candle guns. We added MIDI input capability to the guns and were thus able to very quickly create a compelling show using off-the-shelf MIDI software to fire the guns in time to a recorded music track.
Here are 4 reasons why MIDI is so useful in embedded control projects:
1) MIDI is easy to implement on a microcontroller
MIDI is asynchronous serial data, 8-bit, 1-start bit, 1-stop bit, no-parity at 31.25kbaud. Most microcontrollers have a built-in serial transmitter, receiver or UART that can do this, and usually the only challenge is programming the correct baud rate. The 20mA current loop input can be implement using 2 resistors, a diode and a 6N138 optoisolator. The output can be any logic output pin that can handle 20mA, sometimes buffered, sometime not.
I plan to do an article in the near future on how to easily add MIDI I/O to an Arduino.
2) MIDI is easy to get into and out of a PC
Let’s face it. Once you build something, you’ll probably want to be able to talk to it with a computer. MIDI interfaces that plug into a USB port are cheap, and class-compliant interfaces require no drivers for the Mac OS or Windows. Once installed, there’s a standard API for sending and receiving MIDI comments, so programming your own communications, if you’re into that sort of thing, is a snap.
3) There are a ton of creative products that produce MIDI
The list is simply too long to provide here, but suffice to say that browsing the web or going to Guitar Center will reveal all manner of products whose sole purpose is to convert input controllers to MIDI data, which can be used to control your MIDI enabled device. Imagine using a guitar to control all those LEDs…
4) There’s lots of software to record, manipulate and play back MIDI
Want a way to easily communicate with your device without writing any code? MIDI-OX lets you type in outgoing MIDI messages and display incoming MIDI messages. Want to record control information for your device, perhaps in time to music or audio? Pretty much any MIDI sequencer or DAW (digital audio workstation) software will do that out of the box. Want to create your own control application? Max will let you do that and more.
Nuff said for now. Hopefully, I’ve provided some evidence that MIDI is way more than bad-sounding banjo sounds. Let me know if you have some cool non-standard way to leverage MIDI that I didn’t mention.