Introduction: MIDI Controlled LED Structure
As a true music lover and an electronic and computer science student, I've always wanted to build MIDI devices, that I could use for electronic music creation.
After attending to a lot of shows and music festivals, I started to get really interested in light shows during performances.
After a lot of research, I've mostly only found devices that use microphone and could not allow to control LEDs exactly as you want.
By getting more and more familiar with DAW and MIDI signals, I decided to get start with this project!
It consists in a 3D structure with incoroporated LEDs, that are actually controlled by MIDI signals (NoteOn, NoteOff and CC Messages).
So that, the musician could control the color and the intensity of each LED, only by using MIDI signals, generated by any DAW.
With this idea, I wanted to enhance creativity through light shows and allow everyone to build his own, to make every visual performance unique.
Step 1: Materials
Basically, this project consists in two parts: a MIDI reception curecuit and the LED structure; and a microcontroller to link those parts and "translate" the MIDI signals coming from the DAW to the LED strips. Here is a list of the materials needed for each part.
MIDI reception circuit:
- 1 x 6N138 Optocoupler
- 1 x 1N914 Diode
- 1 x 5-Pin Din Jack (MIDI Jack)
- 2 x 220 Ohm Resistors
- 1 x 4.7K Ohm Resisor
- 1 USB/MIDI Jack
I used RGB LEDs strips based on WS2812B LEDs that can be controlled with only 1 digital port. If you plan to use a high number of LEDs, you may have to care about the maximum current needed (1 LED can consume at most 60mA). If the microcontroller cannot handle this maximum value, you will need another 5V power supply that can deliver enough current. I used a 5V - 8A AC/DC Adapter with the dedicated output adapter and a switch.
Note: It seems that you can use a computer power supply unit, as they're know for being able to deliver a really high current, but you'll have to make sure that it delivers a stable 5V DC voltage, maybe by using a 36 Ohm 5 Watt power resistor between the ground (black) and the 5V ouput (red) to make that there's enough current going through the resistor and thus provide a stable 5V.
Finally, I used a simple Arduino Uno with a screw shield to make the link between MIDI signals and LED strips.
Step 2: Building the MIDI Input Circuit
If you're interested in what is exactly the MIDI protocol and how it works, I higly recommand you to check the Notes and Volts YouTube channel where there is a lot of interesting and innovative tutorials and MIDI Arduino projects.
In this part, I will only focus on the MIDI Input Circuit. It may a good idea to build a prototype on a protoboard and check if MIDI signals coming from the DAW are well received by the microcontroller before getting into soldering the components.
The following two videos describe how to build and test the circuit:
Finally, it may also be a good idea to check this video to understand CC messages and how automation clips can be interpreted by your microcontroller to control LED brightness for example.
Step 3: Configuring FL Studio (optionnal)
As I feel comfortable using FL Studio, I will explain how to properlly configure its MIDI interface, but I am pretty sure this procedure shouldn't be drastically different if you're using another Digital Audio Workstation.
First you'll just have to plug the USB/MIDI jack to your computer. Usually, such devices come with an embedded firmware and are recognized as MIDI devices even they're unpleggud. Then open the "Settings" window (by pressing F10). If everything works properlly, you will notice some output MIDI devices in the output section. Select your device and make sure it is ON.
Then you'll have to define your port number and keep it in mind (0 for example). Just close this window (parameters are automatically saved) and then add a new channel: MIDI Out.
Then, the last thing you will have to do is to define the port of this new channel: make sure to chose the same port number you defined in the "Settings" section: by doing this, the MIDI messages coming from your channel are now linked to the MIDI output.
Now, when a note is played by the MIDI Out channel, a "NoteOn" message will be sent through the MIDI interface. In the same way, a "NoteOff" message will be sent when the note is released.
One other interesting feature, that come with the MIDI Out channel is the ability to control different parameters with potentiometers. By right-clicking on one of them and selecting "Configure...", you can make them sending CCMessages (a value going from 0 to 127) that will be used to control LEDs brightness: choose CC and then Accept.
Normally FL Studio is now ready to send data to your MIDI Interface! The next is to write the code to flash in the Arduino and adapt it to your LED structure.
Step 4: Connecting the LEDs
Connecting the LED strips is quite simple, since they just require +5V, GND and Data. However, as I planned to connect more than 20 of them, I decided to use several Arduino PWM pins and declare several instances of Adafruit_NeoPixel (in the coe) to avoid any kind of unintended delay.
The attached image also intend to explain how the electronics work:
- LEDs strips are directly powered by the power supply.
- A power switch is used to power the Arduino
- the MIDI input circuit is powered by the Arduino when turning on the switch
Step 5: Disigning the 3D Structure
So far, this part was the longest one as I was totally new with 3D-printing (and modelling). I wanted to design a structure that looked like a half exploded truncated icosahedron (yes, it took me some time to find the exact name of the shape).
Of course you're free to design your own model with the shape you want! I will not detail the modelling process but you will find the STL files if you want to design this structure.
The assembly of the different parts took some time, as I had to put one LED in each face and connecting all of them by soldering a large number of wires inside the core that is currently pretty messy!
Note: if you want to design a such structure, you will require 10 hexagonal pieces (about 3 hours each using a PP3DP UP mini printer) and 6 pentagonal pieces (2 hours).
Once there is one LED in each part, you will have to connect every 5V and GND terminals together and wire the several input and output terminals of each LED the way you them to be connected.
Finally, I used LED diffusive acrylic to cover each face and make them light consistently.
All that is left after that is the code, which reveals to be not that complicated!
Step 6: The Code
As I mentionned it in the previous part, the code reveals to be quite simple!
Actually, it only consists in one MIDI instance and several Adafruit_NeoPixel instances (as much as there are diffrerent strips).
Basically, once it is declared, the MIDI class works with kind of "interrupts": NoteOn, NoteOff and CCMessage. When the MIDI input cicruit transmits one of those specific signals to the Arduino, the associate subroutine is called. Then, all that the code is doing is turning on a specific LED on NoteOn signal, turning it down on the associate NoteOff signal, and update the brightness of a strip on CCMessage.
Also, I defined a simple function that gives the possibility to choose the color of the LEDs by reading the velocity coming with the NoteOn signal and every LED can then be either red, purple, blue, turquoise, green, yellow, orange or white, depending on the velocity value going from 0 to 127.
An important thing to notice is that you will have to disconnect the RX pin (coming from the MIDI input circuit) when uploading your sketch as the serial port (used during this process) is connected to that pin!
Step 7: What Now?
I am currently working on a custom enclosure to embed all the electronics and I am also thinking of a name for the structure! Please let me know if you enjoyed this projet, and I am working on different shows as I plan to update this instructable with more videos!
We have a be nice policy.
Please be positive and constructive.