This is a guide for building an Arduino-based LED music visualizer, AKA a totally sweet digital dance room.

There are various guides around instructables about pure circuit visualizers, but those are generally some kind of amplifier to make the lights pulse and change intensity in response to the power conveyed in the audio signal. I wanted something more along the line of multiple strobes responding to different frequencies of music. The end result is the mutant stepchild of this and this and a little of this, but it is totally worthwhile.

The actual audio signal gets read in from the microphone jack on the computer, so it can either accept its own sound fed back or the sound from an iPod / Rock Band / karaoke / whatever you crazy kids can dream up.

Yay new music! Courtesy of DoKashiteru and the Creative Commons, I bring you an uncensored video of the system in action:


 
Remove these adsRemove these ads by Signing Up

Step 1: Parts / Tools

Parts:
LEDs - Obviously. I bought really bright 10mm ones in varying colors in bulk from eBay, but you can find them on Digikey or Mouser. Higher millicandela ratings are better, especially if you want these to illuminate anything and not just be a spot of color. Shop around to find a good deal.

Resistors - One for each LED. Mine required 470 ohms, but make sure you check the ratings on your LEDs so that you get as much light as possible without burning them out.

Solderless breadboad - For all the circuitry.

Arduino - The computer/circuit interface. An awesome little board. Buy it online.

Wire - Lots of solid-core wire. I needed a lot, fast, so I ended up cleaning out my local RadioShack of this stuff, but you should be able to find it a lot cheaper. Having two strands held together like this is extremely useful, as you'll see later.

Computer - Where the actual computation takes place. Yes, this may be slightly overkill to flash a few lights, but as we inevitably end up playing our dance music from a laptop anyway it worked out just fine.

Power supply - The LEDs will likely draw more power than the arduino can provide, so we're going to be powering them externally and switching them with transistors. You should have a bunch of these lying around from old electronics, or you can find them at thrift stores. See the planning page for what voltage / amperage you need.

NPN transistors - We're using these as current amplifiers / switches. A little current drawn from the arduino controls a lot of current drawn from the power supply that runs through the LEDs. Find them online or at RadioShack.

Soldering iron - Pretty self-explanatory.

Speakers / audio splitter / male-male audio cable - Speakers for sound, splitter and cable to feed the signal from the headphone output to the speakers and microphone jack.

Software:
Arduino - Download the arduino software environment from here.

Processing - Processing talks well with arduino, and has some awesome libraries built in. Download it from here. Make sure you have the latest version of the Minim audio processing library from here. You may also need to get the 'arduino' library to get them to communicate - get it from here and stick it in your Processing/libraries folder.
1-40 of 101Next »
jelimoore says: Jun 15, 2013. 10:45 AM
Ok problem solved
jelimoore says: Jun 15, 2013. 10:26 AM
Ok so my input source is my internal mic on my Mac. Any help appreciated!
jelimoore says: Jun 15, 2013. 7:49 AM
Oh, PS I am using this for everything that comes out of my system
jelimoore says: Jun 15, 2013. 7:47 AM
This is so awesome!!
cahill says: Nov 22, 2012. 7:00 AM
Awesome! Thank you pablopeillard
cahill says: Nov 17, 2012. 7:31 PM
Im getting these errors:
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
Exception in thread "AWT-EventQueue-0" java.lang.IllegalAccessError: tried to access class processing.core.PApplet$RegisteredMethods from class cc.arduino.Arduino$SerialProxy
at cc.arduino.Arduino$SerialProxy.(Arduino.java:119)
at cc.arduino.Arduino.(Arduino.java:168)
at cc.arduino.Arduino.(Arduino.java:152)
at sketch_121117a.setup(sketch_121117a.java:73)
at processing.core.PApplet.handleDraw(PApplet.java:2103)
at processing.opengl.PGL$PGLListener.display(PGL.java:2595)
at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:189)
at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:177)
at javax.media.opengl.awt.GLCanvas$DisplayAction.run(GLCanvas.java:928)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:425)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:364)
at javax.media.opengl.awt.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:827)
at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:415)
at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:515)
at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
at sun.awt.RepaintArea.paint(RepaintArea.java:224)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:308)
at java.awt.Component.dispatchEventImpl(Component.java:4729)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:648)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:607)
at java.awt.EventQueue$1.run(EventQueue.java:605)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:621)
at java.awt.EventQueue$2.run(EventQueue.java:619)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:618)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Already called beginDraw().
Exception in thread "Animation Thread" java.lang.RuntimeException: java.lang.IllegalAccessError: processing/core/PApplet$RegisteredMethods
at processing.opengl.PGL.requestDraw(PGL.java:1021)
at processing.opengl.PGraphicsOpenGL.requestDraw(PGraphicsOpenGL.java:1526)
at processing.core.PApplet.run(PApplet.java:2006)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalAccessError: processing/core/PApplet$RegisteredMethods
at cc.arduino.Arduino$SerialProxy.(Arduino.java:119)
at cc.arduino.Arduino.(Arduino.java:168)
at cc.arduino.Arduino.(Arduino.java:152)
at sketch_121117a.setup(sketch_121117a.java:73)
at processing.core.PApplet.handleDraw(PApplet.java:2103)
at processing.opengl.PGL$PGLListener.display(PGL.java:2595)
at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:189)
at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:177)
at javax.media.opengl.awt.GLCanvas$DisplayAction.run(GLCanvas.java:928)
at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:425)
at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:364)
at javax.media.opengl.awt.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:945)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:646)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:607)
at java.awt.EventQueue$1.run(EventQueue.java:605)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:616)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


