HOME AUTOMATION
Home Automation System
The emerging market of home automation devices is encouraging
application engineers to think of solutions that integrate number of features
into a single system.
T
AKSHAT GUPTA, APPLICATION ENGINEER, CYPRESS SEMICONDUCTOR INDIA
hrough their innovative ideas and far
sighted thinking they try to come up with
highly effective and reliable system.
These system not only enable the user to
access his home appliances remotely
and automate his daily chores but also to think of a
solution which addresses most of the his security
concerns in minimum number of chips.
This article talks about such a solution and is
divided broadly into 4 parts
1. Sensors
Different sensors and their interfacing with the main
controller is covered in this section
2. Communication between these sensors
This section covers how to send signal over existing
power lines and interfacing Bluetooth for wireless
connectivity.
3. User Control and feedback: Control through
mobile phones using Mobile Application via
Bluetooth, SMS and DTMF tones is covered in this
section along with control via internet. It also covers
how the user will know whether device has started
working or not once user gives ON/OFF
command.
4. Security measures to prevent intrusion.
Security measures for intrusion prevention using
existing sensors and surveillance cameras are
covered under this section.
Sensors
Sensors are an inherent part of any system and they
act as senses for that system. Let’s start with motion
sensor.
Motion Sensor
This section covers motion sensing using
pyroelectric sensor.
Human beings generate IR radiation. At normal
body temperature, they radiate strongest in the
infrared region, at a wavelength of 9.4µm. A
pyroelectric sensor is made of ceramic material that
generates a surface charge when exposed to
Fig2: Use of Fresnel Lens
Fig3: PIR sensor interface circuit
infrared radiation. This property is used for the
detection of motion. PIR sensor can also trigger
false detection from vibration, radio interference,
sunlight etc. To avoid this dual sensors are
connected out of phase such that any excitation that
is common to both the sensors cancels out. When a
body passes in front of the sensors, it excites the first
one and then the second sensor. Hence there is a
change in sign of the differential output with the
movement of the body from one side of the sensor
to the other side. This change in sign can be used to
detect motion Also to optimize for human
detection, a filter window is added to limit the
incoming radiation to a range of 8 µm to 14 µm
range which is most sensitive to human body
radiation. To improve the range and detection
angle of the sensor, Fresnel Lens are used. It
concentrates the incoming IR radiation to the
sensor. Fresnel lens has large aperture and short
focal length. Figure 3 explains the interfacing circuit
of PIR sensor with electrical devices.
PIR sensor can be used for following purposes:1. For controlling corridor light or any other area
where light is not required continuously thus saving
power.
HOME AUTOMATION
2. Direction sensing by monitoring the differential
output between the two sensing areas inside a PIR
sensor
Door Sensors
Door sensor can be made using capacitive sensing;
change in capacitance between two metal plates is
detected and is converted into counts. The opening
and the closing of the door is detected from the
value of these counts.
Any conductive object has its own capacitance that
is determined by its geometry and
dimensions. When other conductive, non-charged
objects are located close to the conductive object
,the electric field induces charges on these objects
and increases the capacitance. The capacitance
between two metal plates is calculated using the
following formula.
C=A εr ε0/ D
Where
C is capacitance
A is surface area of the plates
D is the distance between two plates.
ε0 is permittivity of free space
εr is relative permittivity
A small metal plate can be attached on the top
portion of the door and a chip capable of sensing
change in capacitance can be mounted on the wall
with a close proximity to the door. When the door is
closed, the capacitance will increase because of
the close proximity with metallic strip. Using this
method we can even detect very slight movement of
opening the door. The other method to detect
whether door is open or closed is to use reed
switches. Reed switch has 2 ferrous metal reeds in a
hermetically sealed glass envelope. A complete
wireless module can be made using a reed switch,
micro-controller and a RF module. This complete
module can be inserted in the door after drilling a
hole. A magnet can be placed on the door such
Fig 4: Door sensor using capacitive sensing
Fig 5: Door sensor using reed switch
that it’s near to the sensor.
Based upon the proximity of magnet and sensor,
door position can be detected.
Glass break sensor
These sensors are used to detect any intrusion in the
home through windows. There are many types of
glass break sensors and they work on different
principles, they can be selected based upon the
cost and requirement. The basic sensor is mounted
on the glass itself and they usually have a
microphone which monitors the noise and vibration
coming from glass. These sensors trigger the output
if the vibration exceeds a fixed threshold. Some
sensors are tuned to glass shattering frequencies
and some use complex algorithms to find out the
glass break from one or multiple glasses. But these
sensors can be easily identified by the thief because
of their visibility to naked eyes. To avoid this, other
glass break sensors can be used which can be
mounted anywhere on walls or ceiling and they
process sound and shock in parallel and also check
the duration to detect the glass break accurately.
Light intensity sensor
These sensors can be used to control the intensity of
porch lights based upon the ambient light. Ambient
light can be measured using a LDR. LDR is a light
dependent resistor whose resistance will vary based
upon the light falling upon it. In the circuit shown in
figure 6, the voltage at input of ADC will vary
according to incident light, thus after processing
that value the intensity of porch light can be
changed. If the light is LED based then it can be
controlled using LED driver IC, in case of
incandescent lamp the intensity can be controlled
by changing the firing angle of thyristor. Generally
a System on Chip with inbuilt power peripherals
Fig 6: Control of LED lamp intensity based upon ambient light
FRAM
and FETs or a micro controller with external FETs
and power peripherals is used to control LEDs in a
lamp.
Moisture sensor
Moisture sensors can be used to control the
sprinklers for watering the garden. They can be
fixed in the soil and based upon the water level of
soil sprinklers will be switched on for a particular
period of time. It will save the water and make sure
that plants are watered timely.
Temperature/Smoke Sensor
Temperature sensors can be used to switch ON
AC/Fan when the temperature rises above a
particular temperature, they can also be used to
control fan intensity. Also the ON time period of a
geyser can be controlled dynamically as per the
outside temperature
Smoke sensors are used for detecting fire at an
early stage. They can be connected near to ironing
Fig 7: Detection of fire and temperature sensing.
area, near to kitchen or any other fire prone area.
In case of fire it will trigger alarm and switch on
water sprinklers.
In case of emergency like short circuit, fire, etc. the
lights on the path of safe exit can be illuminated
using the backup batteries.
Window Sensor
Reed sensor can be connected on one sash of
window and magnet on another sash. Circuit will
be similar as they were for glass sensors. To hide
and prevent the damage of sensor by outside world
small laser light can be fixed on one side and photo
diode on the other side, if someone tries to intrude,
the light will be interrupted and alarm can be
triggered on this event.
There are many other sensors which can be really
useful in home automation. The interfacing of these
sensors is easy and it is left to the readers to
research and interface them in their homes:
1. Gas Sensor: LPG gas detection can be fitted in
kitchen. Smoke sensors which detect CO and other
gases emitted during cooking can be used to
control the speed of exhaust fan/electrical chimney.
2. Water level sensor: It can be used to switch the
water pump ON/Off for filling the water tanks if
required.
3. IR sensors at gates and windows to detect any
intrusion.
4. Timers can be used to control the ON period of
electrical devices where continuous operation is
not required like geyser, coffee machine etc.
5. RFID tag can be fixed on the car for auto
detection to open the shutter of car garage.
Communication between these
sensors
Proper communication channel between different
sensors and processing units makes sure that
signals are communicated properly within a home.
There are different medium of connecting sensors either through wires or wireless, both have pros and
cons over each other. The best method is to use a
trade-off on both of them as per the requirement as
well as factors like distance between sensors, cost
and ease of use.
Powerline Communication(PLC)
PLC is the way of communicating data from one
device to another over the existing power lines
within the home, thus it saves a lot of work and cost
required for rewiring. Data can be transferred over
AC or DC lines. Data to be transferred is modulated
with high frequency signal using frequency shift
keying and then it is coupled over existing power
lines. There are specific ICs available in the market
which takes care of modulation in the device itself.
External circuit is required to amplify the outgoing
and incoming data. To couple the modulated data
over existing power lines a transformer is required.
For consumer use with CENELEC protocol, 125140KHz frequency is used for modulation.
CENELEC protocol ensures that only one device
communicates at a time, thus improving reliability.
ICs used for PLC take care of the protocol and data
Fig 8: Interfacing of electrical devices using powerline
communication
FRAM
can easily be transferred over power lines. PLC
devices can be fitted at different locations in the
home along with other devices. Electrical
appliances can be directly interfaced with PLC
device along with an interface circuitry.
Below is an example of interfacing an LED lamp
with PLC. PLC device will provide brightness
information to LED driver, which in turn will control
the current to change the brightness of LEDs.
Fig 9: LED lamp interfaced through PLC
Bluetooth with PLC
Bluetooth technology is by far the most successful
as compared to any other short-range wireless
standards. Since Bluetooth is available in almost all
smart phones and laptops that makes it very handy
and easy to use. Smart phone or laptop can be
used as a universal remote for controlling all the
devices in a home, all what is required is a
Bluetooth module connected with the PLC device.
Signals over Bluetooth are sent using AT
commands, once a phone/laptop is synchronized
with this modem then whatever data we are sensing
from phone will be received by the Bluetooth
modem. Bluetooth modem in turn will transfer the
Fig 10: Controlling electrical devices through Bluetooth
signal to PLC device. PLC device will decode the
data and as per the commands will transfer it over
power lines. All PLC devices connected within the
home will receive those signals and one for which
the signal is intended will decode the signal and
give the output signals accordingly. Electrical
devices can be connected with PLC device via a
relay or a thyristor based upon the type of device.
Bluetooth with PLC
Bluetooth technology is by far the most successful
as compared to any other short-range wireless
standards. Since Bluetooth is available in almost all
smart phones and laptops that makes it very handy
and easy to use. Smart phone or laptop can be
used as a universal remote for controlling all the
devices in a home, all what is required is a
Bluetooth module connected with the PLC device.
Signals over Bluetooth are sent using AT
commands, once a phone/laptop is synchronized
with this modem then whatever data we are sensing
from phone will be received by the Bluetooth
modem. Bluetooth modem in turn will transfer the
signal to PLC device. PLC device will decode the
data and as per the commands will transfer it over
power lines. All PLC devices connected within the
home will receive those signals and one for which
the signal is intended will decode the signal and
give the output signals accordingly. Electrical
devices can be connected with PLC device via a
relay or a thyristor based upon the type of device.
Control for user
Control has to be intuitive and easily accessible so
that user can control the home any time with
minimum number of remotes.
GSM modem
For controlling the appliances using mobile phone
when outside the home, GSM/CDMA network can
be used. SMS can be sent from mobile to activate/
deactivate any particular device. For sending and
receiving SMS a GSM modem is required. GSM
modem works on AT commands. AT commands are
a set of predefined commands which GSM modem
can understand. GSM modem can be interfaced
with a micro-controller through UART. AT
commands coming from/going to GSM modem
are decoded/encoded in the micro-controller and
functions can be performed accordingly. Generally
Fig 11: GSM modem interface with Electrical Devices
FRAM
GSM modem works at 3V, so a voltage level shifter
is required to convert to 5V in case the microcontroller works on 5V. Another advantage of using
GSM modem over fixed telephone lines is that in
case of theft, intruders won’t be able to cut
telephone lines and also no extra wiring is required.
DTMF Tones
DTMF stands for dual tone multiple frequency.
These tones can be used for controlling the
electrical appliances. Each button on the mobile
phone corresponds to a unique frequency, these
tones can be decoded using a DTMF decoder IC or
within an advanced system on chip device.
Different functions can be defined in the
microcontroller and based upon the input DTMF
tone the corresponding function can be triggered.
Using DTMF tones any phone can be used to
control the home, even the fixed landline can be
used from the same. User can send DTMF tones
either by calling the sim number which is fixed in
home or by sending tones through Bluetooth. Even
a laptop can be used to send DTMF tones via
Fig 12: Control of electrical devices using DTMF tones
Fig 13: GUI for user control through internet
will be stored in the GUI and immediately it will
send this information to a SMS gateway, SMS
gateway will in turn send the SMS to the user SIM
connected in the GSM Modem. GSM modem will
decode this information and send it to microcontroller, which will work accordingly.
Feedback
If we control any appliance using our mobile
phone/internet, it is very important to get the
acknowledgement. There can be many reasons
because of which certain equipments will not work
like no electricity, issue with appliance, etc. So when
we switch the device ON, the relay may be powered
up using back up batteries but still the electrical
device will remain in OFF state.
Current transformer can be used as one of the
method to get the feedback. Whenever any
appliance is switched ON, current will start flowing
in the wire connected to that device. This current
Bluetooth. Following figure shows the block
diagram for processing the DTMF tones.
Through Mobile
As discussed till now we can use mobile phones for
controlling the appliance by sending a message or
by calling and pressing number buttons (DTMF
tones). Another way is making a mobile application
GUI for the user which will send SMS at back end,
and it will also be very easy for user to operate the
appliances. Mobile app will opt for Bluetooth if
inside the home and communicate over GSM when
at a distant place.
Through Internet
A secure website can be created for user login. After
logging in the website, it will show a GUI to the user
and that will vary from user to user based upon the
appliances inside his home. User can switch
ON/OFF or control intensity of any of the electrical
device. Whatever selection the user has selected
Fig 14: Block diagram for sensing feedback
can be sensed to monitor the state of device. Some
of the voice commands like ON, OFF, etc. can be
stored in an IC capable to store voice, then this
voice can be transferred through mobile phone by
connecting the voice output to microphone wires.
Security Measures
For enhancing home security following devices can
be added apart from the sensors which have been
already discussed earlier.
• Door camera which will take a picture and store
it whenever it detects a human being, camera can
be triggered using a PIR sensor. Similarly camera
inside the home can also be switched ON to send
FRAM
live photos to user via email in case it detects a
human being when no family person is there inside
the home.
• Secure home access using finger print scanning
/face recognition.
• Electronic key lock or doors for double security.
microcontroller on a single chip which are needed
to interface different type of sensors which we
discussed. It makes easier and faster for designers
to make the end product and reduces the BOM.
Some of the advanced PLC devices have in build
system on chip as well on a single device (like
Cypress’s PLC devices), using such PLCs ensures
that no other micro controller is required for
processing the decoded signals, received from
power line.
Figure shown below shows the interfacing of a few
sensors in PSoC3. Similarly any other sensor can be
interfaced. Passive components have to be
connected externally.
Different modes
With a single touch complete home can be set for
different modes
• Home Theater
In this mode all the curtains in the entertainment
room will be closed. Projector will come out of the
roof, lights will become dim and all speakers will be
switched ON.
• Out of Home
This mode will check whether all the
doors and windows are closed or
not. If not then it will trigger an alarm.
All the electrical equipments will be
switched OFF & PIR sensors and
security cameras will be activated.
Any movement sensed during this
time will be immediately reported to
the user.
• Vacation Mode
It’s the extended mode of ‘Out of
Home’ and can be activated when
going on long holiday. Apart from the
functions performed in the above
mode it will also perform certain
activities everyday so as to give an
illusion that someone is there in
home. These activities will include Fig 15: Implementation in PSoC3
playing music at loud volume,
switching lights of different rooms randomly and
opening and closing curtains.
• Night Mode
Will close all the lights expect the porch one and
activate PIR sensors in the corridors and check
whether the main gate, windows are closed or not.
• Day Mode
Disable PIR sensors, windows, door sensors and
security cameras.
Implementation using system on chip
When it comes to actual implementation of these
features in hardware, a system on chip based
implementation seems the best fit due to small form
factor of the system and small product
development cycle. System on chip integrates
configurable analog and digital peripherals like
OpAmp, ADCs, filters, DACs etc., memory and a
About the Author
Akshat Gupta is currently
working with Cypress
Semiconductor India Pvt.
Ltd. as an Application
Engineer. He holds a
Akshat
Cypress
Bachelor ’s degree in
Semiconductor
Electrical and Electronics
engineering. He loves working on
embedded system and robotics. He can
be reached at aksh@cypress.com.