You are on page 1of 55

IoT Based Home Automation Using Arduino

CHAPTER 1

INTRODUCTION

1.1 Home Automation

Automation is the process of automatically performing everyday functions


around the home to save you time, energy, money and at the same time offering
improved security. The automation’ is performed by a central controller. This can be
either a standalone unit or a piece of software on a PC. Both options have their
advantages. The controller can carry out a number of functions:

1.2 Functions

Send signals to switch lights and appliances on or off. Open and close contacts to
operate high and low voltage devices. Schedule and initiate events, such as watering the
garden Issue and accept infra-red commands Interface [2] with other systems, i.e. X 10,
telephone, computer, heating etc.

Home automation is anything that gives you remote or automatic control of things
in & around the home. The systems that you can control include: Lighting, Appliances,
Heating and cooling, Security and monitoring systems, Entertainment (home audio and
video), Communications (telephones and intercoms, internet), Lawn sprinklers, Curtain
movements, Pool filter pump, Spa heater, Filtration unit, Gate/garage door motor, Shade
motor control, Roof sprinklers, Electric strikes, Keyless entry etc.

This central controller can be accessed and controlled through interfaces like
keypad, wired or wireless touch-screens (with/without video), universal remotes, mobile
devices. Home automation provides a more convenient & elegant atmosphere for the
family to compliment and match the lifestyle. Everyone in the family experiences the
comfort of automation with added convenience through integrated control of scheduled
common lifestyle activities performed every day. An automated home can provide
security, temperature, lighting, and audio control for comfort, convenience, and safety.

RRCE, DEPT. OF ECE 1


IoT Based Home Automation Using Arduino

It creates reliable and coordinated controls to operate home devices automatically for
simplifying operations.

Home automation saves your time and effort by controlling you home
automatically for performing routine functions such as watering your grass, or turning
off all lights, setting the thermostat to economy mode, control scheduled appliances
operation and arming the security system when you retire for the night

Home automation provides you with the comfort of whole home audio/video
integration so that any source could be placed anywhere in a home and still be enjoyed
everywhere in a home.

Home automation provides you pro-active home security so that you can look in
on your home remotely from anywhere in the world, or that your home will phone you
if it finds anything suspicious, or that a fire will alert your home to wake you, shut down
the gas and ventilation system, turn on a lighting path for your escape, and
automatically phone the fire/police department. In other words, it integrates your alarm
system with other home systems for a response to intrusion that meets your needs of
enhanced Safety.

The term 'home automation' is now acknowledged as covering most I.T.,


automation, communication and wiring aspects of our homes. Most of these functions
can be installed independently of each other, but the real benefits of the automated home
are realized when these different aspects communicate with each other. For example,
having two PC’s networked together in the home, giving both users access to the
internet may seem like the forefront of technology, but imagine if they were tied into
our house wiring and could turn lights and appliances on and off automatically when we
are away from home, even via the internet. Imagine that the PC was networked into our
security system and could display images from our home security cameras onto our
computer screen at work. Imagine that your security system was tied into your
telephone and could ring your mobile in the event of a burglary, you could even talk to
visitors to your door from anywhere in the world.

RRCE, DEPT. OF ECE 2


IoT Based Home Automation Using Arduino

1.3 Objectives of Home Automation

Home Automation Saves Money by lowering your monthly utility bills with the
remote & scheduled control of lights, appliances, sprinklers and your air conditioning

 Never walk into a dark home again.


 Have the porch light automatically turn on when you open the front door after
dark. Lighting and audio controls can make a vacant home look and sound occupied.
 You could set your Omni home control system to automatically call you at work
when your child comes home from school and keys in his security code into the security
system.
 Call your home control system over the phone to make changes to your system.
 Log into your home control system over the Internet via Snap-Link or Web-Link
II and change your temperature settings.
 Set the temperature setting on your Omnistate to automatically turn up when the
security system is armed in the morning. It is then automatically turned down one-half
hour before you normally get home in order for you to arrive home to a comfortable
house.
 If you are leaving early from work, you can call into your home control system to
manually set the temperature to where you want it to be when you get home.

1.4 The Real Benefits of Home Automation

Most controllers will offer all of the above plus more. When you use controllers
connected in the appropriate fashion, you can realize all sorts of benefits, limited
primarily by your imagination.

For example: -

When on holiday or working late, have the lights come on automatically and draw the
curtains.
Set room moods, i.e. one button push to switch off the main light, dim the perimeter
lights and switch the surround sound system on ready to play a movie.
RRCE, DEPT. OF ECE 3
IoT Based Home Automation Using Arduino

At dusk, check that the garage door is closed.


Switch on the electric blanket whilst you're sitting on your sofa.

The controller can be either standalone or combined into a security system to give
additional benefits.

Security

There are real benefits to having your automation controller and security system
combined in one unit. You have the advantage of infra-red detectors from the alarm
system being available to perform/trigger automation tasks. You can also benefit from
the alarm system knowing whether you’re at home or not (i.e. whether the alarm is set
or not). This can give numerous benefits, for example we could set the system so that if
no movement is detected in the home for a given period, say 16 hours, then it rings a
mobile telephone and conveys a message to the recipient. This can be particularly
relevant when you have concerns about ailing relatives having accidents around the
home etc.

Needless to say, if the alarm system forms the basis of our automation system,
then it needs to be of a particularly high standard, able to expand to suit all
requirements. You should be able to connect smoke detectors in to the system and when
triggered, automatically switch on lights to illuminate the exit route whilst at the same
time dialing the fire brigade with a prerecorded message. For further information, see
details of our Comfort System.

PC Networking

Who remembers the time when having our own PC in the home seemed like a
dream that could never happen?

Who sees a future when PC’s have a function in most rooms in our home?

Many families already have more than one PC in the home, the kids want one each, dad
has one for business use, but they only have one printer and one internet access line.
RRCE, DEPT. OF ECE 4
IoT Based Home Automation Using Arduino

Network

Networking involves tying all of your computers together so that you can pass
information easily between them, and also share devices such as printers and internet
access. This is traditionally done with interface cards and cable although several
manufacturers now offer a wireless solution. Systems offering network connections via
the existing in house power lines are now starting to emerge. Using cable gives higher
data transfer rates and greater reliability at a more affordable price, but wireless
solutions are neater and easier to install especially where running cables would prove
difficult or messy. Tying your PC into your automation system generally requires
installing a serial cable between the two.

Convenience

An automated home is about the convenience of saving your time and effort by
having your home automatically do routine functions such as watering your grass (but
only if it has not rained recently), or turning off all lights, setting the thermostat to
economy mode and arming the security system when you retire for the night.

CHAPTER 2

LITERATURE SURVEY

RRCE, DEPT. OF ECE 5


IoT Based Home Automation Using Arduino

The survey is a recognized and accepted part of the modern society. It is one of the
means by which society keeps it informed, a way of bringing under central situations of
increasing size and complexity of obtaining perceptive and standard of comparison. A
survey gives an oversight of a field and is thus distinguishing from a sort of study which
consists of a microscopic examination of a turf; it is a map rather than a detailed plan.
The survey must be planned before a start is made.

2.1 BASE PAPERS

1. Ajah, G, David, N, Abioye, A, Web Based Security System, Sch. J. Eng. Tech,
1(3):112-116, 2013.

According to the popular philosopher - Abraham Maslow, security is the second