Does that mean something is wrong with my arduino library?
Any help would be greatly appreciated
pablopeillard in reply to cahillNov 21, 2012. 4:41 PM
https://github.com/pardo-bsso/processing-arduino
gallactronics says: Apr 14, 2012. 10:16 AM
Wow! That's one of the coolest things ever made with an Arduino! But I have also found this site which has detailed instructions on how to make a simple Arduino LED music visualizer. Its also pretty cool and dead simple: 

http://gallactronics.blogspot.in/

It can be of great help for amateur Arduino geeks. :P

Spio says: Feb 10, 2012. 11:55 AM
Hi, great jobs. Could you tell me which are the transistors that you used before the leds?
SecondTwo (author) in reply to SpioFeb 11, 2012. 12:45 PM
Any NPN transistor that can handle the current will work - I think I used 2n2222s, but really anything should work.

If you want to experiment with fading the LEDs or doing any kind of PWM you'll need to use something more heavy-duty - transistors and MOSFETs dissipate a lot of power while switching, and it's easy to burn up little signal-level transistors like the 2n222.
Spio in reply to SecondTwoFeb 15, 2012. 5:08 AM
tanks a lot :)
SplotchyInk says: Feb 7, 2012. 2:29 PM
I was wondering if it was possible if there was a way to eliminate the computer and have the arduino react to a connected microphone. I kind of plan on making something similar but more portable. I dare say,even wearable.
SecondTwo (author) in reply to SplotchyInkFeb 8, 2012. 9:56 AM
Absolutely! As I said somewhere in here (I think), this project is completely overkill. When the summer residents in my dorm trashed the old system I rebuilt the controller with something like http://www.instructables.com/id/Nixie-Tube-Music-Visualizer/ to get rid of the computer and make it a completely analog system.  The basic idea would be to use a set of band-pass filters to isolate specific frequencies from the microphone input, rectify and time-average each of those frequencies to get a somewhat steady voltage, then use that voltage (potentially buffered or amplified) to drive your lights.

Alternatively, if you're good with microcontroller programming, you could set up the FFT to run only on the Arduino (or some other controller).

If you want to go the analog route, having an oscilloscope handy is VERY useful for identifying the pass-frequencies of your filters and figuring out the necessary gain on the amplifiers.

