Introduction: Sound Reactive LED Strip

THERE MAY BE 9 STEPS BUT I PROMISE THIS ONE IS QUICK AND EASY! 

In this Instructable I will be showing you how to create a light reactive LED system. In this clip, I used a single color LED strip, but you you can use a single LED, multiple LEDs wired together, single color or RGB LED strip, it just depends on what you are trying to build. The set up is fairly simple, the component list is fairly basic so if you are a tinkerer you should already have the majority of the materials laying around. If not, I will post links to the components I used so you can order parts and get to work! 

In the following link you will see the entire setup. Obviously you may arrange it anyway you would like, I just kept everything close and compact for the sake of an easy video. 


Step 1: Components

For this project you will need the following:


1) LED  ~$20 (with shipping) 
- For this project I used a solid blue LED strip which I purchased on amazon. These 5 meter SMD 5050 strips can run around $70 in retail stores so I though I would be taking a chance purchasing something priced under $20, but I was not disappointed in the least. I'm sure there are better quality lights out there, but if you plan on cutting these up and have no real game plan you wont feel any guilt putting these through the ringer.

2) Mini breadboard  $5

3) Arduino Uno  $30

4) Solid core wire  $2.50
- For anything involving breadboarding, do yourself a favor and stay away from any stranded wire. It will just end up getting frayed and hard to manage. Solid core is the way to go. I also like to choose at least two different colors for my wire to keep grounds and powers visibly separate. It makes troubleshooting and wiring easier in the long run when dealing with a lot of components.

5) USB A to B cable  $4
- This will be used to upload your Arduino LED code to the Arduino Uno board

6) Wire cutter/stripper $5

7) Parallax Sound Impact Sensor $10

8) Wall Adapter Power Supply - 9VDC 650mA $6

Total cost will be a bout $80 but keep in mind, all of these components are completely reusable. You can recycle them into a multitude of projects in the future so try not to worry about the cost. Think of it as building up your technical tool box :)

Step 2: Breadboard Basics

Breadboards are incredibly helpful when building circuits. They help you keep all of your components organized and laid out in a logical fashion. They also make it easy to confirm that the right wires are making the connections to the proper component leads. If you have never worked with a breadboard before, I'll explain the internal connection layout with the diagram above:

The on either side of the breadboard there are two columns, denoted by the blue and red highlights. These columns allow the user to have a common power and ground for components no matter where they are placed on the board. Whether your component is placed at A1 or J30, a common power and ground connection will only be a short distance away. All of the holes are connected vertically, so if you connected your ground (or power if you felt so inclined) to the left  or right most blue column, your common ground would extend from that column from position 1 all the way down to 30. However, the left and right sides are not connected, so If you wanted both blue columns grounded you would need to make two separate connections on either side. 

Rows A-E and F-J are where your components will be placed. This part of the board is also split between the left and right side about the center of the board. If a wire is placed in A1, that charge will carry through E1 and stop at the center divide. If a wire is placed in F1 that charge will carry through J1. You do not have to start out at position 1 every time either. If you place a connection at C1 for example, A1, B1, D1 and E1 would all have the same charge. 

TL; DR
The first two and last two blue and red columns share a connection vertically.
A-E share a connection horizontally
F-J share a connection horizontally
A-E connections and F-J connections are not bridged across the center.

Step 3: Parallax Sound Impact Sensor

The basic idea behind this component is that it picks up sounds that cross a certain decibel level. At the very top (opposite side of the pins) of the module is a microphone that listens for ambient sounds. This module has a dial (look for the blue and white) which allows the user to fine tune the sensitivity of the microphone, so that way you can have the microphone register very subtle quiet noises or you can decrease the sensitivity to the point where it only listens for louder than average sounds loud claps, shouts, etc. Play around with this dial and experiment with the sensitivity to get the your desired effect.
Once the microphone picks up a sound that is above the sensitivity threshold, the sensor sends a high (1) signal from the SIG line to whatever component you are trying to connect.

