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
INTRODUCTION
Hello friends there are many devices which control a led (means ON or OFF) with arduino like,
- arduino serial moniter
- bluetooth module(HC-05)
- ir remote
- your computer
- 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,
- arduino serial moniter
- bluetooth module(HC-05)
Parts Required
Hardware part list,
- 1* ARDUINO UNO,
- 1* ARDUINO CABLE(USB CABLE TYPE A/B.)
- 1* BREAD BOARD
- 7* MALE TO MALE JUMPER-WIRES
- 1* RED LED
- 1* 220ohm REGISTER
- 1* HC-05 BLUETOOTH MODULE
software part list,
- ARDUINO IDE(ON YOUR PC)
- ARDUINO BLUETOOTH APP(ON YOUR ANDROID PHONE)(Link)
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.
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.