Mas52 says: Jan 20, 2012. 9:55 AM
Is it possible you can upload a higher resolution of your set up on to the site.....ive been trying to get this to work for hours but your description along with the images posted are extremely gauge for beginners like myself. I followed every instruction to the T and my result is the LEDs not lighting up nor responding to the music being played. I have the proper transistors, ground setup, pin setup, and external power source positive lead to the outer positive power rail and the negative lead to the negative rail of negative less. Im really lost at this point.
SecondTwo (author) in reply to Mas52Jan 20, 2012. 11:14 AM
Unfortunately this setup doesn't exist anymore, so I can't get any better pictures.  Can you identify more specifically where your problem is? Try uploading the basic "blink" sketch to the Arduino and seeing if you can get the LEDs to light that way - if they don't, the problem is in your circuitry, and if they do, the problem is in the Arduino.

Let me know the results and we can continue debugging from there.
aessam1 says: Aug 29, 2011. 6:46 PM
really cool
dogbots159 says: Aug 28, 2011. 9:04 PM
Wow this looks amazing! Could anyone point me in the right direction if i wanted to do this of the inside of my pc? any help would be great because i have little experience :)
hpfev says: Aug 21, 2011. 7:49 PM
nice project! i have one question though. how bright were those leds? like in terms of mcd. thx
Nman120 says: Aug 14, 2011. 10:39 AM
hey this is a great project but I had to go the long way around to get it to work
1. had to make processing libraries folder(this was hard to find a good answer to to fix the lost cc.arduino library)
2.update the java TX/RX file
3.change the com port in your processing file

but all in all its pretty cool
B.F.L.M says: Jun 19, 2011. 10:20 AM
This Is amazing! It would be a super cool dance floor too. but reinforcing might raise the price smidge.....
Nman120 says: Jun 11, 2011. 8:21 PM
(removed by author or community request)
joshua.bitossi says: May 17, 2011. 2:52 AM
After much re-organising i'm just a couple squares away from finishing my own version of this :) Great instructable and explained well enough for a beginner to figure out. I recommend using music with a very strong beat such as Pendulum, Skrillex or Benny Bennasi, looks great. If anyone has any questions feel free to message me (odds are I had the same problem at one point or another :/ )
pinkroxmysox23 says: Apr 12, 2011. 6:53 PM
I've got everything connected, power is going to the LEDs, but I cannot get them to respond to the music. I've uploaded the standardfirmata to my arduino and your processing sketch and changed the pin values to my own pin values. Help please? I have no idea what could be wrong
tvane1225 says: Mar 24, 2011. 5:40 PM
just to be sure... in order to use this? i would need to have the computer running at the same time? is there a way i could make one without having to use my laptop?
xtm49 says: Mar 21, 2011. 4:06 PM
I got it up and running, but the lights will flash randomly when no audio is being played. when music dose play the visualizer shows the audio wave form but the lights still just blink randomly. do you know what the problem might be?
SecondTwo (author) in reply to xtm49Mar 22, 2011. 8:56 AM
For a start, try upping the "tol" value - beatDetect doesn't have any kind of thresholding, so it still reports beats even when the only signal is random noise on the line. I put in "tol" to ensure there's a minium signal strength for the lights to fire.
joshua.bitossi says: Feb 6, 2011. 8:33 AM
Definitely one of the coolest ibles I've seen thus far!

How would you set the frequency for each specific LED? I want to build something like this mainly to learn a bit about arduino and electronics in general but with more of an equalizer feel. Saying that is there anyway to have LED's respond to volume as well. For example if they were in a stack the bottom one would almost always be on and the top would only light when the music is clipping?
joshua.bitossi in reply to joshua.bitossiFeb 6, 2011. 8:02 PM
Sorry i just read the comment about different pins responding to different frequencies (0 is the lowest, 25 the highest yeah?). Still curious about volume or if some LED's can be made more sensitive
SecondTwo (author) in reply to joshua.bitossiFeb 10, 2011. 1:03 AM
Hey! I think out of the box the Minim libraries don't give you access to specific frequencies or input levels; that is, I don't think you can add a few lines of code within my sketch to get a volume level or define frequencies.