most basic need of man. There is need to protect life and property, in order to do this a
security system must be developed. The purpose of this project is to develop a highly
efficient and affordable security system with an industrial complex as a case study,
which would take necessary countermeasures against possible security risks to man and
property. These countermeasures are in three layers. The first layer is protection against
fire outbreaks through a fire detector comprising a smoke detector and a temperature
sensor. The second layer is intrusion detection which monitors and prevents
unauthorized access. The last layer is live video monitoring and analysis employing the
use of IP security cameras. In addition, Automated Fingerprint Identification System
(AFIS) ensures that only registered staff are allowed access into the industrial complex
at any point in time and a door way counter determines the number of people present in
the building at any given time. More so, this system is completely digital and
customizable, incorporating Liquid Crystal Display (LCD) and rich Graphic User
Interfaces (GUIs).

RRCE, DEPT. OF ECE 6


IoT Based Home Automation Using Arduino

2. Mahmood, S M, Abdulsattar, M, Firas, A Y; Home Automation Management


with WLAN (802.11g) and RF Remote Control, Raf. J. of Comp. & Math’s, 6(1),
2009. 3

This paper presents a low cost and flexible home control and environmental
monitoring system. It employs an embedded micro – web server in Arduino Mega 2560
microcontroller, with IP connectivity for accessing and controlling devices and
appliances remotely. These devices can be controlled through a web application or via
Bluetooth Android based Smart phone app. The proposed system does not require a
dedicated server PC with respect to similar systems and offers a novel communication
protocol to monitor and control the home environment with more than just the switching
functionality. To demonstrate the feasibility and effectiveness of this system, devices
such as light switches, power plug, temperature sensor, gas sensor and motion sensors
have been integrated with the proposed home control system.

3. Aru O E ,Ihekweaba G, Opara F K, Design Exploration of a Microcontroller


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

This research work presents the design and implementation of a microcontroller


based RF remote control 13Amp wall socket. The project is designed to control
electronic devices that are connected to an ac power supply through the RF remote wall
socket by turning the wall socket ON/OFF using the RF remote control whose operation
is independent of the direction/positioned, unlike the Infra-red remote control which
uses” line of sight” . The project consists of the 89c52 microcontroller interfaced with”
KYL-500S” micro power wireless transceiver data module and connected with an
electromagnetic relay which turns the switch OFF with open contact and turns it ON
with closed contact. The remote control transmits radio frequency signals which are
received by the receiver of the wall socket and decoded by the microcontroller which
now turns the relay ON or OFF.

4. David, N, Design of an Internet Based Security System, NIJOTECH, 29(2) 118-


129, 2010.

RRCE, DEPT. OF ECE 7


IoT Based Home Automation Using Arduino

To acquiesce to the request of man’s need to protect his life, investment, property and
to maintain law and order in a society, security systems are employed to achieve
these goals. For the effective realization of these goals, the system must be able
to incorporate different function and monitor several activities instantaneously in real
time. These activities include access control-motion-detection, fire hazard & the ease of
monitoring the system via the Internet. The system has a way of monitoring requests for
access to the secured areas as well as reacting to intruder attempts. To achieve this a
successful hardware data acquisition unit based on a microcontroller is designed. The data
from the hardware unit is connected to the PC via the parallel port interface so as to monitor
all status signals in real Time. The GUI provides graphic display of the trends from the
sensor devices.

CHAPTER 3

HARDWARE IMPLEMENTATION
RRCE, DEPT. OF ECE 8
IoT Based Home Automation Using Arduino

3.1 Arduino Mega 2560 Processor

The Arduino Mega 2560 is a microcontroller board based on the ATmega2560


It has 54 digital input/output pins (of which 14 can be used as PWM outputs), 16 analog
inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB
connection, a power jack, an ICSP header, and a reset button. It contains everything
needed to support the microcontroller; simply connect it to a computer with a USB
cable or power it with a AC to-DC adapter or battery to get started. The Mega is
compatible with most shields

Fig 3.1 Arduino 2560 Board

3.1.2 Technical Specifications

Microcontroller ATmega2560

RRCE, DEPT. OF ECE 9


IoT Based Home Automation Using Arduino

Operating Voltage 5V

Input Voltage
7-12V
(recommended)

Input Voltage (limit) 6-20V

Digital I/O Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per I/O Pin 20 mA

DC Current for 3.3V Pin 50 mA

256 KB of which 8 KB used by


Flash Memory
bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 101.52 mm

Width 53.3 mm

Weight 37 g

3.1.3 Pin Descriptions

RRCE, DEPT. OF ECE 10


IoT Based Home Automation Using Arduino

Fig 3.1.2 Pin Diagram of ATMega 2560

Each of the 54 digital pins on the Mega can be used as an input or output,
using pinMode(),digitalWrite(), and digitalRead() functions. They operate at 5 volts.

RRCE, DEPT. OF ECE 11


IoT Based Home Automation Using Arduino

Each pin can provide or receive 20 mA as recommended operating condition and has an
internal pull-up resistor (disconnected by default) of 20-50 k ohm. A maximum of
40mA is the value that must not be exceeded to avoid permanent damage to the
microcontroller.

In addition, some pins have specialized functions:

 Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and
16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and transmit (TX) TTL
serial data. Pins 0 and 1 are also connected to the corresponding pins of the
ATmega16U2 USB-to-TTL Serial chip.

 External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt


4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be configured to trigger an
interrupt on a low level, a rising or falling edge, or a change in level.
 PWM: 2 to 13 and 44 to 46. Provide 8-bit PWM output with
the analogWrite() function.
 SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI
communication using theSPI library. The SPI pins are also broken out on the ICSP
header, which is physically compatible with the Arduino /Genuino Uno and the old
Duemilanove and Diecimila Arduino boards.
 LED: 13. There is a built-in LED connected to digital pin 13. When the pin is
HIGH value, the LED is on, when the pin is LOW, it's off.
 TWI: 20 (SDA) and 21 (SCL). Support TWI communication using the Wire
library. Note that these pins are not in the same location as the TWI pins on the old
Duemilanove or Diecimila Arduino boards.

The Mega 2560 has 16 analog inputs, each of which provide 10 bits of resolution (i.e.
1024 different values). By default they measure from ground to 5 volts, though is it
possible to change the upper end of their range using the AREF pin
and analogReference() function.
There are a couple of other pins on the board:

>AREF. Reference voltage for the analog inputs. Used with analogReference().
RRCE, DEPT. OF ECE 12
IoT Based Home Automation Using Arduino

>Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.

3.1.4 Power

The Mega 2560 can be powered via the USB connection or with an external power
supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart)
or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into
the board's power jack. Leads from a battery can be inserted in the GND and Vin pin
headers of the POWER connector.

The board can operate on an external supply of 6 to 20 volts. If supplied with less
than 7V, however, the 5V pin may supply less than five volts and the board may
become unstable. If using more than 12V, the voltage regulator may overheat and
damage the board. The recommended range is 7 to 12 volts.

The power pins are as follows:

 Vin. The input voltage to the board when it's using an external power source (as
opposed to 5 volts from the USB connection or other regulated power source). You can
supply voltage through this pin, or, if supplying voltage via the power jack, access it
through this pin.

5V. This pin outputs a regulated 5V from the regulator on the board. The board can be
supplied with power either from the DC power jack (7 - 12V), the USB connector (5V),
or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins
bypasses the regulator, and can damage your board. We don't advise it.

RRCE, DEPT. OF ECE 13


IoT Based Home Automation Using Arduino

3V3. A 3.3-volt supply generated by the on-board regulator. Maximum current draw is
50 mA.

GND. Ground pins.

IOREF. This pin on the board provides the voltage reference with which the
microcontroller operates. A properly configured shield can read the IOREF pin voltage
and select the appropriate power source or enable voltage translators on the outputs for
working with the 5V or 3.3V.

3.1.5 Communication

The Mega 2560 board has a number of facilities for communicating with a
computer, another board, or other microcontrollers. The ATmega2560 provides four
hardware UARTs for TTL (5V) serial communication. An ATmega16U2 (ATmega 8U2
on the revision 1 and revision 2 boards) on the board channels one of these over USB
and provides a virtual com port to software on the computer (Windows machines will
need a .inf file, but OSX and Linux machines will recognize the board as a COM port
automatically. The Arduino Software (IDE) includes a serial monitor which allows
simple textual data to be sent to and from the board. The RX and TX LEDs on the board
will flash when data is being transmitted via the ATmega8U2/ATmega16U2 chip and
USB connection to the computer (but not for serial communication on pins 0 and 1).

A Software Serial library allows for serial communication on any of the Mega 2560's
digital pins.

The Mega 2560 also supports TWI and SPI communication. The Arduino Software
(IDE) includes a Wire library to simplify use of the TWI bus

3.1.6 Advantage of Arduino

 It is an open-source project, software/hardware is extremely accessible and very


flexible to be customized and extended
RRCE, DEPT. OF ECE 14
IoT Based Home Automation Using Arduino

 It is flexible, offers a variety of digital and analog inputs, SPI and serial interface


and digital and PWM outputs
 It is easy to use, connects to computer via USB and communicates using standard
serial protocol, runs in standalone mode and as interface connected to PC/Macintosh
computers
 It is inexpensive, and comes with free authoring software
 Arduino is backed up by a growing online community, lots of source code is
already available and we can share and post our examples for others to use, too!

3.2 IR SENSOR

3.2.1 General Description

The IR Sensor-Single is a general purpose proximity sensor. Here we use it for


object detection. The module consists of a IR emitter and IR receiver pair. The high
precision IR receiver always detects a IR signal.

The module consists of 358 comparator IC. The output of sensor is high whenever
it IR frequency and low otherwise. The on-boarded indicator helps user to check status
of the sensor without using any additional hardware.

The power consumption of this module is low. It gives a digital output.

Application Ideas:

 Obstacle detection
 Shaft encoder
 Fixed frequency detection

The IR sensor IC is shown in the next page

RRCE, DEPT. OF ECE 15


IoT Based Home Automation Using Arduino

Fig 3.2(a): IC of IR sensor

Fig 3.2(b): Block diagram of IR sensor

3.2.2 Overview of Schematic

The sensitivity of the IR Sensor is tuned using the potentiometer. The


potentiometer is tunable in both the directions. Initially tune the potentiometer in
clockwise direction such that the Indicator LED starts glowing. Once that is achieved,
turn the potentiometer just enough in anti-clockwise direction to turn off the Indicator
LED. At this point the sensitivity of the receiver is maximum. Thus, its sensing distance

RRCE, DEPT. OF ECE 16


IoT Based Home Automation Using Arduino

is maximum at this point. If the sensing distance (i.e., Sensitivity) of the receiver is
needed to be reduced, then one can tune the potentiometer in the anti-clockwise
direction from this point.

Further, if the orientation of both TX and Rx LED’s is parallel to each other, such
that both are facing outwards, then their sensitivity is maximum. If they are moved
away from each other, such that they are inclined to each other at their soldered end,
then their sensitivity reduces.

Tuned sensitivity of the sensors is limited to the surroundings. Once tuned for a
particular surrounding, they will work perfectly until the IR illumination conditions of
that region nearly constant. For example, if the potentiometers tuned inside
room/building for maximum sensitivity and then taken out in open sunlight, it will
require retuning, since sun’s rays also contain Infrared (IR) frequencies, thus acting as a
IR source (transmitter). This will disturb the receiver’s sensing capacity. Hence it needs
to be returned to work perfectly in the new surroundings.

The output of IR receiver goes low when it receives IR signal as shown 4.1(b) .
Hence the output pin is normally low because though the IR LED is continuously
transmitting, due to no obstacle, nothing is reflected back to the IR receiver. The
indication LED is off. When an obstacle is encountered, the output of IR receiver goes
low, IR signal is reflected from the obstacle surface. This drives the output of the
comparator low. This output is connected to the cathode of the LED, which then turns
ON.

3.3 LIQUID CRYSTAL DISPLAY

An LCD is a small low cost display. It is easy to interface with a micro-controller because
of an embedded controller (the black blob on the back of the board). This controller is
standard across many displays (HD 44780) which means many micro-controllers (including the
Arduino) have libraries that make displaying messages as easy as a single line of code. Hence

RRCE, DEPT. OF ECE 17


IoT Based Home Automation Using Arduino

itis very important device in embedded system. It offers high flexibility to user as he can display
the required data on it

Major task in LCD interfacing is the initialization sequence. In LCD initialization


you have to send command bytes to LCD. Set the interface mode, display mode,
address counter increment direction, set contrast of LCD, horizontal or vertical
addressing mode, color format. This sequence is given in respective LCD driver
datasheet. Studying the function set of LCD lets you know the definition of command
bytes. It varies from one LCD to another.

Next step after initialization is to send data bytes to required display data RAM
memory location. Firstly, set the address location using address set command byte and
then send data bytes using the DDRAM write command. To address specific location in
display data RAM one must have the knowledge of how the address counter is
incremented.

In recent years the LCD is finding widespread use replacing LEDs This is due to
following reasons

1) The declining prices of LCDs


2) The ability to display numbers, characters and graphics. This is in contrast to
LEDs, which are limited to numbers and few characters.
3) Incorporation of a refreshing controller in to LCD, there by relieving the CPU of
the task of refreshing the LCD. In contrast LCD must be refreshed by CPU to keep
displaying the data.

RRCE, DEPT. OF ECE 18


IoT Based Home Automation Using Arduino

Figure 3.3 LCD display

3.3.2 Shapes and sizes

Even limited to character based modules, there is still a wide variety of shapes
and sizes available. Line lengths 8, 16,2,024,32 and 40 character are all standard, in one,
two and 4 lines versions.

Several different liquid crystal technologies based exist.” Supertwist” types, for
Example, offer improved contrast and viewing angle over the older “twisted nematic”
types. Some modules are available with backlighting, so that they can viewed in dimly
lit conditions.

3.3.3 Connections

A 14 pin access is provided having 8 data lines,3 control lines and 3 power
lines.The function of each of the connections is shown in table 4.7.

Pin 1 and 2 are the power supply lines, Vss and Vdd. The Vdd pin should be connected
to positive supply and Vss to 0V supply or ground. Although the LCD module data
sheets specify a 5VDC supply,Supplies of 6V and 4-5V both work well, and even 3V is
sufficient for some modules.

Pin 3 is a control pin ,Vee , which is used to alter the contrast of the display. Ideally, this
pin should be connected to a variable voltage supply.

Pin 4 is the (RS)register select line. When this line is low, data bytes transferred to the
display are treated as commands and data bytes read from the display indicate its status.

By setting the RS line high, character data can be transferred to and from the module.

Pin 5 is read/write line. this line is pulled low in order to write commands or character
data to the module, or pulled high to read character data or status information from its
registers.

RRCE, DEPT. OF ECE 19


IoT Based Home Automation Using Arduino

Pin 6 is the enable line. this input is used to initiate the actual transfer of commands or
character data between the module and the data lines. When writing to the display, data
is transferred only on high to low transition of this signal.

Pin 7 to 14 are data bus lines (D0 to D7).data can be transferred to and from the display
either as a single 8-bit byte or two 4 bit nibbles. The other two pins LED+ and LED- is
used for back light of the LCD.

Table

RRCE, DEPT. OF ECE 20


IoT Based Home Automation Using Arduino

3.4 Temperature sensor

The LM35 series are precision integrated-circuit temperature sensors, whose


output voltage is linearly proportional to the Celsius (Centigrade) temperature. The
LM35 thus has an advantage over linear temperature sensors calibrated in ° Kelvin, as
the user is not required to subtract a large constant voltage from its output to obtain
convenient Centigrade scaling. The LM35 does not require any external calibration or
trimming to provide typical accuracies of ±¼°C at room temperature and ±¾°C over a
full -55 to +150°C temperature range. Low cost is assured by trimming and calibration
at the water level. The LM35's low output impedance, linear output, and precise
inherent calibration make interfacing to readout or control circuitry especially easy. It
can be used with single power supplies, or with plus and minus supplies. As it draws
only 60 µA from its supply, it has very low self-heating, less than 0.1°C in still air. The
LM35D is rated to operate over a 0-100-degree range.

Features

 Calibrated directly in Celsius (Centigrade)

 Linear + 10.0 mV/ C scale factor

 0.5 C accuracy (at +25 C)

 Rated for full -55 to +150 C range

 Suitable for remote applications

 Low cost due to wafer-level trimming

 Operates from 4 to 30 volts

 Less than 60 A current drain

RRCE, DEPT. OF ECE 21


IoT Based Home Automation Using Arduino

 Low self-heating, 0.08 C in still air

 Nonlinearity only 1/4 C typical

 Low impedance output, 0.1 W for 1 mA load

3.5 GAS SENSOR

The Grove - Gas Sensor(MQ2) module is useful for gas leakage detection (in
home and industry). It is suitable for detecting H2, LPG, CH4, CO, Alcohol, Smoke or
Propane. Due to its high sensitivity and fast response time, measurements can be taken
as soon as possible. The sensitivity of the sensor can be adjusted by using the

potentiometer.

Fig 3.4 MQ-2 Gas Sensor

3.5.1 Features

 Wide detecting scope


 Stable and long life
 Fast response and High sensitivity
 Good sensitivity to Combustible gas in wide range.
 High sensitivity to LPG, Propane and Hydrogen.

RRCE, DEPT. OF ECE 22


IoT Based Home Automation Using Arduino

 Long life and low cost.


 Simple drive circuit.
3.5.2 Applications
 Domestic gas leakage detector.
 Industrial Combustible gas detector.
 Portable gas detector.

3.5.3 Specifications

Item Parameter Min Typical Max Unit

VCC Working Voltage 4.9 5 5.1 V

Heating
PH 0.5 - 800 mW
consumption

RL Load resistance adjustable

RH Heater resistance - 33 - Ω

Rs Sensing Resistance 3 - 30 kΩ

Table 2 Specifications of MQ-2 Gas Sensor

3.5.4 Hardware Overview

This is an Analog output sensor. This needs to be connected to any one Analog
socket in Base Shield. The examples used in this tutorial makes uses of A0 analog pin.
Connect this module to the A0 port of Base Shield.

The output voltage from the Gas sensor increases when the concentration of gas
increases. Sensitivity can be adjusted by varying the potentiometer.

RRCE, DEPT. OF ECE 23


IoT Based Home Automation Using Arduino

It is possible to connect the Grove module to Arduino directly by using jumper


wires by using the connection as shown in the below table:

Arduino Gas Sensor

5V VCC

GND GND

NC NC

Analog A0 SIG

Table II Arduino Interface

3.6 Relay

A relay is an electrically operated switch. Current flowing through the coil of the
relay creates a magnetic field which attracts a lever and changes the switch contacts. The
coil current can be on or off, so relays have two switch positions and they are double
throw (changeover) switches.

Relays allow one circuit to switch a second circuit which can be completely
separate from the first. For example, a low voltage battery circuit can use a relay to switch
a 230V AC mains circuit. There is no electrical connection inside the relay between the
two circuits, the link is magnetic and mechanical.

The coil of a relay passes a relatively large current, typically 30mA for a 12V
relay, but it can be as much as 100mA for relays designed to operate from lower voltages.
Most ICs (chips) cannot provide this current and a transistor is usually used to amplify the

RRCE, DEPT. OF ECE 24


IoT Based Home Automation Using Arduino

small IC current to the larger value required for the relay coil. The maximum output
current for the popular 555 timer IC is 200mA so these devices can supply relay coils
directly without amplification.

Figure 3.6 Picture of relays

Relays are usually SPDT or DPDT but they can have many more sets of switch
contacts, for example relays with 4 sets of changeover contacts are readily available. Most
relays are designed for PCB mounting but you can solder wires directly to the pins
providing you take care to avoid melting the plastic case of the relay.

The coil will be obvious and it may be connected either way round. Relay coils
produce brief high voltage 'spikes' when they are switched off and this can destroy
transistors and ICs in the circuit. To prevent damage, you must connect a protection diode
across the relay coil.

The animated picture shows a working relay with its coil and switch contacts. You
can see a lever on the left being attracted by magnetism when the coil is switched on. This
lever moves the switch contacts. There is one set of contacts (SPDT) in the foreground
and another behind them, making the relay DPDT.

RRCE, DEPT. OF ECE 25


IoT Based Home Automation Using Arduino

Figure 3.6.2 Relay showing coil and switches

The relay's switch connections are usually labeled COM, NC and NO:

 COM = Common, always connect to this, it is the moving part of the switch.
 NC = Normally Closed, COM is connected to this when the relay coil is off.
 NO = Normally Open, COM is connected to this when the relay coil is on.
 Connect to COM and NO if you want the switched circuit to be on when the relay
coil is on.
 Connect to COM and NC if you want the switched circuit to be on when the relay
coil is off.

3.6.2 CHOOSING A RELAY

 Physical size and pin arrangement : If you are choosing a relay for an existing
PCB you will need to ensure that its dimensions and pin arrangement are suitable.
 Coil voltage : The relay's coil voltage rating and resistance must suit the circuit
powering the relay coil. Many relays have a coil rated for a 12V supply but 5V
and 24V relays are also readily available. Some relays operate perfectly well with
a supply voltage which is a little lower than their rated value.
 Coil resistance: The circuit must be able to supply the current required by the
relay coil. You can use Ohm's law to calculate the current:

RRCE, DEPT. OF ECE 26


IoT Based Home Automation Using Arduino

Relay coil current = supply voltage / coil resistance

The Figure 3.5.3 shows a working relay with its coil and switch contacts. We can
see a lever on the left being attracted by magnetism when the coil is switched on. This
lever moves the switch contacts. There is one set of contacts (SPDT) in the foreground
and another behind them, making the relay DPDT.

The relay's switch connections are usually labeled COM, NC and NO:

 COM = Common, always connect to this; it is the moving part of the switch.
 NC = Normally Closed, COM is connected to this when the relay coil is off.
 NO = Normally Open, COM is connected to this when the relay coil is on.

Figure 3.6.3: Circuit Symbol of Relay

 Connect to COM and NO if you want the switched circuit to be on when the relay coil
is on.
 Connect to COM and NC if you want the switched circuit to be on when the relay coil
is off.
We need to consider several features when choosing a relay:

• Physical size and pin arrangement

RRCE, DEPT. OF ECE 27


IoT Based Home Automation Using Arduino

If you are choosing a relay for an existing PCB you will need to ensure that its
dimensions and pin arrangement are suitable. You should find this information in the
supplier's catalogue.

• Coil voltage
The relay's coil voltage rating and resistance must suit the circuit powering the
relay coil. Many relays have a coil rated for a 12V supply but 5V and 24V relays are also
readily available. Some relays operate perfectly well with a supply voltage which is a
little lower than their rated value.

• Coil resistance
The circuit must be able to supply the current required by the relay coil. You can
use Ohm's law to calculate the current:

   supply voltage 
Relay coil current   =
  coil resistance

• Switch ratings (voltage and current)

The relay's switch contacts must be suitable for the circuit they are to control. You
will need to check the voltage and current ratings. Note that the voltage rating is usually
higher for AC, for example: "5A at 24V DC or 125V AC".

• Switch contact arrangement (SPDT, DPDT etc)


Most relays are SPDT or DPDT which are often described as "single pole
changeover" (SPCO) or "double pole changeover" (DPCO).

Relays and transistors compared

Like relays, transistors can be used as an electrically operated switch. For


switching small DC currents (< 1A) at low voltage they are usually a better choice than a
RRCE, DEPT. OF ECE 28
IoT Based Home Automation Using Arduino

relay. However, transistors cannot switch AC or high voltages (such as mains electricity)
and they are not usually a good choice for switching large currents (> 5A). In these cases,
a relay will be needed, but note that a low power transistor may still be needed to switch
the current for the relay's coil.

The main advantages and disadvantages of relays are listed below:

Advantages of relays:

• Relays can switch AC and DC; transistors can only switch DC.
• Relays can switch high voltages, transistors cannot.
• Relays are a better choice for switching large currents (> 5A).
• Relays can switch many contacts at once.

Disadvantages of relays:

• Relays are bulkier than transistors for switching small currents.


• Relays cannot switch rapidly (except reed relays), transistors can switch many
times per second.
• Relays use more power due to the current flowing through their coil.
• Relays require more current than many ICs can provide, so a low power transistor
may be needed to switch the current for the relay's coil.
3.6.4 ULN 2003
The ULN2003 is a monolithic high voltage and high current Darlington transistor
arrays. It consists of seven NPN Darlington pairs that feature high-voltage outputs with
common-cathode clamp diode for switching inductive loads. The collector-current rating
of a single Darlington pair is 500mA. The Darlington pairs may be paralleled for higher
current capability.

Applications include relay drivers, hammer drivers, lamp drivers, display


drivers(LED gas discharge),line drivers, and logic buffers.

The ULN2003 has a 2.7kW series base resistor for each Darlington pair for
operation directly with TTL or 5V CMOS devices.
RRCE, DEPT. OF ECE 29
IoT Based Home Automation Using Arduino

Features

 500mA rated collector current (Single output)


 High-voltage outputs: 50V
 Inputs compatible with various types of logic.
 Relay driver application
 Seven darlingtons per package.

Fig 3.6.4 ULN 2003A Internal Circuit Diagram

Absolute maximum ratings

Symbol Parameter Value Unit

Vo Output voltage 50 V

Vi Input voltage 30 V

Ic Continuous collector current 500 mA

Ib Continuous base current 25 mA

Tamb Operating ambient temperature range - 20 to 85 °C

Tstg Storage temperature range - 55 to 150 °C


RRCE, DEPT. OF ECE 30
IoT Based Home Automation Using Arduino

Tj Junction temperature 150 °C

Table 3.5.2 Absolute maximum ratings of ULN 2003A

3.7 ESP8266 WI-FI MODULE

Espressif Systems’ Smart Connectivity Platform (ESCP) is a set of high


performance, high integration wireless SOCs, designed for space and power constrained
mobile platform designers. It provides unsurpassed ability to embed WiFi capabilities
within other systems, or to function as a standalone application, with the lowest cost,
and minimal space requirement.

Fig 3.7.1 ESP8266EX Block Diagram

ESP8266EX offers a complete and self-contained WiFi networking solution; it can


be used to host the application or to offload WiFi networking functions from another
application processor. When ESP8266EX hosts the application, it boots up directly from
an external flash. In has integrated cache to improve the performance of the system in
such applications. Alternately, serving as a WiFi adapter, wireless internet access can be
added to any micro controllerbased design with simple connectivity (SPI/SDIO or
I2C/UART interface). ESP8266EX is among the most integrated WiFi chip in the
industry; it integrates the antenna switches, RF balun, power amplifier, low noise
receive amplifier, filters, power management modules, it requires minimal external
circuitry, and the entire solution, including front-end module, is designed to occupy
RRCE, DEPT. OF ECE 31
IoT Based Home Automation Using Arduino

minimal PCB area. ESP8266EX also integrates an enhanced version of Tensilica’s L106
Diamond series 32-bit processor, with on-chip SRAM, besides the WiFi functionalities.
ESP8266EX is often integrated with external sensors and other application specific
devices through its GPIOs; sample codes for such applications are provided in the
software development kit (SDK). Espressif Systems

3.7.2 Features

 802.11 b/g/n
 Integrated low power 32-bit MCU
 Integrated 10-bit ADC
 Integrated TCP/IP protocol stack
 Integrated TR switch, balun, LNA, power amplifier and matching network
 Integrated PLL, regulators, and power management units
 Supports antenna diversity
 WiFi 2.4 GHz, support WPA/WPA2
 Support STA/AP/STA+AP operation modes
 Support Smart Link Function for both Android and iOS devices
 SDIO 2.0, (H) SPI, UART, I2C, I2S, IR Remote Control, PWM, GPIO
 STBC, 1x1 MIMO, 2x1 MIMO • A-MPDU & A-MSDU aggregation & 0.4s
guard interval
 Deep sleep power < 5uA
 Wake up and transmit packets in < 2ms
 Standby power consumption of < 1.0mW (DTIM3)
 +20 dBm output power in 802.11b mode
 Operating temperature range -40C ~ 125C
 FCC, CE, TELEC, WiFi Alliance, and SRRC certified

3.7.3 Applications

RRCE, DEPT. OF ECE 32


IoT Based Home Automation Using Arduino

 Home Appliances
 Home Automation
 Smart Plug and lights
 Mesh Network
 Industrial Wireless Control • Baby Monitors
 IP Cameras
 Sensor Networks
 Wearable Electronics
 Portable Modem

3.7.4 Pin Definitions

The pin assignments for 32-pin QFN package is illustrated in Fig. 3.7.2.

RRCE, DEPT. OF ECE 33


IoT Based Home Automation Using Arduino

Fig. 3.7.2 Pin Assignments

Table 3.7.1 below presents an overview on the general pin attributes and the functions of
each pin.

T
Pin Name ype Function

1 VDDA P Analog Power 3.0 ~3.6V

RF Antenna Interface. Chip Output Impedance=50Q No


2 LNA I/O
matching required but we recommend that the n-type matching
network is retained.
3 VDD3P3 P Amplifier Power 3.0~3.6V
4 VDD3P3 P Amplifier Power 3.0~3.6V
5 VDD_RTC P NC (1.1V)
6 TOUT I ADC Pin (note: an internal pin of the chip) can be used to
check the power voltage of VDD3P3 (Pin 3 and Pin4) or the
7 CHIP_EN I Chip Enable.
8 XPD_DCDC I/O Deep-Sleep Wakeup; GPIO16
9 MTMS I/O GPIO14; HSPI_CLK
10 MTDI I/O GPIO12; HSPI_MISO

RRCE, DEPT. OF ECE 34


IoT Based Home Automation Using Arduino

11 VDDPST P Digital/IO Power Supply (1.8V~3.3V)


12 MTCK I/O GPIO13; HSPI_MOSI; UART0_CTS
13 MTDO I/O GPIO15; HSPI_CS; UART0_RTS
14 GPIO2 I/O UART Tx during flash programming; GPIO2
15 GPIO0 I/O GPIO0; SPI_CS2
16 GPIO4 I/O GPIO4
17 VDDPST P Digital/IO Power Supply (1.8V~3.3V)
18 SDIO_DATA_2 I/O Connect to SD_D2 (Series R: 200Q); SPIHD; HSPIHD;
GPIO9
19 SDIO_DATA_3 I/O Connect to SD_D3 (Series R: 200Q); SPIWP; HSPIWP;
GPIO10
20 SDIO_CMD I/O Connect to SD_CMD (Series R: 200Q); SPI_CS0; GPIO11
21 SDIO_CLK I/O Connect to SD_CLK (Series R: 200Q); SPI_CLK; GPIO6
22 SDIO_DATA_0 I/O Connect to SD_D0 (Series R: 200Q); SPI_MSIO; GPIO7
23 SDIO_DATA_1 I/O Connect to SD_D1 (Series R: 200Q); SPI_MOSI; GPIO8
24 GPIO5 I/O GPIO5
25 U0RXD I/O UART Rx during flash programming; GPIO3
26 U0TXD I/O UART Tx during flash progamming; GPIO1; SPI_CS1
27 XTAL_OUT I/O Connect to crystal oscillator output, can be used to provide BT
clock input
28 XTAL_IN I/O Connect to crystal oscillator input
29 VDDD P Analog Power 3.0V~3.6V
30 VDDA P Analog Power 3.0V~3.6V
31 RES12K I Serial connection with a 12 kQ resistor and connect to the
ground
32 EXT_RSTB I External reset signal (Low voltage level: Active)

Table 3.7.1 Pin Definitions

CHAPTER 4

RRCE, DEPT. OF ECE 35


IoT Based Home Automation Using Arduino

SOFTWARE IMPLEMENTATION

4.1 ARDUINO IDE

Arduino programs may be written in any programming language with a compiler


that produces binary machine code. Atmel provides a development environment for
their microcontrollers, AVR Studio and the newer Atmel Studio.

The Arduino project provides the Arduino integrated development


environment (IDE), which is a cross-platform application written in the programming
language Java. It originated from the IDE for the languages Processing and Wiring. It is
designed to introduce programming to artists and other newcomers unfamiliar with
software development. It includes a code editor with features such assyntax
highlighting, brace matching, and automatic indentation, and provides simple one-click
mechanism to compile and load programs to an Arduino board. A program written with
the IDE for Arduino is called a "sketch".The Arduino IDE supports the
languages C and C++ using special rules to organize code. The Arduino IDE supplies
a software library called Wiring from the Wiring project, which provides many common
input and output procedures. A typical Arduino C/C++ sketch consist of two functions
that are compiled and linked with a program stub main() into an executable cyclic
executive program:

 setup(): a function that runs once at the start of a program and that can initialize
settings.
 loop(): a function called repeatedly until the board powers off.

After compiling and linking with the GNU toolchain, also included with the IDE
distribution, the Arduino IDE employs the programavrdude to convert the executable
code into a text file in hexadecimal coding that is loaded into the Arduino board by a
loader program in the board's firmware.

4.2 Arduino board interfacing

RRCE, DEPT. OF ECE 36


IoT Based Home Automation Using Arduino

1. Get an Arduino or Genuino board and USB cable


In this tutorial, we assume you're using an Arduino or Genuino Uno or an Arduino
or Genuino Mega 2560. If you are using a retired board as Arduino
Duemilanove, Nano or Diecimila please refer to the driver installation instructions end
of this document. If you have another board, read the corresponding page linked in the
main getting started page.

You also need a standard USB cable (A plug to B plug): the kind you would connect to
a USB printer, for example. 

Download and install the Arduino Software (IDE)

Get the latest version from the download page. You can choose between the
Installer (.exe) and the Zip packages. We suggest you use the first one that installs
directly everything you need to use the Arduino Software (IDE), including the drivers.
When the download finishes, proceed with the installation and please allow the driver
installation process.

Step 1

Choose the components to install

RRCE, DEPT. OF ECE 37


IoT Based Home Automation Using Arduino

Step II

Choose the installation directory (we suggest to keep the default one)

Step III

The process will extract and install all the required files to execute properly the Arduino
Software (IDE)

RRCE, DEPT. OF ECE 38


IoT Based Home Automation Using Arduino

2. Connect the board


The USB connection with the PC is necessary to program the board and not just to
power it up. The Uno and Mega automatically draw power from either the USB or an
external power supply. Connect the board to your computer using the USB cable. The
green power LED (labelled PWR) should go on.

3. Install the board drivers


If you used the Installer, Windows - from XP up to 10 - will install drivers
automatically as soon as you connect your board, if you downloaded and expanded the
Zip package or, for some reason, the board wasn't properly recognized, please follow
the procedure below.

 Click on the Start Menu, and open up the Control Panel.

 While in the Control Panel, navigate to System and Security. Next, click on
System. Once the System window is up, open the Device Manager.

 Look under Ports (COM & LPT). You should see an open port named "Arduino
UNO (COMxx)". If there is no COM & LPT section, look under "Other Devices" for
"Unknown Device".

 Right click on the "Arduino UNO (COmxx)" port and choose the "Update Driver
Software" option.

 Next, choose the "Browse my computer for Driver software" option.

 Finally, navigate to and select the driver file named "arduino.inf", located in the
"Drivers" folder of the Arduino Software download (not the "FTDI USB Drivers" sub-
directory). If you are using an old version of the IDE (1.0.3 or older), choose the Uno
driver file named "Arduino UNO.inf"

 Windows will finish up the driver installation from there.

RRCE, DEPT. OF ECE 39


IoT Based Home Automation Using Arduino

4. Launch the Arduino Software (IDE)


Double-click the Arduino icon (arduino.exe) created by the installation process.
(Note: if the Arduino Software loads in the wrong language, you can change it in the
preferences dialog. See the Arduino Software (IDE) page for details.)

5. Open the blink example


