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 fits your led's power requirement. 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, led.
Step 2: Breadboard
make a breadboard prototype according to this scheme in order to test the circuit.
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.
Step 6: You Finished
Connect 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.
We have a be nice policy.
Please be positive and constructive.
Seems to be a good project! But while running the code, I am getting the following error message.
"exit status 1
'Serial1' was not declared in this scope."
Please provide a solution.
please let me know if you have any other issue, and i will be glad if you would send me a picture of the finished project :).
Thanks a lot for the reply. Surely I will get back to in case of any other issues and will update with a picture of the final product.
Hi! "Serial1" is the serial port of Arduino Pro Micro, which is the microcontroller the code is written for. If you want to use another kind of MC such as arduino UNO you must swap every occurency of "Serial1" with "Serial" to use Hardware Serial or use SoftwareSerial library instead (https://www.arduino.cc/en/Reference/SoftwareSerial) , and of course you also need to change the pinout of the mosfets to some PWM outputs.
If you can't manage out the solution by yourself don't worry, soon i'm going to update the guide with videos and a code for arduino UNO as well.