However, you can go digging around in the Minim library files to figure out exactly what they're doing. I've moved on to a new laptop since writing the Instructable and don't have the library handy, but I do remember finding the declaration of 26 FFT bins and where the variance was calculated. It's possible that there are just undocumented commands to read the bin levels, or it should be easy enough to write your own.

Essentially: it's all in the library code! Once you're able to read the volume level, the display gets a bit trickier - you're essentially talking about a 2-dimensional LED display, which can require a lot of output pins. There are tons of instructables floating around about controlling displays (like http://www.instructables.com/id/LED-matrix-using-shift-registers/) so I'd say look around, mess around, and see what you can come up with.
cereeal says: Jan 11, 2011. 12:25 PM
I know there hasn't been any comments in here for a long while, but I was wondering if there was anyway I could configure this to work with a common anode LED. As of right now my lights are inversed with this program; that is, when there's no sound all LEDs are on.
Thanks.
SecondTwo (author) in reply to cereealFeb 10, 2011. 12:48 AM
Hey! Sorry I've taken so long to get back to you - grad school has sort of kept me busy. I'm not sure I understand the problem - if you have a bank of LEDs with a common anode (the side where current flows in), those should work as is in the circuit.

If you have a common cathode LED bank, you should be able to substitute PNP transistors and rearrange the circuit - connect the transistors between +5V and the LEDs, with the common cathode connected to ground. You may run in to trouble if you try to use +9 or +12 volts - I haven't used PNP transistors in a while but I think you can run into problems if your emitter voltage is much higher than your control signal. Then again, I may be getting confused with MOSFETs, so you may as well try.

Let me know if this helped (or if you've given up in the month I took to reply).
ginkin99 says: Jul 20, 2009. 3:38 PM
Ok, so its been quite a trip, but im almost done putting this all together, haha. And im very impressed so far. Sadly, i just wired my breadboard like the picture shows, and using a test script i found that the transistor is doing the opposite of what i want. When the LED is supposed to be off, it turns on, and vice versa. Any idea why that is?
username299 in reply to ginkin99Nov 7, 2010. 1:45 AM
It is probably way too late for this, but if the transistor is doing the opposite of what you are desiring (which would be the case for a PNP), you could plug in the output to the other side of the transistor (in the picture above move it from the left side to the right side of the transistor). The transistors are set up in a leader-follower stage [the output is on the emitter side (left side)], for a PNP the collector and the emitter are switched. This means that you could just move the output wire over.

SecondTwo (author) in reply to ginkin99Jul 20, 2009. 5:08 PM
I believe you may have gotten PNP transistors instead of NPN ones, but the wisdom of the crowd should definitely check me on that one.
ginkin99 in reply to SecondTwoJul 21, 2009. 9:33 AM
Ugh, yep youre right. Looks like im taking another trip to radio shack, haha. Thanks :)
DanNixon says: Aug 13, 2010. 10:57 AM
I always seem to get errors saying I am missing packages, I actually think this is a problem with me being able to download .zip archives, since I get the same thing when downloading the libraries from the Arduino website for the Mega (library folder empty) but does anyone else need to add the Arduino library before they can run this?
xDGx says: Aug 9, 2010. 7:24 PM
when the processing sketch is running without arduino it works pretty fast, when arduino is up and running there's a delay on the equalizer and on the leds. is there a way to improve this ? any code optimization or hardware (external dedicated soundcard) ? This is what I'm getting: http://www.flickr.com/photos/xdgx/4877732548/ Thanks!
xDGx says: Aug 9, 2010. 4:52 PM
Got it to work, forgot to change the port# @ arduino = new Arduino(this, Arduino.list()[1]);
xDGx says: Aug 9, 2010. 4:08 PM
Hello! I ran the instructable.pde fine, I can see the 2 "lines" moving to the sound, but the LEDs don't light up. I've already uploaded the firmata. Is there something I'm missing ? Thank you in advance!
wcmartin says: Jul 11, 2010. 8:49 PM
Hi, I really like this project and am trying to recreate it but I was wondering what you used to house the LEDs. What are those rounded inset squares you are using? Thanks!
1-40 of 101Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!