Introduction: Music Reactive Multicolor LED Lights
Light up your new year parties and impress all your friends with these amazing music reactive multicolor LED lights that response and change their colors on every loud beat. These lights are nothing but simple RGB LED strips connected to arduino - the brain of this project. LED strips mean that you can mount them anywhere in your home and even outdoors. The main purpose of this project was to use it in parties but you can also use it for daily purpose for making your music more interesting! Whether you mount in on your entrance door, around your sofa, your LED TV, on your computer desk or walls, that's up to you. The uses of this thing are endless! The only condition is that you have to have an audio output device near your lights to feed them with audio signals which can be processed and reacted upon.
As told above, this project uses an arduino for taking the audio input, processing it and then giving an output through it's digital pins to the LED strip controller circuit which then drives the strips. It uses a 12v power supply to power both the strip and arduino. An advantage of this project is that it doesn't 'waste' any audio jacks. It has an input jack which sends the input signal to arduino and an output jack to send the same signal to your speakers or earphones. The entire project can be completed within 2 hours (or 3 hours maximum) and requires just one of the basic parts that can be found easily. I assure that you will be really surprised on watching the final result of the project (it looks much better in real than in the images).
Here is a short video of the project in action:
You are free to ask any question related to this project in the comment section below. Please vote for in the 'Make It Glow' and 'Arduino All The Things' Contests if you like the concept and presentation. Do follow me for more cool projects!
Let's Party!
Subscribe to my YouTube channel here:
Step 1: How It Works?
Before starting with the project, I have added this step to give you a better understanding of the working of this project. This helps you to learn some awesome stuff which lacks when you just copy everything up without knowing the actual working.
As explained in the introduction, the LED strip connected to the project glow and changes it's color whenever arduino detects a loud beat of music. Audio signals are very weak as compared to electronic current so the audio input wire from an audio output device (such as an Mp3 player) is connected to arduino's analog input pin which can detect even very weak electrical signals. Now as you play a music track, whenever there is a loud beat of high amplitude, the arduino detects it as the audio signal goes higher than a set threshold.
On detecting such kind of a change, it changes the LED color to any random one. However, it must be noted that arduino doesn't drive the LED strip directly. It rather sends signals to an external transistor circuit which drives the strip. The reason for this is that the output voltage of Arduino's digital pins is 5v while LED strips require 12v to operate.
Step 2: Parts and Tools
The following parts and tools are required to make this project. The total cost of the entire project was $30 or 1800INR which may vary with the store you buy the parts from. The length of your LED strip that you will need depends on your requirements.
Parts:
- 1x Arduino nano OR uno (Or any other arduino compatible board)
- 1x RGB LED strip (Length as per your choice)
- 3x NPN power transistors (TIP 31C, TIP122 or any other compatible)
- 2x 3.5mm female audio jacks
- 3x 1K resistors
- 2x AUX cables (For connecting the device to an audio output)
- 1x 12v power supply (Can be a battery or an adapter)
- Male headers
- Wire
- A suitable enclosure
- Perforated board
Tools:
- Soldering iron
- Soldering wire
- Hot glue gun w/glue sticks
- Rotatory tool
- Wire cutter/stripper
- Pliers
Step 3: Prep Your Enclosure
The very first step is to prepare your enclosure so as to mount all your components in place. But before that, you must select the type of enclosure and it's dimensions. The simplest way is to use a plastic kitchen ware box or a tupperware container as plastic is quite easy to work with. I wouldn't recommend a metal enclosure as you would need to insulate it entirely with still a risk of short circuits.
Now for the holes to make, use a simple drill or multi purpose rotatory tool with drill bit. You need to make a total of four holes- one for power supply wires, one for RGB LED strip which should be big while two for audio output and input jacks. Please wear safety equipment before working with power tools. You can also use a heated knife or paper cutter.
Step 4: Solder the RGB Strip Controller Circuit
Now an important step, here you have to solder a circuit that will control the RGB LED strip through the signals received by arduino. The need for such a circuit here is that since the output voltage of arduino's digital pins in just 5v while LED strips require atleast 12v to operate. To provide them power, the circuit consists of three power transistors that receive a low power signal from arduino and amplify that signal which is enough to power the strips. There is one transistor for each of the three colors- Red, Green and Blue.
For soldering the circuit, refer to the schematic given above. Please note that you need to solder male headers with four pins for RGB LED strip and the same for connecting it to arduino. Solder two more of them for supply 12 to arduino. Lastly, solder a screw terminal to connect the power supply to the circuit board. Using male headers and screw terminals is optional but is a much better option that directly soldering everything to the circuit. It makes connecting all the components easily through jumper cables.
Step 5: Make a Shield for Arduino
The next step is to make a shield for arduino which is helpful in connecting all the components easily although making it is optional. For UNO users, they won't need this type of shield. The main objective while making it was that it helps you to make any required changes in the pin connections at any time very easily against directly soldering all the wires where you will have to de-solder everything in order to make any changes. This also makes uploading codes to arduino by simply plugging it out from the shield.
You can make your own shield by looking at the image above. It basically consists of some female headers in which the arduino is plugged in and male headers corresponding to each pin on arduino. You may also need to solder some more headers for GND and 5v pins as there are the ones that are mostly used. The best part now is that you can use the same shield for even other projects by simply unplugging all the jumper wires.
Step 6: Connect the Circuit to Arduino
After your shield is ready and your circuit is soldered, now it's time to connect both of them together. First, plug in your arduino to the shield to that the pin labels can be identified. Now using some female jumper wires, connect it to arduino as per the following:
- Emitter pins of all the transistors to Gnd pin on Arduino.
- Base pin of Transistor 1 to Digital pin 09 on Arduino through a 1K resistor.
- Base pin of Transistor 2 to Digital pin 10 on Arduino through a 1K resistor.
- Base pin of Transistor 3 to Digital pin 11 on Arduino through a 1K resistor.
Then finally, glue the circuit as well as the arduino along with shield inside the enclosure.
Step 7: Add the Audio Input/Output Jacks
For taking audio input from an audio device to which the strip will react, there has to be a jack for it. I chose to add an audio output jack as well that will prevent you from wasting a jack from the source. The input jack has to be connected to the audio output such as an Mp3 player while the audio output has to be connected to an earphone or a speaker. Adding the first one is compulsory while the second one is optional. Please note that there are two audio outputs for any audio device- one is left while other is right. Here, only one of the two will be used to input the audio signals through arduino but in the audio output jack, both of them are connected. For making things simple, you can follow the text below or the schematic.
- Sleeve of Jack 1 (Input) to Sleeve of Jack 2 (Output).
- Ring of Jack 1 to Ring of Jack 2.
- Tip of Jack 1 to Tip of Jack 2.
- Sleeve of Jack 1 to Gnd pin of Arduino.
- Ring of Jack 1 to Analog pin 0 of Arduino.
After making all the connections, fasten both the jacks onto the holes in the enclosure that were made earlier.
Step 8: Add Power to the Project
Although this is an easy step, it can be difficult for you if you don't have a proper 12v power supply. Before selecting your choice, you should consider the life of that supply (i.e. how long would it last) and whether it can supply the proper amount of current to arduino as well as LED strip or not. The best and the cheapest option is to use a 12v/2A adapter. Please note that a 1A adapter may not work properly if you are using a lengthy LED strip as it draws a lot of current.
You can extend the wire of your power supply if you want. Connect both the positive and negative wires to the controller circuit (the screw terminals). Now for arduino, you can use the same power supply as Arduino UNO and nano (NOT pro-mini) already have an in-built voltage regulator to convert 12 volts to 5 volts. Using some jumper cables, connect Positive wire from the power supply to Arduino Vcc while the Negative one to Arduino Gnd.
Step 9: Connect the RGB LED Strip to Circuit
All you have to do in this step is to connect the RGB LED strip to it's respective socket in the controller circuit. Make sure that you have connected it in the correct way. Before connecting, cut your strip to the required length and solder wires on the copper pads present at the back of the strip.
If you want, you can extend the wire if you wish to mount the strip away from the controller and other circuitry.
Step 10: Upload the Code
Connect your arduino to a PC and upload the code given below through Arduino IDE. Under Tools>Boards, select arduino nano and under Tools>Serial Port, select your correct COM port number of your arduino. If you look at the code, it is very easy to understand. The basic steps that occur are:
- The arduino checks if the audio signal goes higher than a set threshold.
- If no, it moves ahead and keeps on checking until the condition becomes true.
- If yes, it creates a random number between 1 to 6.
- Depending upon the number, it sets the LED strip of a particular color.
- After waiting for 10ms, it moves further.
- In this way, whenever the audio signal goes high, the color of LED strip changes to a random one.
You can change the threshold value under if() condition as per your requirements and can change the pin numbers remembering that all of them must be PWM pins.
<p>/*<br>Music Reactive Color Changing Lights Source code Made by- Saiyam Agrawal */ int threshold = 20;</p><p>void setup() { pinMode(9, OUTPUT); // set all the pins as output pinMode(10, OUTPUT); pinMode(11, OUTPUT); }</p><p>void loop() { // enter the loop if(analogRead(A0) > threshold) // check if audio signal goes above threshold { int a = random(1, 6); // store a random number if(a == 1) // glow red { digitalWrite(9, HIGH); digitalWrite(10, LOW); digitalWrite(11, LOW); } if(a == 2) // glow green { digitalWrite(9, 0); digitalWrite(10, 1); digitalWrite(11, 0); } if(a == 3) // glow orange { analogWrite(9, random(100, 255)); analogWrite(10, random(100, 255)); digitalWrite(11, 0); } if(a == 4) // glow cyan { digitalWrite(9, 0); analogWrite(10, random(100, 255)); analogWrite(11, random(100, 255)); } if(a == 5) // glow purple { analogWrite(9, random(100, 255)); digitalWrite(10, 0); analogWrite(11, random(100, 255)); } if(a == 6) // glow blue { digitalWrite(9, 0); digitalWrite(10, 0); digitalWrite(11, 1); } delay(20); // wait for 20ms } else digitalWrite(9, LOW); // if audio signal is less than 20, set all the pins low digitalWrite(10, LOW); digitalWrite(11, LOW); // again reach the top and start }</p>
Attachments
Step 11: The End - Connecting and Using It
So you're done making your own music reactive color changing lights! Now you just have to connect it to an audio device, play some good music and watch the lights glowing in the dark changing their colors with every beat.Your friends would surely be jealous with such a cool thing! Since these are LED strips, you can mount them almost anywhere by peeling off the 3M tape at the back. So whether you use it as a sofa light or an ambient light on your TV, this thing will spread it's awesomeness everywhere.
For setting up the device, you'll need two AUX cables. Connect one end of the first cable to any audio output device (Ipod, Mp3 player, Mobile phone, Tablet, TV etc.) and the other end to your device's audio input jack. Now connect the output jack (of the project) to any sort of speakers or earphones which is optional. Now switch it on and play some music. If it doesn't light up, raise the volume. If it lights up but keeps on flickering or is very sensitive, lower the volume.
This marks the end of this instructable. Hope you liked it. Please vote for the project and share if you think it was awesome. Don't forget to follow for more cool projects!
You can even like my facebook page: Frozen Solenoid
Thanks for watching :)

Participated in the
Make It Glow! Contest

Participated in the
Arduino All The Things! Contest
40 Comments
Question 2 years ago
Can this be done with a usb powered string light?
3 years ago on Step 10
does it also work with amplifiers ?😥🤔
4 years ago
I have problem with this setup, everytime I connect the 3.5mm aux to the computer I am getting random buzz from the extrenal speaker and the led strip blinks itself with that buzz without any music. As per your instruction tried to put volume to ZERO, no luck. Need help with this.
4 years ago
if you're getting an error when compiling the codes just add comment on it(see attached picture) But anyway,thank you Saiyam for posting this! it helped me a lot!! :)
7 years ago
How about using this with neopixel?
7 years ago
Alright, so before we get to eventually burn an arduino could someone elaborate a bit on opamp and how to properly offset the voltage here? I'd like to build this but honestly it's been quite a long time absence from hobby-ing and this one dusty Uno I'd like to keep alive.
Thank you
7 years ago
WARNING! audio is an ac voltage swinging from -2.5 to +2.5V Arduino only measures 0 to 5V on it's analogue input YOU ABSOLUTELY MUST OFFSET THE THE AUDIO VOLTAGE or you will burn out your arduino!
You can use a simple voltage divider to achieve this. it's also wise to use an OPAMP voltage follower to protect arduino from spikes above and below 0 to 5V.
Reply 7 years ago
which resistors values do i have to use, if i would use a simple voltage divider to offset the audio voltage? without using an OPAMP. Thanks!
Reply 7 years ago
I used 100k for both r1 and i also used 47nF capacitor in parallel from the middle to ground and 10uf capacitor (polarised) in series from the center v out
Reply 7 years ago
I used 100k for both r1 and i also used 47nF capacitor in parallel from the middle to ground and 10uf capacitor (polarised) in series from the center v out
Reply 7 years ago
couldn't you use a diode to protect the input dropping to negative?
Reply 7 years ago
Using diode is probably worth trying, but please note that it would introduce a distortion to what you measure. An "ideal diode" will just cut negative half of signal, but real diodes are opening only on voltage about 0.6V. So you will cut off low values as well as the negative half. And also real diodes are non linear so it will introduce some distortion.
Reply 7 years ago
The problem is that the ADC. is not designed to handle negative voltage. a negative voltage across the ADC will caus a fault wich will render that pin usless! you could possibly use a diode arrangment to block the negative voltage effectively clipping the lower half of the signal. however a simple voltage divider with resistors could be used to offset the voltage. you can also SAFELY use an OPAMP in a voltage follower arrangement. check out the arduino forums and you will find the correct way to connect an audio signal without frying your arduino.
Reply 7 years ago
Could you post a diagram? Thanks
Reply 7 years ago
Check out this Instructable. he explains very well the issue and has a good circuit. note that the OPAMP he uses is in an amplifying configuration....
https://www.instructables.com/id/Arduino-Audio-Input
the following configuration is for a voltage follower...... configur you OPAMP like this
Reply 7 years ago
Thanks for you your help - I'll get an OPAMP.
Reply 7 years ago
?No problems. don't forget to check out the arduino.cc forum ?
Reply 7 years ago
Maybe you are correct but I have mentioned to use this device always on volume level less than the maximum value. The input values when printed on the serial monitor were going to 250/1023 max. even when the volume was full. Otherwise, they were in simple 10's and 20's so I don't think that would be a problem. If using an amplifier output, it can be dangerous but it shouldn't be in case of earphone jack output.
Reply 7 years ago
it is not the amplitude (volume level) that is the problem, but the basic nature of audio signals. Pins on a microcontroller are designed to work between 0 and 5 volts. the audio signal you are seeing at 250 on the ADC means that the pin is being exposed to -1.25 to 1.25 or greater when there are spikes like drum beats and such. the pins on a microcontroller are NOT designed to EVER see negative voltages, and it can cause irreparable damage to the chip. a headphone jack is more than capable of providing enough power to blow a pin, I've done it accidentally more than once.
7 years ago
Ok. I love this. Im making a few ajustments to allow the lights to hold a solid color and let them cycle. Im having trouble seeing how you soldered the micro controller. If you could explain a bit better. I think i got it from the schematic and the picture but im unsure. If you could carify this that would be great