Introduction
This music responsible IQ light string is an application based on an individually addressable LED strip. It can turn into other different products if you want to. All you have to do is to change the outside wrapper. It's googd choice to be a decoration in your friends' party, Children's room, or date with candlelight dinner and romantic pas de deux. .. ^^
What you’ll need
Connection
You can connect different components together based on the diagram below:
Note: pay attention to the direction of the strips when you cut and reconnect them, you may want to glue the soldering points just in case they get torn.
Installation
If it’s the first time you’re using Arduino, please install the Arduino IDE and the required drive. You can go to the following link for instructions:
Download the Library that is provided for you and import it to your Arduino. This will help you control your LEDs more easily.
Adafruit_NeoPixel
AudioAnalyzer
The CODE
Given the limited length of the led strip I have, I separated the led strip into 6 parts to display changes in various frequencies of the music. There are 7 frequencies that the Audio Analyzer can get, but you’ll find out some are not quite easy to use. Thus you’ll need to play around and see what works best for your own design. You can take a look at my code and start from it. Even more complicated patterns can be created, and I am quite looking forward to more designs .
/*music responsible led strip sample code
created by Yu Sun on 07/28/2015
*/
#include
#include
#define PIN 11 //The signal pin connected with Arduino
#define LED_COUNT 34 //total number of leds in the strip
#define NOISE 120// noise that you want to chrop off
#define SEG 6 // how many parts you want to seperate the led strip into
Analyzer Audio = Analyzer(10,9,0);//Strobe pin ->10 RST pin ->9 Analog Pin ->0
Adafruit_NeoPixel leds = Adafruit_NeoPixel(LED_COUNT, PIN, NEO_GRB + NEO_KHZ800);
int FreqVal[7];//create an array to store the value of different freq
void setup()
{
Serial.begin(57600);
Audio.Init();
leds.begin(); // Call this to start up the LED strip.
clearLEDs(); // This function, defined below, turns all LEDs off...
leds.show(); // ...but the LEDs don't actually update until you call this.
}
void loop(){
Audio.ReadFreq(FreqVal);
for (int i = 0;i<7;i++){
FreqVal[i]=constrain(FreqVal[i],NOISE,1023);
FreqVal[i]=map( FreqVal[i],NOISE,1023,0,255);
Serial.print(FreqVal[i]);//used for debugging and Freq choosing
Serial.print(" ");
}
int j;
//assign different values for different parts of the led strip
for (j=0;j
That’s it! Enjoy the sights and sounds!