0% found this document useful (0 votes)
207 views45 pages

RF Based Home Appliances Control System

This document describes an RF-based home appliance control system using Arduino. The system uses amplitude shift keying modulation with an Arduino-based transmitter and receiver. The transmitter section uses an Arduino microcontroller with an ASK module to communicate wirelessly with the receiver section. The receiver section controls relays to automatically switch appliances like lights on and off remotely by pressing buttons interfaced with the transmitter microcontroller. The system allows remote control of home appliances easily with little circuit complexity.

Uploaded by

James Ononiwu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
207 views45 pages

RF Based Home Appliances Control System

This document describes an RF-based home appliance control system using Arduino. The system uses amplitude shift keying modulation with an Arduino-based transmitter and receiver. The transmitter section uses an Arduino microcontroller with an ASK module to communicate wirelessly with the receiver section. The receiver section controls relays to automatically switch appliances like lights on and off remotely by pressing buttons interfaced with the transmitter microcontroller. The system allows remote control of home appliances easily with little circuit complexity.

Uploaded by

James Ononiwu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 45

RF Based Home Appliances Control

System using Arduino

Group Members
M.Mohsin Raza 2013-SECR-07
Muhammad Dildar 2013-SECR-13
M.Saeed Akhter 2013-SECR-27

Supervisor
Engr. Ahmad Bilal

Department of Electrical Engineering


Swedish College Of Engineering & Technology Rahim Yar Khan
Affiliated with
The Islamia University of Bahawalpur

Session 2013 – 2017

i
CERTIFICATE

Group Members

M.Mohsin Raza 2013-SECR-07


Muhammad Dildar 2013-SECR-13
M.Saeed Akhter 2013-SECR-27

A final year project report presented to Swedish College of


Engineering and Technology, in partial fulfilment of the
requirements of the degree of

Bachelor of Engineering Ele

Project Supervisor

Engr. Ahmad Bilal

External Examiner Signature:

Supervisor Signature:

Project Incharge Signature:

DEPARTMENT OF ELECTRICAL ENGINEERING


Swedish College Of Engineering & Technology Rahim Yar Khan
(2013-2017)

ii
Abstract

Now-a-days we use many electrical devices at homes, industries, offices,


institutions that are controlled manually. To control all electrical devices we need a lot of
“MAN POWER”. We need some wireless controlling systems. Wireless communication
systems can be based on any type of IR or RF communication system .This project uses
amplitude modulation technique of RF communication. The project comprises of arduino
based transmitter and receiver sections with ASK(amplitude shift keying) module for
communication b/w arduinos. This project is a demonstration of how to design and build
a multipurpose remotely controlled system that can switch OFF and ON any electrical
household appliance (including the security light), by pressing a button already interface
to a microcontroller that controls a relay for the automatic switching ON or OFF.

The results of this project show that a microcontroller is a very powerful


device for building smart electronic devices that can control electrical appliances, with
little circuitry complexities and components. This system can be helpful for elderly or
disabled persons who are unable to go to the switch board to control the devices.

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.3 Scope and Limitation.......................................................................................... 3

1.4 Goals....................................................................................................................3

Chapter 2..............................................................................................................................4

Literature Review................................................................................................................4

2.1 History of Home Appliances Control System.....................................................4

2.2 Home Appliances Control Systems.....................................................................4

2.2.1 Individual Control System.............................................................................. 4

2.2.2 Distributed Control System.............................................................................5

2.2.3 Central Control System................................................................................... 5

Chapter 3 Design and Hardware.......................................................................................6

3.1 Block Diagram.................................................................................................... 6

3.2 Schematic Diagram.............................................................................................7

vi
3.3 Hardware ............................................................................................................. 8
3.3.1 c ....................................................................................................................... 8

3.3.2 Pin Description ............................................................................................. 10

3.3.3 RF Module (Transmitter & Receiver)........................................................... 10

3.3.4 5v Relay Driver ............................................................................................. 13

3.3.5 Relay Switch ................................................................................................. 14

3.3.6 9v DC Supply ................................................................................................ 16

3.3.7 LCD .............................................................................................................. 16

3.4 Software Description ........................................................................................ 17

3.4.1 Arduino Integrated Development Environment ........................................... 17

Chapter 4 ............................................................................................................................ 19

Results and Observations ................................................................................................... 19

4.1 Introduction ....................................................................................................... 19

4.2 Hardware Testing .............................................................................................. 19

4.2.1 Arduino ......................................................................................................... 19

4.2.2 .......................................................................................................................... 19

4.2.3 LCD testing ................................................................................................... 20

Chapter 5 ............................................................................................................................ 20

Conclusions and Future Work ........................................................................................... 20

5.1 Conclusions ....................................................................................................... 21

5.2 Recommendation in Future Work ..................................................................... 21

Diagram ............................................................................................................................. 22

References .......................................................................................................................... 23

Appendix A ........................................................................................................................ 24

vii
Code for Arduino Nano Transmitter............................................................................. 24

Appendix B........................................................................................................................28

Code for Arduino Nano Reciever................................................................................. 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

OFF through an RF-controlled remote. This is an advanced technology for home

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.

Nowadays switches are located in different parts of a house and, therefore,

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

the control for any number of appliances in to a single control unit.

Home Appliances Control System is a useful and helpful way to manage


electrical appliances without any physical contact with the switch. This is possible by
utilizing the wireless communication technologies. In this project, an RF based home
Appliances Control system is implemented using Arduino.

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]

2.2 Home Appliances Control Systems


Home Appliances Control systems may designate electronic systems in
homes and residential buildings that make possible the automation of household
appliances. The new stream of home automation systems has developed into a vast
one and the current market is flooded with a flurry of home appliances control
systems and device manufacturers.[4]

The types of home appliances control systems based on their control systems are:

2.2.1 Individual Control System

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

The main feature of these type of systems is emergency shut-down. With


this system you can preset or change the control parameters of several similar devices,
for example, the thermostat of several air conditioners and their ON/OFF timings.

2.2.3 Central Control System

These are computerized systems programmed to handle all functions of


multiple utilities like air conditioning system, home entertainments, doors, windows,
refrigerators and cooking systems, all at the same time regardless of whether you are
at home or away. You can connect to the control system through telephone or internet
from anywhere in the world.[4]

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.

3.1 Block Diagram


RF remote that is interfaced to microcontroller on transmitter side .It sends ON/OFF
signals to the receiver. Receivers are connected with loads that can be turned ON/OFF by operating
remote switches.

The block diagram of both receiver and transmitter is given below :

Figure 1 Block Diagram for Transmitter

6
Figure 2 Block Diagram for Receiver

3.2 Schematic Diagram


Schematic Diagram explains the connection of hardware components so that it may be
programmed and work. After the connection it provide better results. It is basically the circuit diagram
of our project that we made on proteus and see the results.

Figure 3 Schematic Diagram for Home Automation

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]

Figure 4 Arduino Nano [6]

8
3.3.1.1 Specifications

Microcontroller Atmel ATmega328

Operating Voltage (logic level) 5V

Input Voltage (recommended) 7-12 V

Input Voltage (limits) 6-20 V

Digital I/O Pins 14 (of which 6 provide PWM output)

Analog Input Pins 8

DC Current per I/O Pin 40 mA

Flash Memory 32 KB (of which 2KB used by


bootloader)

SRAM 2 KB

EEPROM 1 KB

Clock Speed 16 MHz

Dimensions 0.70” x 1.70”

Table 1 Specifications of Microcontroller

9
3.3.2 Pin Description

Pin No. Name Type Description


1-2, 5-16 D0-D13 I/O Digital input/output port 0 to 13
3, 28 RESET Input Reset (active low)
4, 29 GND PWR Supply ground
17 3V3 Output +3.3V output (from FTDI)
18 AREF Input ADC reference
19-26 A0-A7 Input Analog input channel 0 to 7
27 +5V Output or +5V output (from on-board regulator) or
Input +5V (input from external power supply)
30 VIN PWR Supply voltage

Table 2 Arduino Nano Pin Description

3.3.3 RF Module (Transmitter & Receiver)

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]

Figure 5 RF Module [8]

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.

This RF module comprises of an RF Transmitter and an RF Receiver. The


transmitter/receiver pair operates at a frequency of 434 MHz. An RF transmitter receives serial data
and transmits it wirelessly through RF through its antenna connected at pin4. The transmission occurs
at the rate of 1Kbps - 10Kbps.The transmitted data is received by an RF receiver operating at the
same frequency as that of the transmitter.

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]

Figure 6 Pin Diagram for RF Module [8]

11
3.3.3.1 Pin Description

Pin Number Function Name

1 Ground (0V) GND

2 Serial Data Input Pin DATA

3 Supply Voltage (5V) VCC

4 Antenna Output Pin ANT

Table 3 Transmitter Pin Description

Pin Number Function Name


1 Ground (0V) GND
2 Serial Data Output Pin DATA
3 Linear Output Pin; Not NC
Connected
4 Supply Voltage (5V) VCC
5 Supply Voltage (5V) VCC
6 Ground (0V) GND

7 Ground (0V) GND

8 Antenna Input Pin ANT

Table 4 Receiver Pin Description

12
3.3.4 5v Relay Driver

In general, while designing electronics projects the loads are controlled


(switched ON or OFF) using microcontroller block. But, for this purpose the circuit
requires relays for controlled switches and isolation from high voltage oprating
appliances as well. Depending on the signals received from the microcontroller or other
control circuits the relay controls the load. The required current to run the relay coil is
more than can be supplied by microcontrollers .So, drivers provides sufficient current
relay needs to operate.

Figure 7 Relay Driver [9]

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

3.3.4.1 Pin Diagram

Figure 9 Pin Diagram for Relay Driver [9]

3.3.5 Relay Switch

Relay is an electromagnetic device which is used to isolate two circuits

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.

Figure 10 Relay Switch [10]

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

AC-DC adapter. This is a standard 110/240VAC to 9VDC 1000mA power


supply compatible with US power plugs. It can be used to power our part numbers BF430
and XS1000 serial to ethernet converters and all other products requiring a stable 9VDC
supply.

Figure 11 Dc supply 9v [11]

3.3.7 LCD

LCD (Liquid Crystal Display) screen is an electronic display module and


find a wide range of applications. A 16x2 LCD display is very basic module and is very
commonly used in various devices and circuits. These modules are preferred over seven
segments and other multi segment LEDs. The reasons being: LCDs are economical;
easily programmable; have no limitation of displaying special & even custom characters
(unlike in seven segments), animations and so on.

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]

3.4 Software Description

3.4.1 Arduino Integrated Development Environment

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.

Figure 13 Android IDE

18
Chapter 4

Results and Observations


4.1 Introduction
After finalization of our design we did the final testing in which all
components were included. This testing basically included the altogether working of the
circuit by operating as we want to control our appliances.

4.2 Hardware Testing


To avoid the future difficulties we test all the hardware parts that we are
using in the project.

4.2.1 Arduino

To test the Arduino board we connected it to the laptop .which powered it


.then through the software which is used to burn the program in the Arduino board IC
which is Atmega. then run it to see if the led on board blink .then we tested all ports of
board if the output voltages and currents are as per required rang. Analog and digital pins
are tested as digital I/O ports.
1. Pins D0 and D1 are regarded as tested if USB-channel works well.
2. Analog inputs A6 and A7 are tested in analog mode.

19

Figure 14 Arduino testing


4.2.2 LCD testing

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.

Figure 15 LCD testing

4.3 Software Testing


When any key is pressed, data is passed to the arduino nano and then to the
RF transmitter from where it is transmitted.

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

Conclusions and Future Work


5.1 Conclusions
The implementation of this project overall is successful. The motive of
making the project cost efficient and user friendly is taken into account and achieved. It is
evident from this project work that an individual control home appliance coontrol system
can be cheaply made from low-cost locally available components and can be used to
control multifarious home appliances ranging from the security lamps, the television to
the air conditioning system and even the entire house lighting system.

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).

5.2 Recommendation in Future Work


Finally, this home automation system can be also implemented over
Bluetooth, Infrared and WAP connectivity without much change to the design and yet still
be able to control a variety of home appliances. Hence, this system is scalable and
flexible.

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

Figure 16 Project Diagram

22
References
[1] Ajah, G, David, N, Abioye, A, Web Based Security System, Sch. J. Eng. Tech, Page
112-116, Edition 2013.

[2] Aru O E ,Ihekweaba G, Opara F K, Design Exploration of a Microcontroller Based


RF Remote Control 13amps Wall Socket, IOSRJCE, 11(1),Page 56-60, Edition 2013.

[3].Wikipedia (2016). Automation. From http://en.wikipedia.org/wiki/Automation.


Retrieved on 7/30/2016
[4] B & B Electronics (2016) http://www.bb-elec.com Retrieved on 29/03/2016

[5] From http://en.wikipedia.org/wiki/European_Home_Systems_Protocol. Retrieved on


8/4/2017
[6] From https://store.arduino.cc/usa/arduino-nano Retrieved on 12/08/2017

[7] From https://www.engineersgarage.com/electronic.../rf-module-transmitter-receiver


Retrieved on 5/6/2016

[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)

char msg[1] = {'X'};

vw_send((uint8_t *)msg, 1);

vw_wait_tx();

delay (5);

f=digitalRead(b);

if(f==1)

char msg[1] = {'Z'};

vw_send((uint8_t *)msg, 1);


25
vw_wait_tx();

delay (5);

g=digitalRead(c);

if (g==1)

char msg[1] = {'W'};

vw_send((uint8_t *)msg, 1);

vw_wait_tx();

delay (5);

if(e==0&&f==0&&g==0&&h==0)

char msg[1] = {'o'};

vw_send((uint8_t *)msg, 1);

vw_wait_tx();

delay (5);
26
}

h=digitalRead(d);

if (h== 1)

char msg[1] = {'Y'};

vw_send((uint8_t *)msg, 1);

vw_wait_tx();

delay (5);

27
Appendix B
Code for Arduino Nano Reciever

//Reciever code

#include <VirtualWire.h>

#include <LiquidCrystal.h>

LiquidCrystal lcd(6, 7, 9, 10, 11, 12);

int a;

int k;

int l;

int m;

int n;

int b;

int buz = 13;

int Out1 = 3;

int Out2 = 4;

int Out3 = 2;
28
int Out4 = 5;

int d;

int e;

char c;

const int receive_pin = 8;

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];

uint8_t buflen = 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

You might also like