Sei sulla pagina 1di 53

Music Reactive Multicolor LED Lights

by Saiyam
Vote!

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:

Object 1

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!
You can like my facebook page: Frozen Solenoid for more projects, updates and videos.
Let's Party!

Object 2

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:

Tools:

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

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:
1.
2.
3.
4.

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.
1.
2.
3.
4.
5.

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:
1.
2.
3.
4.
5.
6.

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>

Project_code.ino

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 :)

Object 3

Potrebbero piacerti anche