Step 4: Arduino and Pulse-Wave Modulation

An Arduino Uno is perfect for this project because it can handle the load of the LED strip, you can write multiple programs depending on what particular behavior you would like to see from your LEDs and besides the standard General Purpose Input/Output (GPIO) pins, it also has Pulse-Width Modulation (PWM) pins. PWM pins are great for powering components such as LEDs and electronic motors and although the pulse wave forms may look a bit jumpy (from the pulsating ons and offs) it actually allows you to control aspects such as brightness (when it comes to LEDs) and speed (when it comes to motors) in a very deliberate. smooth fashion, while efficiently utilizing your power. 

Here is a nice explanation of Pulse-Wave Modulation from the awesome people of MAKE (makezine.com)

Step 5: Arduino IDE

"The Arduino language is merely a set of C/C++ functions that can be called from your code. Your sketch undergoes minor changes (e.g. automatic generation of function prototypes) and then is passed directly to a C/C++ compiler (avr-g++). All standard C and C++ constructs supported by avr-g++ should work in Arduino." - Arduino support page

It is fairly straight forward and Arduino has a nice set of references and tutorials listed on their webpage: http://arduino.cc/en/Reference/HomePage

To begin programming your Arduino, you will need to download the Arduino IDE software: Click here

Once you have downloaded the IDE open up a blank document. 

Step 6: LED Arduino Code

Copy and paste the following code into the new project window:


#define LEDstrip 9


void setup()
{
  pinMode(7,INPUT); //SIG of the Parallax Sound Impact Sensor connected to Digital Pin 7
  pinMode(LEDstrip, OUTPUT);

}

//this function will make the LED dim once the Parallax Sound Impact Sensor sends a 1 signal, and then return to it’s original brightness.
void loop()
{
  boolean soundstate = digitalRead(7);
  if (soundstate == 1) {
         analogWrite(LEDstrip, 255);
         delay(10);
  }
  else{

    analogWrite(LEDstrip,0);
  }
}

Step 7: Compile and Upload Your Code

The check button is for the compiler. Click it and you should receive a message at the bottom of your screen saying that the code is done compiling. 

Once that has been verified, use the USB A to B cable to hook up your Arduino to your computer. Be sure you do not simultaneously powering the Arduino with the wall adapter power supply. You can end up frying the microcontroller if it is being powered by both sources simultaneously...I accidentally did this to an Arduino Mega before. 

Once the Arduino is connected to your computer navigate to Tools > Board to make sure you have the right model board selected. You may also want to navigate to Tools > Serial Port to be sure you have the proper port selected to send your information.

Hit the upload icon (looks like a right facing arrow) and it should upload in about 10 seconds. You should see a "Done Uploading." pormpt at the bottom of the window when this is complete.

Unplug your Arduino from your computer, it will save the information you just uploaded even when it is in an "off" state.

*the first figure shows the compilation steps and the second figure shows the upload steps

Step 8: Wiring

Now it is time to wire your project up! The following diagram shows all of the connections. These are the direct connections for the sake of simplicity, the number of wires on your actual project may vary since you will be using a breadboard and literally connecting wire to wire. 


*explanation
Parallax sound sensor:
GND > GND on Arduino
5V > 5V on Arduino
SIG > Digital Pin 7 on Arduino

LED:
Anode (+, long end) > Vin on Arduino
Cathode (-, short end) > PWM pin 9 on Arduino
*LED strips usually have two wires at one end, black (ground) and red (power), which makes things pretty easy to wire. 

Use your 9 volt wall adapter to power the Arduino (plug it into the black component on the lower left side of the Arduino) 

Step 9: Pick a Song!

Pick a song with some solid down beats and have some fun watching your LEDs dance to the music! 

Put them anywhere you think some ambient mood lighting is needed. For example, I placed mine behind my computer monitor: