This project will demonstrate how a home automation system can be regulated from a PC. The project is based on Arduino UNO and uses a 434 MHz RF module to interface home appliances with the control circuit. A desktop based application will be used to pass control signals switching appliances ON or OFF on virtual serial port of the PC. The control signals will be read by the Arduino board and passed through the RF module. The home appliances will be interfaced to the RF receiver which will switch the appliances ON or OFF based on RF data using relay circuits.
For demonstration purpose, four 15 Watt bulbs will be switched ON or OFF in the project. However, any home appliance operating on 220-240 V 50 Hz AC supply can be interfaced and controlled by the project.

Fig. 1: Prototype of PC based Home Automation System
The project will have two circuits – a controller circuit that will be built on Arduino and will connect with the PC. The other will be an RF receiver circuit with which the home appliances will be interfaced through relay circuits. On PC, REALTERM application will be used to pass data serially to the Arduino board. The application will send single control characters to the Arduino. The Arduino will have program code to read serially received characters and send relevant data on RF module accordingly. The RF data will be converted to parallel data using decoder IC and the status of data bits of the received data will be used to drive the relays.
The Arduino sketch will be written using Arduino IDE and burnt to the Arduino board using AVR Dude.
Components Required –
Receiver Side:
1. Arduino UNO
2. Tx RF 433MHz module.
3. 16×2 LCD
4. Encoder IC (HT12E)
5. 1K and 1M ohm resistor
6. 5mm LED
7. 10K ohm PRESET
Transmitter Side:
1. 7805 and 7812 voltage regulators.
2. Rx RF 433MHz module.
3. Decoder IC (HT12D)
4. 1K and 47K ohm resistor.
5. 5mm LED
6. 12v Relay.
7. 10K ohm PRESET
8. Transistor (BC547)
9. Bulb holder
10. TWO pin plug
Block Diagram

Fig. 2: Block Diagram of PC based Home Automation System
Circuit Connections
There will be two circuits in the project – receiver circuit where the appliances to be controlled will be interfaced and transmitter circuit that will connect to the PC through Arduino board.
The transmitter circuit will be built on Arduino UNO and have the following components connected to the Arduino –
Personal Computer – The personal computer will run the desktop application to send control characters serially. The desktop application used will be REALTERM. REALTERM is a Hyperterminal software. A HYPERTERMINAL is a software which is used to send serial data using the serial port of the computer or laptop. Since nowadays, desktop systems or Laptops does not come with serial port, Virtual Serial Port can be used. A Virtual Serial port allows the USB port to function as a serial port and needs a USB to Serial Convertor cable to connect with the microcontroller board. The Arduino UNO also comes equipped with a virtual serial port named ARDUINO UNO (COM4) where COM number can be different in different Arduino boards. The REALTERM Hyperterminal application can be downloaded from the SourceForge.
Arduino UNO – The Arduino board will be receiving the control characters from the desktop application over virtual serial port. The Arduino sketch will read the control data over virtual serial port and transmit relevant RF data to control the appliances.
16X2 LCD – The LCD will be used to show the status of the devices controlled by the home automation system. It is connected to the Arduino board by connecting its data pins to pins 3 to 6 of the Arduino board. The RS and E pins of the LCD are connected to pins 13 and 12 of the Arduino UNO respectively. The RW pin of the LCD is grounded.

Fig. 3: Table listing circuit connections between Arduino Uno and Character LCD
The standard open-source library for interfacing LCD with Arduino UNO is used in the project. The library works as expected and needs no changes or modifications.
RF Transmitter – The RF transmitter will be used to transmit the control data to the receiver circuit. The RF transmitter module is a small PCB sub-assembly. The pin configuration of transmitter module is as follows-

