About This Project
Hi fellows. In this project I will instruct you to sync Adafruit NeoPixel LED strips with music using Arduino. What we do is we will take Fourier Transform of our music input. The Fourier transform will return the current frequency bands in each rotation of Arduino loop(). Using the values of frequency band between minimum and maximum range, we will code Arduino to light up specific portion of strip for specific frequency band. You will definitely enjoy learning this interesting makeable.
Meet The MakersJoin Team
In this project, we will make Adafruit NeoPixel LED strips to sync with music. Basic concept of Digital Signal Processing is used in this project. We will take Fourier transform of the music signal to extract the frequency bands. As Arduino loop() rotates continuously so it will return new frequency band at instant with every rotation. The NeoPixel strips, that I used, have 300 LEDs. Your NeoPixel strip might have different number of LEDs. So, for coding purpose, we will split the 300 LEDs in portions. For each frequency band specific portion of LEDs is associated with it so when Arduino reads that band, associated portion will light up. In this way, we will code Arduino for all frequency bands and associate portion of LEDs to each band.
Here is the step by step procedure that you need to follow to achieve the complete music reactive system:
.1. Downloading Software
Arduino IDE: https://www.arduino.cc/en/Main/Software
.2. Installing Libraries
You need to install fast Fourier transform & Adafruit NeoPixel Library. Links to download libraries are:
- Adafruit NeoPixel: https://github.com/adafruit/Adafruit_NeoPixel
- Fast Fourier Transform: https://github.com/TJC/arduino/tree/master/sketchbook/libraries/fix_fft
.3. Hardware Requirements
- Arduino (UNO , Mega or any other board but performance varies with board processing speed)
- Adafruit NeoPixel strips (you can use different models such as ws2811 or ws2811b but keep track of RGB and GRB parameters difference)
- Audio Jack
- Power Source
- Connecting Wires
.4. Making Connections
In the below image, connections are shown. Connect according to image and also follow the instruction written below image:
Analog Read (A0) in is from the audio jack (mono) or if you are using stereo audio jack then use only left or right channel of jack .
- You will need to power NeoPixel strips separately that is not shown in schematic due to lack of availability of digital prototype.
Note: Ignore the unused pin (Data out) in above schematic because we don't need to cascade strips here. And for the safety of Arduino board, try to power NeoPixel modules by external power source.
.5. Coding Arduino
This is a real work in this project that needs your attention. As described earlier, we divide our strip into small portions. In my case, I am using strip of 300 LEDs and band range of frequency spectrum is from 0 to 12. Values from 0 to 6 indicate bass while values from 7 to 12 indicated treble. Now, we will code Arduino in such a way that we associate each value with specific portion of LEDs. I am dividing 300 LEDs into small portions of 23 LEDs which means in this way I could cover all 300 LEDs with values from 0 to 12. Well-commented code is attached in the script files section. You can get it from there.
Test the sketch and make changes in the conditional and repetition flow loops to change the effect of glow. Don't forget to share your experience in the comments section. Enjoy!
Last updated on 07/12/2016
|Qty||Item||Where to Find||Est. Cost||More Info|
Arduino IDE v2.2
Item #: DHT11
4 channel Relay