This tutorial will show you how to sync a rainbow LED strip to flash to the beat of your music. A few things that I’d like to point out first, the setup will make the lights flash according on how you code the rainbow strip. Is this the best way to go about flashing lights with music? No, it is very crude but hey, it will give you the satisfaction of playing around with Arduino code, especially for the beginners because it is super easy to learn and is loads of fun!
What is Rainbow Strip?
This is an LED strip, but is a different type of LED. This LED strip is mounted with RainbowBit (WS2812B) LED. If you’ve used RainbowBit before, you’ll know that it uses a unique serial protocol to control each and every RGB LED along the strip. Since its a serial protocol, all your controller need is ONE digital output pin. Yes, a single pin to control as many RGB LED as you like
2. Stack CT ARM, Easy MP3 Shield and ESP Wifi Shield together.
3. Take a look on which pins are Tx and Rx connecting to, we are going to use them for both shields.
|ESP8266 Wifi Shield||D3||D2|
|Easy MP3 Shield||D9||D8|
4. Connect the rainbow strip according to the picture below. Make sure you connect with the right pins.
|Rainbow Strip||Easy MP3 Shield|
6. Place your favorite songs inside the MP3 folder. Since this is a code based song, you need to code based on the music beat, I choose Star Sky(Instrumental) for the project song. The sample code provided is based on this song. You can download both sample code and music from here.
Then paste it on your MicroSD Card under the folder name “MP3”.
7. Plug in your earphone or speaker to DC jack on MP3 shield. Connect the boards to your PC using USB cable. Then you can start Arduino IDE!
8. Copy the sample code and paste it into your Arduino sketch.
9. Choose the correct COM Port.
10. Then go to Tools>Boards>CT ARM. *If you are using different board, choose the correct one.
11. Compile and upload the sketch. Open serial monitor. Make sure baud rate is 115200.
12. Connect your phone to ESPShield Wifi > Open Wifly apps>Enter the correct IP Address and Port Number> Click Connect> Click ^
13. Enjoy the song!
These are both the sample code and song for your reference. Don’t worry, you can play around with the codes and set it according to your favorite song
Oh one more thing that I like about this rainbow strip is you can code the color simply by changing the rgb color codes in arduino sketches! You can easily find the rgb codes scattering around the internet and test it yourself.