LED WILL CONTROLLED BY DIFFERENT DEVICES WITH ARDUINO-UNO

by HarshS91 in Circuits > Arduino

1814 Views, 7 Favorites, 0 Comments

LED WILL CONTROLLED BY DIFFERENT DEVICES WITH ARDUINO-UNO

IMG_20180124_225220884.jpg

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)

Parts Required

IMG_20180125_172925692_LI (2).jpg
IMG_20180125_173318572_LI.jpg
IMG_20180125_174011980_LI.jpg
IMG_20180125_173722307_LI.jpg
IMG_20180125_173411780_LI.jpg
IMG_20180125_173933357_LI.jpg
IMG_20180125_173831893_LI.jpg

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)

Case 1:::::::::::::::::::::::::::::::::::::::::::ARDUINO SERIAL MONITER

first circuit (2).png
IMG_20180125_181217237.jpg
IMG_20180125_181237102.jpg
IMG_20180125_181254937_HDR.jpg

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.

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

bt (2).png
IMG_20180125_202222780.jpg
IMG_20180125_202445229.jpg
IMG_20180125_202504682.jpg
IMG_20180125_202551976.jpg
IMG_20180125_202743201.jpg

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.