Music Reactive RGB LED Strip
Music Reactive RGB LED Strip
Music Reactive RGB LED Strip
#define Rpin 11
#define Gpin 10
#define Bpin 9
#define delayLEDS 3
#define sensorPin A0
void setup () {
Serial.begin (9600);
}
void loop () {
MainFunction();
void MainFunction() {
FilterSignal(sensorValue);
Serial.print(sensorValue);
Serial.print(" ");
Serial.println(filteredSignal);
CompareSignalFiltered(filteredSignal);
}
void FilterSignal(float sensorSignal) {
RGBColor(0, 0, 255);
Serial.println("Blue");
filteredSignalValues[1]) {
Serial.println("Azure");
filteredSignalValues[2]) {
Serial.println("Cyan");
filteredSignalValues[3]) {
Serial.println("Aqua marine");
filteredSignalValues[4]) {
Serial.println("Green");
filteredSignalValues[5]) {
filteredSignalValues[6]) {
RGBColor(255, 0, 255);
Serial.println("Magenta");
filteredSignalValues[7]) {
RGBColor(255, 0, 127);
Serial.println("Rose");
filteredSignalValues[8]) {
Serial.println("Orange");
RGBColor(255, 0, 0);
Serial.println("Red");
} else {
RGBColor(0, 0, 255);
Serial.println("Default: Blue");
analogWrite(Rpin, Rcolor);
analogWrite(Gpin, Gcolor);
analogWrite(Bpin, Bcolor);
delay(delayLEDS);
}
Program Explanation.
Acoustic Control for RGB LED Strips. How to build your own Music
This is a program that teaches you how to change the color of a LED strip
based on the value that is obtained from a Sound sensor, the signal is
filtered using a First Order Low pass IIR Digital filter with a cutoff
values that are used to determine which color will be displayed based on
the frequency of the sound that is sensed by the sensor, low frequency
sounds (barely audible) are displayed as Blue in the LED Strip, all the
MainFunction()
This method read the value of the output of the Sound sensor with
gives an output of 1023 or 5V when is not sensing any sound, this way we
have a value of 0 when not sensing sound & values up to 1023 when it
FilterSignal()
Filter the signal using a First Order IIR Low Pass Digital Filter created
CompareSignalFiltered()
between, our treshold values to assign a color to the LED Strip and print
RGBColor()
Send to the defined pins for each RGB color a value from 0 to 255 that
represent the color that we want; Search on Google RGB Color Wheel to