RF Based Home Appliances Control System
RF Based Home Appliances Control System
Group Members
M.Mohsin Raza 2013-SECR-07
Muhammad Dildar 2013-SECR-13
M.Saeed Akhter 2013-SECR-27
Supervisor
Engr. Ahmad Bilal
i
CERTIFICATE
Group Members
Project Supervisor
Supervisor Signature:
ii
Abstract
iii
Acknowledgement
First of all, I would like to express my sincere thanks and great gratitude to
my parents. In the name of Allah, the Most Merciful and beneficent, all praises to
Almighty Allah for His blessings in completing this project. We pray from the sole of our
heart that we utter His blessings throughout the life.
We would like to express our gratitude to all those who motivated us to
complete this project. We are deeply indebted to our Advisor Sir Ahmed Bilal who
helped by giving suggestions and encouragements in project making and thesis writing.
We must appreciate the efforts of our Faculty of Electrical Engineering
who provided us enough enthusiasm and passion that we could do this project
successfully. Not only the final year but the time interval of four years with this faculty
was much motivating that we could develop skills in ourselves. They realized us that
nothing is difficult and nothing is impossible, every task can be achieved with
determination and intention.
The great appreciation goes to the rest of Lab Staff also that helped us time
to time during the project. They always helped and supported us with their practical
experience. There was too much to learn from those people which helped us in making
this project successful in time. Besides, this project makes us realize the importance of
working together as a Team which challenges us every minute.
Last but not the least we would like to thank all our friends and all those who
worked with us and also those friends who were a continuous source of inspiration and
encouragement for us. The whole program really brought us together to appreciate the
true values of friendship and respect each other.
iv
Dedication
This project is dedicated to our Parents who never failed to give us financial
and moral support and for teaching us that even the toughest task can be accomplished if
it is done with determination.
v
Table of Contents
CERTIFICATE.................................................................................................................... ii
Abstract.............................................................................................................................. iii
Acknowledgements............................................................................................................ iv
Dedication............................................................................................................................v
List of Figures.....................................................................................................................ix
List of Tables....................................................................................................................... x
Chapter 1 Introduction......................................................................................................1
1.1 Aim......................................................................................................................2
1.2 Objective............................................................................................................. 2
1.4 Goals....................................................................................................................3
Chapter 2..............................................................................................................................4
Literature Review................................................................................................................4
vi
3.3 Hardware ............................................................................................................. 8
3.3.1 c ....................................................................................................................... 8
Chapter 4 ............................................................................................................................ 19
4.2.2 .......................................................................................................................... 19
Chapter 5 ............................................................................................................................ 20
Diagram ............................................................................................................................. 22
References .......................................................................................................................... 23
Appendix A ........................................................................................................................ 24
vii
Code for Arduino Nano Transmitter............................................................................. 24
Appendix B........................................................................................................................28
viii
List of Figures
Figure 1 Block Diagram for Transmitter............................................................................ 6
Figure 2 Block Diagram for Receiver.................................................................................7
Figure 3 Schematic Diagram for Home Automation.......................................................... 7
Figure 4 Arduino Nano [6]..................................................................................................8
Figure 5 RF Module [8]....................................................................................................10
Figure 6 Pin Diagram for RF Module [8].........................................................................11
Figure 7 Relay Driver [9]..................................................................................................13
Figure 8 Schematic for ULN2003.....................................................................................14
Figure 9 Pin Diagram for Relay Driver [9].......................................................................14
Figure 10 Relay Switch [10].............................................................................................15
Figure 11 Dc supply 9v [11]............................................................................................. 16
Figure 12 Lcd Diagram.....................................................................................................17
Figure 13 Android IDE..................................................................................................... 18
Figure 14 Arduino testing................................................................................................. 19
Figure 15 LCD testing...................................................................................................... 20
Figure 16 Project Diagram................................................................................................22
ix
List of Tables
Table 1 Specifications of Microcontroller.......................................................................... 9
Table 2 Arduino Nano Pin Description.............................................................................10
Table 3 Transmitter Pin Description................................................................................. 12
Table 4 Receiver Pin Description..................................................................................... 12
x
Chapter 1
Introduction
In the present day, security systems play an important role in the
protection of lives and investment. This is achieved by the incorporation of various
subsystems into the security system with a single control unit such as surveillance,
intruder control, access control, fire detection, etc. A smart home is one that is
equipped with lighting, heating, and electronic devices that can be controlled remotely
by Remote or via smart phone [1]. Home Appliances Control gives an individual the
ability to remotely control things around the home. A home appliance is a device or
instrument designed to perform a specific function, especially an electrical device,
such as a refrigerator, for household use. The words appliance and devices are used
interchangeably. Appliances Control lowers the human judgment to the lowest degree
possible but does not completely eliminate it. The concept of remote management of
household devices over the internet from anywhere, any time in the world today can
be a reality. Assume a system where from the office desk, the user could view the
status of the devices and decides to take control by tuning his TV set to his favourite
channel, turns on the cooling system, say the air conditioner, and switches on or off
some of the lights. This user could walk back home and only find a very comfortable,
pleasant home. The recent developments in technology which permit the use of
Bluetooth and Wi-Fi have enabled different devices to have capabilities of connecting
with each other [2]. With this in mind, an RF based home Appliances Control system
for remote control of home appliances is designed.
1
1.1 Aim
The aim of this project is to design and construct a home Appliances
Control system that will remotely switch on or off any household appliance connected
to it, using a microcontroller.
1.2 Objective
The main objective of this project is to control home appliances by using
RF technology, which helps to turn the electrical loads such as light, and fan ON and
Appliances Control as it is used to make homes very smarter without requiring any
switches on the walls. This Appliances Control is achieved with the help of arduino
microcontroller.
to switch on such switches someone has to go there and press them to turn the loads
on or off. Hence, this project is proposed to control home appliances through an RF.
With this system, by pressing selected switch of a remote its corresponding load can
be controlled. Home Appliances Control reduces the physical efforts and integrates
2
1.3 Scope and Limitation
This project work is complete on its own in remotely switching on and
off of any electrical appliance not limited to household appliances. It does not
implement control of multiple appliances or automatic detection of faults in the
controlled appliance.
1.4 Goals
i. Enable any user in this modern world to us it for different task in different
fields.
ii. Establish an efficient modal.
iii. To provide low cost solution.
iv. Easy to use
3
Chapter 2
Literature Review
2.1 History of Home Appliances Control System
Home Appliances Control System has been around since the world war 1
(1914), in fact, the television remote (a simple Home Appliances Control system) was
patented in 1893. Since then different home appliances control systems have evolved
with a sharp rise after the second World War. It's growth has been through various
informal research and designs by technology enthusiasts who want a better way of
getting things done at home without much effort on their part. The systems evolved
from one that can do routine chores like switch on and off security lights, to more
sophisticated ones that can adjust lighting, put the television channel to favourite
station and control doors. [3]
The types of home appliances control systems based on their control systems are:
These types were the first to hit the market in the early years, here each
device like the heater or the air conditioner will have an independent control
dedicated to it.
4
2.2.2 Distributed Control System
5
Chapter 3
Design and Hardware
In this project , we control home appliances by using RF technology, which helps to
turn the electrical loads such as light, and fan ON and OFF through an RF-controlled remote. This is
an advanced technology for home automation as it is used to make homes very smarter without
requiring any switches on the walls. All the hardware and components were searched and calculated
and then ordered or installed for maximum efficiency and feasibility.
6
Figure 2 Block Diagram for Receiver
7
3.3 Hardware
Important components used in this project are listed below
i. Arduino Nano
ii. RF Module (Transmitter & Receiver)
iii. 5v Relay Driver ULN2003
iv. 5v Relay Switch
v. 9v DC Supply
vi. LCD
vii. Buzzer
viii. Push Buttons
ix. Lamps
3.3.1 c
Arduino Nano is a surface mount breadboard embedded version with integrated USB. It
is a smallest, complete, and breadboard friendly. It has everything that Diecimila/Duemilanove has
(electrically) with more analog input pins and onboard +5V AREF jumper. Physically, it is missing
power jack. The Nano is automatically sense and switch to the higher potential source of power, there
is no need for the power select jumper.[5]
8
3.3.1.1 Specifications
SRAM 2 KB
EEPROM 1 KB
9
3.3.2 Pin Description
The RF module, as the name suggests, operates at Radio Frequency. The corresponding
frequency range varies between 30 kHz & 300 GHz. In this RF system, the digital data is represented
as variations in the amplitude of carrier wave. This kind of modulation is known as Amplitude Shift
Keying (ASK). [7]
10
Transmission through RF is better than IR (infrared) because of many reasons. Firstly,
signals through RF can travel through larger distances making it suitable for long range applications.
Also, while IR mostly operates in line-of-sight mode, RF signals can travel even when there is an
obstruction between transmitter & receiver. Next, RF transmission is more strong and reliable than IR
transmission. RF communication uses a specific frequency unlike IR signals which are affected by
other IR emitting sources.
The RF module is often used alongwith a pair of encoder/decoder. The encoder is used for encoding
parallel data for transmission feed while reception is decoded by a decoder. HT12E-HT12D, HT640-
HT648, etc. are some commonly used encoder/decoder pair ICs. [7]
11
3.3.3.1 Pin Description
12
3.3.4 5v Relay Driver
ULN2003 is a high voltage and high current Darlington array IC. It contains
seven open collector Darlington pairs with common emitters. A Darlington pair is an
arrangement of two bipolar transistors. [10]
Each channel or Darlington pair in ULN2003 is rated at 500mA and can withstand peak
current of 600mA. The inputs and outputs are provided opposite to each other in the pin
layout. Each driver also contains a suppression diode to dissipate voltage spikes while
driving inductive loads. The schematic for each driver is given below:
13
Figure 8 Schematic for ULN2003
14
electrically and connect them magnetically. They are very useful devices and allow one
circuit to switch another one while they are completely separate. They are often used to
interface an electronic circuit (working at a low voltage) to an electrical circuit which
works at very high voltage. For example, a relay can make a 5V DC battery circuit to
switch a 230V AC mains circuit. Thus a small sensor circuit can drive, say, a fan or an
electric bulb.
A relay switch can be divided into two parts: input and output. The input
section has a coil which generates magnetic field when a small voltage from an electronic
circuit is applied to it. This voltage is called the operating voltage. Commonly used relays
are available in different configuration of operating voltages like 6V, 9V, 12V, 24V etc.
The output section consists of contactors which connect or disconnect mechanically. In a
basic relay there are three contactors: normally open (NO), normally closed (NC) and
common (COM). At no input state, the COM is connected to NC. When the operating
voltage is applied the relay coil gets energized and the COM changes contact to NO.
Different relay configurations are available like SPST, SPDT, DPDT etc, which have
different number of changeover contacts. By using proper combination of contactors, the
electrical circuit can be switched on and off. Get inner details about structure of a relay
switch.[10]
15
3.3.6 9v DC Supply
3.3.7 LCD
16
Figure 12 Lcd Diagram
A 16x2 LCD means it can display 16 characters per line and there are 2
such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two
registers, namely, Command and Data.
The command register stores the command instructions given to the LCD. A
command is an instruction given to LCD to do a predefined task like initializing it,
clearing its screen, setting the cursor position, controlling display etc. The data register
stores the data to be displayed on the LCD. The data is the ASCII value of the character
to be displayed on the LCD. [7]
The open-source Arduino Software (IDE) makes it easy to write code and
upload it to the board. It runs on Windows, Mac OS X, and Linux. The environment is
written in Java and based on Processing and other open-source software. This software
17
can be used with any Arduino board.It contains a text editor for writing code, a message
area, a text console, a toolbar with buttons for common functions and a series of menus.
It connects to the Arduino and Genuino hardware to upload programs and communicate
with them. Programs written using Arduino Software (IDE) are called sketches. These
sketches are written in the text editor and are saved with the file extension .ino. There are
two special functions that are a part of every Arduino sketch: setup() and loop() . The
setup() is called once, when the sketch starts. It's a good place to do setup tasks like
setting pin modes or initializing libraries. The loop() function is called over and over and
is heart of most sketches.
18
Chapter 4
4.2.1 Arduino
19
To check the results of lcd we connect it with Arduino and Arduino with
laptop and run a code named HelloWorld. The pins used on Arduino are 2,3,4,5,6,7. As
result we see HelloWorld on the screen.
The RF receiver receives this data and gives it to the arduino nano. The
arduino nano serially converts the serial bit data into four-bit data at a port of
microcontroller ATmega328p. The microcontroller energizes the corresponding relay
through a relay driver. Devices are connected to normally-open (N/O) contacts of the
relays.
20
Chapter 5
And better still, the components required are so small and few that they
can be packaged into a small inconspicuous container. The designed home appliance
control system was tested a number of times and certified to control different home
appliances used in the lighting system, air conditioning system, heating system, home
entertainment system and many more (this is as long as the maximum power and current
rating of the appliance does not exceed that of the used relay).
This project can be further developed to control more than one home
21
appliance at once through the use of short message service texts rather than remotely
though it will be more expensive and will require more relay circuits, making it a
distributed control home automation system. Also, to cut the cost of mobile phone, the
project may be implemented using standalone GSM modems that only perform
specialized functions like text messaging and/or phone calls. This GSM modems often
are cheaper and more reliable than GSM mobile phones.
Diagram
22
References
[1] Ajah, G, David, N, Abioye, A, Web Based Security System, Sch. J. Eng. Tech, Page
112-116, Edition 2013.
[8].Fromhttps://www.engineersgarage.com/electronic-components/rf-module-transmitter-
receiver Retrieved on 12/08/2017
[9]Fromhttp://www.edgefxkits.com/blog/relay-driver-circuit-using-uln2003-ic/ Retrieved
on 12/08/2017
[10] From https://www.engineersgarage.com Retrieved on 5/7/2017
[11] From http://www.electronics-tutorials.ws/io/io_5.html Retrieved on 12/08/2017
[12].Fromhttps://www.amazon.com/Wall-Adapter-Power-Supply-650mA/dp/B003XZSZ
WO Retrieved on 12/08/2017
23
Appendix A
Code for Arduino Nano Transmitter
//Transmitter code
#include <VirtualWire.h>
int e;
int f;
int g;
int h;
int a = 2;
int b = 3;
int c= 4;
int d= 5;
void setup()
{Serial.begin(9600);
pinMode(a, INPUT);
pinMode(b, INPUT);
pinMode(c, INPUT);
pinMode(d, INPUT);
vw_set_tx_pin(12);
24
vw_setup(5000);
void loop()
e=digitalRead(a);
if (e== 1)
vw_wait_tx();
delay (5);
f=digitalRead(b);
if(f==1)
delay (5);
g=digitalRead(c);
if (g==1)
vw_wait_tx();
delay (5);
if(e==0&&f==0&&g==0&&h==0)
vw_wait_tx();
delay (5);
26
}
h=digitalRead(d);
if (h== 1)
vw_wait_tx();
delay (5);
27
Appendix B
Code for Arduino Nano Reciever
//Reciever code
#include <VirtualWire.h>
#include <LiquidCrystal.h>
int a;
int k;
int l;
int m;
int n;
int b;
int Out1 = 3;
int Out2 = 4;
int Out3 = 2;
28
int Out4 = 5;
int d;
int e;
char c;
void setup()
{ digitalWrite(buz, LOW);
digitalWrite(Out1, LOW);
digitalWrite(Out2, LOW);
digitalWrite(Out3, LOW);
digitalWrite(Out4, LOW);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("SCET RYK");
Serial.begin(9600);
delay(100);
vw_set_rx_pin(receive_pin);
29
vw_set_ptt_inverted(true);
vw_setup(5000);
vw_rx_start();
pinMode(buz, OUTPUT);
pinMode(Out1, OUTPUT);
pinMode(Out2, OUTPUT);
pinMode(Out3, OUTPUT);
pinMode(Out4, OUTPUT);
digitalWrite(Out1, LOW);
digitalWrite(Out2, LOW);
digitalWrite(Out3, LOW);
digitalWrite(Out4, LOW);
void loop()
uint8_t buf[VW_MAX_MESSAGE_LEN];
if (vw_get_message(buf, &buflen))
30
{ c = buf[0];
Serial.println(c);
if (buf[0] == 'Z') {
a = digitalRead(Out1);
delay(100);
digitalWrite(buz, HIGH);
delay(400);
digitalWrite(buz, LOW);
digitalWrite(Out1, !a);
if (buf[0] == 'X')
e = digitalRead(Out4);
delay(100);
31
digitalWrite(buz, HIGH);
delay(400);
digitalWrite(buz, LOW);
digitalWrite(Out4, !e);
if (buf[0] == 'Y')
b = digitalRead(Out2);
delay(100);
digitalWrite(buz, HIGH);
delay(400);
digitalWrite(buz, LOW);
digitalWrite(Out2, !b);
if (buf[0] == 'W')
32
d = digitalRead(Out3);
delay(100);
digitalWrite(buz, HIGH);
delay(400);
digitalWrite(buz, LOW);
digitalWrite(Out3, !d);
k = digitalRead(2);
l = digitalRead(3);
m = digitalRead(4);
n = digitalRead(5);
lcd.setCursor(0, 0);
lcd.print("B1=");
if (k == 0) {
lcd.print("off ");
if (k == 1) {
lcd.print("on ");
}
33
lcd.setCursor(9, 0);
lcd.print("B2=");
if (l == 0)
lcd.print("off");
if (l == 1)
lcd.print("on ");
lcd.setCursor(0, 1);
lcd.print("B3=");
if (m == 0)
lcd.print("off ");
Serial.println("off");
if (m == 1)
lcd.print("on ");
Serial.println("on");
34
}
lcd.setCursor(9, 1);
lcd.print("B4=");
if (n == 0)
lcd.print("off");
if (n == 1)
lcd.print("on ");
35