The Complete Home Automation System

Written by: techguru

Picture of The Complete Home Automation System

Fit it inside your switch board and your home turn automatic..
Just need to have an android mobile to in your hand...
So lets be a bit lazy...

Step 1: Requirments

Picture of Requirments

1. An Arduino Board( I used an Arduino UNO)
2. A hc-05 bluetooth module
3. An LDR
4. An FSR
5. 5 volt relays- 8 in number
6. Connecting wires

Step 2: Circuit Connection

Picture of Circuit Connection

Relay connection: Connect the 5v input of 8 relays to the digital pins 0,1,4,5,6,7,8 and 9 of the UNO board and short the gnd pins and connect them to gnd pin of the board. Give a common input voltage to the relays of 230V 50Hz AC. The output pins of the relays should be connected to the wire from electrical appliances connected to the switches in the switch board. Connect the output pins of relay 0 and 1 to the electrical lamps, 4 and 5 to the fans, 6 to the A.C, 7 to the water pump, 8 to the TV, and 9 to the kitchen chimney.

Bluetooth connection: Connect the Vcc and Gnd of the hc-05 to 5V and Gnd of the UNO board. Now connect the Tx and Rx of the module to digital pins 2 and 3.

Sensor connections: Connect the LDR and FSR to the 5V and then a 1K ohm resistor in series with each one of them, connected to the Gnd. Wires should be connected to the terminal of LDR/FSR with resistor. Wire coming from LDR resistor terminal should go to analog pin A0 and that coming from FSR resistor terminal should go to analog pin A2.


The circuit diagram is given. Including this the UNO board requires to be power using the usb cable or 2.1 channel.

Step 3: Programming

For programming the UNO board you need to have Arduino IDE in your PC.

Copy this sketch on a new ino file, compile it and then upload it to the UNO.






#include 

SoftwareSerial b(2,3);//bluetooth pins

int a=1,c=1,e=1,f=1,k=1,l=1,p=1,t=1,/*status of switches*/ks=0,ls=0,ps=0,/*status of sensors*/ldr=1023,/*light intensity to switch on lights*/prs1=0,/*water level to start pump*/prs2=1023/*water level to stop pump*/;

void setup()
{
Serial.begin(9600);
b.begin(9600);//bluetooth
pinMode(0,OUTPUT);//light pins
pinMode(1,OUTPUT);//light pins
for(int i=4; i pinMode(i,OUTPUT);
//analog pins taken as input by default
}
void loop()
{
while(b.available())
{
switch(b.read())
{
case 75://K sent
digitalWrite(0,k);
k=!k;//toggle switch
ks=0;
break;
case 76://L sent
digitalWrite(1,l);
l=!l;//toggle switch
ls=0;
break;
case 69://E sent
digitalWrite(4,e);
e=!e;//toggle switch
break;
case 70://F sent
digitalWrite(5,f);
f=!f;//toggle switch
break;
case 65://A sent
digitalWrite(6,a);
a=!a;//toggle switch
break;
case 80://P sent
digitalWrite(7,p);
p=!p;//toggle switch
ps=0;
break;
case 84://T sent
digitalWrite(8,t);
t=!t;//toggle switch
break;
case 67://C sent
digitalWrite(9,c);
c=!c;//toggle switch
break;
case 107://k sent
ks=1;
break;
case 108://l sent
ls=1;
break;
case 112://p sent
ps=1;
break;
case 73://I sent
ldr=analogRead(A0);//save light intensity to switch on lights
break;
case 87://W sent
prs1=analogRead(A2);//save water level to start pump
break;
case 88://X sent
prs2=analogRead(A2);//save water level to stop pump
break;
}}
if(ks==1)//check sensor status
{
if(analogRead(A0) digitalWrite(0,1);
if(analogRead(A0)>(ldr+25))
digitalWrite(0,0);
}
if(ls==1)//check sensor status
{
if(analogRead(A0) digitalWrite(1,1);
if(analogRead(A0)>(ldr+25))
digitalWrite(1,0);
}
if(ps==1)//check sensor status
{
if(analogRead(A2) digitalWrite(7,1);
if(analogRead(A2)>(prs2))
digitalWrite(7,0);
}
}

 

Step 4: Placing in your Room.

Place the board and the bluetooth module inside the switch board with the power wire connected.

The LDR and FSR should be connected with long wires. The LDR should be placed behind the lamp of the room where the lamp's light wont reach since we want it to sense the daylight only. Place the FSR below the water water tank of your room.

Remark: The FSR should be choosen according to the size, volume and weight of your water tank. It should sense more than the total filled up weight of the tank.

Step 5: FINALLY... Using your completely automated home.

These are the instructions for using the automation features of your completely automated home. For this you need to have an android app called arduino bt installed in your android mobile. You will get it on google play.
Connect the device to the hc-05 device. The pin is usually 1234. Start the application and start sending comands.

(In uppercase)
K to toggle the lamp 1 on/off.
L to toggle the lamp 2 on/off.
E to toggle the fan 1 on/off.
F to toggle the fan 2 on/off.
A to toggle the A.C on/off.
P to toggle the pump on/off.
T to toggle the T.V on/off.
C to toggle the chimney on/off.
I to save the light intensity at which the light should toggle on/off at sensor mode.
W to save the water level at which the pump should start.
X to save the water level at which the pump should stop.

(In lowercase)
k to connect lamp 1 to sensor mode.
l to connect lamp 2 to sensor mode.
p to connect pump to sensor mode.


Remark: Before using sensor mode the system requires the sensor levels to be set once( by sending I, W and X).

Leave a Reply