Introduction: Mobile Control LED(Arduino+Bluetooth Module)

Picture of Mobile Control LED(Arduino+Bluetooth Module)

Hello,

In this instructable i will show how to control LED from Android phone using Arduino Uno Board and HC-05 Bluetooth module.

In this Arduino code is explained.

For Android code refer...

https://www.instructables.com/id/App-for-Mobile-Control-LEDArduinoBluetooth-Module

Step 1: Requirements

Picture of Requirements

Hardware:

  • Arduino Uno board
  • Bluetooth Module(here HC-05)
  • LED
  • Male to Male wires
  • breadboard
  • Android Phone

Software

  • Arduino

Step 2: Circuit

Picture of Circuit

Make circuit as shown in diagram above.

Note: connect VCC and GND of bluetooth module to 5V and GND of Arduino respectively.

Step 3: Arduino Code

You can download code (led.ino file)

code is to turn ON ,turn OFF and adjust the brightness of LED.

boolean led= false;
char command;
String string;
  void setup()
  {
    Serial.begin(9600);
    pinMode(6, OUTPUT);//connect led to pin 6
  }
  void loop()
  {
    if (Serial.available() > 0) //check for input data 
    {string = "";}
    
    while(Serial.available() > 0)
    {
      command = ((byte)Serial.read());
      if(command == ':')
      {
        break;
      }
      else
      {
        string += command;
      }
      delay(3);
    }
    
    if(string == "on")//as "on" is written in android app for turning on led
    {
       analogWrite(6, 255);
       delay(10);
       Serial.println(string);
       led = true;
    }
    
    if(string =="off")//as "off" is written in android app for turning on led
    {
         analogWrite(6, 0);
         delay(10);
         led = false;
         Serial.println(string);
    }
    
    if ((string.toInt()>=0)&&(string.toInt()<=255))
    {
      if (led==true)
      {
        analogWrite(6, string.toInt());//type casting to integer
        Serial.println(string);//printing the int value 
        delay(10);
      }
    }
 }

Step 4: Android App

Picture of Android App

Download the LED Control.apk from link given:

https://drive.google.com/open?id=0B4eY-jcXDOueX0M5...

  • Install the app
  • upload the code in Arduino (NOTE:keep recieving pin of arduino disconnected while uploading code)
  • OPen the app and enjoy controlling LED from mobile

If want to learn Android app code refer...

https://www.instructables.com/id/App-for-Mobile-Control-LEDArduinoBluetooth-Module

thank you.

Comments

MoisésR24 (author)2017-04-25

gracias

DIY Hacks and How Tos (author)2016-09-11

Cool.

About This Instructable

1,140views

11favorites

License:

Bio: Likes to build circuits, electronics project in free time... Also love coding...have knowledge of JAVA, C, C++, Arduino, HTML, Android Studio, LabView, CoDeSys, OrCAD.....
More by Kitu Singh:Simple Home Automation With Android AppSmart Solar LampMobile control LED(Arduino+Bluetooth module)
Add instructable to: