Sound Reactive Cheap Ir Led Strip

by Johermohit in Circuits > LEDs

1450 Views, 6 Favorites, 0 Comments

Sound Reactive Cheap Ir Led Strip

WhatsApp Image 2019-05-26 at 12.19.32 PM(1).jpeg
WhatsApp Image 2019-05-26 at 10.05.06 AM(1).jpeg
WhatsApp Image 2019-05-26 at 10.05.06 AM.jpeg
WhatsApp Image 2019-05-26 at 10.05.08 AM(1).jpeg
WhatsApp Image 2019-05-26 at 10.05.08 AM.jpeg
WhatsApp Image 2019-05-26 at 10.05.05 AM.jpeg

Sound Reactive Cheap Ir Led Strip

well, the idea came after the led strip arrived from AliExpress and they were not neopixels but RGB LED strip with 44krys or 24 key remote types, Dumb me lol, I ordered the wrong one.
I wanted them for a party, but with remote!!! Naaah. So I folded my sleeves and googled it.

Got esp based IR Web server that maps the same remote buttons over the IR emitter pin connected to an IR led.

but I wanted something different like a sound reactive, again i got a lots of Tutorials with ws1811 or neopixels and some even with MOSFETs and LED`s, but i was out of time so i tried a Dumb approach of Mapping Audio though A0 PIn of esp and Mapping the output in buckets to enable some combinations of IR remote Buttons MOstly rgb only but i bet you are going to make it better than me.

Supplies

1. a LED Strips obviously with Power supply

2. esp8266 / node mcu

3. Ir Emitter led

4. A resistor

5. Programming cable

6. arduino ide

7. a soldering iron (some basic soldering)

8. a 7805 ic (for using led supply as esp supply )

9. A mmicrophone module or aux y split for Sound input

Preparing Esp

  • First of all, connect the Nodemcu with computer or laptop.
  • Now install the driver of nodemcu( google it).
  • After this open, the Arduino IDE (Of course you need to download it and install it)Click on "Tools" on Arduino toolbar click on "Board" Select "Board Manager" and search for esp8266 install it (will take some time to finish)
  • Now, select "Sketch" from Arduino toolbar select "Include Library" from there select "Manage libraries"Search for "IRremoteESP8266" and install it
  • Now the configuration is done only from "Tools" we need to go to "Boards" Select "NodeMcu 1.0(ESP 12-E)" or something else version of ESP8266.

Preparing and Testing IR LED

F7J13AVIXUSD89N.LARGE.jpg

  • First of all, we need to install irLED library for esp.

GO here

Identifying your led strip either 24 key or 44 key(bigger one ) remote

for getting the remotes code go HERE

With library installed we need to prepare our IR LED by connecting it as shown in Image. Basing on it connect IR LED, then upload the following Sketch and point the IR LED to the controller. The LED strip should blink (turns on and off). // works both with 24 and 44 keys Remote.

HERE is the code to Do so.

#define IR_OFF    0xF740BF  //Resective ir codes in 32 bits<br>#define IR_ON     0xF7C0
#include<IRremoteESP8266.h

IRsend irsend(4); // IR pin

void setup() {
  irsend.begin();
}

void loop() {
  irsend.sendNEC(IR_ON, 32);
  delay(5000);
  irsend.sendNEC(IR_OFF, 32);
  delay(5000);
}

Wiring and Preparing the Microphone

mic.jpg
mic2.jpg

We will use only Analog pin of Espe8266 A0 for Taking Input as Analogue signal and Using it to trigger ir led based on Sound

Connect Out Pin to a0

Connect 5V to Vin (AS node mcu does not have 5v output )

that's it we will align the IR LED connected to D2 pin to the Reciever of LED strip.

a

Upload the Code and Its Ready to Rock

WhatsApp Image 2019-05-26 at 12.19.32 PM(1).jpeg
WhatsApp Image 2019-05-26 at 12.19.34 PM.jpeg

#include <IRsend.h>
#include<IRremoteESP8266.h>
#define microphonePin A0 int sound; int sound1; const int irPin = 4; //d2IRsend irsend(irPin);void setup() { Serial.begin(9600); pinMode(microphonePin, INPUT); pinMode(irPin, OUTPUT);} // ir led Codes #define IR_BPlus 0xFF3AC5 // #define IR_BMinus 0xFFBA45 // #define IR_ON 0xFF827D // #define IR_OFF 0xFF02FD // #define IR_R 0xFF1AE5 // #define IR_G 0xFF9A65 // #define IR_B 0xFFA25D // #define IR_W 0xFF22DD // #define IR_B1 0xFF2AD5 // #define IR_B2 0xFFAA55 // #define IR_B3 0xFF926D // #define IR_B4 0xFF12ED // #define IR_B5 0xFF0AF5 // #define IR_B6 0xFF8A75 // #define IR_B7 0xFFB24D // #define IR_B8 0xFF32CD // #define IR_B9 0xFF38C7 // #define IR_B10 0xFFB847 // #define IR_B11 0xFF7887 // #define IR_B12 0xFFF807 // #define IR_B13 0xFF18E7 // #define IR_B14 0xFF9867 // #define IR_B15 0xFF58A7 // #define IR_B16 0xFFD827 // #define IR_UPR 0xFF28D7 // #define IR_UPG 0xFFA857 // #define IR_UPB 0xFF6897 // #define IR_QUICK 0xFFE817 // #define IR_DOWNR 0xFF08F7 // #define IR_DOWNG 0xFF8877 // #define IR_DOWNB 0xFF48B7 // #define IR_SLOW 0xFFC837 // #define IR_DIY1 0xFF30CF // #define IR_DIY2 0xFFB04F // #define IR_DIY3 0xFF708F // #define IR_AUTO 0xFFF00F // #define IR_DIY4 0xFF10EF // #define IR_DIY5 0xFF906F // #define IR_DIY6 0xFF50AF // #define IR_FLASH 0xFFD02F // #define IR_JUMP3 0xFF20DF // #define IR_JUMP7 0xFFA05F // #define IR_FADE3 0xFF609F // #define IR_FADE7 0xFFE01F // void loop() { sound = analogRead(microphonePin); // getting input audio signal reading Serial.print(sound); // input audio signal readings to Serial display Serial.print(" "); if (sound > 415) { sound1 = map(sound, 415, 750, 140, 255); // mapping higher frequency values which are above offset to the scale of 150 - 255 } else if (sound > 340 && sound < 415) // keeping offset reading to zero scale..here offset value in the range of 340 - 415(offset value at 1.45v) ..its depends on componets used in circuit.. { sound1 = map(sound, 340, 415, 0, 9); } else if (sound < 340) { sound1 = map(sound, 0, 340, 10, 139); // keeping below offset readings to scale of 1-139.. } if (sound1 > 240) { irsend.sendNEC(IR_FLASH, 32); irsend.sendNEC(IR_QUICK, 32); irsend.sendNEC(IR_QUICK, 32); irsend.sendNEC(IR_QUICK, 32); irsend.sendNEC(IR_QUICK, 32); irsend.sendNEC(IR_QUICK, 32); irsend.sendNEC(IR_QUICK, 32); } else if ((sound1) > 200) { irsend.sendNEC(IR_G, 32); irsend.sendNEC(IR_B, 32); delay(120);} else if (sound1 > 160) { irsend.sendNEC(IR_R, 32); irsend.sendNEC(IR_B, 32); delay(120); } else if (sound1 > 120) { irsend.sendNEC(IR_B, 32); delay(120); } else if (sound1 > 80) { irsend.sendNEC(IR_B, 32); delay(120); } else if (sound1 > 40) { irsend.sendNEC(IR_G, 32); delay(120); } else if (sound1 > 10) { irsend.sendNEC(IR_R, 32); delay(120);} else { irsend.sendNEC(IR_FADE7, 32); delay(120); } Serial.println(sound1); delay(50); }