@tutorial: 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.

External Link: https://electronoobs.com/eng_arduino_tut13.php

by: ELECTRONOOBS on 2026-05-27

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.


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.


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.


I've designed my App in App inventor. If you want to see step by step how to create one, just folow this other tutorial of mine. This will be the main interface of the App with a button for each color. The app also has the bluetooth button. When pushed it will open the bluetooth devices list. Select the HC06 device in that lis in order to connect.

Now if we take a look in the blocks section we can see that the App will send a different character for each color button. Like for example "r" for red, "b" for blue, "g" for green and so on... The arduino will receive those values and it will have to take the decision on what signals to activate.

Before you install it you should allow unknown origin aplication to be installed. For that open your smartphone, go to settings, security, and check the "allow unknown origin aplications". Now open the folder where the App is and install it. Before we start the App we have to syncronise the devide. Open the bluetooth settings on your smartphone. Search for devices and select the HX06 when found. The password should be 1234 or 0000. Now we are syncronised. Open the App, click the bluetooth icon and select the HC06 device from taht list. Now just select your color and observe the magic. Oh, yeah, we have to programe the Arduino!. Take a look at the next code.


The Code NPN


There will be a different code for thr NPN schematic and other for the PNP. Just download the sketch or copy it from below. There is no extra library to install so the code should work for any Arduino ID


The Code PNP


There will be a different code for thr NPN schematic and other for the PNP. Just download the sketch or copy it from below. There is no extra library to install so the code should work for any Arduino IDE.


Final results


Now upload the code to the Arduin. Make sure that the RX and TX pins of the Bluetooth module are nopt connected while uploading the code, otherwise an error will pop out. After uploading, connect the bluetooth module, start the app, connect all the components, transistors, led stip, etc and start changeing the color.


Try other Apps


In order to try other PlayStore apps download the next Arduino code. Upload it to your Arduino, connect the bluetooth module like in the past schematics and open the serial monitor. Afet you download a PlayStore App, open it, connect to the HC06 bluetooth module and start pressing one button at a time. On the serial monitor you should see each received data. Note the sended data for each button and change the LED strip code to match your colors.


Not all the apps will be compatible. Some of them will send just 3 data packs with values between 0 and 255 directly for each of the 3 basic colors PWM width.


Leave a comment

Please login in order to comment.

Comments

ADVERTISERS
ADVERTISERS
PCBWAY