Introduction: Mobile Control LED(Arduino+Bluetooth Module)

About: 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.....

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

Hardware:

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

Software

  • Arduino

Step 2: 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);
      }
    }
 }

Attachments

Step 4: 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.

LED Contest

Participated in the
LED Contest

Lamps and Lighting Contest 2016

Participated in the
Lamps and Lighting Contest 2016