English
Español
PCBWAY PCB service

PCBWAY PCB service

PCBONLINE PCB service






Arduino ANDROID App RGB LED strip control





This will be an awesome tutorial. We will see how to create an App in app inventor with some buttons for each color. Send data with our smartphone to the arduino using a bluetooth connections between the android smartphone and a HC06 bluetooth module. With the receive data, we decide which color of the RGB strip to activate. In order to use high current we will use some transistors between the RGB strip and the arduino.


Material


1 x Arduino (NANO or UNO)
1 x Bluetooth module HC06
3 x BD681 NPN transistors or (BD140 PNP)
3 x 1k ohm resistors
1 x RGB LED strip
1 x 12V 1.5A or more DC transformer
Drilled PCB, connectors, solder,etc...




Schematic


First let's examine the LED strip input. It has 4 wires. The first one, usually white, is the positive 12V input. The other 3 wires are the red, green and blue signal wires. In order to create a broad variety of colors we should give more or less brightness to each of this 3 basic colors. To do that we shoould apply a PWM signal to this color pins. If the white pin is already connected to a positive 12V votage, in order to close the circuit, the RGB output pins should be modulated toward ground.

led strip arduino bluetooth


The problem is that Arduino digital outputs can'y supply more than 200mA and this strip at full brightness could draw more than 1A. For that we have to put something between the Arduino PWM signal and the LED strip. To do this we have two options. Use a NPN transistor twith the emmiter pin connected to ground aor a PNP transistor with the emitter pin connected to the RGB output pins. This will allow current to flow from the 12V input, toward ground and at the same time through the LEDs makeing them glow.




NPN schematic


If we use NPN transistors the full brightness of each color will be achived with a maximum PWM width and for PNP transistors just the oposite, with a 0 PWM width soi be careful.

led strip arduino bluetooth

Connect theHC06 bluetooth Vcc pins to the 5V output from the Arduino. Also share ground between the module and the microcontroller. Connect the Rx pitn to the Tx and the Tx to the Rx like in any other UART connection. Remember, while uploading the code to the Arduino, disconnect this two pins otherwise the code won't upload and an error would pop up. Supply 12V to the strip from the DC transformer. It has to have more than 1.5A to be able to supply the strip at full brightness. Share ground between the 12V transformer and the Arduino, otherwise the circuit won¡t work, the parts must have a commune ground. Connect the NPN transistors like in the scheamtic with the emitter pin toward ground. Add the 1k resistor and make the connections to the PWM pins from the Arduino, in this case D3 for red, D5 for green adn D9 for blue.


PNP schematic


If we use PNP transistors the full brightness of each color will be achived with a minimum PWM width so be careful to change the code if needed.

led strip arduino bluetooth

Connect theHC06 bluetooth Vcc pins to the 5V output from the Arduino. Also share ground between the module and the microcontroller. Connect the Rx pitn to the Tx and the Tx to the Rx like in any other UART connection. Remember, while uploading the code to the Arduino, disconnect this two pins otherwise the code won't upload and an error would pop up. Supply 12V to the strip from the DC transformer. It has to have more than 1.5A to be able to supply the strip at full brightness. Share ground between the 12V transformer and the Arduino, otherwise the circuit won¡t work, the parts must have a commune ground. Connect the PNP transistors like in the scheamtic with the emitter pin from the RGB output strips and the collector toward ground. Add the 1k resistor and make the connections to the PWM pins from the Arduino, in this case D3 for red, D5 for green adn D9 for blue.