Introduction: Creating an Audio-Reactive LED Circuit

These instructions will help you learn how to construct an audio-reactive LED circuit.  Familiarity with electronics and soldering is strongly recommended  Barring any circuit errors, the task should take no more than an hour. This circuit can easily be expanded and integrated into other projects to create visually impressive effects.

Step 1: Safety Precautions

Caution should always be exercised when working with electric currents.  Currents can cause burns or damage to vital organs.  Currents as small as 10 mA can be damaging or even fatal.  Power sources should be disconnected when modifying a circuit, and remember to always use common sense when working with electronics.

Step 2: Materials Needed

-9 Volt Battery (or a lab power supply)
-9 Volt Battery Connector (if using a battery)
-An Audio Splitter
-Speakers or Headphones
-An MP3 Player (or computer)
-1 or more LEDs of any color
-1 NPN Transistor (this guide uses the 2N3904)
-1 100-400 ohm resistor
-An audio Y Cable
-A few alligator clips
-Jumper wires
-A breadboard

Step 3: Calculating Resistor Values

Pictured above is a chart detailing how to read a resistor value from color coding information.  The formula to calculate the resistor value needed to power a single LED is:
resistance(R) = (power supply voltage - LED voltage drop) / LED current

The typical recommended LED current is 20mA, our power supply voltage is 9V, and the LED voltage drop for a clear blue LED is 3.0V.  This results in:
(9-3)/0.020=300 ohm
Of course this doesn't need to be exact, a 330 ohm resistor will work fine here.  If we plug 330 ohm back into our formula we get
(power supply voltage - LED voltage drop) / resistance (R) = LED current
(9-3)/330 = 18 mA

18 mA is a good value to power our LED.  If the current is too low, the LED will be dimly lit, and if the current is too high, the LED will become very bright and may explode.

Step 4: Powering the Breadboard

1) Strip off a small amount of the wire insulation from the 9V battery connector
2) Insert the wires into the respective positive and negative rails of the breadboard
    -Red: Positive
    -Black: Negative

Step 5: Powering the LED

To Ensure that our LED and resistor are working, we will send power to it.  Notice that one of the LED legs is shorter than the other — the shorter leg is the negative end, and the longer leg is positive.
1) Insert the negative end of the LED into the negative rail, and the positive end into an adjacent hole.
2) Insert the 330 ohm resistor in series with the LED, connecting the positive leg to Vcc (9 Volts).

The LED should be illuminated.  If not, check the orientation of the LED and that all connections are inserted into the breadboard fully.

Step 6: Adding the Transistor

Next we will add the NPN transistor, giving us control over when the LED turns on and off.  A NPN transistor is a current controlled switch, meaning that a small current flowing into the base will result in current flow from the collector to the emitter.  We will use the audio signal to allow current to flow through the LED, illuminating it. (For a more in-depth explanation of NPN Bipolar Junction Transistors see the following: http://www.electronics-tutorials.ws/transistor/tran_2.html)
1) Insert the NPN transistor into the breadboard so that the 3 different pins are in separate columns.
2) Using a jumper wire, connect the emitter pin to ground.
3) Reorient the LED so that the negative leg is connected to the collector pin.
4) Connect a jumper wire to the base pin. (we will use this for our audio signal later)
Now our switch is almost ready, but the LED will not turn on yet, because we haven't connected anything to the base.

Step 7: Connecting the Audio Y Cable

We will now connect the Y Cable to the breadboard setup.  For this step, temporarily unplug the battery from the connector.  Looking at the Y Cable, there is a stereo input (standard 3.5 mm headphone jack), and RCA left and right output.  The pin protruding from each connector carries the signal (the positive element), and the outer jacket is ground.  To ensure we get the signal from both left and right channels, we will be using both outputs.
1) Connect an alligator clip to each of the RCA pins.
2) Connect one alligator clip to the ground sheath on one of the channels. (IMPORTANT: ensure that the clips do not touch)
3) Connect the other ends of the two signal-carrying alligator clips to the base pin of the transistor.
4) Connect the other end of the ground alligator clip to a jumper wire inserted in the ground rail of the breadboard.

Now our circuit is almost complete.  We are done with the breadboard, so go ahead and plug the battery in again.

Step 8: Seeing the Flashing LED

Now we will connect all our cables together to both see and hear the result.
1) Connect the audio jack end of the Y Cable to one of the audio splitter inputs.
2) Connect the headphones or speakers to the other audio splitter input.
3) Connect the other end of the audio splitter to the MP3 player or computer.

Step 9: Enjoying the Result

1) Ensure that the volume on the device is turned all the way up.
2) Ensure that the battery is connected.
3) Start the music and enjoy the show!

Step 10: Additional Modifications

This design is very extensible.  Some additional ideas include:
-Adding additional LEDs
-Filtering out treble, bass, and band frequencies and blinking different colored LEDs
-Separating out the left and right channel to control different LEDs
-Changing the input to be driven by a microphone
-Inserting the circuit into a set of speakers.

In the above video you can clearly see that the quieter tones aren't picked up very well if at all by the circuit,  this issue could be alleviated by using an operational amplifier to amplify the signal.  Unfortunately, this would require either a dual supply or a rail-splitter, both of which are beyond the scope of this tutorial.  If you are interested in reading about amplifiers, have a look here: http://en.wikipedia.org/wiki/Operational_amplifier_applications#Inverting_amplifier

Below is an example of a similar circuit I made that makes use of  high-pass and low-pass filters to separate out the treble and bass signals.  To achieve ideal results in a filtered circuit, it is recommended that an amplifier be implemented.  For more information about filters, have a look at these pages:
http://en.wikipedia.org/wiki/High-pass_filter#First-order_continuous-time_implementation
http://en.wikipedia.org/wiki/Low-pass_filter#Passive_electronic_realization