Introduction: Blinking LEDs to the Frequency of Music
Here's a short video of it in action:
YouTube
Step 1: Materials Needed
Note: I'm a big fan of Tayda Electronics, as their materials are very cheap and they usually post 15% off discounts on their Facebook Page.
1 x Breadboard
1 x 12V 5A power supply
note: this depends on how long you want your LED strip to be, I find that 5A is plenty for 5 meters, it could probably even handle more since you'll be fading between colors instead of having everything on maximum. Here's a look link to how I figured out the current draw: link
1 x LED strip (waterproof and nice 1M long strip here, super cheap and ok-quality 5M here)
1 x Audio Jack
3 x 10k resistors
1 x 220k resistor
1 x 33pf ceramic capacitor
2 x 100nf ceramic capacitor
1 x 10nf ceramic capacitor
1 x Arduino (I used a sparkfun-branded RedBoard, but an Arduino Uno would work fine
1 x 3.5mm audio cable
1 x MSGEQ7
3 x N-channel MOSFET Transistors
Many x male to male jumper cables
1 x speakers
Computer with Arduino Software Installed
Step 2: Setting Up the Circuit
Look at the attached picture for details. I used a combination of:
The RGB LED strip tutorial from Adafruit
The MSGEQ7 tutorial from skoba
I also attached my Fritzing file if you want to look at it.
EDIT: I made a small error in the Fritzing file. Please see the following comment (thank you Isaack19 for the clarification)
IMPORTANT: MAKE SURE PORT 2 (and any other ports that need to be grounded) ON YOUR MSGEQ7 IS NOT GROUNDED TO THE SAME GROUND AS YOUR MOSFETS. The Fritzing file shows the MSGEQ7 sharing ground with the MOSFET transistors. I was about to return my MSGEQ7 back from where I got it because of this. I almost gave up, but then I noticed in the serial monitor that when the 12v 5a power supply is plugged into the Arduino, the last two of seven frequencies spike up (it went from 0 0 0 0 0 4 19 to 0 0 0 0 0 8 39. Notice the last two numbers were also spiking up without the power supply plugged in.) Anyways, after grounding the MSGQE7 and the MOSFET transistors to separate grounds, all seven frequencies were at 0. I just wanted to share this with you because I saw some other people having problems.
Step 3: Setting Up the Script
Here's also a pastebin of my code:
http://pastebin.com/wsHFADWe
Attachments
Step 4: Final Steps
Thanks for reading!