Open the LED blink example sketch: File > Examples >01.Basics > Blink.

Step IV

6. Select your board


You'll need to select the entry in the Tools > Board menu that corresponds to your
Arduino or Genuino board.

RRCE, DEPT. OF ECE 40


IoT Based Home Automation Using Arduino

Step V

7. Select your serial port


Select the serial device of the board from the Tools | Serial Port menu. This is likely to
be COM3 or higher (COM1 andCOM2 are usually reserved for hardware serial ports).
To find out, you can disconnect your board and re-open the menu; the entry that
disappears should be the Arduino or Genuino board. Reconnect the board and select that
serial port.

8. Upload the program


Now, simply click the "Upload" button in the environment. Wait a few seconds - you
should see the RX and TX leds on the board flashing. If the upload is successful, the
message "Done uploading." will appear in the status bar.

RRCE, DEPT. OF ECE 41


IoT Based Home Automation Using Arduino

A few seconds after the upload finishes, you should see the pin 13 (L) LED on the board
start to blink (in orange). If it does, congratulations! You've gotten Arduino or Genuino
up-and-running. If you have problems, please see the troubleshooting suggestions.

9. Retired boards installation


Installing drivers for the Arduino Duemilanove, Nano, or Diecimila with Windows7,
Vista, or XP:

