You are on page 1of 43

SMART HOME USING PARTICLE PHOTON

A report submitted in accordance with the requirements of


FREDERICK UNIVERSITY

Department of Electrical Engineering

for the fulfilment of the course


AEEE499 – SENIOR PROJECT

by

Aayush Bista

March 2017
ACKNOWLEDGEMENTS

I would like to thank the department of Electrical Engineering of Frederick University for
including the project course in the curriculum. I would like to express my sincere and deep
gratitude to my project supervisor Dr. Vryonides Photos for all the continued guidance, help
and support and providing the necessary information throughout the project.
Also, I would like to express my appreciation to Dr. Simos Nikolaou and Dr. Haralambous
Haris for his motivation and valuable suggestions toward achieving the objectives of this
project, Mr. Loizos Loizou and Mr. Stathis Efstathiou for providing all the necessary
technical help during the project. I would also like to thank Dr. Christos Themistos for
allowing me to take the senior project and for this ERASMUS Program.
Finally, I would like to thank my colleagues and friends who helped me in many ways to
complete this project.

i
ABSTRACT

Smart home (Home Automation System) is a technology which monitors and coordinates
the house system and the environment of house. In this time, smart home system is being
more sophisticated and user friendly, but with its sophistication the cost of the system is
increasing. This project integrates many sensors and work accordingly with real time
environment. Five different sensors are used in this project. Temperature and humidity
sensor which tracks the temperature and humidity of house in real time, reed switch which
is a magnetic switch to monitor the door of house, MQ-4 sensor for detecting smoke and
gas, PIR sensor for motion detection, Light Dependent Resistor (LDR) for monitoring the
lights status of the house. Also, the hardware is integrated with Blynk app, where the user
can get data in screen of a smart phone. The user can switch on/off the light by a touch in
phone’s screen. Also when the data from the sensors are above or below from the
predefined value a buzzer is alarmed. Also if the system is activated, the buzzer is alarmed
when a motion is detected or the door is opened. Also the system is integrated in a house
model, made up of cardboard boxes. This report describes the prototype model of Smart
Home using particle photon.

ii
Table of Contents
ACKNOWLEDGEMENTS...........................................................................................................................i
ABSTRACT..............................................................................................................................................ii
Table of Contents..................................................................................................................................iii
Chapter 1 Introduction..........................................................................................................................1
1.1 Objectives....................................................................................................................................2
1.2 Outcomes....................................................................................................................................2
Chapter 2 Literature Review..................................................................................................................3
2.1 Ways of Implementing the Smart Home......................................................................................3
2.2 Internet Of Things........................................................................................................................5
2.3 History Of Internet Of Things.......................................................................................................5
2.4 Use Of IoTs in different Sector.....................................................................................................6
2.5 Working of IoTs............................................................................................................................7
2.6 BLYNK Application-Internet of Things..........................................................................................7
2.7 IFTTT............................................................................................................................................9
2.8 Material Used:.............................................................................................................................9
2.9 Different Researches With Smart Home....................................................................................12
Chapter 3 Innovation of Project..........................................................................................................14
3.1 What is Smart Home?................................................................................................................14
3.2 What can a Smart Home (Home Automation System) do?........................................................14
3.3 What does this project do?........................................................................................................15
Chapter 5 System Design and Description...........................................................................................16
5.1 Overview....................................................................................................................................16
5.2 Schematic Diagram....................................................................................................................17
Fig.5.1 Schematic Diagram of Smart Home Using Particle Photn....................................................17
5.3 Event Flow Diagram...................................................................................................................18
5.3.1 Flowchart for Sensor Unit...................................................................................................18
5.3.2 Flowchart for Control Unit..................................................................................................19
5.3.3 Flowchart for User Define and Display Unit........................................................................20
Chapter 6 Project Activity....................................................................................................................21
6.1 Methodology.............................................................................................................................21

iii
6.2 Test and Results.........................................................................................................................22
6.3 Selecting User Interface.............................................................................................................23
6.4 House Model.............................................................................................................................24
6.5 Problems Faced.........................................................................................................................24
6.6 Future Work...............................................................................................................................25
6.7 Cost Estimation..........................................................................................................................25
6.8 Gantt Chart................................................................................................................................26
Chapter 7 Conclusion...........................................................................................................................27
Chapter 8 References and Appendix...................................................................................................28
8.1 References.................................................................................................................................28
8.2 APPENDIX I: Code of Project......................................................................................................30
8.3 Appendix II: Particle Photon Datasheet.....................................................................................35
8.4 APPENDIX III: Technical Specification of Humidity and Temperature Sensor (DHT11)..............37

iv
Chapter 1 Introduction

A smart home (Home Automation System) is a technology which monitors and coordinates
the house system and the environment of house. Home Automation System accessed from
a remote place through internet allows a house owner to control, monitor and coordinate
home appliances allows home owner to save time, money, energy, and secure house. It
makes the life of a house owner easier.

Smart Home(Home Automation System) involves monitoring temperature, humidity, the


condition of door(open/closed), condition of lights(on/off) on real-time. Moreover Smart
home can detect fire, smoke in house and take certain actions to secure house
autonomously.
This project consists of a microcontroller monitoring and coordinating with sensors and
appliances of a house. The microcontroller used is Particle Photon. Particle Photon is a
microcontroller with inbuilt Broadcom Wi-Fi chip which let us to connect to Internet through
Wi-Fi. In this project the particle is connected with sensors. A Software IDE (Integrated
Development Environment) is used to program the particle photon. The program specifies
task to particle photon to perform the tasks. It monitors the data through sensors and sends
the received to user through internet when asked by user via Email or other Internet
application. The sensors used are Light Sensors to detect if the lights are ON or OFF,
temperature and humidity sensor for monitoring the temperature and humidity of the
house(interior), Magnetic Reed Sensor which detects if the Door is closed or Open, Flame
and Smoke Detector for warning the user if there any fire or smoke is detected in house.
Moreover user can remotely control different appliances of house like to switch ON/OFF
lights, by monitoring the temperature switch AC or Heater ON/OFF.

This project also helps in energy conservation, like one can turn off the light, Air Conditioner,
Heater, etc. of house remotely saving electricity and money. Also this project is user
friendly as it uses Internet, which is accessible to most people.

1
Reed Switch

Internet

Light Sensor

Microcontroller Relay for light


(with WI-FI shield) bulb
DHT 11 Sensor

PIR Sensor

Flame Sensor

Fig.1.1 General Overview of Smart Home

1.1 Objectives

This project consists of a microcontroller monitoring and coordinating with sensors and
appliances of a house. The microcontroller used is Particle Photon. Also the particle photon
transmits the data to its cloud, which can be accessed through a remote place via Internet.
This project allows me to work with microcontroller, different sensors and IoTs(Internet of
Things).
From this project I can acquire many new skills and knowledge in research, report writings,
circuit analysis and design. I can also gain knowledge in coding different microcontrollers
(Particle Photon and Arduino), and understand the working of microcontroller.

1.2 Outcomes

The user can monitor real time conditions of the house through his/her smartphone
connected to internet. The user can turn on/off the alarm through a button on smartphone.
Also user can control the lights through smartphones with a touch. The action to take plac in
real time is affected by the internet connection.

2
Chapter 2 Literature Review
In the recent years IoTs (Internet of Things) and software interference to most of hardware
is increasing rapidly to make the life of people (consumer) more convenient and
comfortable. Wireless Communication like WLAN has become more popular in home
networking. Different technologies have been made to make every day work of humans
easier and comfortable.
In this project the microcontroller used is Particle photon which has an inbuilt Broadcom Wi-
Fi chip which lets to connect to Internet through Wi-Fi. The Particle Photon can be
connected to Internet through its cloud from particle app or the particle website. For
different actions to be made BLYNK, an android app with a platform for IoTs , is used which
can sense the trigger in particle and respond to the trigger with certain action which is
predefined.
The output of the sensor is connected to the input of particle photon, which analyses and
monitors the signals from the sensors. If any signal with trigger condition comes to the
photon, it takes an action. Ex- if a smoke sensor detects smoke and feds 1 to the digital
input of the photon; it takes the signal as a trigger signal and triggers a buzzer which creates
a loud alarm in house.
Also if the owner sends signal for turning off the house lights, the particle receives signal
through its cloud, and then triggers the relay connected to lights; and turns the lights off.

2.1 Ways of Implementing the Smart Home

The Ways of Implementing the Smart Home (Home Automation System) in this project:

Using Arduino and Pi

By using Arduino and Pi, we can build this system with the sensors connected to the Arduino
which is used as a main microcontroller. The Arduino is attached with Ethernet Shield, which
is connected to the Raspberry Pi. In this technique the Raspberry Pi is used as a gateway to
internet for the Arduino. Third party application is installed in Raspberry Pi for connecting to
the cloud for trigger and action purpose. The third-party application can be OpenHAB which
has a cloud and mobile applications too. [2]

3
Sensors

Ethernet

Raspberry Pi
Arduino

Wi-Fi

Data of
Sensors

Fig.2.1 Implementing Idea with Arduino and Pi


If this way is implemented, many hardware components must be used which will be
expensive for the user to install.

Using Particle Photon:


Particle's Internet of Things hardware development kit, the Photon, provides everything we
need to build a connected product. It has a powerful ARM Cortex M3 micro-controller with
a Broadcom Wi-Fi chip in a tiny thumbnail-sized module called the PØ (P-zero).
Particle Photon has a 3.3VDC SMPS power supply, RF and user interface components to the
PØ on a small single-sided PCB. Particle is open source, so it can be integrated to other
products.
The Photon comes in two physical forms:
-with headers
4
-without headers
Prototyping is easy with headers as the Photon can be plugged directly into standard
breadboards. Using Photon, the data in Photon can be easily monitored, stored and
modified through internet. Also, the number of hardware reduces significantly by using
photon. [3]

Fig.2.2 Particle Photon

2.2 Internet Of Things

The Internet of Things is the concept of everyday objects – from industrial machines to
wearable devices – using built-in sensors to gather data and take action on that data across
a network. So, it’s a building that uses sensors to automatically adjust heating and lighting.
Or production equipment alerting maintenance personnel to an impending failure. Simply
put, the Internet of Things is the future of technology that can make our lives more efficient.

2.3 History Of Internet Of Things

The term “Internet of Things” was coined in the late 1990s by entrepreneur Kevin Ashton.
Ashton, who’s one of the founders of the Auto-ID Center at MIT, was part of a team that
discovered how to link objects to the Internet through an RFID (Radio-frequency
identification) tag. He said he first used the phrase “Internet of Things” in a presentation he
made in 1999 – and the term has stuck around ever since.
From then IoTs have been developing in different ways and now being used to make our
daily life easier.

5
2.4 Use Of IoTs in different Sector

Health Care
Many people have already adopted wearable devices to help monitor exercise, sleep
and other health habits – and these items are only scratching the surface of how IoT
impacts health care. Patient monitoring devices, electronic records and other smart
accessories can help save lives.
Manufacturing
This is one of the industries that benefits from IoT the most. Data-collecting sensors
embedded in factory machinery or warehouse shelves can communicate problems
or track resources in real time, making it easy to work more efficiently and keep
costs down.
Retail
Both consumers and stores can benefit from IoT. Stores, for example, might use IoT
for inventory tracking or security purposes. Consumers may end up with
personalized shopping experiences through data collected by sensors or cameras.
Telecommunications
The telecommunications industry will be significantly impacted by the IoT since it will
be charged with keeping all the data the IoT uses. Smart phones and other personal
devices must be able to maintain a reliable connection to the Internet for the IoT to
work effectively.
Transportation
While cars aren’t at the point of driving themselves, they’re undoubtedly more
technologically advanced than ever. The IoT also impacts transportation on a larger
scale: delivery companies can track their fleet using GPS solutions. And roadways
can be monitored via sensors to keep them as safe as possible.

Utilities

6
Smart meters not only collect data automatically, they make it possible to apply
analytics that can track and manage energy use. Likewise, sensors in devices such
as windmills can track data and use predictive modeling to schedule downtime for
more efficient energy use.

2.5 Working of IoTs

In IoT discussions, it’s recognized from the onset that analytics technologies are critical for
turning this tide of streaming source data into informative, aware and useful knowledge.
But how do we analyze data as it streams nonstop from sensors and devices? How does the
process differ from other analytical methods that are common today?
In traditional analysis, data is stored and then analyzed. However, with streaming data, the
models and algorithms are stored and the data passes through them for analysis. This type
of analysis makes it possible to identify and examine patterns of interest as data is being
created – in real time.
So, before the data is stored, in the cloud or in any high-performance repository, it process
it automatically. Then, the analytics to decipher the data, all while devices continue to emit
and receive data.
With advanced analytics techniques, data stream analytics can move beyond monitoring
existing conditions and evaluating thresholds to predicting future scenarios and examining
complex questions.
To assess the future using these data streams, one need high-performance technologies
that identify patterns in your data as they occur. Once a pattern is recognized, metrics
embedded into the data stream drive automatic adjustments in connected systems or
initiate alerts for immediate actions and better decisions.
Essentially, this means we can move beyond monitoring conditions and thresholds to
assessing likely future events and planning for countless what-if scenarios. [3]

2.6 BLYNK Application-Internet of Things

Blynk is a Platform with iOS and Android apps to control Arduino, Raspberry Pi, Particle
Photon and the likes over the Internet.
7
It's a digital dashboard where one can build a graphic interface for a project by simply
dragging and dropping widgets.
Blynk is designed for the Internet of Things. It can control hardware remotely, it can display
sensor data, it can store data, visualize it and do many other internet of things.
There are three major components in the platform:
Blynk App - allows to create interfaces for projects using various widgets.

Blynk Server - responsible for all the communications between the smartphone and
hardware. Also one can use Blynk Cloud or run private Blynk server locally. It’s open-source
and can easily handle thousands of devices and can even be launched on a Raspberry Pi.

Blynk Libraries - for all the popular hardware platforms - enable communication with the
server and process all the incoming and outcoming commands.
Also no laptop is required to create a communication between hardware and the software
when Blynk is used. [3]

8
Fig.2.3 Working of Blynk

2.7 IFTTT

IFTTT is a free web-based service that people use to create chains of simple conditional
statements, called applets. An applet is triggered by changes that occur within other web
services such as Gmail, Facebook, Instagram, or Pinterest. IFTTT is an initialism for If This
Then That
Typical applets are:
Send an e-mail message if the IFTTT user tweets using a certain hashtag.
Copy a photo on Facebook to a user's archive if someone tags (identifies) the user in that
photo. [4]

2.8 Material Used:

9
Particle Photon:
Particle Photon is a microcontroller with inbuilt Broadcom Wi-Fi chip which let us to connect
to Internet through Wi-Fi. As seen in Fig.2.1 particle photon has 6 Analog I/O ports with 2
port for RX and TX, one DAC ( Digital to Analog Converter), and 8 Digital I/O port with inbuilt
LED at D7 port. Particle has its own cloud where the data in our particular photon can be
accessed through Internet. Also having its own cloud, the data can be accessed by IFTTT and
use it for action and trigger purpose to send email and receive command through user
easily. [3]

Temperature and Humidity Sensor (DHT11):


DHT11 temperature and humidity sensor is a composite sensor
contains a calibrated digital signal output of the temperature
and humidity. The sensor includes a resistive sense of wet
components and temperature measurement devices. It can
sense temperature from 0⁰C to 50⁰C with accuracy of ±2⁰C and
humidity of 20-90%RH with accuracy of ±5%RH. [4]

Fig.2.4 DHT11

PIR Sensor:
PIR(Passive Infrared) sensor is a motion detection sensor.
It sends a high signal to microcontroller when it detects
any movement or motion in its range. It can detect
motion up to 20 feet (6 meters) and 110° x 70° detection
range. A PIR sensor is shown in fig.2.5. As seen in the
figure, by the potentiometer in built in sensor, the
sensitivity and range can be adjusted. [5]

10
Smoke and Gas Detector:
A smoke detector is a device that senses smoke, typically
as an indicator of fire. The resistance changes in the
sensor with change in the composition of gas in air. With
typical air condition, it can be adjusted to environment it
is working on. A MQ-4 smoke and gas sensor is shown in
fig.2.6. [6]
Fig.2.6 Smoke and Gas Sensor

Light / Photoresistor Sensor:


A light sensor module uses a photo resistor which had a LDR
(Light dependent Resistor). It gives low resistance (in bright
light) triggers a HIGH signal towards the output module and
high resistance (in darkness) triggers a LOW signal towards
the output module. The output module is connected to
photon for monitoring the sources. It has a Wide spectral
response, wide ambient temperature range and is cheap.
[7]

Fig.2.7 LDR

Reed Switch:
The reed switch is an electrical switch operated by an applied
magnetic field. It was invented at Bell Telephone Laboratories
in 1936 by W. B. Ellwood. It consists of a pair of contacts on
ferrous metal reeds in a hermetically sealed glass envelope. It
sends a digital high when a magnetic material comes close to
Fig2.8 Reed Switch
the switch and stays at digital idle low when there is no magnetic
material. In this project, it can be used to monitor home door. [8]
A reed switch showed the following results when tested:

Magnet is near Magnet is not near

0 1

11
Relay:
A relay is an electrically operated switch. Many relays use an electromagnet to mechanically
operate a switch, but other operating principles are also used, such as solid-state relays.
Relays are used where it is necessary to control a circuit by a low-power signal (with
complete electrical isolation between control and controlled circuits), or where several
circuits must be controlled by one signal. Since relays are
switches, the terminology applied to switches

applied to relays. A relay can be operated in two states:

• Normally - open (NO) contacts connect the circuit


when the relay is activated; the circuit is
disconnected when the relay is inactive. It is also
called a FORM A contact or “make” contact.
• Normally - closed (NC) contacts disconnect the
circuit when the relay is activated; the circuit is connected when relay is inactive. It is
also called FORM B contact or “break” contact. [9] Fig.2.9 Relay

2.9 Different Researches With Smart Home

As from the article published in THE ECONOMIST under title “The internet of things Where
the smart is” states that in 2015 5% of Americans used smart home devices and is expected
to rise to 17% by 2021, which is way less than expected. The article also says that this slow
increase in usage of smart home is due to the price of smart appliances. People are still not
convinced to believe that through internet the hardware at their houses can be controlled.
So building a smart home device which cost less than 100€ would be a solution to the
problem. [9]

12
Sadeque Reza Khan and Farzana Sultana Dristy made ANDROID BASED SECURITY AND HOME
AUTOMATION SYSTEM using Bluetooth Module to communicate between Android and
microcontroller and GSM module for Home Automation System. [10]

Ai, Wei, Chen, Cifa had discussed about Green House environment monitor technology
implementation based on android mobile platform, which uses android mobile phone as the
monitoring terminal. They discussed about parameters in the green house and are
monitored on the PC as well as the android mobile phone from anywhere in the world via
internet through the team viewer software. [11]

Varun Dange, Nilima Zad, Anurag Kotangale, Rahul Chauhan and Sanket Ramane made
Smart Home System Using Wireless Module, in which a ARM mbed- FRDM KL25Z
microcontroller and WI-FI module is used to design and implementation of home
automation system. They used microcontroller FRDM KL25Z, WI-FI module, opto-coupler
and triac circuit for varying intensity of bulb/speed of fan, relay module for switching on and
off and an android app for controlling these appliances wirelessly. [12]

David Bregman and Arik Korman discussed about Universal Implementation Model for the
Smart Home. Their model emphasizes on a central management unit and a built-in database
for smart equipment integration. Their proposed idea in smart home is that any new
integrated device is synchronized upon connection and removed when not in use. They
concluded that universal model can substantially lead to higher quality and usability of both
devices and user interface; Production costs may be significantly reduced if manufacturers
adopt a universal standard. [13]

Ahmed ElShafee and Karim Alaa Hamed made a purposed a home automation system based
on Wi-Fi. They made a master server and used many Arduino (microcontroller) as slave and
connected different hardware and sensors to the microcontroller. The master server is
13
connected to the cloud which can be accessed from different remote devices via internet.
[14]

14
Chapter 3 Innovation of Project
3.1 What is Smart Home?

A smart home (Home Automation System) is a technology which monitors and coordinates
the house system and the environment of house. It can also be connected with Internet to
work with IoTs(Internet of Things).
Early home automation began with labor-saving machines. Self-contained electric or gas
powered home appliances became viable in the 1900s with the introduction of electric
power distribution and led to the introduction of washing machines, water
heaters, refrigerators, and sewing machines, dishwashers, and clothes dryers.

3.2 What can a Smart Home (Home Automation System) do?

Heating, ventilation and air conditioning (HVAC): It is possible to gain remote control of


all home energy monitors over the internet incorporating a simple and friendly user
interface.
Lighting control system: Light can be controlled by the system easily via Internet. One tap on
smartphone can switch on/off lights.
Appliance control and integration with the smart grid and a smart meter: Integrating smart
grid and smart meter can take advantage by automatically running washing machine at the
middle of day, when the output from solar panel is maximum.
Security: A household security system integrated with a home automation system can
provide additional services such as remote surveillance of security cameras over the
Internet, or central locking of all perimeter doors and windows.
Leak detection, smoke and CO detectors: Any leaks or smoke in home is detected by Home
automation System.
Indoor positioning systems: The position of indoor objects can be monitored by integrating
IPS system. For example, a baby can be monitored using IPS.
Home automation for the elderly and disabled: Imagine your parents at home cannot move
to switch light ON/OFF from their bed. Now it is not possible for you to be with them
anytime, so you can put a Home Automation System for their easiness.

15
3.3 What does this project do?

This project uses a particle photon as a microcontroller monitoring and coordinating with
sensors and appliances of a house. Particle Photon is a microcontroller with inbuilt
Broadcom Wi-Fi chip which let us to connect to Internet through Wi-Fi. Sensors (Light
Intensity Sensor, Temperature and Humidity Sensor, Smoke Detector, IR motion Sensor),
Reed Switch monitors the status of home/home appliances. Relay connected to photon is
capable of sounding a buzzer and turning of lights of the house automatically or manually as
specified by the user. Also, the particle photon sends data from sensors periodically to the
user. Also, user can send command to photon to send data via email at any time asked by
the user.

16
Chapter 5 System Design and Description
5.1 Overview

Smart Home have three different units for operating


1. Sensor Data accusation
In this unit, the data from the sensors are acquired through the photon. In this project I’ve
used five sensors: Temperature and Humidity sensor(DHT 11), Magnetic Reed Switch,
Passive Infrared Sensor(PIR),Smoke and Gas Detector(MQ-4), Photoresistor (Light Sensor).

2. Control Unit
The controller unit analyzes the sensor data acquired. This unit takes certain actions from
the sensor data. A buzzer is used as alarm system for this project. The alarm goes off if any
smoke/gas is detected. Also when the user activates this system, the alarm goes off when
the door is open or any motion is detected. Also the unit sends the data to its cloud from
where Blynk app retrieves the data and displays it on the users phone. Also the signal from
user is processed by control unit.

3. User Define and Display Unit:


The user can push virtual button in his/her phone to turn light on/off. The signal is given to
the controller for further processing. The controller then sends a signal to relay for the light
switching action.

17
5.2 Schematic Diagram

User Define Unit


Sensor Unit

Temperature and
Humidity sensor BLYNK
APP Light Bulb

Motion Sensor

Relay Switch
Smoke Sensor
MICROCONTROLLER

(PARTICLE PHOTON)

REED Switch

Control Unit

Light Intensity
Sensor

Fig.5.1 Schematic Diagram of Smart Home Using Particle Photn

5.3 Event Flow Diagram

18
5.3.1 Flowchart for Sensor Unit

Start

Motion Temp. and Smoke and Light


REED Switch
Sensor Humidity Gas Sensor Intensity

Control Unit

5.3.2 Flowchart for Control Unit

Fetch Data from


Sensors 19
If smoke If alarm If time= Send data to
value > 500 system On 10:30pm display
(particle
cloud)

Send Email to User

If reed If motion
value = 1 value > 2048

Buzzer

5.3.3 Flowchart for User Define and Display Unit

20
START

If Button pressed
Fetch Data From
Particle Cloud

Send signal to Control


Unit accordingly

Display Data on user’s


screen

21
Chapter 6 Project Activity
6.1 Methodology

