Documente Academic
Documente Profesional
Documente Cultură
art Hom
me Autoomation
n using LabVIIEW
By
Bilal
B
Shaheeen
Hamza
H
Khaan
K
Kamil
Abbaas
neering in partial
p
fulfilllment of req
quirements for the
Thesiss submitted to the faculty of Engin
D
Degree
of BS Electricall Engineerin
ng
Department of
o Electricall Engineerinng,
E
and Applieed Sciences,,
Pakistan Innstitute of Engineering
N
Nilore,
Islamabad 456550, Pakistann
June, 20144
iii
Declaration of Originality
We hereby declare that the work contained in this thesis and the intellectual content of this
thesis are the product of our own research. This thesis has not been previously published in
any form nor does it contain any verbatim of the published resources which could be treated
as infringement of the international copyright law. We also declare that we do understand the
terms copyright and plagiarism, and that in case of any copyright violation or plagiarism
found in this work, we will be held fully responsible of the consequences of any such
violation.
Signature:.
Name: Bilal Shaheen
Signature:..
Name: Hamza Khan
Signature:.
Name: Kamil Abbas
Date: June, 2014
Place: PIEAS
iv
Certificate of Approval
Approved By:
Signature: ...
Supervisor: Dr. Haroon ur Rashid
Verified By:
Signature: ..
Head, Department of Electrical Engineering
Stamp:
Dedication
To our grandparents, parents and siblings
vi
Acknowledgements
Foremost, we would like to thank Almighty Allah, the most merciful and beneficent for
giving us the strength and courage to accomplish the task assigned to us. We would like to
express our sincere gratitude to our supervisor Dr. Haroon ur Rashid for the continuous
support of our Bachelors study and FYP.
Besides our advisor, we would like to thank the rest of my thesis committee: Dr. Ghulam
Mustafa and Dr. Arif Gilgiti for their encouragement, insightful comments and questions.
We thank our fellow-mates in PIEAS for the stimulating discussions, for the sleepless nights
we were working together before deadlines, and for all the fun we have had in the last two
years.
Last but not the least, we would like to thank our families for supporting us spiritually
throughout our academic life.
vii
Table
T
of Coontents
ginality ............................................................................................................. iii
Declaraation of Orig
Certificcate of Apprroval .................................................................................................................. iv
Dedicattion ....................................................................................................................................... v
Acknow
wledgementts ........................................................................................................................ vi
Table oof Contents ..........................................................................................................................vii
Table oof Tables ............................................................................................................................... x
Table oof Figures ............................................................................................................................. xi
Abstracct ....................................................................................................................................... xiii
1
Inttroduction ............................................................................................................................. 1
1.1
Overview
w .......................................................................................................................... 1
1.2
1.3
Objectivees ......................................................................................................................... 2
1.4
Litterature Revview.................................................................................................................... 4
2.1
Automation ....................................................................................................................... 4
2.2
History .............................................................................................................................. 4
2.3
2.3
3.1
Buildding Autom
mation ............................................................................................... 5
2.3
3.2
2.3
3.3
Indusstrial Autom
mation .............................................................................................. 5
2.3
3.4
Hom
me Automatiion .................................................................................................... 6
2.4
2.4
4.1
2.4
4.2
2.4
4.3
viii
2.5
2.55.1
Sensoors .................................................................................................................... 10
2.55.2
2.55.3
Ardu
uino UNO.......................................................................................................... 15
2.6
Communiication .............................................................................................................. 16
2.66.1
2.7
LabVIEW
W ....................................................................................................................... 19
2.77.1
3
Meethodology ......................................................................................................................... 21
3.1
3.2
3.22.1
XBeee ....................................................................................................................... 22
3.22.2
3.22.3
Addrressing of XBee
X
............................................................................................... 26
3.3
4
Typees of Comm
munication ....................................................................................... 16
4.2
4.3
L
system .............................................................................................. 35
External Lighting
5.2
Internal Lighting
L
sysstem................................................................................................ 37
5.3
Fire Alarm
m System ......................................................................................................... 39
5.4
Burglar Alarm
A
................................................................................................................ 40
5.5
5.6
ix
5.7
5.8
Conclusion ....................................................................................................................... 46
6.1
References ........................................................................................................................ 48
Table of Tables
Table 2-1- Comparison of Automation Control Systems ............................................................... 9
Table 2-2- Sensor Types ............................................................................................................... 10
Table 3-1- Comparison of NI DAQ with Arduino UNO .............................................................. 21
Table 3-2- Product Comparison (Series 1 vs. Series 2) ................................................................ 22
Table 3-3 - Pin out of XBee Series 2 ............................................................................................ 24
Table 3-4- API format for Remote AT Command Request .......................................................... 27
xi
Table of Figures
Figure 1-1- Overview of the automation system ............................................................................ 2
Figure 2-1 - Typical Centralized Systems ...................................................................................... 6
Figure 2-2 - Semi Distributed/Centralized Systems ....................................................................... 7
Figure 2-3 - Mesh Network of Distributed Systems ....................................................................... 8
Figure 2-4 - DAQ Systems ........................................................................................................... 10
Figure 2-5 - Temperature Sensor LM 35 ...................................................................................... 11
Figure 2-6 - Passive IR Sensor...................................................................................................... 11
Figure 2-7 - Smoke Detector......................................................................................................... 12
Figure 2-8- Typical block diagram of a DAQ card....................................................................... 13
Figure 2-9- NI USB 1208FS DAQ card ....................................................................................... 14
Figure 2-10- Arduino UNO .......................................................................................................... 15
Figure 2-11- NI LabVIEW............................................................................................................ 19
Figure 2-12- Processing acquired signal in LabVIEW ................................................................. 20
Figure 3-1- A typical ZigBee network .......................................................................................... 26
Figure 3-2 - Single Pole Double Throw ........................................................................................ 29
Figure 4-1- Proteus layout of XBee PCB ..................................................................................... 30
Figure 4-2- XBee Breakout Board ................................................................................................ 31
Figure 4-3- Programming XBee with X-CTU software ............................................................... 32
Figure 4-4- Relay Circuitry to switch load ................................................................................... 33
Figure 4-5- PCB layout of relay circuit ........................................................................................ 33
Figure 4-6 - Relay Module ............................................................................................................ 34
Figure 5-1- Block Diagram of LabVIEW controlled applications ............................................... 35
Figure 5-2- Front panel of external lighting system ..................................................................... 36
Figure 5-3- Back panel of external lighting system ...................................................................... 37
Figure 5-4- Front panel of internal lighting system ...................................................................... 38
Figure 5-5- Back panel of internal lighting system ...................................................................... 38
Figure 5-6- Front panel of fire alarm system ................................................................................ 39
Figure 5-7- Back panel of fire alarm system ................................................................................ 39
Figure 5-8- Front panel of burglar alarm system .......................................................................... 40
Figure 5-9- Back panel of burglar alarm system .......................................................................... 40
Figure 5-10- Front panel of temperature control system .............................................................. 41
xii
xiii
Abstract
In smart homes, information technology is used to control electrical equipment and to
converse with the surroundings. The technology is new and is still in the development phase.
Smart home automation system is capable of replicating the domestic activities performed on
daily basis such as light automation, security of the house, watering system and HVAC (heat,
ventilation and air conditioning). The backbone of the home automation system is LabVIEW
which provides the complete control in the form of GUI to the end-user. This home
automation system is made up of different subsystems, capable of controlling lights around
the house, fire and burglar alarm to warn the user and automating different daily routines. By
using an internet connection the system can be monitored from all over the world. The
prototype of the system has been developed with hardware which is easily available in
Pakistan. The hardware implementation and communication of a control system for house
automation using LabVIEW is discussed here. The prototype of the system not only monitors
the power used in the house but also helps in conserving the energy by allowing the user to
take full control of the system.
1 Introduction
1.1 Overview
Home automation within the recent years has seen much awaited progress. Although the
technology is present for quite some time but the recent advancements in the field of signal
acquisition and computer manipulations has really helped the process automation industry. Home
automation is actually a branch of automation. Automation systems use different kinds of
instruments to sense a change or anomaly in the behavior of a plant and then take the necessary
action against the detected change.
Home automation systems can detect and identify a change and then adjust the light intensity,
room temperature or control opening or closing of drapes based on the logic set by the user.
These type of features make the home automation smart, because it is making decisions on its
own. A user can set manually the number of changes to detect and then take the required action
according to the detected change. All these type of features of a home automation system can
make the life easier of elderly or those who are physically challenged.
The user gets a graphical interface to interact with different energy loads around the house. This
gives complete control over the appliances and the user can turn them on or off or can even
schedule time to dim the lights when needed.
1.3 Objectives
The objectives of our project are mentioned below:
Control and integration of security systems having the potential of sending emails to
warn user.
Power monitoring and data logging so that user can easily understand power utilization
going around the house.
Chapter two covers literature review on automation, different types of data acquisition
systems, different communication protocols and standards and software over which home
automation can be implemented.
Chapter three highlights the decisions that led to the selection of a particular component
and also, brief details on both hardware components and communication services used.
Chapter four discusses the hardware design and implementation with practical details of
the project design, construction and testing.
Chapter five includes the software implementation of the control system. The front panels
and back panels designed in LabVIEW have been discussed.
The last chapters concludes the project by summarizing the results, observations and
hurdles faced during the project. It also includes short comings and recommendations.
2 Literature Review
2.1 Automation
Automation includes the use of different control systems to run different equipment by using
computer technology. Automation reduces the requirement of human supervision. This not only
helps to increase the efficiency of the overall plant but also ensures consistent results.
We now live in the age of modern machines and intelligent systems. The need of having
automated systems is more than ever before. The fast paced economy trend demands faster
production rates which requires a more sophisticated and complex control of systems to achieve
the ever increasing demand of product supplies. In this situation, engineers analyze the problem
and try to overcome the hurdles with mathematical and programming tools.
Though the use of automation is increasing day by day, but there are still some domains where
automation cannot help us at all. The intelligent control systems cannot distinguish between
taste, smell or handwriting. Also these systems fail when it comes to strategic planning or
designing a federal law framework.
2.2 History
Automation existed around 1898 when Nikola Tesla patented the idea for a remote controlled
boat. This was the birth of remote administration which proved to be a precursor for automation.
In 1910, when mass production was popularized, a new kind of system was implemented by
Ford Inc. The systems used electric motors with a chain and the rig was commonly known as
sequential motion production. The idea of home automation originated during the Worlds Fairs
in late 1930s. Although the production and availability of electricity was scarce, the enthusiasts
and hobbyists kept on working the idea of home automation. In 1960s an engineer named Jim
Sutherland made an automation system but this was not commercialized due to the unavailability
of the basic framework. The term smart house was first used in 1984 by American Association of
House builders. The creation of microcontroller caused sudden reduce in the cost of electrical
control of products. In 1990s the concept of home automation gained prominence. The use of
computer and robotics rose to control equipment for the feasibility of user. Although the concept
became popular
p
but as there was not any sim
mplified prootocol to imp
mplement succh systems itt was
still not affordable by
b common man. ABI research
r
tellss that in 2012 the numbber of autom
mated
home rosse to 1.5 million
m
in US
S and this fiigure will riise to 8 milllion till 20117 as the cuurrent
analyses shows. [1]
Although
h the start of
o the autom
mation system
m used cablles to comm
municate witth controllerr and
devices. But since th
he advent off wireless tecchnology, thhe whole sceenario has chhanged a lott. The
a
system
s
to bee introduced in the markket was the X
X-10. Since then,
first wireeless home automation
many home automation systems have entereed the markeet and we arre witnessingg progress inn this
d by day.
domain day
2.3
2 Types of Auto
omation
There aree mainly fou
ur types of au
utomation diiscussed beloow:
2.3.1
1 Building
g Automa
ation
Building automation
n essentially
y means co
ontrolling thhe different devices prresent insidee the
network of a buildiing. This co
ould includee surveillannce systems,, power sysstems, and other
mechaniccal systems inside a building.
b
Most
M
of the building aautomation systems usee the
distributeed control sy
ystems for eaasier access in case of apppliance failuure.
2.3.2
2 Power Automati
A
ion
Power sy
ystem autom
mation, comm
monly known
n as power aautomation eemploy techhniques to coontrol
power pllants by usin
ng instrumen
ntation devicces and conttrol systems. Data is acqquired in forrm of
voltage or
o current waaveforms. Th
his acquired
d data is thenn sent to the database whhere the enggineer
or superv
visor uses th
he data for making
m
futurre decisions. The power system autoomation can even
perform fault detecttion and co
orrection wiithout humaan interferennce. The m
most used ppower
y Control an
nd Data Acquuisition or S
SCADA systtem.
automation system iss Supervisory
2.3.3
3 Industriial Autom
mation
Industriaal automation
n use differeent kinds of control to c arry out autoomation proocesses. Sincce the
industries now a days heavily relly on compu
uters and infoormation tecchnology, it bbecomes obvvious
utomation eq
quipment to monitor
m
and
d control diffferent parts oof the plant. Most of thee time
to use au
HMI (Hu
uman Mach
hine Interfacce) is used to monitor and controol the activiity of a proocess.
Industriaal automatio
on is used for processs control, eenergy manaagement annd environm
mental
managem
ment.
2.3.4
4 Home Automatio
A
on
Home au
utomation as discussed in
n the previou
us paragraphhs is the autoomation applied to houseehold
appliancees. It can incclude intellig
gent event triiggering, whhere the systtem takes ann action accoording
to the sig
gnal receiveed from the environmen
nt or the ort
rthodox scheeduled taskss e.g. turninng the
outdoor light
l
on and off at a speecific time. The
T basic puurpose of hoome automattion systemss is to
provide the
t user con
nvenience an
nd offer a mo
ore comfortaable and seccure life. In addition to these
and many
y other num
merous featurres, it can help
h
you savve energy, w
which is becooming a preecious
commodity in our co
ountry. The present hom
me automatioon systems can providee the user coontrol
over inteernet and thu
us enabling the user to monitor annd control hhis/her housee from anyw
where
around th
he world.[2]
2.4
2 Types of Auto
omation Systems
S
Automation systems have been present
p
for more
m
than a hundred yeears now andd have consttantly
evolved with
w the chaanging techn
nologies. Theese systems have changed from a siimple to com
mplex
schemes.. Based on the
t level off complexity
y, automationn systems aare further ccharacterizedd into
three majjor categoriees:
2.4.1
1 Centrali
lized Systtems
These sy
ystems are th
he oldest of automation
a
systems.
s
Alll the devicess are controllled or moniitored
from onlly one rack or control panel.
p
The systems
s
are usually lesss complex w
when it com
mes to
logic butt they requirre a lot of hardware
h
and
d space as th
the number oof inputs annd outputs ggo up,
because now
n
these in
nputs and ou
utputs would
d require sepparate data cables. Proggrammable L
Logic
Controlleer or PLC is based on thee same conccept. Block ddiagram is shhown in figuure 2-1.
2.4.2
2 Semi Diistributed
d/Centrallized Systems
Figu
ure 2-2 - Semi Distributed/Centr
D
ralized Systems
These sy
ystems are partially
p
disttributed and
d partially ceentralized coontrol systeems, as show
wn in
figure 2--2. This systtem also con
nsists of a main
m
controlller which ccontrols diffferent periphherals
attached to it throug
gh a field bus.
b
The perripherals connnected with
th the centraal controllerr also
contain a processor, and can be programmed
d separately from the ceentral controoller. This syystem
is a little bit more complex than the old centrral systems bbut provide more flexibiility. Thoughh this
a
ing and saves a good deal
d
of hardw
ware, the usser must repprogram the main
is very accommodat
controller to change the
t logic to desired
d
settin
ngs.
2.4.3
3 Distribu
uted Systtems
These are the new systems and are generallly more exppensive thann the rest of the types. T
These
type of systems
s
conttain multiplee subsystem
ms, each linkked together to form a m
mesh networrk, as
shown in
n figure 2-3. The commu
unication beetween the ssubsystems ccan be achieeved using ccables
or radio frequencies. Each roo
om of the house or bbuilding cann have its own subsyystem,
independ
dent of otherr subsystemss present insiide the wholle building. This subsystem is capabble of
controllin
ng the lights, temperatu
ure etc. on its
i own. Whhile this subbsystem conntrols the deefined
parameteers of the roo
om, the conttroller of the subsystem is controlledd by anotherr controller w
which
communicates with all
a the contro
ollers of all the
t subsystem
ms present innside a buildding.
Figu
ure 2-3 - Mesh Network
N
of Distrributed Systems
As the whole
w
system
m works in a mesh like network,
n
it iis not affecteed if one off the subsysteem is
taken dow
wn for main
ntenance or iff it malfuncttions. The leevel of flexibbility in this type of systtem is
more thaan the rest off the system
ms available in the past. A highly usser friendly interface ennables
the novicce user to customize th
he settings to
o suit his/heer needs. Thhough it is vvery flexiblee, the
system is also very complex and requires experience and knowledge to execute and maintain the
system.
Table 2-1- Comparison of Automation Control Systems
Categories
Centralized
Semi-Centralized/Decentralized
Pros
Cons
Simple
Complex
Lacking redundancy
Highly customizable
No extensive cabling required
Highly complex
Expensive
10
Figure 2-4
2 - DAQ Systeems
The phy
ysical quanttities can be
b temperatu
ure, light ettc. These pphysical pheenomena caan be
measured
d by differen
nt type of seensors availaable in the m
market. Somee of the com
mmon sensorrs are
given bellow.
Table 2-22 Sensor Typees
Sensor
Pheno menon
Thermoco
ouple, Therm
mistor
Tempeerature
Photo Sen
nsor
Light
Micropho
one
Sound
Potentiom
meter
2.5.1
1 Sensors
s
2.5.1.1 Temperatur
T
e sensors
They aree temperaturee sensors wiith voltage liinearly propportional to ddegree
centigrad
de. It works in a range of -55 to 15
50 degree ccentigrade. D
Due to
11
trimming and calibration at wafer level low cost is ensured. The current it draws is just 60uA.
Pin layout of LM35 is shown in figure 2-5.
Figure 2-5 Sensor LM 35
Temperature
There are many types of burglar alarms but the most common sensor we can use is PIR (passive
infrared) sensor. PIR sensors can be placed in the house to detect change if someone enters your
house.
12
2.5.1.4 Smoke
S
detecctor
It is a deevice that detects smoke which resullts in the eveent of fire staarting. Manyy smoke deteectors
work on the principlee of photoeleectric and ionization.
Two maiin types of sm
moke detecto
ors;
Optical
It is ligh
ht sensor in which theree is light so
ource like buulb and a leens to
focus its light in a form of beam.. In the absen
nce of smokke the light ppasses
straight through
t
in frront of the detector and if
i smoke is ppresent it cuuts the
path of light and ligh
ht reaches sensor
s
and trrigger the allarm as show
wn in
7.
figure 2-7
Ionization
2.5.2
2 Data Ac
cquisition
n Cards
Data Acq
quisition carrds, shown in
n figure 2-8,, act as a briidge betweenn the real phhysical worldd and
the digitaal world. It digitizes the incoming data so thatt the compuuter can inteerpret them. Data
Acquisitiion cards are used to prrocess the physical
p
quanntities after they have bbeen transfoormed
into electtrical signalss by sensing
g instrument.. As newer ttechnology hhas arrived, Data Acquissition
(DAQ) cards
c
with more
m
resolutiion and inpu
ut/output poorts are avaiilable in the market. Wee can
then exploit the disp
playing and processing capabilities
c
of a PC to further anallyze the acqquired
data. Eveen though th
he technology
y advances has
h brought in new techhniques, the bbasic structuure of
every DA
AQ card is allmost the sam
me. Every DAQ
D
containns a signal coonditioning ccircuitry whhich is
compriseed of an amp
plifier and an
nalog to digiital converteer, input/outpput ports andd microcontrroller
or microp
processor.
Data Accquisition Devices
D
are available in differennt types, m
mainly charaacterized byy IO
(input/ou
utput) ports,, sampling rate, resolu
ution and coost. DAQ ddevices are interfaced with
computerr in a num
mber of diffferent ways.. Most of tthe DAQ ddevices are PCI (Perippheral
13
Component Interconnect) and some are designed for mounting in board slots on a computer
motherboard.
Data Acquisition device interfaces with computer and exploits the processing power and display
capabilities of the PC. Usually a software package like NI LABVIEW, NI Measurement Studio,
Microsoft Visual C/C++, Visual Basic etc. is used to communicate and manipulate the acquired
data. Thus it offers powerful, flexible and economical measurement solution.
National Instruments (NI) is the leading DAQ card manufacturer in the world. Their devices are
usually very high grade and reliable. All their devices are compatible with a multitude of
software including LabVIEW. The NI DAQ cards are easy to setup and configure. [3]
2.5.2.1 NI-USB 1208FS
It is a USB 2.0 powered device that can be connected to a PC with analog and digital I/O. The
card features eight analog input channels. Each channel is 11-bit resolution input. Two output
ports with 12-bit resolution are available. When it comes to digital, 16 I/O channels can be
selected as input or output in two 8-bit ports. The maximum sampling rate that the card can
achieve is 50 kSamples/sec. The card comes with MCC DAQ software.
14
The NI-USB 1208FS, shown in figure 2-9, features two mode of inputs. The user can either set
Differential Input mode or the Single-Ended Input mode. The number of input channel decreases
two four when we use the differential mode.
Differential Mode
The signal input will have two channels with respect to ground. A signal HI and a signal LO pins
are used for one input. By doing this we are actually reducing common mode rejection noise,
which is helpful when there is electromagnetic interference or radio frequency interference. The
differential mode will have half number of inputs when compared to single-ended mode. If there
are n number of signals, the differential mode will require 2n wires or channel.
Single-Ended Mode
The signal input will have only one HI pin and a common LO pin. All the inputs have one
common LO pin while they have separate HI input. For example, if A/D board has 8 singleended inputs, there will be 8 HI pins while there will be only one LO pin common to all HI pins.
Single-ended mode is the most common and easiest way to transmit signals over the channel.
The single-ended mode is cheaper in a sense that it requires only n+1 wires or channels. The
widely used RS-232 system is an example of single-ended mode. [4]
15
2.5.3
3 Arduino
o UNO
nd 3.0 com
mpatible deviice shown iin figure 2-10. It is used in
Arduino UNO is a USB 2.0 an
duino UNO is mainly ssold as micrrocontroller board baseed on
multitudee of projectts. The Ard
ATmega 328 chip. The
T board supports
s
14 digital I/O pins. It alsoo have 6 annalog inputs. The
board can
n be program
mmed throug
gh the USB port with thhe Arduino ID
DE softwaree that comess with
the packaage.
Although
h the UNO can
c be used as DAQ caard, but its ssampling ratte is much loower than thhe NI
DAQ carrds. The max
ximum samp
pling rate thaat the UNO ccan achieve is about 5kS
Samples/sec..
Figure 2-102
Arduino UN
UNO
The Ard
duino UNO has an AD
DC with 10
0-bit resolutiion. The A
Arduino UNO
O communiicates
through serial
s
port by
y using its 0 (RX) and 1 (TX) pins. RX pin is ussed to receivve and TX ppins is
used to trransmit the data.
d
Althou
ugh the numb
ber of analo g channels iis less than tthat of a NI DAQ
card, butt it is inexpeensive and iss easily avaiilable. The oonly downsiide is the sloow samplingg rate
16
(30 Sam
mples/sec) an
nd the diffiiculty in intterfacing thhe Arduino UNO with LabVIEW. The
interfacin
ng will be diiscussed in th
he coming chapters. [5]
2.6
2 Comm
municatiion
Commun
nication is th
he process of
o transferrin
ng data from
m the data accquisition caard to the deesired
load. Wee are using wireless
w
com
mmunication in which deevices know
wn as XBee, based on ZiigBee
technolog
gy are used to
t transfer our signals frrom LabVIE
EW to load.
2.6.1
1 Types of
o Commu
unication
n
The two types of co
ommunicatio
on are poweer-line comm
munication aand wirelesss communicaation.
Wireless technology was chosen
n but the reaasons to droop power-linne Communnication wouuld be
briefly diiscussed.
2.6.1.1 Power-line
P
Communica
C
ation:
It is a co
ommunicatio
on technique in which a person moddulates the data and sendds it over thee line
and dem
modulates it at the receiivers end to
o read whatt informatioon was sendd. The differrence
between other comm
munications is
i that it doees not requirre any new wiring as thhe wiring ussed in
our homees is used fo
or sending in
nformation. This meanss all the deviices connectted to powerr line
can be co
ontrolled and
d monitored..
A carrierr in the range of 20 to 200 kHz com
mmonly know
wn as narrow
w band is m
modulated intto the
wiring of the house. The reason
n to use thiis band is too avoid inteerference wiith radio channel
y and it is not
n legal to operate
o
in the range of thhose frequenncies. The carrier is digiitized
frequency
and the each
e
receiverrs used havee an address and can be ccontrolled byy signals trannsmitted oveer the
line and decoded att the receiv
ver. So we can use devvices pluggged inside ppower sockeets or
permanen
ntly wire theem.
Advanta
ages:
No
N new wirin
ng was needeed.
Anything
A
plugged inside socket could
d be controllled.
Disadvan
ntages:
17
The use of power-lines wires inside homes is high, in fact everything that runs on
electricity is connected to power-line and as a result there is a lot of electrical noise which
comes in the path of transferring the data.
2.6.1.2 Popular Power-line Protocols in Home Automation
Some of the popular Power-line protocols used in home automation are briefly described in the
next subsections.
X-10:
It is one of the first few protocols which used power-line communication to connect devices. It
didnt receive any major upgrades and considered as an old technology. [6]
Insteon:
Insteon connects the devices together through power-line, radio frequencies or both. All Insteon
devices can receive, transmit and repeat messages without the need of a controller.
Universal Power-line Bus (UPB):
Like X-10 it uses existing home wires to communicate between devices but when comparing
reliability, functionality and cost it is far better.
The technique looked quite attractive at start but due to bad wiring in homes especially in our
country this technique could not be relied upon. [7]
Wireless Communication:
18
It is a communication technique in which data is transmitted over the air without the help of
electrical conductors. The radio waves are made to travel and the distance they travel varies from
device to device as the power requirements increases as the distance increases.
Advantages:
Wireless networks have the ability to get interfaced with the wiring system present in our
homes.
The system is flexible and can be easily shifted to another place when needed.
The running cost of wireless devices is quite low as not much energy is required to make
them work.
They can be installed in places which are not easily accessible and also in harsh
environmental conditions.
Disadvantages:
Radio frequencies are expected to get interference from nearby devices which also emits
radio frequencies.
The initial cost of installing and buying is too high to attract interested people.
The radio signals get distorted while passing through walls, ceilings and floors. The main
information initially sent might get lost.
19
Wi-Fi:
It is already a famous technology and many manufactures are developing their products which
are compatible with Wi-Fi devices. Many devices in home uses Wi-Fi and interference with
smart devices that are needed to be controlled and monitored is likely to happen. The device
equipped with Wi-Fi technology consumes a lot of power and application like controlling lights
is not feasible with it.
ZigBee:
ZigBee technology is based upon IEEE 802.15.4 radio specification and usually operates in 2.4
GHz frequency. The main objective was to develop low cost and low power consuming packet
based radio protocol. It uses mesh networking to communicate between devices and is highly
reliable. [8, 9]
It was decided to use ZigBee due to its numerous advantages, not over power-line but also over
other wireless protocols.
2.7 LabVIEW
LABVIEW is widely used in many industrial applications. Custom applications that interact with
real time problems can be designed in LabVIEW. LabVIEW has been used as the brain in this
project and acts as the control for the entire smart home automation system. LABVIEW provides
a wide variety of tool in a single interface, confirming that simple task such as drawing wires
ensures compatibility. LABVIEW is an application designing software and itself contains a lot of
components as shown in figure 2-11.
20
LabVIEW
W analyzes the
t block diagram and compiles
c
it tto create a pproficient maachine code.. This
machine code avoidss the disadvantages relaated with perrformance thhat are associated with other
languagees. LabVIEW
W can also break down the
t applicatiion into mannifold threadds which cann then
be run in
n parallel pro
oviding efficcient results and better ccontrol as coompared to a single threeaded
serial app
plication. LaabVIEW pro
ovides option for both ggraphical proogramming and a code to be
written by
b the user in
i C but thee graphical programming
p
g is consideered more feeasible becauuse it
provides the ease of combining
c
a number of modules alreeady provideed by the software. One node
is conneccted with thee other by means
m
of wirees. The whoole sketch alsso gives a general idea aabout
the physiical realizatiion of the system. Furth
hermore LabbVIEW provvides remotte access thrrough
internet making
m
it easy for the usser to controll his applicaation sitting iin any part oof the world.
2.7.1
1 Using DAQs
D
with
h LabVIE
EW
LabVIEW
W can comm
municate witth the outer world
w
usingg different kiinds of hardw
ware periphherals.
In most cases,
c
a DAQ
Q card is used to obtain
n the data froom the real w
world. The ddata obtained can
be manip
pulated at useers will.
There aree different ty
ypes of anallysis available in LabVIE
EW. One caan perform ccurve fitting,, take
FFT of th
he acquired signal, timee and frequen
ncy analysiss and much more. The aacquired datta can
be displaayed in graph
hs, tables an
nd with a GU
UI for the endd user. The iinformation flow is show
wn in
figure 2-12.
21
3 Methodology
3.1 Selection of DAQ card
As discussed in the previous chapter that we had two options to select from the available DAQs
in the market. We went ahead to purchase the Arduino UNO because of the following reasons.
We wanted a system that has at least 5 analog inputs and more than 5 outputs.
We needed a system that was real time and had a good sampling rate (more than
10Samples/sec).
NI USB-1208FS
Arduino UNO(ATmega328 )
Digital Inputs
14 I/Os
Sampling Rate
50k Samples/Second
Resolution
10 bit
Counters
1 (32 bit)
Operating
Conditions
5 volts
5 volts
EEPROM
1KB
1KB
Conversion Time
10s
110s
Price
$300
$30
Analog Inputs
22
3.2
3 Modees of Com
mmunica
ation
3.2.1
1 XBee
The com
mmon misconception is that peoplee think that XBee and ZigBee are identical thhings.
XBees arre digital rad
dios that may
y or may no
ot be using Z
ZigBee experrtise like eveeryone nowaadays
possessess a cellphon
ne with Wi-F
Fi and it caan be used tto downloadd and transfeer data. Thinnk of
XBee as the cellphon
nes and ZigB
Bee as the Wi-Fi.
W
3.2.1.1 Types
T
of XBee
There aree many typees of XBees available in
n the market.. We selecteed two of thee XBees, serries 1
type and series 2 typee. A brief co
omparison beetween the tw
wo is made in the next ffew lines
Series 1 XBee
The chip
p used is man
nufactured by
b Freescalee to offer higgh quality pooint to pointt communicaation.
The stand
dard followeed is just 802
2.15.4 firmw
ware which iss faster than ZigBee.
Series 2 XBee
p used is manufacture
m
ed by Ember Networkks in whichh different type of ZiigBee
The chip
standardiized mesh neetworking caan be implem
mented. Thee ZigBee meesh network is unsurpasssed in
low poweer scenarios.
The both
h types of Xbees are further diviided in XBeees and Xbbees-Pro verrsions. The only
differencce between th
hem is that in Pro versio
ons power traansmission ccapacity is hhigher. [10]
Table 3-2- Product Co
omparison (Seriies 1 vs. Series 2)
Characteeristics
Indoor/Urban ran
nge
XBee Serie s 1
up to 100
1 ft. (30m))
3 ft. (100m
m)
Outdo
oor RF line--of-sight ran
nge up to 300
XBee Series 2
uup to 133 ft. (40m)
uup to 400 ft. (120m)
23
1 mW (0dbm)
2 mW (+3dbm)
RF Data Rate
250 Kbps
250 Kbps
Supply Voltage
2.8 - 3.4 V
2.8 - 3.6 V
45 mA (@ 3.3 V)
40 mA (@ 3.3 V)
50 mA (@ 3.3 V)
40 mA (@ 3.3 V)
Power-down Current
10 uA
1 uA
Frequency
Dimensions
0.0960" x 1.087"
0.0960" x 1.087"
Operating Temperature
-40 to 85 C
-40 to 85 C
PCB,
Antenna Options
Integrated
Whip, PCB,
U.FL, RPSMA
Network Topologies
Number of Channels
Whip,
U.FL, RPSMA
Direct
Sequence 16
Channels
PAN
Filtration Options
Integrated
ID,
Direct
Sequence
Channels
Channel
Source/Destination
& PAN
ID,
Channel
&
Source/Destination
The XBee Series 2 is equipped with ZigBee technology and it was decided to buy XBee Series 2.
The discussions made in later sections will be related with XBee Series 2 and the name XBee
will be used for Series 2 chip. [11]
24
Self-healing mesh
It automatically figures out if one or more radios were missing and repair any broken link.
Working of XBee
The XBee module connects to a host device through a logic level asynchronous port. Using its
serial port XBee can connect to any logic and voltage compatible UART.
3.2.1.3 Serial Interface Protocols
Transparent Operation
When operating in this mode all serial data received through Data in pin simply line up for radio
frequency transmission. The data send out through Data out pin after radio frequency data is
received.
Application Programming Interface (API) Operation
In API mode all data entering and leaving is contained in frames which describes the action of
the XBee modules. The frame allows the UART devices connected to communicate with the
network capabilities of the modules.
Table 3-3 - Pin out of XBee Series 2
Pin No.
Name
Direction
Default State
Description
Vcc
Power Supply
Dout
Output
Output
Din/Config
Input
Input
UART Data In
DIO12
Both
Disabled
Digital I/O 12
Reset
Both
RSSI
PWM/DIO10
Open-Collector with
Pull-up
Both
Output
Module Reset
RX Signal Strength Indicator
/Digital IO
DIO11
Both
Input
Digital I/O 11
[reserved]
Disabled
Do not Connect
25
DIO8
8
Both
B
Input
Diggital IO 8
10
GND
D
G
Ground
11
DIO4
4
Both
B
Disabled
Diggital IO 4
Clear to sennd Flow Conttrol or
12
CTS/DIIO7
Both
B
Output
digital IO 7. C
CTS, if enablled is an
ooutput.
13
ON/Sleeep
Ou
utput
Output
14
VREF
F
In
nput
15
DIO5
5
Both
B
Output
Diggital IO 5
Request to ssend flow coontrol,
16
RTS/DIIO6
Both
B
Input
Digital IO 6. R
RTS, if enablled, is an
input
17
AD3/DIIO3
Both
B
Disabled
A
Analog Inpuut 3 or Digitaal IO 3
18
AD2/DIIO2
Both
B
Disabled
A
Analog Inpuut 2 or Digitaal IO 2
19
AD1/DIIO1
Both
B
Disabled
A
Analog Inpuut 1 or Digitaal IO 1
Both
B
Disabled
20
AD0/DIIO0
3.2.2
2 XBee ZiigBee concepts
XBee can
n be configu
ured as threee device typ
pes Coordinaator, Router and End deevice as show
wn in
figure 3-1.
3.2.2.1 Coordinator
C
r
When sett in this mod
de the modulle is in charg
ge of setting up the netw
work. In eachh network thhere is
one coordinator and to start the network
n
a ch
hannel and P
PAN ID is asssigned. It allows routerrs and
26
3.2.3
3 Address
sing of XBee
X
To transffer informattion between
n radios onee should knnow the desttination adddress of the radio
receiving
g the informaation. Each XBee
X
module is assigneed with a diffferent 64 bitt address andd this
is fixed. Then there is
i dynamic short 16 bit address
a
assiggned by coorrdinator to oother radios. For a
network this address is unique.
27
Byte
Example
Description
0x7E
0x00
28
0x10
0x17
0x52
0x00
0x13
0xA2
0x00
0x40
10
0x77
11
0x9C
12
0x49
13
0xFF
14
0xFE
15
0x02
16
0x44(D)
17
0x02(02)
18
0x04
Command Parameter
19
0xF5
Checksum
0x0000000000000000 = Coordinator
0x000000000000FFFF = Broadcast
Byte 0 indicates the start of the byte which is 7E and byte 1 and 2 informs about start of byte
which is 0 and length of frame which is 16 bytes long respectively. All the numbers written here
are in hexadecimal as XBee is programmed to recognize numbers in hexadecimal. Byte 3 gives
information about frame type and 17 is an AT command request. Byte 4 is Frame ID which
acknowledges whether the other side has received the information or not. The next 8 bytes are to
29
write the serial address of the destination radio. It can be set 000000000000FFFF to set it as
broadcast meaning it will connect to nearest available XBee. The next two bytes are recipients
network address and setting it too FFFE will make it a broadcast. The next byte is about remote
command options and setting it to 02 will allow the XBee to make changes immediately. The
byte 16 and 17 are going to be the commands send to the remote XBee. The byte 18 contains any
parameters to be set. The last 19th byte is checksum which is needed to be accurate otherwise
XBee wont perform any function it was assigned to do. It is the sum of bytes after the byte
length. [12]
30
4 Ha
ardware Imp
plemen
ntation
4.1
4 Conn
necting th
he XBee to
t Arduino
XBee pins are too small to en
nter inside any
a breadbooard so PCB
B were madde as the boards
compatib
ble with XBeee were rath
her expensiv
ve. The RX ((data in) pinn of Arduinoo is attachedd with
TX (dataa out) pin off XBee Coo
ordinator and
d the TX pi n Arduino iis connectedd with RX ppin of
XBee. Th
he layout of PCB is show
wn in figure 4-1. The finnal PCB is shhown in figuure 4-2.
31
32
33
4.3
4 Relay
y Circuit
To conneect the load
d with routerr XBee a reelay circuit w
was needed. It was dessigned in Prroteus
software and consistted of relayss, diodes, NPN
N
transistoors, DC suppply, resistoors and load. The
figure 4-4
4 below shows the layou
ut in Proteuss.
J2
6 V DC supply
J
J1
1
2
1
2
2
220V
AC
R
RL1
G
G5CLE-14-DC5
D1
DIODE
J4
J
J3
1
2
R1
Q1
TIP122
12R
1
2
LOAD
X
XBee
output
Figure 4-5- PC
CB layout of relaay circuit
34
The figure 4-5 shows the PCB tracks made in Proteus. The Figure 4-6 above shows the final
relay PCB.
35
5 Software Implementation
The smart home control system has been divided into five parts or subsystems as shown in figure
5-1. Each subsystem can be taken out from the network without affecting other subsystems
functionality. All these subsystems can be accessed over the internet and desired variation can be
achieved. The first subsystem is the external lighting system. It controls all the external lighting
around the house. The second subsystem is the internal lighting system which basically controls
the ceiling lighting. The third subsystem is the fire alarm system. It detects the presence of fire
and warns the user in pre-programmed way. The fourth subsystem is the security unit of the
house. It is basically a burglar alarm system. The fifth subsystem is the temperature control of
the system and can be adjusted according to users desire.
EXTERNAL
LIGHTING
INTERNAL
LIGHTING
TEMPERATU
RECONTROL
LABVIEW
BURGLAR
ALARM
SYSTEM
FIRE
ALARM
SYSTEM
36
light and it decreases as light intensity increases. Thus as potential drop across LDR varies goes
below than 3.5v the system turns on the light and when it goes above the particular threshold
then the lights are turned off. The graphical interface shows a LED which shows the current
status of lights that whether they are turned on or off. Moreover the user is also provided with a
manual switch to change the status of lights at his or her own will. The system also shows a
waveform chart continuously detecting the change in potential drop across the LDR. Moreover a
stop switch is present to turn off the system in case of a malfunctioning as shown in figure 5-2.
In the back panel the programming for this system is done. Initially the settings for the
communication port are done. The Baud rate is kept at 9600. Then after initializing the
communication port LabVIEW takes input from Arduino UNO card and upon receiving this
input compares it with a threshold i.e. if the input is less than 0.3v then a Boolean true occurs but
if input is greater than 0.3v then a Boolean false occurs. On receiving a Boolean true serial write
is performed. A string is serially written into Arduino and then Arduino acts accordingly. On
receiving a Boolean false another string is written which tells Arduino to turn off the system for
the particular time being. After this the session is closed. The back panel of external lighting
system is shown in the figure 5-3.
37
38
In the back panel firstly the communication port is initialized. LabVIEW then receives the
analog input and then uses a greater than or equal to block to compare the input with a threshold
of 3.3v. If input is greater than or equals to 3.3v a Boolean true occurs. When Boolean true is
present the output is turned on for a particular time being (as selected by the user) regardless of
the input state during that time instance. After that time instance the input is sampled again.
Upon receiving a Boolean false again a string is written which tells Arduino to turn off the
system for the particular time being. The whole system is placed in a while loop so that the
whole system keeps repeating unless the emergency stop is pressed. The back panel is shown in
the figure 5-5.
39
In the back panel input is received by LabVIEW and then the input is compared through a
greater than or equal to block with a value of 2v. The serial write is placed in a case structure. In
case of a Boolean true the system maintains this true state for a particular time instant. During
this time instant the alarm will stay on. LabVIEW will send a particular string to Arduino in case
of a true and a different string in case of a false. Upon receiving this string Arduino will send
corresponding signal to transceivers. The back panel is shown in the figure 5-7.
40
The back panel for the burglar alarm system is similar to that of the fire alarm system. Upon
receiving the input from the sensor it will be compared with a particular threshold and then upon
receiving a Boolean true serial data will be send to Arduino. Then Arduino will perform the
corresponding function accordingly. The back panel is shown in the figure 5-9.
41
In the back panel after initialization of communication port input is received. This input is then
furthermore compared with a particular threshold as recommended by the used i.e. whether air
conditioners should be working at 35oC or 40oC and then after comparing, Boolean true or false
is created. Upon receiving a true LabVIEW writes a particular string serially to Arduino telling
the card to perform a particular function. On receiving a false LabVIEW writes a different string
which tells Arduino to turn off the particular output. The back panel is shown in figure 5-11
below.
42
43
44
45
5.8
5 Contrrol acrosss the Glo
obe
The userr will be ab
ble to contro
ol this system sitting frrom anywheere in the w
world through the
World Wide
W
Web. The
T user willl be provideed with a paarticular UR
RL. By usingg this addresss the
user wou
uld be able to
t see the fro
ont panel off the system on his screeen and woulld able to coontrol
the system
m. The automation systeem can be op
perated from
m a browser like shown iin the figuree 5-15
below.
Figure 5-15- Fiinal GUI: Accesssing Front Paneel through internnet browser
46
6 Conclusion
This project presents a novel technique to implement a smart home automation system
which is both affordable and can be easily replicated with locally available equipment. The
automation system is based on a star network and each subsystem communicates with the central
control. This eliminates interference and we can take down any subsystem for maintenance
without affecting the working of other subsystems in the automation system. The automation
system is controlled through LabVIEW software and the accessibility of data over the internet
enables the user to access the system from anywhere in the world.
During the course of completion of this project, a lot of problems were faced. Configuration of
XBees with Arduino UNO and LabVIEW is difficult. There is no complete support over the
internet and no library of XBee in NI LabVIEW, which makes it difficult to interface and
communicate with the module.
The automation system based on LabVIEW is not capable of detecting fault. The system
can be made to detect faults as the technology progresses.
The automation system uses PIR sensors, which can be triggered by house pets. Also PIR
sensors work best in cold to moderate temperature environment. PIR with 360o can be
used to accurately detect human occupants.
The home automation system uses sensors that are easily available. Most of the sensors
are cheap and doesnt provide a high resolution.
The system is not standalone and requires the server to be powered on for 24 hours. This
means that the server needs a UPS.
If the server crashes or is hacked in, the whole automation system is compromised.
47
The system only controls the ON/OFF state of load. It cant control the speed in case of
fan or thermostat in case of AC. A more elaborate system can be designed which involves
reed relays.
48
7 References
[1] ABI Research 1.5 Million Home Automation Systems Installed in the US This Year. 2014.
URL: https://www.abiresearch.com/press/15-million-home-automation-systems-installed-inth.
[2] B. Hamed, Design & Implementation of Smart House Control Using LabVIEW, vol. 1, issue
6, IJSCE, January 2012.
[3] Measurement Computing, USB 12-Bit DAQ Device with 8 Analog Input and 16 Digital I/O.
February 2014.
URL: http://www.mccdaq.com/usb-data-acquisition/USB-1208FS.aspx
[4] National Instruments, Introduction to Data Acquisition, May 2014.
URL: http://www.ni.com/white-paper/3536/en/
[5] Arduino, Arduino Board Uno, 2014.
URL: http://arduino.cc/en/Main/arduinoBoardUno
[6] Smarthome, What is X10, 2014.
URL: http://www.smarthome.com/sh-learning-center-what-is-x10.html.
[7] SmartHomeUSA , About UPB Technology, 2014 .
URL: https://www.smarthomeusa.com/info/UPB/about
[8] Digital Trends, ZigBee vs Z-Wave vs Insteon: Home automation protocols explained, 2014.
URL: http://www.digitaltrends.com/home/zigbee-vs-zwave-vs-insteon-home-automationprotocols-explained/#!IZN7S
[9] Digi International, ZigBee Wireless Standard,2014.
URL: http://www.digi.com/technology/rf-articles/wireless-zigbee
[10]
Digi International, The Major Differences in the XBee Series 1 vs. the XBee Series 2,
2014.
URL: http://www.digi.com/support/kbase/kbaseresultdetl?id=2213
[11]
R. Faludi, Building wireless sensor networks, Beijing: OReilly & Associates, 2010.
[12]
URL: http://www.digi.com/support/kbase/kbaseresultdetl?id=3222