Introduction: RGB Led Strip Bluetooth Controller + Music Sync
This project use arduino to control a RGB led strip with your phone via bluetooth, you can change the color of it, make it fade out and in ( or make any animation you want in the code ) and even make it sync with music beat.
Step 1: Components
For this project you are going to need the following components:
- Arduino pro micro,i chose this because it's really cheap and small but you can tweak the code to work with your microcontroller:
- Sound sensor (or mic + opamp ic):
- bluetooth module:
- 3x N-channel MOSFET's,
be sure to buy some which fit the led's power requeirement :
- 5v voltage regulator:
- RGB led strip:
- Power supply,
buy one that supply 12v and that fit the power requeirement of your led strip. those led strip i linked are 60W/5m, i want to connect 10m of them so i go for a 180w power supply just to be sure:
- Perf board:
Optional: screw terminal for Power Supply , led for Bluetooth status, switch to put in between the circuit and the power supply and ribbon cable for connecting the led strip to the circuit.
Step 2: Breadboard
make a breadboard prototype according to this scheme in order to test the circuit.
Connect the all the mosfets like this:
GATE to pins 9,6,5 of Arduino.
SOURCE to ground ,if you have a common cathode strip you need to connect all source pins to +12v instead.
DRAIN to the respective color line on the led strip :mosfet connected to pin 9 is RED,pin 6 is GREEN,pin 5 is BLUE.
The other wire of the led strip needs to be connect to +12v ,or ground if you have a commond cathode strip.
Connect microphone power pins to +5v and GND of arduino and of course the output to pin 3 on Arduino.
Connect RX of HC-05 to TX ,TX to RX and power pins to +5v and GND, if you want you can connect a led between the STATE pin and ground.
Finally the voltage regulator need to be connected to 12v (Vin and ground) and the Vout(5v) pin to Vcc of Arduino.
Step 3: Code
Download and unzip all files, then upload "ledStripControl.ino" to the board. ( in the board menu in arduino IDE select "arduino/genuino micro").
You can select Arduino MICRO or UNO with a constant (default is MICRO), the pinout is the same, if you want to use a different board select UNO and change the pinout int "variables.h" tab.
You can also enable Debug trough the serial port if you are using Arduino UNO.
What this code basically does is receiving inputs from bt module as decimal ascii and convert them in actions and values for R G B channels.
There are three way you can control your led strip:
1. Color mode
is the default mode and it basically receives the RGB values from your smartphone and sends them to the led strip.
2. Fade mode
make the led strip fade in and out with the color and the duration you specified from you smartphone app.
3. Music mode
make the led strip turn off according to high peeks of sound coming from the mic. you need to adjust the potentiometer on the mic board to a point where you see a good result with music sync.
Step 4: Android App
You have to download this app: https://play.google.com/store/apps/details?id=com....
and import the .kwl file that you find here.
If you want to create your own app that work with my code you need to have the following things:
a slider for RED value that sends:" r+value between 0 and 255+x" (es: "r130x")
a slider for GREEN value that sends:"g+value between 0 and 255+x"
a slider for BLUE value that sends:"b+value between 0 and 255+x"
a pushbutton that sends "m" for music mode
a pushbutton that sends "f" for fade mode
a pushbutton that sends "c" for color mode
a slider for duration of the fade animation that sends: "d+value between 1 and 150+x"
Step 5: Perf Board Circuit
When you have the full working circuit on a breadboard you can move it to a piece of perf board according to the circuit diagram explained in the step above.
Use Header socket for Arduino, microphone and HC-05, also use header pins for the output for the led strip.
You should add also a screw terminal or some other kind of connector for power supply and also a switch right after it. Use a quite big switch as the led strips could drain a lot of amps according to how many meters you have connected.
Step 6: You Finished
Connect some led strips and power supply to your circuit and you are done.
That's it, at this point you should have a working THING.
Please let me know if you have issues or suggestions in the comment section.
P.S. In the video above the effectivness of sync with music is not shown as well as it is in reality due to low video framerate.