Introduction: RGB Led Strip Control Via Bluetooth Using Arduino (Android Application)

In this tutorial, I will be teaching you how you can control the RGB led strip using an Android smartphone. A while ago, I was thinking to install an RGB strip on my desk. Having RGB strip on desk gives a cooler effect. I wanted to control it wirelessly. So finally, I come with a solution. what if I make an android application to control it! Stay till the end of the tutorial. I will share you my all the experience and at the end, you will know about how to make the android application and control RGB led strip with it. lets get started!

Supplies

1. Arduino uno

2. IRFz44n MOSFET x 3

3. 10k Resistor x 3

4. 2.2k Resistor

5. 4.7k Resistor

6. Breadboard

7. Jumper wires

8.RGB led strip

9. Bluetooth module(HC-05)

10. 12v adapter

Step 1: Circuit Diagram and Explanation

For this project, I used a 12v RGB strip. Which has four pins one for power and remaining each for individual colors. I can obtain a variety of color combination by providing an RGB color code to these pins. Arduino is used to giving the RGB values from 0 to 255 for control the led strip. But the problem is Arduino I/O pins can provide the only 40mA of current, but the RGB strip required more than 1A of current. So we can not connect the Arduino to the led strip directly. We required the driver for it, I use an IRFz44n n channel MOSFET. which can boost the current driving capability. Then I search for an RGB color picker and writedown the RGB values for different colors, These values are PWM values, Forgiving this values to RGB strip, I used PWM pins of Arduino respectively (9= RED, 10= GREEN, 11= BLUE) you can use any other PWM pins. The main function of our project was wireless control, for that, I connect an HC-05 Bluetooth module Tx pin to digital pin 2 of Arduino, HC-05 has a logic of 3.3v to receive the data from Arduino it will require a voltage divider circuit because Arduino uses logic level of 5v which may damage our Bluetooth module. For this, I connected a 4.7k resistor between pin Rx and Ground of Bluetooth module and connect the digital pin 3 of Arduino to Rx pin of Bluetooth module via 2.2k Resistor. After that been done I make the common ground connection. In this project, I connected two separate power sources one for Arduino and other for led strip. You can use a single power source of 12v and connect a 5v voltage regulator before connecting it to Arduino.

Step 2: Coding

Coding for this project is quite simple. Read each line with the comments for better understanding.

/*
Author:DIYelex date: 3/8/2019 */

#include // TX RX software library for bluetooth SoftwareSerial myserial(2, 3); // Connect the TXD pin of BT module to pin 2 of the Arduino and the RXD pin of BT module to pin 3 of Arduino. /////////Defining pins //// int Red=9; int Green=10; int Blue=11; String readString;

void setup() { pinMode(Red,OUTPUT); pinMode(Green,OUTPUT); pinMode(Blue,OUTPUT); Serial.begin(9600); //serial communication myserial.begin(9600); //Bluetooth serial communication with android// }

void loop() { while(myserial.available()){ //bluetooth is connected and data is available delay(50); char data = myserial.read(); //Read the serial data comming from bluetooth and store it in data charactor readString+=data; } if(readString.length() > 0) { Serial.println(readString); if(readString=="red") { analogWrite(Red,255); analogWrite(Green,0); //RGB values for red color analogWrite(Blue,0); } if(readString=="green") { analogWrite(Red,0); analogWrite(Green,255); //RGB values for green color analogWrite(Blue,0); } if(readString=="blue") { analogWrite(Red,0); analogWrite(Green,248); //RGB values for blue color analogWrite(Blue,252); } if(readString=="pink") { analogWrite(Red,252); analogWrite(Green,0); analogWrite(Blue,227); } if(readString=="yellow") { analogWrite(Red,227); analogWrite(Green,255); analogWrite(Blue,0); } if(readString=="purple") { analogWrite(Red,123); analogWrite(Green,0); analogWrite(Blue,255); } if(readString=="navyblue") { analogWrite(Red,3); analogWrite(Green,23); analogWrite(Blue,252); } if(readString=="white") { analogWrite(Red,255); analogWrite(Green,255); analogWrite(Blue,255); }

readString=""; } }

Step 3: Android Application

I make the android application in the Mit app inventor I added the buttons for each color. When the button is pressed then that color text would be sent over a Bluetooth. You can download my application and all the necessary files

Step 4: Conclusion

Thanks for reading

I have shared all the required information about this project here, If you have any queries then please let me know in the comment section. If you are interested in making this project, you can download all the necessary files and android application(APK) from the link given below:

https://github.com/diyelexvidyadhar/RGB_strip

Link to the YouTube video tutorial;