When you connect the board, Windows should initiate the driver installation process (if
you haven't used the computer with an Arduino board before).

On Windows Vista, the driver should be automatically downloaded and installed.

On Windows XP, the Add New Hardware wizard will open:

 When asked Can Windows connect to Windows Update to search for


software? select No, not this time. Click next.
 Select Install from a list or specified location (Advanced) and click next.
 Make sure that Search for the best driver in these locations is checked;
uncheck Search removable media; check Include this location in the search and browse
to the drivers/FTDI USB Drivers directory of the Arduino distribution. (The latest
version of the drivers can be found on the FTDI website.) Click next.
 The wizard will search for the driver and then tell you that a "USB Serial
Converter" was found. Click finish.
 The new hardware wizard will appear again. Go through the same steps and select
the same options and location to search. This time, a "USB Serial Port" will be found.

You can check that the drivers have been installed by opening the Windows Device
Manager (in the Hardware tab of System control panel). Look for a "USB Serial Port" in
the Ports section; that's the Arduino board.

4.2 Advantage of Arduino IDE


RRCE, DEPT. OF ECE 42
IoT Based Home Automation Using Arduino

 The Arduino Environment provide easiest debugging environment which is


cross-platform and is accepted by every member of the family.
 No programmer or dumping flash by dirty ways, with most of the companies
already providing on-board debugger still compared to a lot of
microcontroller (8051) upload is a click away.
 Every time you don't need to take datasheet out and figure what the
architecture is what are the addresses of the microcontroller to write simple
functions like delay or interrupt.
 Design of the board is very carefully crafted for beginners be it Moron
Switch or ISP header to the polarity of power, the chances are steep that you
would be blow it.
 Peripherals and Modular Design: Arduino Ecosystem has fantastic
modular design, you can simply add the already designed shields to the board
without any wire, just plug and play with peripherals like motor shield,
Bluetooth shield, Wi-Fi and what not already made.
 A lot of libraries and IC's have already been built for the same which is
crucial a lot of times.

CHAPTER 5

PROJECT DESIGN

RRCE, DEPT. OF ECE 43


IoT Based Home Automation Using Arduino

Fig 5.1 Block Diagram

Project design is the model on the basis of which we proceed with the designing
part, in our project a low cost and efficient smart home system is presented. This system
has two main modules: the hardware interface module and the software communication
module. At the heart of this system is the Arduino Mega 2560 microcontroller which is
also capable of functioning as a micro web server and the interface for all the hardware
modules. All communication and controls in this system pass through the
microcontroller. Arduino can sense the surroundings by receiving input signal from a
variety of sensors and can affect its environment via actuators. An analog temperature
sensor is a chip that tells you what the ambient temperature is.

The Infra-Red (IR) sensors allow one to sense motion, almost always and is used
to detect whether a human has moved in or out of the sensors range. The IR Sensor-
Single is a general purpose proximity sensor. Here we use it for Motion detection. This
RRCE, DEPT. OF ECE 44
IoT Based Home Automation Using Arduino

motion can be detected by checking for a high signal on a signal I/O pin. They are
small, inexpensive, low-power, easy to use and don't wear out. For that reason, they are
commonly found in appliances and gadgets used in homes or businesses. MQ2 is a
semiconductor type sensor, which can appropriately sense the presence of smoke, LPG,
methane, butane, propane and other hydrocarbon combustible gases. The sensitive
material in this sensor is tin-dioxide (SnO2). When it comes in contact with the gas to
be monitored, the electrical resistance of the sensor decreases; enabling the
microcontroller to respond to the situation. When it detects the concentration of
combustible gas in the air it outputs its reading as an analog voltage. The sensor can
measure concentrations of flammable gas of 300 to 10,000 ppm. The sensor can operate
at temperatures from -20 to 50°C and consumes less than 150 mA at 5 V.To allow
connection for power plugs and switching of electrical load within the home, relay
switches are used. The relay switches have capability to carry a maximum load of 10A
at 240V. This is sufficient to carry any household appliance as these devices do not
draw much current. To enable Wi-Fi connectivity on the microcontroller, ESP8266 Wi-
Fi modem is used. To receive sensor data an android app called Termtcp app is used.
This application allows the user to control devices and monitor Sensor data like
temperature gas leakage by using internet.

CHAPTER 6

FLOWCHARTS FOR PROJECT DESIGN

6.1 IR Sensor Flow Chart

RRCE, DEPT. OF ECE 45


IoT Based Home Automation Using Arduino

Start

Initialize Digital pin =0

Wait for Object Detection

No
Object
Detected?

Yes

Trigger Buzzer

Fig 6.1 Flow chart for IR Sensor

6.2 Temperature Sensor Flow Chart

Start

Initialize Analog pin =0

RRCE, DEPT. OF ECE 46


IoT Based Home Automation Using Arduino

Wait for Temp Data

No
If temp>35

Yes

Trigger Fan

Fig 6.2 Flow chart for Temperature Sensor

6.3 Gas Sensor Flow Chart


Start

Initialize Analog pin =0

RRCE, DEPT. OF ECE Wait for Gas Data 47


IoT Based Home Automation Using Arduino

No
If Gas Leaked

Yes

Trigger Light

Fig 6.3 Flow chart for Gas Sensor

CHAPTER 7
EXPERIMENTAL RESULTS

Results obtained under the new experimental conditions of input and output are


called experimental results. The project has a conclusive result but for high performance
applications can be added and for good flexibility.

RRCE, DEPT. OF ECE 48


IoT Based Home Automation Using Arduino

Fig 7.1 Overall Project Model

Fig 7.2. Experimental Results

CHAPTER 8

Advantages and Applications


RRCE, DEPT. OF ECE 49
IoT Based Home Automation Using Arduino

8.1 ADVANTAGES OF HOME AUTOMATION

 Reliability
 Low cost
 Quality of service
 Scalability
 Network co-existence
 Security and Privacy
 Efficiency
 Energy

8.2 Applications

1- Heating, Ventilation and Air Conditioning

Heating, Ventilation and Air Conditioning solutions include temperature and


humidity control (climatic). This is generally one of the most important aspects to a
homeowner. An Internet-controlled thermostat, for example, can both save money and
help the environment, by allowing the homeowner to control the building's heating and
air conditioning systems remotely.

2- Lighting

Lighting control systems involves aspects related to controlling electric lights.

 Extinguished general of all the lights of the house


 Automation of switched off / ignition in every point of light
 Regulation of the illumination according to the level of ambient luminosity

3- Natural lighting

Natural lighting control involves controlling window shades, LCD shades,


draperies and awnings. Recent advances include use of RF technology to avoid wiring
to switches and integration with third party home automation systems for centralized
control.
RRCE, DEPT. OF ECE 50
IoT Based Home Automation Using Arduino

4- Audio

Major companies associated with Audio Distribution include: There are three
components that allow the consumer to listen to audio throughout your home, or
business:

 Cat 5e/CAT 6 cable from Audio central unit.


 2 sets of speaker cabling (4ply from amplifier, and 2 ply from key pad to ceiling
or wall speakers).
 A keypad to control your volume and sources.

This category includes audio switching and distribution. Audio switching


determines the selection of an audio source. Audio distribution allows an audio source
to be heard in one or more rooms. This feature is often referred to as 'multi-zone' audio.

5- Video

This includes video switching and distribution, allowing a video source to be


viewed on multiple TVs. This feature is often referred to as 'multi-zone' video.

Integration of the intercom to the telephone, or of the video door entry system to the
television set, allowing the residents to view the door camera automatically.

6- Security

Control and integration of security systems.

With Home Automation, the consumer can select and watch cameras live from an
Internet source to their home or business. Security cameras can be controlled, allowing
the user to observe activity around a house or business right from a Monitor or touch
panel. Security systems can include motion sensors that will detect any kind of
unauthorized movement and notify the user through the security system or via cell
phone.

This category also includes control and distribution of security cameras


RRCE, DEPT. OF ECE 51
IoT Based Home Automation Using Arduino

 Detection of possible intrusion


 sensors of detection of movement
 sensors of magnetic contact of door/window
 sensors of glass breaking
 sensors of pressure changes
 Simulation of presence.
 Detection of fire, gas leaks, water leaks (see fire alarm and gas alarm)
 Medical alert. Tele assistance.
 Precise and safe closing of blinds.

7- Intercoms

An intercom system allows communication via a microphone and loud speaker between
multiple rooms.

 Ubiquity in the external control as much internal, remote control from the Internet,
PC, wireless controls electrical equipment.
 Transmission of alarms.
 Intercommunications.

Using special hardware, almost any device can be monitored and controlled
automatically or remotely.

8 - Plant Watering

 Pool pump(s) and heater, Hot tub and Spa


 Sump Pump (need info and links)

CONCLUSION
This project is developed for Houses, small, Large, Medium size national and
multinational organizations which keeps large amount of money in their office and want
100% security. Their main requirements were they wanted a system that could alert
them when burglary takes place at the time when office is closed. These organizations
are very big and have many employees; most of the employees do overtime and stay at
office for late nights. Supervisor is responsible to switch off the electric lights, other
RRCE, DEPT. OF ECE 52
IoT Based Home Automation Using Arduino

appliances and lock the office after everyone leaves but the main problem was this
supervisor had to stay with employees for long time until they finish their work, so we
proposed this system to these organizations that can solve out their problems. Now
supervisor can monitor the employees from their houses using live web cams, turn off
lights and doors when everyone is gone.

FUTURE SCOPE

(1) Dedicated Home Automation Hardware Will Still Have Its Place

But the kind of dedicated home automation hardware that we are going to see are
the components usually hidden from the view of the home owner. Dedicated gateway
products that specialize on translating automation protocols to and from the home IP
network are still needed. The mass consumer electronics industry will have little interest
to target this area, at least not yet.

Expect to see less and less dedicated touch screens or dedicated home automation
controllers that are easily replaced with off-the-shelf products. Their pricing, and
therefore their utility, can only exist at the very peak of the luxury market, targeting
high-net-worth-individual homes, not the mass market. There's not much space at
the peak of the consumer pyramid, few vendors will survive in this segment but most
will need to adjust their business models to cater to a different kind of home owner.

(2) IP networks Will Have an Increasing Role

As with the off-the-shelf hardware, IP networks are already in the homes, already
installed around the house in new buildings, and they are being used to transfer media
for user consumption. Undoubtedly, whether it is music, video, photos etc. the
distribution happens on an IP network. Media centers are enabled for IP based controls.
Web's HTTP protocol and Universal Plug'n'Play protocols are being used over IP to
control things.

This means the backbone communication and control infrastructure is often in


place already and it is IP-based. A fact that cannot be ignored by any vendor that wishes
to reach a wider market that demands lower initial investment to experiment with the
automation technology. What needs to be supported by automation vendors is the "last-
meter" of network integration between IP to Infrared, IP to serial, IP to Z-Wave and so
on.

RRCE, DEPT. OF ECE 53


IoT Based Home Automation Using Arduino

(3) Increasing Need for Interoperability, Testing and Certification

Both off-the-shelf hardware and IP networks are generic technical solutions that
must be adapted to automation purposes accordingly.

IT industry today uses these same components to support critical functions in the
business enterprise. Same can be done for automation. But it requires establishing new
processes that tackles the challenges of quality assurance in testing components,
ensuring they work together and ultimately, certifying them as a supported solution for
an automation installation. Training programs will need to be created and updated to
include technical and configuration details of third party components.

REFERENCES
1. Ajah, G, David, N, Abioye, A, Web Based Security System, Sch. J. Eng. Tech,
1(3):112-116, 2013.

2. Mahmood, S M, Abdulsattar, M, Firas, A Y; Home Automation Management with


WLAN (802.11g) and RF Remote Control, Raf. J. of Comp. & Math’s, 6(1), 2009.
RRCE, DEPT. OF ECE 54
IoT Based Home Automation Using Arduino

3. Aru O E ,Ihekweaba G, Opara F K, Design Exploration of a Microcontroller Based


RF Remote Control 13amps Wall Socket, IOSR-JCE, 11(1), 56-60, 2013.

4. David, N, Design of an Internet Based Security System, NIJOTECH, 29(2) 118-129,


2010.

5. Diaa, M F, Mahmood, B M, Data Acquisition of Greenhouse Using Arduino, Journal


of Babylon University/Pure and Applied Sciences/ No.(7)/ Vol.(22), 1908-1916, 2014.

6. Robotics D, “DHT11 Humidity & Temperature Sensor”, 2010,


www.micro4you.com/files/sensor/DHT11.pdf

7. Anandan, R, Karthik, B, Kumar, K, WIRELESS HOME AND INDUSTRIAL


AUTOMATION SECURITY SYSTEM USING GSM, JGRCS, Volume 4, No. 4, 126-
132, 2013.

8. Asif, O, Hossain, B, Hasan M, Rahman, T, Chowdhury, M, Fire-Detectors Review


and Design of an Automated, Quick Responsive Fire-Alarm, 2014. 9. Violino, B, The
'Internet of things' will mean really, really big data, InfoWorld, 2013.
http://www.infoworld.com/article/2611319/computer-hardware/the--internet-of-things-
-will-mean-really--really-big-data.html

RRCE, DEPT. OF ECE 55

You might also like