Fig. 4: Table listing pin configuration of RF Transmitter
The serialized data from encoder is received at pin 2 of the module and passed on to the antenna from pin 4 of the module.
HT12E IC – The HT12E IC converts the parallel data into serial data for passing it to the RF transmitter. HT12E encoder IC belongs to the 212 series of encoders. It is paired with 212 series of decoders having the same number of addresses and data format. HT12E is capable of encoding 12 bits, out of them 8 are address bits and 4 are data bits. Thus the encoded signal is a serialized 12-bit parallel data comprising of 4-bit data to be transferred appended with the address byte. The data encoded by HT12E IC can be decoded and output in parallel mode as it is by HT12D IC.
The receiver circuit is a basic RF receiver setup connecting RF receiver and the HT12D decoder IC. The appliances will be connected to the data pins of the decoder IC via relay circuits. The relay circuits will have 12V relays connected to the data pins via BC547 transistors connected in common emitter configuration.
RF Receiver – The RF receiver detects the radio signal carrying the control data. The RF receiver module has 8 pins and has following pin configuration –

Fig. 5: Table listing pin configuration of RF Receiver
HT12D Decoder – The signal detected from the RF receiver is passed to the HT12D decoder. It converts the serial data back to the parallel data after separating data and addresses. HT12D belongs to the 212 series of decoders and can be paired with 212 series of encoders having the same number of addresses and data format. HT12D is capable of decoding 12 bits, out of them 8 are address bits and 4 are data bits. The appliances will be controlled by the parallel data received on the HT12D decoder IC. The data bits of the decoder IC will be used to drive the relays. The address byte of the decoder IC should be same as of the encoder IC to match the transmitter and receiver circuits. In the project, address byte of both the receiver and transmitter modules is set to 0x00.
Relays – The 12V 2A relays are used to switch the AC appliances ON or OFF in the project. The relays are connected to the data pins of the HT12D IC via BS547 transistor circuits connected in a common emitter configuration. The phase wire from the AC supply is connected at the COM terminal of the relays. When a HIGH logic is received at the data pins of HT12D, the COM point switches from NC to NO point and the relay short-circuits the phase with the neutral wire. The appliances are connected between the neutral and relays so the supply to them is switched ON when COM point switches to NO point.
Power Supply – Both the circuits will be powered by 5V DC supply. The 7805 voltage regulator is used to supply the desired voltage. The power can be drawn from a regular battery which can be connected to the 7805 IC. The IC has three pins – pin 1 should be connected to anode of the battery, pin 2 and 3 with the cathode (common ground). The 5V DC should be drawn from the pin 3 of the IC.
How the Project Works –
When the circuits are powered on, at the transmitter circuit, some initial messages are flashed on the LCD display showing the name of the project and the status of the devices as OFF. The Arduino board gets ready for reading the serial data. On the receiver circuit, the decoder IC gets the 0x0 nibble by default therefore tripping the relays to NC point by default. So, by default, the appliances are switched OFF.
When the transmitter circuit is connected to the PC and Hyperterminal application is launched, the user needs to set the baud rate for serial communication, select a port according to the port number noted beforehand and configure stop bit, parity and data bit settings. On clicking the change button on the GUI of the Hyperterminal application, the application gets ready to send characters serially.

