Skip to main content

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.

Comments

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?
thanks
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.
StayStayLetGo said…
Is there an updated video link?
Wayne said…
Something must have changed. I have updated the link to the video.
StayStayLetGo said…
Thanks for the quick response. I'm having issues understanding what pins my midi signal in is effecting on the OUT side of things. That is to say, I see the board receiving midi, but my LED isn't firing. Any suggestions?
Wayne said…
In the schematic the RX would be MIDI IN, the TX pin would be MIDI OUT.

In the Demo I used a USB to MIDI converter in which I had the MIDI IN plugged into the port labeled MIDI OUT on the DX7 keyboard. The MIDI OUT from the USB to MIDI converter went into the MIDI IN (RX pin) on my MIDI breakout board. The USB end of course was plugged into my laptop. I used Logic Express to record the MIDI signals from the DX7 and play them back to the arduino through the MIDI breakout board. I suppose I should produce a wiring diagram which would simplify the whole thing.
StayStayLetGo said…
Ahh gotcha. See I had used portions of your code some years ago to just nail down the MIDI IN but it was for a direct action of C3 turning a single LED on. In reality it was just triggering a relay which was effectively "stomping" a guitar pedal. But now I can't figure out which pins I was triggering by looking at the code. Or I'm seeing it an just not understanding what I'm seeing. Whomp Whomp.

For context:
The original project mysteriously vanished when I renovated my house last month so now I'm scrambling to put it back together.
Wayne said…
Wow that's an awesome idea. I never thought of using it to control stomp boxes and the like. Seems like a perfect use case for this. You'll just need to figure out which Arduino PIN you want to use for C3. Based on my code it looks like it might be PIN 11 on the arduino but you can configure that here: https://github.com/prock-fife/midi_led_controller/blob/master/midi_led.pde#L25

The first element in that array should be 'C'.
Wayne said…
Just thinking about some other cool things you could do... you could re-wire your stomp boxes and use digital POTs to control volume/gain/whatever using MIDI. Just throwing an idea out there.. https://www.arduino.cc/en/Tutorial/DigitalPotentiometer

Popular posts from this blog

Ardunio and the SHT15

For my ongoing thermostat project I require some sort of temperature and humidity sensor. Because I'm fairly new to all this I decided to get a 2 in 1 sensor from Robotshop called the SHT15. I went with the SHT15 because it had both a temperature and humidity sensor and uses a "digital 2-wire" interface. When I first purchased it I didn't realize that "digital 2-wire" didn't mean I2C, but that's another story.

In order to get the sensor to communicate with the Arduino I needed to write some custom code that manipulates the data and clock lines by pulling them high and low at the correct times. I haven't had any experience doing this before so it was a learning experience for me.

Connecting the SHT15 to the Arduino is pretty simple. The data and sck lines each goto a digital input/output on the Arduino and the VCC goes to +5V. Pretty simple. Here is a picture of my breadboard.



As you can see I had to solder on some breadboard wires onto th…

First Ardunio Program

I have finally received my Arduino and have been able to write a few simple programs for it. For my thermostat program I am interested in being able to read several analog sensors (temperature and humidity). I also need to be able to poll specific sensor values from the computer using the serial interface so I can log their values in 5 minute intervals. I don't have all the electronic components yet to build my thermostat so I wanted to write up some test sketches. I based my sketches on a todbot blog entry that I found very useful.

I was originally going to use the C code that todbot wrote to test communication with the Arduino but I soon realized the limitations. What I ended up doing is using "screen" to open a terminal connection to the serial port so I could send and receive data to/from the Arduino. In the future I will have to write a daemon that will run on my linux box that will constantly poll the Arduino for data but thats another story. For now screen …