·
Home Automation with Bluetooth Module HC-05:
o Components:
Ø Arduino Mega 2560/UNO (x1)
Ø Bluetooth Module HC-05 (x1)
Ø Bulb (230V AC) (x1)
Ø AC Supply (230v, 50Hz)
Ø Relay Card (5V DC) (x1)
Ø Jumper Wire (As per required)
o Connections:
Ø Take one Arduino Mega 2560/UNO, Bluetooth Module, 5V DC
Relay Card and One 230v Bulb.
Ø Connect Bluetooth module HC-05 with Arduino Board, Connect
VCC terminal of HC-05 To 5V Terminal of Arduino board then connect GND terminal
of HC-05 to GND terminal of Arduino then connect RXD pin of HC-05 to Tx0 Pin of
Arduino and TXD pin to RX0 pin.
Ø Now connect the VCC terminal of Relay Card with 5V
terminal of Arduino board and GND terminal to GND terminal of Arduino and
connect In terminal to 2 Pin of Arduino because here i take 2 no pin as a
output.
Ø Now give 230v Supply to common (C) terminal of the
relay card and from Normally open (NO) Terminal give connection to the Phase of
the Bulb and Connect neutral directly to the bulb.
Ø Switch on the AC power Supply.
Ø Upload the given program to Arduino Board.
Here i use Serial Terminal app (Android Users) to give commands to module.
o Program:
Note: Remove RX & TX pin Before uploading
Program.
const int Relay=2;
String inputString="";
void setup() // run once, when the
sketch starts
{
Serial.begin(9600); // set the baud rate to 9600, same
should be of your Serial Monitor
pinMode(Relay, OUTPUT);
}
void loop()
{
if(Serial.available()){
while(Serial.available())
{
char inChar = (char)Serial.read(); //read the input
inputString += inChar;
//make a string of the characters coming on serial
}
Serial.println(inputString);
if(inputString == "0"){
//in case of '1' turn the LED on
digitalWrite(Relay, HIGH);
}else if(inputString == "1"){
//incase of '0' turn the LED off
digitalWrite(Relay, LOW);
}
inputString = "";
}
}
o Working Demo:
You Can see the working Demo on my Youtube channel by searching "CreZy ElecTriCal EnGinEer" or you can see the video by click the give link.
Comments
Post a Comment