For the completion of this project first different articles, books, and internet research was
done to study the idea of implementing the idea with different materials. Ideas from
professors and colleagues were be taken into account. The feasibility study of the project
was done.
The materials used in this project were studied thoroughly and collected. The materials used
are integrated into particle photon (microcontroller) and tested with different parameters.
After the integration of microcontroller and sensors the product was tested, debugged
sensibility was calibrated for different environment sensing.
After the debugging and integration of the microcontroller and sensors, the data from
sensors to microcontroller was connected to cloud to store or for accessing the data via
Internet. The project was made more user-friendly by connecting it to internet, from which
the user can get information of home through remote devices connected to Internet.
First different researches were done and the way to complete the project was created. Then
the hardware components were ordered and collected. Initially sensors were used
individually to calibrate the sensors. When all the sensors were calibrated with the
environment the sensors were then integrated. After then the results were monitored and
further works were done. After creating the visual platform in Blynk app, then the home
casing was made for the demonstration. The casing was designed and then the circuit was
integrated in the casing. After that the results were collected and different tests were done.
The output came positive and the hardware system responded accordingly to the software.
Finally, a presentation was made for demonstrating the project.

22
6.2 Test and Results

A following results were obtained from the testing and calibration done in different
environment scenario:
Light Intensity Sensor:
The value from the sensor were:

S.N Parameters Value


1. During Day Time (Lights OFF) 170-600
2. During Day Time (Lights ON) 840-1400
3. During Night Time (Lights OFF) 20-40
4. During Night Time (Lights ON) 900-1500

So, from the above results I concluded that value from Light Sensor above 750 means the
light is ON in any condition.

REED Switch:
If the sensor gives value of 1, then it signifies that the door of house is open, and if it gives 0,
it signifies that the door is closed.

PIR Sensor:

The value from the sensors were:

S.N Parameters Value


1. No motion 0-30
2. Motion 4000-4086

So, it is concluded that if the value from motion sensor is greater than 2048, then motion is
detected.

23
Smoke Sensor:

The value from the sensor were:

S.N Parameters Value


1. During Day No Smoke 400-450
2. During Day with Cigarette Smoke >700
3. During Night No Smoke <300
4. During Night with Cigarette Smoke >500

So, it was concluded that value greater than 500 indicates there is a presence of smoke, so it
gives signal to buzzer to sound alarm.

Temperature and Humidity Sensor:

The value of temperature and humidity is directly send to the display unit.

6.3 Selecting User Interface

IFTTT

First the user interface of the project was meant to be completed by using IFTTT, but while
doing so, there were many problems encountered. IFTTT was too slow for this project as it
depends on the server usage. IFTTT took a delay of up to an hour to send an email to user.
So, it was practically not feasible to use IFTTT in this project. So, an alternate was chosen to
do this project.

24
Blynk

Blynk provided a platform for IOS and Android phones, where one can display the data from
the hardware. Using Blynk, its easy to program and modify the program. Also Blynk has
many graphical symbols and widgets to provide good user interface. So, I have used Blynk as
my User Interface program to display my values to the user.

6.4 House Model

A house model was constructed to put circuit in it. The house model was made with paper
and cardboard boxes. The circuit was assembled in the house and made ready for
demonstration. The cardboard boxes were cut and joint with glue to make the model ready.

6.5 Problems Faced

1. Lack of equipment and electrical shop in Cyprus:


There are no shop in Cyprus where one can buy electronics items. I had to order items from
online store either waiting for months or paying a lot as delivery charge.
1. Problems with IFTTT
IFTTT took a long to respond via email. It sometimes took up to an hour to send an email to
notify the user. Though IFTTT is easy to use and nice user interface, because of its time delay
its not used in this project.
2. Problems with Internet Connectivity
The as internet connectivity of Frederick university uses Enterprises type security, because
of which the photon cannot be connected to the internet in Frederick University. So I have
to buy mobile data to do the project in the University premises.
3. Casing Material
I couldn’t find any casing materials, so I build up one with the cardboard box from DHL
services. To cut the DHL postal box was really hard and time consuming.
4. Power Supply
For supplying 9V power to microcontroller, the battery or adapter is expensive in Cyprus, so
I used power supply from USB Cable.

25
5. Lack of time
Due to lack of time, new innovation could not be integrated in this project. Ex- a RF
transmitter of transmission of data.

6.6 Future Work

The following integration and work can be integrated in this project are:
1. For working in real house, a RF (Radio Frequency) Transmitter can be used which
reduced the wiring cost in house. The cost of radio transmitter is €1.42. [18]
2. Smart appliances can be integrated in this project. Ex- a smart refrigerator can be
integrated in this project.
3. A bridge rectifier can be created to supply the power to microcontroller and sensors
from 220-240V supply which we get normally in house.
4. More user interface like sending text message to user can be done in future.

6.7 Cost Estimation

Component Quantity Cost per unit (€) Total cost(€)


Particle Photon 1 22 22
Temperature and Humidity sensor 1 1.42 1.42
Motion sensor 1 2.02 2.02
Smoke and gas Sensor 1 2 2
LDR 1 .70 .70
Reed Switch 1 1.85 1.85
Breadboard 2 3.02 6.04
Relay 1 3.5 3.5
Filament Bulb 1 0.75 0.75
Materials for House Model 1 12 12
9V DC battery 1 4 4
Others 35 35
Total €91.28

6.8 Gantt Chart


