Remote Controlled LED Using HC-05 Bluetooth, Arduino and Mobile Phone App




About: I am a digital nomad and I often find myself navigating myself the fields of IoT, IIoT, VR, Voice Activation, Web and Mobile Apps and you know.. you got the idea :)

If you are looking to connect a BLE (Bluetooth 4.0) module instead of Bluetooth 2.0 module, please see my new tutorial: How to control Arduino with HM-10 (CC2541) BLE module and a mobile app.

Technology is progressing at break-neck speed, everyone of us has smart phones now-a-days, there are cool apps which let us stay in contact with our friends and family, get latest weather information or stay-updated with latest news but what's next? All of these are old-school techs by now, what is the next use of this amazing processing speed and cutting-edge communication method we carry around with us all times? If I say you can control the lights of your home, know that if heating is on? or if your mobile phone automatically shuts off your air conditioner? Ring bells?

Of course, here on Instructables, we all know these uses and using this tutorial we will build a circuit and control it through the mobile app and we will do it very rapidly, let's say you will be able to control lights of your home in under 20-30 minutes? Uh-oh, not really the lights but for brevity's sake we will be controlling an LED for now and you can add all kinds of circuitry later!

Let's start, we will need:

  1. A cheap and commonly available Bluetooth module known as HC-05, you can buy it from ebay with "buy it now price" starting from $4.17
  2. An Arduino, for this tutorial I will be using Arduino Uno.
  3. A solder less breadboard, 220 ohm to 1K ohm resistor and a LED
  4. Evothings Studio to rapidly develop our app in JavaScript

Let's go forward to the next step and start building our circuit!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Connecting HC-05 Bluetooth Module With Arduino

HC-05 is a serial port module which makes it very easy to use. If you see the pin configuration of HC-05, there are total 6 but we only need 4 middle ones for our set-up.

  1. Connect VCC with 3.3V of Arduino, please do not connect it with 5V as that can cook the module
  2. Connect GND with any GND of Arduino
  3. Connect Rx pin with Tx of Arduino
  4. Connect Tx pin with Rx of Arduino

Now power-up the Uno using USB cable, a red light LED on HC-05 will start blinking, means we are ready to go forward to the next step!

Step 2: Connect the LED and Control It Using Arduino Serial Monitor

I often refer to this step as Arduino 101, connecting the LED with Arduino on pin 13 is the most basic thing to do and you must be familiar with it if you came so far, just to help you again doing it:

  1. Connect the long end of LED with 220 ohm to 1K ohm resistor
  2. Connect the other end of resistor to the pin 13 of Arduino
  3. Connect the short leg of LED to GND of Arduino

If you prefer, you can skip this step and just use the built-in yellow LED of Arduino. Our circuit is now complete and we will now move forward to building our software blocks!

Step 3: Send Serial Commands to Arduino Using Serial Monitor (or Any Terminal)

Upload the following sketch to the Arduino using USB cable.

Caution: Disconnect the HC-05 bluetooth module Rx and Tx pins from Arduino Uno as this particular board has only one hardware serial and connecting something to it while uploading a sketch will create conflict or your can using Arduino SoftwareSerial to avoid conflicts. Reconnect these pins once you are done uploading the sketch.

Arduino Turn LED On/Off using Serial Commands Created April 22, 2015 Hammad Tariq, Incubator (Pakistan)

It's a simple sketch which waits for a character on serial and in case of a desirable character, it turns an LED on/off.

Possible string values: a (to turn the LED on) b (tor turn the LED off) */

char junk; String inputString="";

void setup() // run once, when the sketch starts { Serial.begin(9600); // set the baud rate to 9600, same should be of your Serial Monitor pinMode(13, OUTPUT); }

