Tuesday, November 4, 2008

Arduino LED MIDI Controller

It's been a while since I've made a post so I have decided that it was about time I did. This time I'll be talking about my Haunted House I made.

I started with the idea to take a Halloween decoration (small haunted house) and add some LEDs to it and make them blink. What I ended up with was a haunted house with 6 LEDs in it all controlled by MIDI. I used an Arduino to receive MIDI signals from my computer and turn on/off LED lights based on those signals.

Check out the video...

The "MIDI to Arduino Breakout Board" as I call it in the video I designed myself. I used various resources on MIDI around the web and came up with this schematic.

Digikey Part list:

2 x DIN5 - CP-2350-ND
2 x 6N138 - 516-1600-5-ND
1 x diode - 1N914B-ND
2 x 220 ohm resistor
1 x 270 ohm resistor

As you can see it isn't very complicated. The hardest part was finding in DIN5 part numbers at Digikey. The code on the other hand was a bit more complicated. The trick was to decode the MIDI signals without any real debugging tools. The RX/TX ports on the Arduino are being used by the MIDI ports. I had to use blinky LED lights to do the debugging. After fumbling around with it for a while I was able to get it working. The code should easily be expendable to allow for more LED lights. I chose to use the PWM pins on the Arduino so I could adjust the brightness of the LEDs.

I tried to comment the code the best I could. Download it here. Keep in mind that you must disconnect the MIDI breakout board before you program your Arduino or it wont work.

Side Node:

Unfortunately MIDI is meant for instruments and not lights so I wasn't able to really do what I wanted to do. As a future project I would like to implement MIDI show control to allow for more light specific functions. I still have to find a freeware program that supports MIDI show control. I'll keep you posted.


Wayne said...

I've updated the video link to work again and also moved the code to GitHub in case anyone wants to improve it.

EnomYs said...

Hi, works fine but i have a problem. When I play single note from a midi keyboard the LEDS blink in the right way, but when a play a sequence from Logic Pro 9, the LEDS blink random with the same notes I played before on the keyboard. I tried to remove midi filter on Logic but the same... How can I do?

Wayne said...

Good question. I never had that issue when I had set it up. It could be that logic is sending some sort of MIDI command that isn't recognized by the code and causing some odd behavior. I'd been a while since I've looked at this but you could try to connect to the Arduino via a terminal and modify the code to output all the MIDI commands it is receiving.