26
Activity Duration in Weeks
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20
Literature
Review
Sensors
Interface
Photon and
Sensors
Integration
Monitoring
Output
Circuit and
Model
Integration
Writing of
the Report
and
Presentatio
n

Work Accomplished

27
Chapter 7 Conclusion

The design of a smart home using Particle Photon was completed with all the proposed
work accomplished within the time frame. In this system, the user can activate or deactivate
the alarm system with a touch in the user’s phone connected to Internet. User can also get
the real-time data from sensors when connected to the Internet. More integration can be
done in near future to make the product usable in real house.

28
Chapter 8 References and Appendix

8.1 References

[1] "Instructables," [Online]. Available: http://www.instructables.com/id/Uber-Home-Automation-


w-Arduino-Pi/. [Accessed 28 11 2016].

[2] "Particle," [Online]. Available: https://docs.particle.io/datasheets/photon-datasheet/#pin-and-


button-definition. [Accessed 29 11 2016].

[3] "sas-the power to know," [Online]. Available:


https://www.sas.com/en_us/insights/big-data/internet-of-things.html. [Accessed 03 03 2017].

[4] "Blynk," [Online]. Available: http://www.blynk.cc/. [Accessed 28 02 2017].

[5] "Wikipedia," [Online]. Available: https://en.wikipedia.org/wiki/IFTTT. [Accessed 12 02 2017].

[6] D.-R. UK, "DHT11 Humidity & Temperature Sensor".

[7] L. Ada, "PIR Motion Sensor," 10 09 2016. [Online]. Available:


https://cdn-learn.adafruit.com/downloads/pdf/pir-passive-infrared-proximity-motion-
sensor.pdf. [Accessed 29 11 2016].

[8] H. Electronics, "MQ-4," [Online]. Available:


https://www.sparkfun.com/datasheets/Sensors/Biometric/MQ-4.pdf. [Accessed 11 12 2016].

[9] "GO TRONIC," [Online]. Available: www.gotronic.fr/pj-1284.pdf. [Accessed 25 11 2016].

[10] "Tkkkr Lab," [Online]. Available: https://tkkrlab.nl/wiki/Arduino_KY-


003_Hall_magnetic_sensor_module. [Accessed 26 11 2016].

[11] "Wikipedia," [Online]. Available: https://en.wikipedia.org/wiki/Relay. [Accessed 09 12 2016].

[12] T. Economist, "The internet of things," 11 06 2016.

[13] S. R. K. a. F. S. Dristy, "ANDROID BASED SECURITY AND HOME AUTOMATION SYSTEM,"


International Journal of Ambient Systems and Applications (IJASA) Vol.3, No.1, March 2015.

[14] C. C. Wei Ai, "Green house environment monitor technology implementation based on android
mobile platform".

[15] N. Z. A. K. R. C. S. R. Varun Dange, "Smart Home System Using Wireless Module," International
Journal of Electrical and Electronics Research , pp. 224-229, 2015.

[16] A. K. David Bregman, "A Universal Implementation Model for the Smart Home," International

29
Journal of Smart Home , vol. 3, no. 3, July, 2009.

[17] K. A. H. Ahmed ElShafee, "Design and Implementation of a WiFi Based Home Automation
System," International Journal of Computer, Electrical, Automation, Control and Information
Engineering, vol. 6, no. 8, 20112.

[18] "Gearbest," [Online]. Available: http://www.gearbest.com/. [Accessed 09 12 2016].

8.2 APPENDIX I: Code of Project

// This #include statement was automatically added by the Particle IDE.

30
#include <SparkTime.h>

// This #include statement was automatically added by the Particle IDE.

#include <HttpClient.h>

// This #include statement was automatically added by the Particle IDE.

#include <Adafruit_DHT.h>

// This #include statement was automatically added by the Particle IDE.

#include <blynk.h>

#define BLYNK_PRINT Serial

#define DHTPIN 5

#define DHTTYPE DHT11

UDP UDPClient;

SparkTime rtc;

char auth[] = "d345081bd6b44583a8bb5ef73f865e51";

int temperature;

int humidity;

int light;

int GasSensor = A1;

// Pins

int light_sensor_pin = A0;

int smoke;

// DHT sensor

int motionsr = A3;

DHT dht(DHTPIN, DHTTYPE);

WidgetLED light1(V4);

int overwrite=0;

int reedsr= D1;

31
int reed;

int switchon= D3;

int buzzer=D6;

int motiondata;

void setup()

Serial.begin(9600);

delay(5000); // Allow board to settle

Blynk.begin(auth);

dht.begin();

pinMode(GasSensor, INPUT);

pinMode(D4, OUTPUT);

pinMode(reedsr,INPUT);

pinMode(D6, OUTPUT);

pinMode(D2, OUTPUT);

pinMode(D0, INPUT);

rtc.begin(&UDPClient, "north-america.pool.ntp.org");

rtc.setTimeZone(+2); // gmt offset

BLYNK_CONNECTED()

//Blynk.syncAll();

