RGB Led Strip Bluetooth Controller + Music Sync

1,447

35

2

Posted in TechnologyLeds

Introduction: RGB Led Strip Bluetooth Controller + Music Sync

About: Electronics and Drones enthusiast

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:

https://www.banggood.com/Pro-Micro-5V-16M-Mini-Leo...

  • Sound sensor (or mic + opamp ic):

https://eu.banggood.com/Wholesale-Warehouse-Sound-...

  • bluetooth module:

https://www.banggood.com/HC-05-Wireless-Bluetooth-...

  • 3x N-channel MOSFET's,

be sure to buy some which fit the led's power requeirement :

https://www.banggood.com/10Pcs-IRFZ44N-Transistor-...

  • 5v voltage regulator:

https://www.amazon.com/7805-5V-Voltage-Regulator-T...

  • RGB led strip:

https://www.banggood.com/5M-RGB-Non-Waterproof-300...

  • 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:

https://www.banggood.com/Wholesale-DC-12V-15A-180W...

  • Perf board:

https://www.banggood.com/40pcs-FR-4-Double-Side-Pr...

  • Headers

https://www.banggood.com/10pcs-40Pin-2_54mm-Female...

  • Pins

https://www.banggood.com/10pcs-1x40P-40Pin-2_54mm-...

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.

Share

    Recommendations

    • Spotless Contest

      Spotless Contest
    • Trash to Treasure

      Trash to Treasure
    • Science of Cooking

      Science of Cooking
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    1 Questions

    0

    Hai,
    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 :).

    2 more answers

    0

    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.

    2 Comments

    sure, i'm going to embed it from YouTube