RGB Led Strip Bluetooth Controller V3 + Music Sync + Ambient Light Control

9,941

47

8

Introduction: RGB Led Strip Bluetooth Controller V3 + Music Sync + Ambient Light Control

This project use arduino to control a RGB led strip with your phone via bluetooth. You can change color, make lights sync with music or make them auto adjust for the ambient lighting.

Step 1: Components

For this project you are going to need the following components:

  • LED strips of course, i ordered 10 meter of high density RGB strips from aliexpress for around 1€/m:https://it.aliexpress.com/item/10000000224362.html... , the adhesive is pretty bad but other than that they are awesome for the price. when choosing what to buy you need to go for the RGB "dumb" strips, no adressable and no RGBW. Also take note of the power per meter rating of your strip and multiply it for the meters you are going to need to get a rough power estimate. 5050 LED strips are around 7W/m for the low density 30 LED/m type and 14W/m for the high density 60 LED/m type.
  • 12/24v switching power supply, depending on your strips voltage. You can use an ATX power supply but in any case be sure to choose a power supply with a suitable power rating. I raccomend buying a power supply that has at least 30% more power rated than you actually need for the LEDs, expecially if you buy a cheap one like this: https://it.aliexpress.com/item/32304688758.html?sp... .My Strips were 14W/m, i needed to power 7.5m so I needed roughly 105W, I bought a 180W nominal power supply just to be on the safe side. I don't raccomend buying this if you are new to electronics as it has exposed high voltage terminals, do it at you own risk.
  • Arduino, i used a PRO micro but you can use whatever you want, keep in mind you may have to change some pins and the name of the Serial port in my code if you are going to use a different micro controller.
  • 3x N channel mosfets , I've gone with IRF3205 because I already had them on hand, they are capable of 80Amps and have a reasonable low on resistance so they should be plenty good. If you notice that they tend to overheat you can also add some heatsinks like i did.
  • 3x TC4420 mosfet drivers, They might not be necessary depending on your power need, go on reading for explanation.
  • HC-05 bluetooth module, be aware to choose a 5v logic level one or you might need additional circuitry (a voltage divider should work) to step down the voltage coming out of the TX of the arduino .
  • 7805 voltage regulator/ 5v buck converter to power arduino and bluetooth module.
  • 5x 0.1uF, 1x 100uF capacitors, 4x 10kohm resistors.

(optional)

  • electrect microphone module , it consist of a microphone and an amp with adjustable gain that sends out an analog voltage ready to be read from the arduino. You can build your own circuit or don't use it at all if you don't want your lights to turn on to the rythm of music.
  • photoresistor, you can also use a simple LED used as a light sensor but you must change the code for it to work.

Step 2: Schematic

Make the circuit on a breadboard to test it, replicate the mosfet driver circuit (second picture) 3 times, one for each channel, connect the 3 PWM output of the arduino to the PWM inputs of the driver circuit. If you don't want to use a dedicated mosfet driver IC you can build a simple push-pull driver using two NPN transistor, you can find more info on the internet. If you are planning to use the circuit for just a few LEDs you can directly connect the gate of the mosfets to the PWM outputs of the arduino via a 100ohm resistor, and add a 10Kohm resistor between source and drain of the mosfets, however this is not raccomended because it does not fully turn on the mosfets and so cause a lot of inefficency.

The 3 R G B pads of the led strip have to be connected to the drain of the 3 mosfets, and the other pad to +12v.

Step 3: Code

This is the code you need to upload to the arduino, what it does is basically using some low level registry magic to generate three 15KHz pulse-width-modulated signal (PWM) to drive the three mosfets with a variable duty cycle. In the loop it checks for incoming transmission from the bt module and when it does receive something it updates the color and the mode, also it saves all of that to the internal EEPROM so it remembers the settings when it is restarted. There are currently 3 modes implemented:

  • Color mode: just display a fixed color.
  • Music mode: turn off all the outputs for a brief moment if a sound treshold is reached, basically making a strobe light effect in sync with your music. If it does not work as intended you need to adjust the microphone sensitivity with the pot on the module, the treshold value in the code labeled as "thd" or the distance between microphone and sound source.
  • Ambient mode: It measure the amount of light in the room via the photoresistor and fade the brightess of your chosen color accordingly. In the mobile app or in the code you can adjust the HIGH and LOW tresholds that determine on what value (0-1023) the lights go fully on or fully off. If you notice some flicker while in this mode you may want to move the light sensor away from the LED strips themselves in order to avoid interference.