Fig. 6: Screenshot of RealTerm application on Windows
The characters ‘W’, ‘S’, ‘A’ and ‘D’ will be used to switch ON or OFF the appliances controlled by D0, D1, D2 and D3 bits of the RF data respectively. A control character ‘Q’ is used to alter the status of all the devices together. The D0, D1, D2 and D3 bits are controlled by the pins 7, 8, 9 and 10 of the Arduino board respectively. By default, the appliances are switched OFF. When one of the characters is passed from the Hyperterminal application, the Arduino board reads the character and alternates the digital output at the respective pin HIGH or LOW depending upon the previous status of the pin. The same logic is passed on the RF data and output in parallel mode at the decoder IC in receiver circuit. When a data bit is set to HIGH logic, the relay connected at that decoder IC pin switches from NC to NO point and the respective appliances starts getting the supply. When a data bit is set to LOW logic, the relay connected at that decoder IC pin switches back to NC point and the respective appliance stops getting the supply.
Programming Guide –
The program code will run on the Arduino board. In the program code, first the standard open-source libraries of Arduino for interfacing LCD and Virtual Serial port are imported.
#include <SoftwareSerial.h>// import the serial library
#include <LiquidCrystal.h>//import the LCD library
An object of LCD class is declared and is mapped to the Arduino pins where LCD is connected. A variable to hold control character received serially is declared and variables a, b, c, d, and e are declared to keep track of device statuses. The pins 7, 8, 9 and 10 are assigned to variables ONE, TWO, THREE and FOUR respectively representing the devices.
LiquidCrystal lcd(13, 12, 6, 5, 4, 3);// Pins used for RS,E,D4,D5,D6,D7
int Data; // the data received from the app store here
int a=0,b=0,c=0,d=0,e=0; //used for key press or not
int ONE=7; //Digital pin 6 isS used to ON relay 1
int TWO=8; //Digital pin 7 is used to ON relay 2
int THREE=9; //Digital pin 8 is used to ON relay 3
int FOUR=10; //Digital pin 9 is used to ON relay 4
A setup() function is declared in which the baud rate for serial transmission of data to the LCD is set to 9600 bits per second using Serial.begin() function and the LCD is initialized using lcd.begin() function. The pins connecting with the relays are set to digital output using PinMode() function. Some initial messages are flashed on the LCD display indicating the purpose of the project and default OFF status of all the devices.
void setup() {
// Setup code to initialize all the user and predefined functions
Serial.begin(9600); //Software serial initialization
lcd.begin(16,2);//LCD 16×2 initialization
pinMode(ONE, OUTPUT);// Set pim 6 as OUTPUT
pinMode(TWO, OUTPUT);// Set pim 7 as OUTPUT
pinMode(THREE, OUTPUT); // Set pim 8 as OUTPUT
pinMode(FOUR, OUTPUT); // Set pim 9 as OUTPUT
lcd.setCursor(0,0); //Initially set the cursor position of LCD to 1st Columb 1st row.
lcd.print(“Engineers Garage”);//After initialising print data
lcd.setCursor(0,1); //Initially set the cursor position of LCD to 1st Columb 2nd row.
lcd.print(” “); //print blank to clear all the data on LCD
delay(3000);
lcd.setCursor(0,0);
lcd.print(” PC Based Home “);
lcd.setCursor(0,1);
lcd.print(” Automation “);
delay(3000);
lcd.setCursor(0,0);
lcd.print(“D1:OFF D2:OFF”); //Initially dispaly all are OFF
lcd.setCursor(0,1);
lcd.print(“D3:OFF D4:OFF”);//Initially dispaly all are OFF
}
The loop() function is called in which the characters passed over the virtual serial port are checked for availability using Serial.available() function and the passed character is read using Serial.read() function. The same character is passed to the computer using Serial.write() function to confirm the reception of control character. If the character received is ‘W’ corresponding to Device 1 connected at D0 bit of decoder IC, and if Device 1 is OFF traced by checking variable “a” set to 0, a HIGH logic is sent to the pin 7 using DigitalWrite() function and variable “a” is set to 1. If Device 1 is ON traced by checking variable “a” set to 1, a LOW logic is sent to the pin 7 using DigitalWrite() function and variable “a” is set to 0. The current status of Device 1 is updated on the LCD.
void loop() {
if (Serial.available()) // wait for the data to be available at the receiver buffer.
{
Data=Serial.read(); // Read the dat store it in the variable.
Serial.write(Data);
if(Data==’W’ && a==0){ // Checking the received number if found with the given condition
a=1; // “a” variable used to checked if button is pressed or not.
digitalWrite(ONE,1); //if pressed send HIGH value to the pin number 6
lcd.setCursor(3,0);
lcd.print(“ON “); //Display ON in the location 1st ROW and 3rd COLUMB
}
else if (Data==’W’ && a==1)
{// if character ‘W’ pressed ….
a=0;
digitalWrite(ONE,0);
lcd.setCursor(3,0);
lcd.print(“OFF”);
}
If the character received is ‘S’ corresponding to Device 2 connected at D1 bit of decoder IC, and if Device 2 is OFF traced by checking variable “b” set to 0, a HIGH logic is sent to the pin 8 using DigitalWrite() function and variable “b” is set to 1. If Device 2 is ON traced by checking variable “b” set to 1, a LOW logic is sent to the pin 8 using DigitalWrite() function and variable “b” is set to 0. The current status of Device 2 is updated on the LCD.
else if (Data==’S’ && b==0)
{// if character ‘S’ pressed ….
b=1;
digitalWrite(TWO,1);
lcd.setCursor(13,0);
lcd.print(“ON “);
}
else if (Data==’S’ && b==1)
{// if character ‘S’ pressed ….
b=0;
digitalWrite(TWO,0);
lcd.setCursor(13,0);
lcd.print(“OFF “);
}
If the character received is ‘A’ corresponding to Device 3 connected at D2 bit of decoder IC, and if Device 3 is OFF traced by checking variable “c” set to 0, a HIGH logic is sent to the pin 9 using DigitalWrite() function and variable “c” is set to 1. If Device 3 is ON traced by checking variable “c” set to 1, a LOW logic is sent to the pin 9 using DigitalWrite() function and variable “c” is set to 0. The current status of Device 3 is updated on the LCD.
else if(Data==’A’ && c==0)
{ // if character ‘A’ pressed ….
c=1;
digitalWrite(THREE,1);
lcd.setCursor(3,1);
lcd.print(“ON “);
}
else if (Data==’A’ && c==1)
{// if character ‘A’ pressed ….
c=0;
digitalWrite(THREE,0);
lcd.setCursor(3,1);
lcd.print(“OFF “);
}
If the character received is ‘D’ corresponding to Device 4 connected at D3 bit of decoder IC, and if Device 4 is OFF traced by checking variable “d” set to 0, a HIGH logic is sent to the pin 10 using DigitalWrite() function and variable “d” is set to 1. If Device 4 is ON traced by checking variable “d” set to 1, a LOW logic is sent to the pin 10 using DigitalWrite() function and variable “d” is set to 0. The current status of Device 4 is updated on the LCD.
else if (Data==’D’ && d==0)
{// if character ‘D’ pressed ….
d=1;
digitalWrite(FOUR,1);
lcd.setCursor(13,1);
lcd.print(“ON “);
}
else if (Data==’D’ && d==1)
{// if character ‘D’ pressed ….
d=0;
digitalWrite(FOUR,0);
lcd.setCursor(13,1);
lcd.print(“OFF “);
}
If the character received is ‘Q’ corresponding to representation of all the devices, and variable “e” set to 0, a HIGH logic is sent to the pins 7, 8, 9 and 10 using DigitalWrite() function and variable “e” is set to 1. If all devices are ON traced by checking variable “e” set to 1, a LOW logic is sent to the pins 7, 8, 9 and 10 using DigitalWrite() function and variable “e” is set to 0. The current status of all the devices is updated on the LCD.
else if (Data==’Q’ && e==0)
{// if character ‘Q’ pressed ….
e=1;
digitalWrite(ONE,1);
digitalWrite(TWO,1);
digitalWrite(THREE,1);
digitalWrite(FOUR,1);
lcd.setCursor(0,0);
lcd.print(“D1:ON D2:ON “); //Initially dispaly all are OFF
lcd.setCursor(0,1);
lcd.print(“D3:ON D4:ON “);//Initially dispaly all are OFF
}
else if (Data==’Q’ && e==1)
{// if character ‘Q’ pressed ….
e=0;
digitalWrite(ONE,0);
digitalWrite(TWO,0);
digitalWrite(THREE,0);
digitalWrite(FOUR,0);
lcd.setCursor(0,0);
lcd.print(“D1:OFF D2:OFF”); //Initially dispaly all are OFF
lcd.setCursor(0,1);
lcd.print(“D3:OFF D4:OFF”);//Initially dispaly all are OFF
}
else; } delay(100);
}
This ends the program code for PC controlled home automation system built on Arduino UNO.
Project Source Code
###
//Program to #include <SoftwareSerial.h>// import the serial library #include <LiquidCrystal.h>//import the LCD library LiquidCrystal lcd(13, 12, 6, 5, 4, 3);// Pins used for RS,E,D4,D5,D6,D7 int Data; // the data received from the app store here int a=0,b=0,c=0,d=0,e=0; //used for key press or not int ONE=7; //Digital pin 6 isS used to ON relay 1 int TWO=8; //Digital pin 7 is used to ON relay 2 int THREE=9; //Digital pin 8 is used to ON relay 3 int FOUR=10; //Digital pin 9 is used to ON relay 4 void setup() { // Setup code to initialize all the user and predefined functions Serial.begin(9600); //Software serial initialization lcd.begin(16,2);//LCD 16x2 initialization pinMode(ONE, OUTPUT);// Set pim 6 as OUTPUT pinMode(TWO, OUTPUT);// Set pim 7 as OUTPUT pinMode(THREE, OUTPUT); // Set pim 8 as OUTPUT pinMode(FOUR, OUTPUT); // Set pim 9 as OUTPUT lcd.setCursor(0,0); //Initially set the cursor position of LCD to 1st Columb 1st row. lcd.print("Engineers Garage");//After initialising print data lcd.setCursor(0,1); //Initially set the cursor position of LCD to 1st Columb 2nd row. lcd.print(" "); //print blank to clear all the data on LCD delay(3000); lcd.setCursor(0,0); lcd.print(" PC Based Home "); lcd.setCursor(0,1); lcd.print(" Automation "); delay(3000); lcd.setCursor(0,0); lcd.print("D1:OFF D2:OFF"); //Initially dispaly all are OFF lcd.setCursor(0,1); lcd.print("D3:OFF D4:OFF");//Initially dispaly all are OFF } void loop() { if (Serial.available()) // wait for the data to be available at the receiver buffer. { Data=Serial.read(); // Read the dat store it in the variable. Serial.write(Data); if(Data=='W' && a==0){ // Checking the received number if found with the given condition a=1; // "a" variable used to checked if button is pressed or not. digitalWrite(ONE,1); //if pressed send HIGH value to the pin number 6 lcd.setCursor(3,0); lcd.print("ON "); //Display ON in the location 1st ROW and 3rd COLUMB } else if (Data=='W' && a==1) {// if character 'W' pressed .... a=0; digitalWrite(ONE,0); lcd.setCursor(3,0); lcd.print("OFF"); } else if (Data=='S' && b==0) {// if character 'S' pressed .... b=1; digitalWrite(TWO,1); lcd.setCursor(13,0); lcd.print("ON "); } else if (Data=='S' && b==1) {// if character 'S' pressed .... b=0; digitalWrite(TWO,0); lcd.setCursor(13,0); lcd.print("OFF "); } else if(Data=='A' && c==0) { // if character 'A' pressed .... c=1; digitalWrite(THREE,1); lcd.setCursor(3,1); lcd.print("ON "); } else if (Data=='A' && c==1) {// if character 'A' pressed .... c=0; digitalWrite(THREE,0); lcd.setCursor(3,1); lcd.print("OFF "); } else if (Data=='D' && d==0) {// if character 'D' pressed .... d=1; digitalWrite(FOUR,1); lcd.setCursor(13,1); lcd.print("ON "); } else if (Data=='D' && d==1) {// if character 'D' pressed .... d=0; digitalWrite(FOUR,0); lcd.setCursor(13,1); lcd.print("OFF "); } else if (Data=='Q' && e==0) {// if character 'Q' pressed .... e=1; digitalWrite(ONE,1); digitalWrite(TWO,1); digitalWrite(THREE,1); digitalWrite(FOUR,1); lcd.setCursor(0,0); lcd.print("D1:ON D2:ON "); //Initially dispaly all are OFF lcd.setCursor(0,1); lcd.print("D3:ON D4:ON ");//Initially dispaly all are OFF } else if (Data=='Q' && e==1) {// if character 'Q' pressed .... e=0; digitalWrite(ONE,0); digitalWrite(TWO,0); digitalWrite(THREE,0); digitalWrite(FOUR,0); lcd.setCursor(0,0); lcd.print("D1:OFF D2:OFF"); //Initially dispaly all are OFF lcd.setCursor(0,1); lcd.print("D3:OFF D4:OFF");//Initially dispaly all are OFF } else; } delay(100); }
###
Circuit Diagrams
Project Video
Filed Under: Electronic Projects
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.