Home Automation using Arduino UNO and Android App
Home Automation using Arduino UNO and Android App
Home automation means automatic control of electrical and
electronics appliances. It includes Lighting, switching and controlling appliances.
In a home automation system we have a mobile host controller and a number of
client module such as home appliances. These appliances are connected through relay,
Bluetooth and micro controller. The aim of this project is to control home appliances using a mobile host.
Components required
Hardware
- Arduino UNO
- HC – 05 Bluetooth Module
- 5 V Relay two channel
- Jumper/Connecting Wires
- Smart phone
- 5 V DC Adapter
Software
- Arduino IDE
- Android App
Warning: - AC is very risky and accidental shock could be fetal, so be sure to pursue appropriate safety precautions. Predictable Designs assumes no accountability for any injury that may happen by following this tutorial.
The home automation circuit is built using Arduino Uno,
Bluetooth and a 2-channel relay or as per the requirements. Using a 4-channel relay we can control only four
loads.
The step-wise working is as follows:
Step1: Upload the sketch in Arduino Uno. A Sample sketch is shown below:
int relay1 = 10;
int relay2 = 11;
String readString;
void setup() {
Serial.begin(9600);
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
}
void loop() {
while (Serial.available()) {
delay(3);
char c = Serial.read();
readString += c;
}
if (readString.length() >0) {
Serial.println(readString);
if (readString == "1 ON")
{
digitalWrite(relay1, HIGH);
}
if (readString == "1 OFF")
{
digitalWrite(relay1, LOW);
}
//relay2
if (readString == "2 ON")
{
digitalWrite(relay2, HIGH);
}
if (readString == "2 OFF")
{
digitalWrite(relay2, LOW);
}
//All on / off
if (readString == "ALL ON")
{
digitalWrite(relay1, HIGH);
digitalWrite(relay2, HIGH);
}
if (readString == "ALL OFF")
{
digitalWrite(relay1, LOW);
digitalWrite(relay2, LOW);
}
//next
readString="";
}
}
RX > TX
TX > RX
GND > GND
+5V > 3.3V
int relay2 = 11;
String readString;
void setup() {
Serial.begin(9600);
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
}
void loop() {
while (Serial.available()) {
delay(3);
char c = Serial.read();
readString += c;
}
if (readString.length() >0) {
Serial.println(readString);
if (readString == "1 ON")
{
digitalWrite(relay1, HIGH);
}
if (readString == "1 OFF")
{
digitalWrite(relay1, LOW);
}
//relay2
if (readString == "2 ON")
{
digitalWrite(relay2, HIGH);
}
if (readString == "2 OFF")
{
digitalWrite(relay2, LOW);
}
//All on / off
if (readString == "ALL ON")
{
digitalWrite(relay1, HIGH);
digitalWrite(relay2, HIGH);
}
if (readString == "ALL OFF")
{
digitalWrite(relay1, LOW);
digitalWrite(relay2, LOW);
}
//next
readString="";
}
}
Step 2: Connect Relay with Arduino Uno
Relay Adruino Uno
IN1 > Pin 10
IN2 > Pin 11
IN2 > Pin 11
GND > GND
VCC > 5V
Step 3: Connect Bluetooth Module with Arduino Uno
Bluetooth Module Adruino UnoRX > TX
TX > RX
GND > GND
+5V > 3.3V
Step 4: Connect Relay and AC Load as shown below
Step 5: Power the Load and Adruino Uno ( use 5V Adapter)
Step 6: Install the Android App to control the appliances.
Step 6: Install the Android App to control the appliances.
Nice
ReplyDeleteGreat
Delete