Bluetooth Remote Control RGB LED

The Plan

I wanted to add some cool lighting effects to some of my projects and thought I would start playing around with some RGB LED’s.  I want to be able to use my Android device to control the color of the RGB  LEDs.  I will use an Arduino to control the RGB LED.  I will also need a Bluetooth Module to have communications between the Arduino and my Android phone.

Here is the video demo of the completed project….

The RGB LED Research

From my quick research around the web, it turns out that a RGB LED is a pretty simple device.  It essentially is just 3 small LEDs all bunched into one dome.  Here is a crude diagram to illustrate…


My diagram is for a common cathode RGB LED.  There is one ground pin and whichever color LED has a high enough voltage on its leg, it will turn on and glow.  The brightness of the color will depend on the voltage level. Note:There are also common anode RGB LED’s where there are 3 grounds and 1 positive pin but I find that would be less intuitive to use.

The Supplies

The Hardware Diagram

Here is a Fritzing diagram of my setup. BT_RGBLED_Schematic

The Arduino Sketch

The Arduino sketch consist of a loop that reads all the characters coming in on a SW UART looking for key words.  The SW UART is connected to the Bluetooth module which is paired to an Android phone running a custom app sending requests to control the colors of the RGB LED.  Once a key word is found, the line is parsed to determine the color and value to set.  The Android app sends a command with the letter for the color and value between 0 to 255.  The value is the analogWrite value for the PWM pin connected to the corresponding LED color. You can download the full Arduino sketch here:  You will need to have the companion Android app below to make it work.

The Android App

I used MIT’s AppInventor platform to make the companion Android app to send color request through a Bluetooth interface to my Arduino via a HC-06 Bluetooth module.  I based it off of the AppInventor project described in my previous post “Simple Android to Arduino Bluetooth Communication”.  I added 3 slide bars, 1 for each color LED.  There are also 3 text boxes that get updated with the slide bar position whenever the slide bar position changes.  In addition to updating the text box, the value is also concatenated into a “[color letter]:[value]|” command to be sent through the BT interface which is picked up by the Arduino sketch as described above.  Here is a snapshot of the screen setup… Here are the relevant AppInventor blocks… If you would like to install the app on your device, you can get the .apk file here…. If you are familiar with the AppInventor environment and would like the .aia file to look at all the blocks an play around with it yourself, you can get it here…

The Testing

You can see a quick demo video of the setup working at the top of this post.  After playing around with it some more, I do find there are sometimes glitches in the setup.  The color jumps and then self corrects if I slide one of the colors too fast.  Most likely loss of characters during Bluetooth transfer or the 9600 serial port baud rate SW UART is too slow to keep up.  I could probably put in some error checking in the string received, but this is just for simple demos for now.  If I really want this to be in some more elaborate project, I will add the error handling.