Categories: Tutorials

Control LEDs with your Android | Arduino-Bluetooth module tutorial

You already know what we are gonna do today…so lets get started !

Things you’ll need :-

  • Arduino board
  • Breadboard
  • Bluetooth module/sensor – HC05
  • Couple of jumpers/single stranded wires
  • LEDs
  • An ANDROID(obviously 😛 )

Video tutorial down below↓

Connections Of Bluetooth module HC05 :-

VCC – to VCC of Arduino.
GND – to GND of Arduino.
RX – to digital pin 0(TX pin) of Arduino.
TX – to digital pin 1(RX pin) of Arduino. (connect RX & TX pin after uploading the code)

Of LED –
Positive terminal – to pin 8 of Arduino.
Negative terminal – GND of Arduino.



Connections of bluetooth module HC05 with Arduino

Procedure :-

  1. Make the connections as shown in the above image. Don’t connect the RX & TX pins WHILE/BEFORE  uploading the code !
  2. Copy the code given below.
  3. Download the app called BlueControl (It’s free). Here is the link
  4. Open the app Blue control (It will automatically turn on the device’s Bluetooth). Go to options. Click on “Connect to Robot”. Choose the device – HC 05.
  5. When you are connecting to the Bluetooth module for the first time, it will ask you the password. Enter 0000 OR 1234.
  6.  When the device gets successfully paired with the sensor, the LED lights on sensor will start blinking at a slower rate than usual.
  7. DONE. Copy the code given below & test it out !

Code :-

void setup() {
Serial.begin(9600);
 pinMode(8, OUTPUT); // put your setup code here, to run once:
 }

void loop() {
  // put your main code here, to run repeatedly:
 if(Serial.available()>0)
   {     
      char data= Serial.read(); // reading the data received from the bluetooth module
      switch(data)
      {
        case 'a': digitalWrite(8, HIGH);break; // when a is pressed on the app on your smart phone
        case 'd': digitalWrite(8, LOW);break; // when d is pressed on the app on your smart phone
        default : break;
      }
      Serial.println(data);
   }
   delay(50);
}

You may like it –

Control LEDs with Voice command (in 2 mins, just change code)

 

Here’s a video tutorial which will surely make your job easy… 🙂

You may like –

Make an Obstacle avoiding robot using Ultrasonic sensor (in 10 mins)

Comment below if you face any difficulties. I’ll solve them for you ASAP

Jay Baviskar

View Comments

  • Thank you for this tutorial, but I am facing a problem while applying this project.

    My circuit is connected as you connect and my code is the same, but when i press the button in my phone, Nothing happen :(

    Actually I change the default name and password for my Bluetooth module, I don't know if this was the problem. Can you help me?

    Thank you

    • Hello Mary ! Check whether you've connected the RXD & TXD pins properly !
      Well, changing the name won't affect the circuit, but if your connections are proper & code is correct, try reverting the module's name back to the original/default one !

  • Thank you for the tutorial..connections are same as you did, same code same app...But my led won't turn on and off...and a on board Tx led is glowing as i'm pressing any buttons on the app...
    Waiting for the reply

  • i want to connect bluetooth modulo hc-05 with arduino mega 2560.in which pin i connect rx and tx pin.

    • The 'break' command ends the execution of the the nearest 'do while' OR 'while' statement.

  • Hello I'm Trying to control 5 LEDS and a Motor with bluetooth,can i achieve this by simply adding the pinModes and add switch data to more cases? Ex:

    switch(data)
    {
    case 'a': digitalWrite(8, HIGH);break;
    case 'b': digitalWrite(8, LOW);break;
    case 'c': digitalWrite(9,High);break;
    case'd': digitalWrite(9,LOW);break;
    default : break;
    }

    and so on

  • Hi, thank you for the tutorial. It's clear and great.
    I first encountered the same problem that the led won't glow. Then I found that was because of I had it reversely connected. So if anybody have the same problem may try to reconnect the led.

  • Hi sir, actually im doing 3D 4x4x4 LED cube to my final project for interaction design but in all the youtube tutorial they use arduino nano to play the led but for my project we must use hc-06 for control with bluetooth so i dont know how to connect it with bluetooth control animation in mobile device?

Recent Posts

Protecting and Enhancing Radar Performance in Extreme Climates

Radar systems are integral to a variety of crucial applications, from national defense to weather…

6 months ago

Metal Fabrication – A complete guide for Engineering students

Metal fabrication plays a vital role in engineering, transforming metal into functional components of everyday…

1 year ago

CNC Machine Inspection Techniques Based on Blockchain Technology

The pieces being produced in complex machining services frequently have difficult patterns. They may need…

2 years ago

How does a Digital Height Gauge work?

Digital height gauges are precision measuring instruments used to determine the height of an object…

2 years ago

The Advantages of Multi-Cavity Injection Molds

Injection molding is a rapid prototyping and manufacturing process applicable in the mass production of…

2 years ago

What are Industrial Pins? | Types and Applications

Fastening hardware, such as industrial pins, serve various functions in all industries. Butprimarily, you can…

2 years ago