void loop() {

Blynk.run();

32
int currentTime = rtc.now();

int min = rtc.minute(currentTime);

int hour = rtc.hour(currentTime);

temperature = dht.getTempCelcius();

int temp=temperature;//temperature measurement

humidity = dht.getHumidity();//humidity measurement

float smoke_measurement = analogRead(GasSensor);

smoke = (int)(smoke_measurement);

Blynk.virtualWrite(V5, smoke);

float light_measurement = analogRead(light_sensor_pin); // Light level measurement

light = (int)(light_measurement);

delay(500);

Blynk.virtualWrite(V2, humidity);

Blynk.virtualWrite(V1, temp);

Blynk.virtualWrite(V3, light);

if (light < 750)

light1.off();

if (light >750)

light1.on();

motiondata=analogRead(motionsr);

if (digitalRead(D0 == HIGH) )

33
if (motiondata > 2048)

digitalWrite(D6,HIGH);

delay(200);

digitalWrite(D6,LOW);

if (reed==1)

digitalWrite(D6,HIGH);

delay(200);

digitalWrite(D6,LOW);

if (smoke > 500)

digitalWrite(D6,HIGH);

delay(200);

digitalWrite(D6,LOW);

Blynk.virtualWrite(V6, motiondata);

float reed_measurement= digitalRead(reedsr);

reed = (int)(reed_measurement);

Blynk.virtualWrite(V7, reed);

if (hour==22 && min==30)

if (reed==1 && light > 750 )

34
{

Blynk.email("Status","door is open and light is on");

else if (reed==1 && light < 750)

Blynk.email("Status","door is open and light is off");

else if (reed==0 && light > 750)

Blynk.email("Status","door is closed and light is on");

else

Blynk.email("Status","door is closed and light is off");

8.3 Appendix II: Particle Photon Datasheet

35
Fig.7.1 Particle Photon WLAN Schematic Diagram

Pin Description

Pin Description
VIN This pin can be used as an input or output. As an input, supply 3.6 to 5.5VDC to
power the Photon. When the Photon is powered via the USB port, this pin will
output a voltage of approximately 4.8VDC due to a reverse polarity protection
series Schottky diode between VUSB and VIN. When used as an output, the max
load on VIN is 1A.
RST Active-low reset input. On-board circuitry contains a 1k ohm pull-up resistor
between RST and 3V3, and 0.1uF capacitor between RST and GND.
VBAT Supply to the internal RTC, backup registers and SRAM when 3V3 is not present
36
(1.65 to 3.6VDC).
3V3 This pin is the output of the on-board regulator and is internally connected to
the VDD of the Wi-Fi module. When powering the Photon via VIN or the USB
port, this pin will output a voltage of 3.3VDC. This pin can also be used to power
the Photon directly (max input 3.3VDC). When used as an output, the max load
on 3V3 is 100mA. NOTE: When powering the Photon via this pin, ensure power is
disconnected from VIN and USB.
WKP Active-high wakeup pin, wakes the module from sleep/standby modes. When
not used as a WAKEUP, this pin can also be used as a digital GPIO, ADC input or
PWM.
D0~D Digital only GPIO pins. D0~D3 may also be used as a PWM output.
7
A0~A7 12-bit Analog-to-Digital (A/D) inputs (0-4095), and also digital GPIOs. A6 and A7
are code convenience mappings, which means pins are not actually labeled as
such but you may use code like analogRead(A7). A6 maps to the DAC pin and A7
maps to the WKP pin. A4,A5,A7 may also be used as a PWM output.
DAC 12-bit Digital-to-Analog (D/A) output (0-4095), and also a digital GPIO. DAC is
used as DAC or DAC1 in software, and A3 is a second DAC output used as DAC2 in
software.
RX Primarily used as UART RX, but can also be used as a digital GPIO or PWM.
TX Primarily used as UART TX, but can also be used as a digital GPIO or PWM.

8.4 APPENDIX III: Technical Specification of Humidity and Temperature Sensor (DHT11)

37
Overview:

Item Measurement Humidity Temperature Resolution Package


Range Accuracy Accuracy
DHT11 20-90%RH ±5%RH ±2℃ 1 4 Pin Single
0-50 ℃ Row

Detailed Specifications:

Parameters Conditions Minimum Typical Maximum


Humidity
Resolution 1%RH 1%RH 1%RH
8 Bit
Repeatability ±1%RH
Accuracy 25℃ ±4%RH
0-50℃ ±5%RH
Interchangeability Fully Interchangeable
Measurement 0℃ 30%RH 90%RH
Range 25℃ 20%RH 90%RH
50℃ 20%RH 80%RH
Response Time 1/e(63%)25℃, 6 S 10 S 15 S
(Seconds) 1m/s Air
Hysteresis ±1%RH
Long-Term Typical ±1%RH/year
Stability
Temperature
Resolution 1℃ 1℃ 1℃
8 Bit 8 Bit 8 Bit
Repeatability ±1℃
Accuracy ±1℃ ±2℃
Measurement 0℃ 50℃
Range
Response Time 1/e(63%) 6S 30 S
(Seconds)

38

You might also like