LED WILL CONTROLLED BY DIFFERENT DEVICES WITH ARDUINO-UNO

736

4

3

Posted

Introduction: LED WILL CONTROLLED BY DIFFERENT DEVICES WITH ARDUINO-UNO

INTRODUCTION

Hello friends there are many devices which control a led (means ON or OFF) with arduino like,

  1. arduino serial moniter
  2. bluetooth module(HC-05)
  3. ir remote
  4. your computer
  5. wi-fi(internet/web),etc

but in this instructable we will be control a led (means ON or OFF)by different devices with arduino-uno.

here,different devices like,

  1. arduino serial moniter
  2. bluetooth module(HC-05)

Step 1: Parts Required

Hardware part list,

  1. 1* ARDUINO UNO,
  2. 1* ARDUINO CABLE(USB CABLE TYPE A/B.)
  3. 1* BREAD BOARD
  4. 7* MALE TO MALE JUMPER-WIRES
  5. 1* RED LED
  6. 1* 220ohm REGISTER
  7. 1* HC-05 BLUETOOTH MODULE

software part list,

  1. ARDUINO IDE(ON YOUR PC)
  2. ARDUINO BLUETOOTH APP(ON YOUR ANDROID PHONE)(Link)

Step 2: Case 1:::::::::::::::::::::::::::::::::::::::::::ARDUINO SERIAL MONITER

in this method we will be ON or OFF led by using of arduino serial monitor,means we will press "1" on serial monitor the led will be ON and we will press "2" on serial monitor the led will be OFF.

circuit diagram:::::::

arduino (pin no.12)>>>>>>>>>>>>>220ohm register's one leg

220ohm register's another leg>>>>>>>>>>>led long leg(anode(+))

led short leg(cathode(-))>>>>>>>>>>>arduino (GND pin)

after complete the connection we will connect the arduino uno to our computer by using of USB CABLE TYPE A/B,

then we will open the arduino IDE software and write below program(CODE-1) and upload it in our arduino.

<<<<<<<<<<<<<<<<<<<<<<<<<<CODE-1>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

int LED = 12;led pin
void setup()
{
Serial.begin(9600);//for serial comunication
pinMode(LED,OUTPUT);
}
void loop()
{  
 while(Serial.available()==0);
 int state = Serial.read();
 if(state=='1')
 {     
 digitalWrite(LED,HIGH);led is ON
  } 
  else if(state=='2') 
  { 
  digitalWrite(LED,LOW);led is OFF  
  }
}

After uplode the code,please open the serial moniter of arduino IDE software,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

then press<<<< 1>>>>for led on.

press<<<< 2>>>>for led off.

Step 3: Case 3:::::::::::::::::::::::::::::::::::::::::::BLUETOOTH MODULE(HC-05)

In this method we will be ON or OFF led by using of Bluetooth module(hc-05) ,means we will type h on Arduino Bluetooth app in our android phone the led will be ON and we will type l(l for Lion) on Arduino Bluetooth app in our android phone the led will be OFF

circuit diagram:::::::::::

arduino (12pin)>>>>>>>>>>>>>220ohm register's one leg,

220ohm register's another leg>>>>>>>>>>>led long leg(anode(+)),

led short leg(cathode(-))>>>>>>>>>>>arduino (GNDpin),

<<<ARDUINO & BT MODULE(HC-05) CONNECTION>>>

arduino uno>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>bluetooth module(hc-05)

Rx(pin0)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Tx,

Tx(pin1)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Rx

5v>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>5v

GND>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>GND

after complete the connection we will connect the arduino uno to our computer by using of USB CABLE TYPE A/B,
then we will open the arduino IDE software and write belowe program(CODE-2) and uplode it in our arduino.

(note::when we uplode the any program please free the arduino's Rx and Tx pin;;

after uplode the program sucsessfull then connect the bluetooth (hc-05) and any device.)

<<<<<<<<<<<<<<<<<<<<<<<<CODE-2>>>>>>>>>>>>>>>>>>>>>>>>

int LED = 12;//led pin
void setup()
{
Serial.begin(9600);//for serial comunication
pinMode(LED,OUTPUT);
   }   
void loop()
{
 
 while(Serial.available()==0);
  
char state = Serial.read();
 
 if(state=='h') 
{  
digitalWrite(LED,HIGH);//led is ON
 
 } 
else if(state=='l') 
  {
digitalWrite(LED,LOW);//led is OFF
  
  }
}

after uplode the code,please open the Arduino Bluetooth application in your android smart phone

and connect your phone's bluetooth to hc-05 then open terminal mode in Arduino Bluetooth application

then ,

press<<<< h>>>>for led on,

press<<<< l>>>>for led off.

Share

Recommendations

  • Epilog Challenge 9

    Epilog Challenge 9
  • Sew Warm Contest 2018

    Sew Warm Contest 2018
  • Gluten Free Challenge

    Gluten Free Challenge
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

2 Comments