void loop() { if(Serial.available()){ while(Serial.available()) { char inChar = (char); //read the input inputString += inChar; //make a string of the characters coming on serial } Serial.println(inputString); while (Serial.available() > 0) { junk = ; } // clear the serial buffer if(inputString == "a"){ //in case of 'a' turn the LED on digitalWrite(13, HIGH); }else if(inputString == "b"){ //incase of 'b' turn the LED off digitalWrite(13, LOW); } inputString = ""; } }

After uploading, open Arduino Serial Monitor, set the baud rate to 9600 and command line ending drop down (the one next to baud rate) to "No line ending", that means we will not be sending and /r or /n characters with our serial command.

Now type character "a" in the serial monitor and press send, the your LED should turn on, then send "b", the LED should turn off.

I have also attached the sketch file with this step, this is all we need at Arduino sketch level for turning LED on/off even through the Bluetooth and mobile app. In next step, we will communicate via bluetooth in order to play with our LED.

Step 4: Getting HC-5 to Work With Arduino and Testing the Commuincation

In this step, we are focusing on getting HC-05 to work with Arduino and testing all the communication before we move towards building our mobile app.

Important: There is no extra step or coding required for HC-05 to work, it's a simple serial port module, which means if you pair it and then connect to it using any serial port terminal, it will work just like Arduino Serial Monitor.

Follow these mini-steps:

  1. Connect the Rx and Tx pins of HC-05 back to Arduino (if you haven't did this already).
  2. Pair the device with your mobile phone (in my case I am using Android OS and my phone is Samsung SII).
  3. Download "Bluetooth Terminal" app from Google Play Store.
  4. Open Bluetooth Terminal app.
  5. From the menu, tap on "Connect a device - Insecure".
  6. You will see a pop-up of "Paired Devices", tap on "HC-05", after a second you will get a toast notifying "Connected to HC-05".
  7. Now type "a" and send, the LED will turn on, similarly, send "b" to turn the LED off.

In the next step will start building our cross-platform HTML5 app by installing and using Cordova and Evothings Studio.

Step 5: Installing Evothings Studio

In this step, we will install Evothings Studio.

Evothings Studio uses Cordova which let's you develop applications in HTML5 and provides easy to use functions to interface with underlying OS architecture to use different functionalities of smartphone itself! Apps built with Cordova can be deployed on all kinds of modern mobile operating systems such as iOS, Android and Windows Phone etc. It's open-source and a large community is behind it, means you can easily find online help and plugins written for different use-cases and technologies.

Similarly, Evothings Studio is also open-source and it's main advantage is it's "reload-on-save" functionality, which means you don't need to rebuild your app all the time. If Evothings client and studio are installed and working, you can just edit your source HTML file and can see the latest changes in your mobile phone instantly.

Now quickly, follow these steps:

  1. Install Evothings Workbench.
  2. Install Evothings Client app ( Android, iOS)
  3. Connect Evothings Client with Evothings Workbench using your local WiFi IP address.
  4. Download and save the complete example app code from my github repository.
  5. Drag & drop the app's "index.html" file from the example app code folder to the Evothings Workbench, that will creat a new project entry in the Evothings Workbench.
  6. Click the "Run" button alongside the new project entry, that will load the example app inside the Evothings Client.
  7. Now click the "Code" button to see the location of the code, open the "index.html" file in your favourite IDE and change something, like the colour of a button, the Evothings Studio will immediately pick the change and will reload the app inside the Evothings Client, this functionality allows you to rapidly prototype your web app for IoT devices.

In the next step, I will explain the code.

Step 6: Introducing BluetoothSerial

Evothings comes pre-installed with BluetoothSerial plugin of Cordova, that means we can straight away start implementing bluetooth to serial communication in our project.

The most important function of BluetoothSerial plugin is:


Whatever we will send in write function, the plugin will write that on serial output of bluetooth module.

So, in this case, following code bit is doing all the work. When a user presses the "LED ON" button, the script will write "a" onto the Arduino serial using BluetoothSerial plugin and in the other case it will write the character "b", which our Arduino sketch understands as the argument to switch the LED to off status.

app.ledOn = function(){
app.ledOff = function()

Step 7: Developing Front-end Using Evothings

So, we have everything ready now, our circuit, Arduino sketch, example app code and Evothings Studio also knows about the location of the project and can "Run" it.

The plugin's functionality code is hidden under /www/js/index.js and front-end is in /www/index.html, we have copied default CSS of Evothings and project is also running using Evothings Studio, whatever we will change, it will automatically reload the app in the phone, giving us the instant preview.

The only bit required is a bit of JavaScript and HTML know-how.

In next step, we will review our final app which is now ready!

Step 8: Reviewing the Completed Bluetooth Remote Control App

So, now we have our app and hardware working. Your app is already running in Evothings client, that is great, you have your 3 buttons and they switch the lights on and off and also let your manage your connection with the bluetooth module. Play with these, your work is over. The next step will be to Google a tutorial about adding a relay instead of the LED and control your home's lights through your new remote control.

Have fun!

8 People Made This Project!


  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

65 Discussions


6 months ago

the above code is used to control only one led light using bluetooth module .can u give the code to control three leds as traffic signal lights


Question 1 year ago

I follow every step but it doesn't work on step 4 when I have to send "a" or "b" from my moblie phone... What can I do for solving this problem? I have already tried with other apps...

2 answers

Answer 10 months ago

I had this problem too but I managed to figure it out.
What I did was:
On your Arduino board, swap TX and RX Connections.
So Arduino's TX will now be connected to (HC-05) RX
and Arudio RX should be connected to (HC-05) TX
SO pretty much just swap the two connections on the Aruino board.

That worked for me.


Answer 1 year ago

Have you found a solution? I have the same problem.


Question 10 months ago

How to make an unmanned flood rescue boat system using arduino
Could help please it's urgent


Question 1 year ago on Step 4

My connection is working perfectly with the serial monitor but when conected by phone it is not working


1 year ago

Please download the iPhone serial APP on your phone _

plug your UNO on Pc and copy and past the code....

// Connect : uno pin 7 to HM-10 pin TX,

uno pin 8 to HM-10 pin RX,

uno pin 5/3 volt to HM-10 pin VVC,

uno pin Ground to HM-10 pin Ground and led short leg,

uno pin 2 to led long leg with 220 Ohm reg.

// LED control with iPhone 5s & HM-10 Bluetooth Moduel by_Syed Shakhawat Hossain, Dhaka, Bangladesh

#include <SoftwareSerial.h>
#define LED_PIN 2

SoftwareSerial mySerial (7, 8); // TX, RX

// Connect HM10 Arduino Uno
// Pin 1/TXD Pin 7
// Pin 2/RXD Pin 8

char junk;
String inputString="";

void setup() // run once, when the sketch starts
Serial.begin(9600); // set the baud rate to 9600, same should be of your Serial Monitor
pinMode(2, OUTPUT);


void loop()
char inChar = (char); //read the input
Serial.println("Got input:");
inputString += inChar; //make a string of the characters coming on serial
while (mySerial.available() > 0)
{ junk = ; } // clear the serial buffer
if(inputString == "a"){ //in case of 'a' turn the LED on
Serial.println(" on");
digitalWrite(2, HIGH);
}else if(inputString == "b"){ //incase of 'b' turn the LED off
Serial.println(" off");
digitalWrite(2, LOW);
inputString = "";

// Happy Controling.......................


2 years ago

Hey, can you please help me. I wanna code an arduino for Ios app and the app only allows to send commands digitally from 1-9, for example 0 turn an led on and 1 to turn it off. But i need to control a lot of led's and it doesns't read past 9, When i press command 11 it receivs it as 1. I know its in the code. but im a bad coder. Can you please help me?


2 years ago

Could you do this?

I have completed the awesome project by Hammad Tariq (Control an Arduino via the HM-10 BLE module, from a mobile app on your smartphone)

I was wondering if I could send a 4 digit string via a text box from the app instead of one of the buttons. I could have the arduino loaded up with a 4 digit number to turn on led instead of the predetermined "0" . I would like to be able to change that 4 digit number ever so often by reloading the arduino sketch, but not the app html. So when i put 1234 or any 4 digit number into the arduino sketch, i could just input the 4 digit number in the app and submit.

Arduino Sketch

void loop() {
int c;
if (mySerial.available()) {
c =;
Serial.println("Got input:");
if (c != 0) // I would be able to change this part to any 4 digit number
// Non-zero input means "turn on LED".
Serial.println(" on");
digitalWrite(LED_PIN, HIGH);
// Input value zero means "turn off LED".
Serial.println(" off");
digitalWrite(LED_PIN, LOW);

And the text box instead of the predetermined "0"

// Turn on LED.
app.ledOff = function()
app.device && app.device.writeDataArray(new Uint8Array([0]), '0000ffe1-0000-1000-8000-00805f9b34fb'); //the 0 here would be the text box to enter any 4 digit number corresponding to the 4 digit number in the sketch



2 years ago

from my Bluetooth terminal app only the commands a and b are sent but there is no change in the LED at PIN 13. It remains in the OFF state. but the TX LED in the arduino is glowing when i send the command from the app.( HC-05 Vcc = 5V RX pin = 3.3 V.) I am not able the fix the problem. Kindly suggest me some soulution.


2 years ago

You can control RGB led via bluetooth.


3 years ago

Stucked at last step, not showing any bluetooth device as shown in ur screen shots though it is easily getting Connected using bluetooth terminal app.. Plz help

1 reply

Reply 2 years ago

Yes , Me too. my smartphone is searching nearby devices but it is saying.

No nearby bluetooth device found . While everything is connected correctly. Please Help!


2 years ago


I have a problem. The red letters are not the same of blue letters. Do you know how to fix this?

Thanks a lot

1 reply

Reply 2 years ago

I suppose the colors are just for differentiating between lines. It's not a thing to worry about


Reply 2 years ago

It's attached below the Instructable.


2 years ago

Am I correct in thinking you don't need to use the breadboard, but you can connect the chip straight to the arduino?

1 reply

Reply 2 years ago

Yes, but:
"Caution: Disconnect the HC-05 bluetooth module Rx and Tx pins from Arduino Uno as this particular board has only one hardware serial and connecting something to it while uploading a sketch will create conflict or your can using Arduino SoftwareSerial to avoid conflicts. Reconnect these pins once you are done uploading the sketch."

A breadboard simply acts as a method to extend a single pin to multiple pins (like sharing grounds) or for creating an organized simple circuit (testing purposes and stuff)


2 years ago

why is my serial moonitor not working