Notion of Home Automation using Arduino

 

Notion of home automation is to replace physical switch of home with anything which is automatic or different from physical switch, like by using sensor, timing based, controlling through web, mobile phone, remote control etc. In all same is done  by sending small switching signal (mainly D.C) to switch it, but at the same time it is little bit complex to design a DC triggering AC switch circuit. So to solve this problem we have a device called RELAY.
Relay is a electromechanical switch which we can use for AC switching and this switching can be control using a small DC supply.

RELAY CIRCUIT:

RELAY has a coil which is driven by a 12V or 5V DC supply. Once this driven voltage is applied, Relay will close the AC switch. So we need to control that driven voltage as per our wish, which can be done using a ARDUINO

                                                         SCHEMATIC DIAGRAMScreenshot (14)

                                                        WORKING CIRCUIT

100_0789

CONNECTING LCD:

To see how to connect a LCD display with Arduino click here

100_0774

CODE:

Code for automatic switching ON/OFF with interval of 1 minute.

#include<LiquidCrystal.h>
LiquidCrystal LCD(10,9,6,4,3,2);
int RelayPin=7;


void setup() {
pinMode(RelayPin,OUTPUT);
LCD.begin(16,2);
LCD.setCursor(3,0);
LCD.print("CFL LIGHT"); 

}
void loop(){
         digitalWrite(RelayPin,HIGH); 
              LCD.setCursor(7,1); 
              LCD.print("ON "); 
              delay(1000); 
         digitalWrite(RelayPin,LOW);
              LCD.setCursor(7,1); 
              LCD.print("OFF"); 
              digitalWrite(RelayPin,LOW); 
              delay(1000);
            }

Code for switching ON/OFF by giving command in serial monitor.

#include<LiquidCrystal.h>
LiquidCrystal LCD(10,9,6,4,3,2);
int RelayPin=7;
int commandsignal;


void setup() {
Serial.begin(9600);
pinMode(RelayPin,OUTPUT);
LCD.begin(16,2);
LCD.setCursor(3,0);
LCD.print("CFL LIGHT"); 

}
void loop() {
Serial.println("Switch the CFL bulb by typing below command");
Serial.println("1 : to switch ON the bulb");
Serial.println("2 : to switch OFF the bulb");

while(Serial.available() == 0 )
             {
             } 
commandsignal=Serial.parseInt();
if (commandsignal==1)
            {
              LCD.setCursor(7,1);
              LCD.print("ON ");
              digitalWrite(RelayPin,HIGH);
             }
             
if (commandsignal==2)
            {
              LCD.setCursor(7,1);
              LCD.print("OFF");
              digitalWrite(RelayPin,LOW);
            }
         
}

Leave a comment