Feel free to modify the code and add more modes, if you need my help understanding the code my email on top of the file.

Step 4: Android App

You have to download this app: https://play.google.com/store/apps/details?id=com....

and also download and import the .kwl file.

If you want to create your own app that work with my code you need to have the following things:

slider for RED value that sends:" r+value between 0 and 1023+x" (es: "r130x")

slider for GREEN value that sends:"g+value between 0 and 1023+x"

slider for BLUE value that sends:"b+value between 0 and 1023+x"

slider for High treshold that sends:"h+value between 0 and 1023+x"

slider for Low treshold that sends:"l+value between 0 and 1023+x"

pushbutton that sends "m" for music mode

pushbutton that sends "a" for ambient mode

pushbutton that sends "c" for color mode

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, use thick traces for the drain and source connection of the mosfets and screw terminals to connect led strips and power to the circuit. If you have thermal problems add some heatsinks, if you want to use a single heatsink for all of three mosfets be sure to isolate them from each other using thermal pads or you will short the outputs as the drain of the mosfets is internally connected to the metal part of the body.

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 real life due to low video framerate.

1 Person Made This Project!

Recommendations

  • The 1000th Contest

    The 1000th Contest
  • Battery Powered Contest

    Battery Powered Contest
  • Hand Tools Only Challenge

    Hand Tools Only Challenge

8 Discussions

0
maxmafia
maxmafia

8 weeks ago

I made the project succesfully!! Thank you very much. I mounted it on the tv & console shelving and It makes the experience a lot inmmersive with shooters hahah!
- No need to use the voltaje regulator cause I used an standard ATX PSU which provides me 12v and 5v directly.
- I had to modify a little the circuit to use a 3.3v level BT module, as the image I attach.
- Also, I modified the code to reduce the thd value from 1000 to 500, and adjusted the potentiometer in the module, cause the music mode didn't work.
- Made a 3D printed box to protect the circuits.
Now I wonder if we can add more modes, like...
- allow graduating the brightness on every mode.
- leave the colours gradually change slowly.
- change to one color with the detection of a sound pulse and back to previous color (music mode 2.0 xD).
- an intermitent pulse like breathing.
- ...

I think it would not be hard to achieve this, but have to investigate... I have no idea of programming in arduino...

Thanks!!

IMG_20200810_195421.jpgIMG_20200810_195512.jpgIMG_20200819_161400.jpgIMG_20200820_191535.jpgmodulo-bluetooth-hc-05.jpg
0
maxmafia
maxmafia

3 months ago

Hi! I am going to try this wonderful instructable, so I have to buy the components in Aliexpress. I have a question.
If I find a classic Power Supply Unit with +12v and also a +5v output, can I omit the part of the circuits with the 7805 voltage regulator and the capacitors? I understand I can connect directly the Arduino, Bluetooth module and micro to +5v, can't I?

Thank you very much!

0
Sky_Rider
Sky_Rider

Reply 3 months ago

Hello, sorry for the late response, in fact is very much possible to use a PC power supply. Adding capacitors is still a good idea, However i think arduino and bluetooth module already have the mandatory decoupling capacitors already soldered on board, you should be fine by just connecting the 5v line to them. Be sure to check the power rating of your power supply as the nominal power of the unit is rarely all available for the 12v line.

0
GurSanjeetS
GurSanjeetS

1 year ago

Hai,

I'm using Arduino Nano for this project, but whenever I upload the code to my arduino It sends me an error stating ('byte' does not name a type) for this part of the code(byte convert (byte vet[]); )
Please help me out.

0
ArunP26
ArunP26

Question 2 years ago

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.

0
Sky_Rider
Sky_Rider

Answer 2 years ago

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

0
ArunP26
ArunP26

Answer 2 years ago

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.

0
Sky_Rider
Sky_Rider

Answer 2 years ago

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.