Download as pdf or txt
Download as pdf or txt
You are on page 1of 61

Yarmouk Private University

Faculty of Informatics and Communication Engineering


Department of Communication and Information Engineering

Implementation of Home Automation Based


On The Internet of Things

Prepared by :

Sally Nofal Joun Shaheen

Supervisor

Dr. Eng. Mohamed Shryda Eng. Loay Al-Jassim

Fall Semester

2022-2023
‫جامعة اليرموك الخاصة‬
‫كلية هندسة المعلوماتية واالتصاالت‬
‫قسم هندسة المعلوماتية واالتصاالت‬

‫تنفيذ أتمتة المنزل على أساس إنترنت األشياء‬

‫إعداد‬

‫جون شاهين‬ ‫سالي نوفل‬

‫إشراف‬

‫م‪ .‬لؤي الجاسم‬ ‫د‪ .‬محمد شريدة‬

‫‪2022-2023‬‬
Acknowledgments
We take this opportunity to express our gratitude to all the faculty
members of the department for their help and support.

We especially thank the Dean of the Faculty of Informatics and


Communications Engineering, Dr. Moatasem Shafa'mari, who
provided us with all the required capabilities within the university
to accomplish this idea.

We thank the head of the department, Dr. Adnan Mutarmawi, for


his constant follow-up and briefing on the completion of the steps
on time and for his continuous support

We also thank the doctor who supervises our project, Mohamed


Shryda, for his help from the beginning of the semester until the
completion of work on the project, so that we can reach this result.

And we will not forget in our thanks to Mr. Loay Al-Jassim, who
personally supervised the practical section of the project, as he
provided us with all the information and research that enabled us to
reach the required end.

We also thank our families for the encouragement, support and


continued concern. We are also grateful to our friends who have
supported us during this time
Abstract

As technology is advancing so houses are also getting smarter. Modern


houses are gradually shifting from conventional switches to centralized
control system, involving remote controlled switches. Presently,
conventional wall switches located in different parts of the house makes
it difficult for the user to go near them to operate. Even more it becomes
more difficult for the elderly or physically handicapped people to do
so. Remote controlled home automation system provides a most
modern solution with smart phones. The main objective of this project
is to develop a home automation system using an Arduino board and
do a simulation using Proteus suit design.

1
‫الملخص‬

‫ضا أكثر ذكا ًء‪ .‬تتحول المنازل الحديثة تدريجيا ً من‬


‫مع تقدم التكنولوجيا ‪ ،‬أصبحت المنازل أي ً‬
‫ا لمفاتيح التقليدية إلى نظام التحكم المركزي ‪ ،‬بما في ذلك مفاتيح التحكم عن بعد‪ .‬في الوقت‬
‫الحالي ‪ ،‬تجعل مفاتيح الحائط التقليدية الموجودة في أجزاء مختلفة من المنزل من الصعب‬
‫على المستخدم االقتراب منها للعمل‪ .‬ويزداد األمر صعوبة بالنسبة لكبار السن أو المعاقين‬
‫جسديًا للقيام بذلك‪ .‬يوفر نظام التشغيل اآللي للمنزل الذي يتم التحكم فيه عن بُعد أحدث الحلول‬
‫مع الهواتف الذكية‪ .‬الهدف الرئيسي من هذا المشروع هو تطوير نظام أتمتة للمنزل باستخدام‬
‫لوحة ‪ Arduino‬وإجراء محاكاة باستخدام تصميم بدلة ‪Proteus‬‬

‫‪2‬‬
Contents
Abstract ............................................................................................................................ 1
List of figures ................................................................................................................... 5
Abbreviations ................................................................................................................... 6
Chapter 1 - General Introduction ................................................................... 7
1.1. Introduction .......................................................................................................... 8
1.2. Problem Statement ................................................................................................ 9
1.3. Problem Solution ................................................................................................... 9
1.4. Aim and Objectives ............................................................................................... 9
1.5. Methodology ........................................................................................................ 10
1.6. Dissertation Outline ............................................................................................ 10
Chapter 2 – Literature Review ...................................................................... 12
2.1. Background ......................................................................................................... 13
2.2. IoT Layers ........................................................................................................... 13
2.3. IoT Challenges .................................................................................................... 15
2.3.1. Security and Privacy .............................................................................................. 15
2.3.2. Heterogeneity .......................................................................................................... 16
2.3.3. Reliability ................................................................................................................ 17
2.3.4. Large Scale ............................................................................................................. 17
2.3.5. Legal and Social Aspects ........................................................................................ 18
2.3.6. Big Data .................................................................................................................. 18
2.4. Standardization ................................................................................................... 18
2.5. Sensors ................................................................................................................. 20
2.5.1. What are sensors?................................................................................................... 21
2.5.2. Classification of sensors .......................................................................................... 21
2.5.3. IoT sensor types ...................................................................................................... 23
2.5.4. Parameters of sensors ............................................................................................. 24
2.6. Smart cities .......................................................................................................... 25
2.6.1. Wireless Sensor Networks (WSNs) ........................................................................ 25
2.6.2. Smart city applications ........................................................................................... 26
2.6.3. Smart Homes .......................................................................................................... 28

Chapter 3 Description of the system and software components .................. 29


3.1. Overview of the Smart House System ................................................................ 30

3
3.2. System Description .............................................................................................. 30
3.3. Proteus Software ................................................................................................. 32
3.4. Introduction to Arduino ..................................................................................... 33
3.4.1. Arduino boards type ............................................................................................... 34
3.4.2. Arduino IDE ........................................................................................................... 35
3.4.3. NodeMCU ESP8266 WIFI Module ........................................................................ 35
3.4.3. VSPE: VIRTUAL SERIAL PORTS EMULATOR-------------------------------------31
3.5. Blynk application ................................................................................................ 37
3.6. IFTTT application............................................................................................... 38
Chapter 4 –Implementation and Results ...................................................... 41
4.1. Implementation ................................................................................................... 42
4.1.1. Implementation of the circuit on the Proteus program ......................................... 42

Chapter 5 –Conclusion and Future works ................................................... 56


5.1. Conclusion ........................................................................................................... 57
5.2. Future Work ....................................................................................................... 57
References ...................................................................................................................... 58

4
List of figures
Figure 1-1: IoT objectives. .............................................................................................................. 8
Figure 2-1: IoT layers. ................................................................................................................... 14
Figure 2-2: IoT challenges. ............................................................................................................ 16
Figure 2-3: IoT Security aspects. .................................................................................................. 17
Figure 2-4: shows he light sensor pinout. ........................................... Error! Bookmark not defined.
Figure 2-5: Internet protocols are extended to the sensor networks. ........................................... 19
Figure 2-6: IoT smart cities applications. ..................................................................................... 27
Figure 3-1: A general block diagram of smart home. ..................................................................... 31
Figure 3-2: Proteus design suite interface. ..................................................................................... 32
Figure 3-3: Arduino famous boards. .............................................................................................. 34
Figure 3-4: Arduino IDE user interface. ........................................................................................ 35
Figure 3-5: ESP8266 WIFI MODULE. ......................................................................................... 36
Figure 3-6: Virtual serial ports ....................................................................................................... 37
Figure 3-7: Functioning of Blynk App. .......................................................................................... 38
Figure 3-8: IFTTT Application ...................................................................................................... 39
Figure 3-9: Trigger creation in IFTTT........................................................................................... 40
Figure 4-1: System block diagram. ................................................................................................. 43
Figure 4-2: Proteus system design. ................................................................................................. 43
Figure 4-3: Blynk control from a website ....................................................................................... 45
Figure 4-4: Control panel of home automation system in Blynk app .......................................... 46
Figure 4-5: Settings of Blynk app.................................................................................................. 46
Figure 4-6: hex link ....................................................................................................................... 47
Figure 4-7: Voice controlled .......................................................................................................... 55

5
Abbreviations
IoT Internet of Things
IoE Internet of Everything
RFID Radio Frequency Identification Devices
GPS Global Positioning Systems
GPRS General Packet Radio Service
PLC Power Line Communication
IETF Internet Engineering Task Force
ROLL Routing Over Low Power and Lossy Networks
CORE Constrained Restful Environments
LLNs Low Power and Lossy Networks
IEEE Institute of Electrical and Electronics Engineers
IP Internet protocol
LDR Light dependent resistor
ADC analog-to-digital converter
WSN Wireless Sensors Network
NAN Neighbor Area Network
USB Universal Serial Bus
I/O Input / Output
IFTTT IF THIS THEN THAT
PIN Personal Identification Number
IDE Integrated Development Environment
Wi-Fi Wireless Fidelity
GACHA Google Assistant Controlled Home Automation
HTTP Hyper Text Transfer Protocol
PCB Printed Circuit Board
TCP Transmission Control Protocol
VSPE Virtual serial port emulator

6
Chapter 1 - General Introduction

7
1.1. Introduction

Every day modern people expect a new device and new technology to simplify
their day to day life. The developers and researchers are always trying to find new
things to provide comfort to the people. In the past 1990s, Internet usage
increased rapidly in enterprise and consumer markets but was still limited in its
use because of the low performance of the network interconnects. But in the
2000s Internet connectivity became a part for many applications to provide access
to information. However, these devices require more human interaction and
monitoring through apps and interface. The Internet of Things is a new era of
intelligence computing and it’s providing a privilege to communicate around the
world. Figure 1-1 describes the coupling of C’s and A’s. That reveals people and
things can be connected, ideally by using in Any path/network and any service

1. Resource usage (water conservation and energy consumption)

2. Security and Comfort

Figure 1-1: IoT objectives.

8
This thesis introduces an IoT agent which is the brain of this architecture and it
controls the devices through the internet. At a very short period of time, the IoT
agent receives the user data in the form of commands, which will be sent to
control the systems through Google commands. This command will be received
by Google assistant and control the devices.

1.2. Problem Statement

When people left their homes, number of problems may exist, this include:

Saving power from wasting electricity when forgetting electrical appliances open.
Also saving effort and comfort for handicaps.

 Monitoring the appliances for protection from causing fires or Electric stuns.
 Monitoring the entries of the house to provide safeness from thieves or any
interlopers.
The main problem is the lack of a user's ability to control home appliances more
efficiently from anywhere.

1.3. Problem Solution

The proposed solution is to provide remote control and monitoring system for
home appliances and environment. The system uses NodeMcu with internet
connectivity to communicate with Smartphone, the NodeMcu connected to
household devices to perform control and monitor functions.

1.4. Aim and Objectives

Aim:

The aim of this project is to develop prototype for a Smart Home System that will
enable homeowners to control and monitor electric devices such as lamps, fans,
and other devices by using Blynk Application and Google Assistance.

9
Objectives:

 To design smart home based on Nodemcu that will run as central hub in home.
 To provide the communications mechanism between Smartphone and
Nodemcu via internet.
 To develop software for Nodemcu, that will enable to control and monitor
household devices from Smartphone application.

1.5. Methodology

The project describes the implementation of a system using ordinary household


appliances.

Natural language voice commands are given to the Google Assistant and with the
help of IFTTT (If This Then That) application and the Blynk application the
commands are decoded and then sent to the microcontroller, the microcontroller
in turn controls the relays connected to it as required, turning the device connected
to the respective relay On or OFF as per the users request to the Google Assistant.

The microcontroller used is NodeMCU (ESP8266) and it is programmed directly


using Arduino ide Establishing the connection between the microcontroller and
the application via Wi-Fi (Internet).

1.6. Dissertation Outline

Chapter 1 is the general introduction to the project.

Chapter 2 spots the light about Internet of things technology and its requirements
and different applications.

Chapter 3 gives a review about the materials and methodologies used in this
projects, such as sensors and its main important parameters

10
Chapter 4 shows the components of the system that we designed in terms of the
solid entity and the software needed to make it work.

Chapter 5 contains the implementation of the design and results.

11
Chapter 2 – Literature Review

12
2.1. Background

When people think about home automation system, most of them get to a thought
of living in a smart home: One remote controller for every household appliance,
cooking the rice automatically, starting air conditioner automatically, heating
water for bath automatically and shading the window automatically during the
night. To some extent, home automation equals to the smart home. Then
automatically these will bring out smart living condition and make our life more
convenient and faster. Early home automation began with laborsaving machines.
Self-contained electric or gas-powered home appliance became viable in the
1900s with the introduction of electric power distribution led to the introduction
of washing machine (1904), water heater (1889), refrigerator, sewing machines,
dishwashers and clothes dryers. As per our survey currently there exists system
neither at cheaper rates nor easy to handle. Various systems

are hard to install, difficult to use and maintain. Current systems are generally
proprietary, closed and not very user friendly Based on Arduino or GSM or low-
cost home security system and home automation system.

2.2. IoT Layers

In the past, it was difficult or even impossible to combine digital devices.


Likewise, gathering information for day-to-day management of activities and
long-term development planning in the city is essential. For example, some public
transport information, e.g., real-time location and utilization, occupancy of
parking spaces, traffic jams, and other data like weather conditions, air and noise
pollution status, water contamination, energy consumption, etc. should be
gathered continuously. To this end, different technologies have been applied to
address the specific features of each application. The required technologies cover
a wide range and layer from the physical level to the data and application layers.
One of these technologies, proposed in [4], considered a two-way relay network

13
with an orthogonal frequency division multiple accesses to achieve higher
efficiency in smart grid communications. The IoT archetype is in the power of
smart and self-configuring devices which are well linked together by global grid
infrastructures. IoT can be typically defined as a real object, largely dispersed,
with low storage capabilities and processing capacities, while aiming at
enhancing reliability, performance and security of the smart cities as well as their
infrastructure. The IoT consists of three layers, including (Figure 2.1):

 The perception layer.


 The network layer.
 The application layer.

Figure 2-1: IoT layers.

The perception layer includes a group of Internet-enabled devices that are able to
perceive, detect objects, gather information, and exchange information with other
devices through the Internet communication networks. Radio Frequency
Identification Devices (RFID), cameras, sensors, Global Positioning Systems
(GPS) are some examples of perception layer devices. Forwarding data from the

14
perception layer to the application layer under the constraints of devices’
capabilities, network limitation and the applications’ constraints is the task of the
network layer. IoT systems use a combination of short-range networks
communication technologies such as Bluetooth and ZigBee which are used to
carry the information from perception devices to a nearby gateway based on the
capabilities of the communicating parties. Internet technologies such as WiFi,
2G, 3G, 4G, and Power Line Communication (PLC) carry the information over
long distances based on the application. Since applications aim to create smart
homes, smart cities, power system monitoring, demand-side energy management,
coordination of distributed power storage, and integration of renewable energy
generators, the last layer which is the application layer, is where the information
is received and processed. Accordingly, we are able to design better power
distribution and management strategies [5].

2.3. IoT Challenges

This section presents the current challenges for the implementation of IoT smart
cities. Different IoT challenges for smart grids are demonstrated in Figure 2.2 and
the expression of each one is as follows:

2.3.1. Security and Privacy

When all the information is gathered and evaluated in the same IoT platform, the
system may confront numerous attacks such as cross-site scripting, and side-
channels. Moreover, the system can be subjected to significant vulnerabilities. In
addition, its multi-tenancy may lead to the security problems as well and result in
data leakage [6].

15
Figure 2-2: IoT challenges.

Therefore, cities must adopt serious measures to ensure the privacy and security
of citizen data. Without this guarantee, citizens cannot trust to government, and
the collection of the information will be difficult. All systems should be resistant
against cyber-attacks, particularly the critical infrastructure like smart meters. As
a result, for successful implementation of IoT, cities should place privacy and
security as a top priority. In Figure 2.4, some aspects of security in IoT including
privacy, trust and data confidentiality as well as their solutions are presented.

2.3.2. Heterogeneity

IoT systems have usually developed with specific and notable solutions in which
each element of the system is joined to the special application context. On this
basis, the authorities have to examine their goal scenarios, define the needed
hardware/software and afterward aggregate these heterogeneous subsystems.
Providing such substructures and the procurement of a proper cooperating
scheme among them is indeed a major challenging mission for IoT systems.

16
Figure 2-3: IoT Security aspects.

2.3.3. Reliability

IoT-based systems cause some reliability problems. For example, due to cars’
mobility, the interconnection among them is not very reliable. Moreover, the
participation of huge numbers of smart technologies would lead to some
reliability challenges, particularly regarding their failure.

2.3.4. Large Scale

A number of defined scenarios need interactions among the enormous amount of


distributed devices that are likely to be embedded in a wide area environment.
The IoT system provides a proper platform which is able to analyze and aggregate
information extracted from various devices. However, this large-scale data needs
proper storage and computational ability because it is gathered at high rates that
lead to the usual challenges to be more difficult to cope with. In addition, the

17
distribution of the IoT devices can influence the monitoring actions, since the
devices have to deal with delays related to dynamics and connectivity.

2.3.5. Legal and Social Aspects

The IoT system likely is a service according to the user-provided data. For such
terms, the service providers have to be based on various local and international
rules. Likewise, the applicants are faced with sufficient incentives to attend a
specified scenario and data gathering. It would be more comfortable if the
opportunity were given to the applicants to choose and participate in the
registration information that indicates an event.

2.3.6. Big Data

Considering around 50 billion devices, it is definitely essential to pay attention to


data transfer, storage and recall as well as analyze the large amount of information
generated by them. It is clear that the IoT substructures would be some of these
significant sources of big data. In big data problems, three main specifications are
highlighted, consisting of the number, speed as well as variance. Hence, smart
meter information is received according to these specifications.

2.4. Standardization

To ensure the wide adoption of the IoT, it should be interoperable with the most
widely used protocols in the Internet. The Internet Engineering Task Force
(IETF) has formed several working groups to address IoT challenges and
requirements. The IETF is a standards developing organization that creates
voluntary standards to maintain and improve the usability and interoperability of
the Internet. It has a major role in the development of a number of standards that
are directly related to creating the environment needed for a successful, vibrant
IoT.

18
Standardization has obvious advantages, namely:

 interoperability and compatibility with pre-existing architectures and web-


services developed for standard IP networks.
 plug-and-play installation.
 rapid connectivity and development of applications.

The IETF working groups targeted the:

 IPv6 over Low Power WPAN (6LoWPAN).


 Routing Over Low Power and Lossy Networks (ROLL).
 Constrained Restful Environments (CORE).

The 6LoWPAN group [WG-6LoWPAN] concentrates on the definition of


methods and protocols for the efficient transmission and adaptation of IPv6
packets over IEEE 802.15.4; which is a standard for short-range low-power radios
networks. The ROLL group develops IPv6 routing solutions for Low Power and
Lossy Networks (LLNs), and the CORE group aims at providing a framework for
resource-oriented applications intended to run on constrained IP networks.
Together, these protocols allow the IP-based integration of constrained devices
into the Internet in a standardized way, as shown in 2.5.

Figure 2-4: Internet protocols are extended to the sensor networks.

19
Before 6LoWPAN, a complex application-layer gateway was needed to make
devices such as ZigBee, Bluetooth and proprietary systems connect to the Internet
using IP. IP is the networking protocol used to provide all devices with an IP
address to transport packets from one device to another. 6LoWPAN solves this
dilemma by introducing an adaptation layer between the IP stack’s link and
network layers to enable transmission of IPv6 datagrams over IEEE 802.15.4
radio links; which radically changes the IoT landscape. By communicating
natively with IP, 6LoWPAN networks are connected to other networks simply
using IP routers.

The 6LoWPAN network is connected to the IPv6 network using an edge router
or gateway. The edge router handles three actions:

 Data exchange between 6LoWPAN devices and the Internet (or other IPv6
net-work).
 Local data exchange between devices inside the 6LoWPAN
 Generation and maintenance of the radio subnet (the 6LoWPAN network).

2.5. Sensors

loT or the Internet of Things is the newest trend that's been used for many
products and appliances these days. While it's easy to dismiss it as the newest fad,
loT devices do have a huge potential in disrupting and revolutionizing our lives
and workflows and is indeed a technology that we need to pay attention to. An
loT device is a physical object with sensors/actuators, processors, software and
common communication ability that allows it to send and exchange information
with other loT devices, forming a collective network of smart systems. These can
then be used to set routines, reminders, and alerts and be used to completely
automate current workflows effectively. loT devices can encompass many
functions and features and can be broadly divided into based on what type of
device itis - whether it is a

20
1. Sensor device - like temperature, humidity, pressure, light, distance
2. Actuator device - fans, blinds, motors, pumps, valves
3. Communication device - hubs for Zigbee, Z- wave, Matter, WiFi router, etc

For this blog, we will primarily be focusing on Sensor devices and different types
of sensors in loT

2.5.1. What are sensors?

Sensors are devices that provide an output signal based on measuring an


environmental phenomenon such as measuring temperature, humidity, pressure,
altitude, ambient light, distance etc. These devices are used to give quantitative
and qualitative measurements of an environmental factor for the purposes of
monitoring data to either record or take action. For example, a temperature sensor
can be used to monitor the ambient temperature. Based on the temperature
sensor's measurement and output, heating or cooling can be enabled to bring the
ambient temperature of the room to the optimal temperature

2.5.2. Classification of sensors

Due to the sheer number of sensors available, for simplification sensors are
divided into 5 core classifications depending on how they work

 Active and Passive Sensors


 Contact and Non-contact Sensors
 Absolute and relative sensors
 Analog and Digital Sensors
 Miscellaneous Sensors
1) Active and Passive Sensors

Active Sensors are sensors that require a dedicated external power supply in
order to function. Examples include GPS and ultrasonic sensors. Passive sensors

21
on the other hand do not require any external supply and can receive enough
electrical signal from the environment to function. Examples include thermal
sensors, NFC tags, etc

2) Contact and non-contact sensors

Contact sensors are sensors that require physical contact with the environmental
stimulus the sensor is measuring. Examples include touch sensors, temperature
sensors, strain gauges, etc Non-contact sensors are sensors that do not requir
direct contact with the environmental stimulus it measures. Examples include
optical sensors, m: sensors, infrared thermometers, etc

3) Absolute and relative sensors

Absolute sensors, as its name suggests, provide an absolute reading of the


stimulus. For example, thermistors always give out the absolute temperature
readings Relative sensors provide measurements relative to something that is
either fixed or variable. Thermocouple is an example of a relative sensor, where
the temperature difference is measured as opposed to direct measurement

4) Analog and digital sensors

Analog sensors produce a continuous output signal proportional to the


measurement. Examples include thermometers, LDR, pressure sensors etc Digital
sensors are sensors that convert the measurement into a digital signal. Examples
include Inertial Measurement Units, ultrasonic sensors, etc

5) Miscellaneous sensors

There are many more types of sensors that may not necessarily fit into the above
categories. Those sensors will be classified as miscellaneous sensors and these
include biological, chemical, radioactive sensors, etc

22
2.5.3. IoT sensor types

1) Temperature sensors

Temperature sensors are used to measure the temperature of the ambient room.
Temperature sensors come in different variants each working on different
principles ideal for each use case, depending on the placement (indoor or
outdoor), expected temperature range, temperature variations, size, etc Examples:
Thermistors, thermocouples, RTD, mercury thermometers, pyrometers, etc

2) Distance sensors

Distance sensors are sensors that measure the distance between the sensor and
any objects. These sensors can also work on many different principles and the
type of sensor is chosen based on range, accuracy, durability, etc. Examples:
Infrared, Radar, Ultrasonic, Lidar, etc

3) Light sensors

Light sensors are sensors used to measure the intensity of ambient light. Different
types of light sensors are used based on the variations of light intensity it is
required to measure. Examples: LDR (light dependant resistors), photodiode,
OPT3001

 The LDR is a special type of resistor that allows higher voltages to pass
through it (low resistance) whenever there is a high intensity of light, and
passes a low voltage (high resistance) whenever it is dark. The sensor has
three pins, a power pins that is fed by 5 volts, a ground pin and an analogue
data pin that is acquired using the analog-digital converter located in the
Arduino board. Figure 4.12 shows the light sensor pinout.

23
Figure 22-5: shows the light sensor pinout
4) Optical sensors
5) Inertial measurement unit
6) Environmental sensor

2.5.4. Parameters of sensors

Sensors have several parameters that are considered when choosing a sensor, the
most important of which are:

 Measurement range: range is the range of values that can be measured by the
sensor.
 Sensitivity: is the ratio of the change in the measurement output of the sensor
(sensor output) 𝑑𝑦 to the change in the measured amount (input of the sensor)
𝑑𝑥.
 Frequency response: The ability of the sensor to track changes in the input
to be measured.
 Transparence: is the ability of the sensor to give the value of the measured
income without its presence within the measurement system affecting this
value.
 Sensitivity to the environment: It is the totality of external influences that
can change the level of sensor performance, such as the effect of working time,
temperature, vibrations and changing nutrition.

24
 Discriminant: resolution is the smallest value that a sensor can measure,
given as a percentage of the measurement range.

Reversibility: It is the difference between what the sensor measures when it


reaches a certain value of the measured income in ascending order, and what it
measures when it reaches the same value in descending order. The reversibility
error is usually calculated by taking half the difference between the two values
as a percentage of the measurement field

2.6. Smart cities

The smart city is becoming smarter than in the past as a result of the current
expansion of digital technologies. Smart cities consist of various kinds of
electronic equipment applied by some applications, such as cameras in a
monitoring system, sensors in a transportation system, and so on. Furthermore,
utilization of individual mobile equipment can be spread. The key features of
potential smart cities in 2020 is presented as, Smart citizens, smart energy, smart
buildings, smart technology, smart healthcare, smart infrastructure, smart
governance and education and finally smart security are the aspects of smart
cities.

2.6.1. Wireless Sensor Networks (WSNs)

WSNs make diverse proper data available and might be applied in lots of uses
like healthcare, as well as government and environmental services [7]. Moreover,
WSNs can be aggregated with RFIDs to obtain several targets such as gaining
data related to the position of people and objects, movement, temperatures, etc.
A WSN consists of wireless sensor nodes which include a radio interface, an
analog-to-digital converter (ADC), multiple sensors, memory and a power
supply. According to the wireless sensor node framework, it includes various
kinds of sensors which measure data in analog format which are converted to

25
digital data through an ADC. Some procedures are processed on the data through
a memory and microcontroller according to data requirements. Finally, data are
transmitted by a radio interface. All of this equipment needs to be equipped with
a power supply. A completed WSN is an extremely tiny low-power, low-cost
sensor node which can be applied in any environment and works continuously for
a few years. In reality, this utopic WSN has not been realized. WSN has severe
source constraints like reliance on battery life. With a large number of sensor
nodes in smart cities, replacing or recharging their batteries is infeasible.
Designing a protocol for sophisticated power management schemes like solar
panels is essential for WSN power sources.

2.6.2. Smart city applications

The IoT uses the Internet to merge various heterogeneous things. Accordingly,
and for providing the ease of access, all existing things have to be linked to the
Internet. The reason behind this is that smart cities include sensor networks and
connection of intelligent appliances to the internet is essential to remotely monitor
their treatment such as power usage monitoring to improve the electricity usage,
light management, air conditioner management. To get this aim, sensors are able
to be extended at various locations to gather and analyze data for utilization
improvement [6]. Figure 2.6 illustrates the major utilizations of the IoT for a
smart city.

26
Figure 2-6: IoT smart cities applications.

By utilizing the data which are produced by various sensors, smart homes can be
observed. For example, customers can be cautioned in the case where pollution
is above its acceptable limit through monitoring the pollution. In fact, IoT
technology leads to having smart houses and appliances including smart TVs,
home security system, lighting control, fire detection, and temperature
monitoring. The sensors of this appliances monitor the conditions and
environment and send surveillance data to a central controller at home which
enables the householder to continuously monitor and control the home even from
outside and make the best decision under every circumstance. Likewise, these
surveillance data aid to predict future events to be prepared in advance by taking
an efficient measurement to prevent losing convenience, security, comfort and
high standard of living. Moreover, smart houses in a neighborhood can be
connected together through Neighbor Area Network (NAN) to form a smart
community. In this case, houses are able to share some surveillance data like
outside camera to find an accident or report events to a police station. Healthcare,
managing shared resources, and enabling support social networking are other

27
applications of the smart communities. Hence, this concept is not only connection
of neighbors but also extension and development of a comprehensive smart city
which can monitor and control entire activities in a smart city.

2.6.3. Smart Homes

For instance, smart lighting has been widely investigated in recent years. About
19% of the total electricity load is used for lighting, which leads to 6% of the air
pollution. Accordingly, about 45% of the energy needed for lighting can be saved
by employing various smart lighting control methods. The main target of smart
houses is to reduce the energy consumption in the building because they consume
a very large portion of the electricity. Some contributors like heat, ventilation,
and air conditioning increase the consumption. Hence, sensing the building to
order suitable action is important. Before an action like dimming lights or
switching of air conditioning occurs, the environment state is checked, and this is
conducted by smart meters. It can aid in demand prediction as well.

28
Chapter 3 Description of the system and software
components

29
3.1. Overview of the Smart House System

The project revolves around developing a smart home system, which allows
homeowners to control household devices through a Smartphone application.
Currently it is focused on being able to turn ON and turn OFF lights, fans, and
other electronic home appliances. This chapter describes the system and its
components which might make into the final product and the technologies used
for the software part of the project.

3.2. System Description

The system architecture consists of an application installed in the Smartphone


that connects to a Blynk server over the Internet with NodeMcu.

The NodeMcu interacts with the Blynk server to perform the control and
monitoring function by means of a program written in C/C++ programming
language in the Arduino IDE.

Lamps and household appliances are connected to the NodeMcu within proteus
and blynk software.

. The design consists of three main parts:

 IoT cloud: Blynk Platform


 IoT device: NodeMCU
 Sensors: We use in this design the following sensors:
o LDR light sensor.

30
Figure 3-1: A general block diagram of smart home.

 Constitutes a programme:

proteus,Arduino IDE, Blynk app, IFTTT app, Google Assistant design software
and these apps will be integrated into your Android device. The Blynk app on the
Android device communicates with the microcontroller and sends the required
signal over the internet.

31
3.3. Proteus Software

The Proteus Design Suite is a proprietary software tool suite used primarily for
electronic design automation. Proteus is used to simulate, design and drawing of
electronic circuits. It was invented by the Lab center electronic. By using proteus
you can make two-dimensional circuits designs as well. With the use of this
engineering software, you can construct and simulate different electrical and
electronic circuits on your personal computers or laptops. There are numerous
benefits to simulate circuits on proteus before make them practically. Designing
of circuits on the proteus takes less time than practical construction of the circuit.
The possibility of error is less in software simulation such as loose connection
that takes a lot of time to find out connections problems in a practical circuit.
Circuit simulations provide the main feature that some components of circuits are
not practical then you can construct your circuit on proteus. There is zero
possibility of burning and damaging of any electronic component in proteus. The
electronic tools that are very expensive can easily get in proteus such as an
oscilloscope. Using proteus you can find different parents of circuits such as
current, a voltage value of any component and resistance at any instant which is
very difficult in a practical circuit. Figure 4.1 shows Proteus interface.

Figure 3-2: Proteus design suite interface.

32
3.4. Introduction to Arduino

Arduino is an open source physical processing hardware, which is based on a


microcontroller board and an incorporated development environment for the
board to be programmed. Arduino is simple and can be easily learned by
beginners. Arduino can run on any platform that includes Windows, Linux
Operating System, and Macintosh, unlike other microcontrollers, which run only
in the Windows operating system. The Arduino can be used to develop an
interactive interface, get inputs from a diverse collection of switches as well as
sensors, and simultaneously control the output from various physical devices
including lights and other appliances. Arduino is focused on an environment,
which needs to be programmed with a language that is executed via wiring: a
physical computing platform.

There are multiple advantages of the Arduino which are listed as follows:

 Less expensive: Arduino boards are inexpensive compared to other


microcontrollers that are available in the market. A preassembled Arduino
board is available for as low as $50.
 Compatible: Arduino is compatible with all the operating systems including
Linux, Macintosh, and Windows, whereas other microcontrollers are
restricted to Windows.
 Easy to program: The environment used to program Arduino and the ways
to perform the coding are user friendly even for beginners.
 Expandable programming and open source: The programming language of
an Arduino is an open source and can incorporate the Arduino code into the
AVR-C code if needed.
 Allows easy and fast prototyping: There are a number of pre-wiring and free
code libraries, which help to test an idea instead of spending time in building
and creating an excessive amount of low level codes.

33
3.4.1. Arduino boards type

Today, new Arduino boards (Figure 4.2) are emerging day by day. The most used
Arduino boards in general are:

 Arduino Uno
 Arduino Leonardo
 Arduino Due
 Arduino Mega 2560
 Arduino Mini
 Arduino Nano
 …

Arduino Uno is the most widely used card among these cards. Arduino Uno will
examine; ATMega328 is a microcontroller based card. It has 14 digital input /
output pins (6 can be used as PWM output pin), 6 analog inputs, 16 Mhz crystal,
USB socket, power socket, ICSP connector and reset key. It contains all of the
required for the operation of the microcontroller on the card. It can be connected
to the computer via USB cable easily. It can be operated with adapter or battery.

Figure 3-3: Arduino famous boards.

34
3.4.2. Arduino IDE

Arduino IDE allows to edit and upload programs to microcontroller. Arduino IDE
calls programs “sketches”. The interface shown in Figure 4-3 is where to write
and upload code within Arduino IDE.

Figure 3-4: Arduino IDE user interface.

The main white area is where the input code is inserted. IDE use the C
programming language to program the microcontroller. When you press “verify”
or “upload”, the code instructions will be translated in to machine language by a
piece of software called a “compiler” so that the microcontroller can understand
it. This process is called “compiling” or “verifying”. Messages shown in the black
area will show information about the compiling and upload process.

3.4.3. NodeMCU ESP8266 WIFI Module

The NodeMCU is an eLua based firmware for the ESP8266 WiFi SOC from
Espressif. The firmware is based on the Espressif NON-OS SDK and uses a file

35
system based on spiffs. The code repository consists of 98.1% C-code. The
ESP8266 is a low cost Wi-Fi chip with full TCP/IP stack and microcontroller
unit. This small module allows microcontroller to connect to a Wi-Fi network and
make simple TCP/IP connection using Hayes style commands, The ESP8266
with 1MiB of built in flash, allowing for single chip device capable of connecting
to Wi-Fi. Fig 2 shows theESP8266 module structure.

Figure 3-5: ESP8266 WIFI MODULE.

Advantages of NodeMCU platform relative to the Arduino

 Integrated support for WIFI network


 Low cost
 Reduced size of the board
 Low energy consumption

Disadvantages

 Need to learn a new language and IDE


 Reduced pinout
 Scarce documentation

36
3.4.3. VSPE: VIRTUAL SERIAL PORTS EMULATOR

Is a tool for software engineers and developers to create, debug and test
applications that use serial ports .

We replaced the Node Mcu with the serial port in arduino ide. We created a
virtual connection between com4 and com3, Then we upload the code to com4
and so the arduino understands that we have a virtual microcontroller in com4
Then in proteus we put arduino device and connect it with com 3

Figure 3-6: Virtual serial ports

3.5. Blynk application

The Blynk application was mainly designed for the Internet of Things (IoT). It
can control hardware Arduino, Raspberry Pi, NodeMCU and several other boards
over the Internet using Android, IOS apps. It can show us the sensor data, store
data, visualize it and do many other cool things. Figure 8 shows the functioning
of Blynk App. There are three major components in the platform:

 Blynk App - It allows us to create interfaces for our projects using various
widgets that we can provide to it.

37
 Blynk Server - It is responsible for all the communications between the smart
phone and hardware kit. We can use the Blynk Cloud or run private Blynk
server. Its open-source, could easily handle thousands of devices.
 Blynk Libraries - It is mandatory for all the popular hardware platforms that
enable communication with the server and process all the incoming and out
coming commands

Figure 3-7: Functioning of Blynk App.

Now imagine every time we press a Button in the Blynk app, the message travels
to the Blynk Cloud, where it will find its way to our hardware. It works the same
in the opposite direction and everything happens in a Blynk of an eye.

3.6. IFTTT application

IFTTT stands for “IF THIS THEN THAT”. IFTTT is a website and a mobile app
that was launched in 2010 and has the slogan. The idea of IFTTT is to automate
everything from your favorite apps and websites to app-enabled accessories and
smart devices. What the company provides is a software platform that connects
apps, devices, and services from different developers in order to trigger one or
more automation involving those apps, devices, and services. Here, IFTTT
application will bridge the gap between the Google Assistant commands and the
Blynk app. When we are setting up the IFTTT application first requires logging
in after which we need to create an applet and then “This”, i.e. the trigger, we

38
have to select is Google Assistant and then we will type in the commands to which
the Google Assistant should respond and to this command it should control the
appliance/relay associated with it. The response command from the Google
Assistant can also be typed in as desired. After configuring the trigger, Google
Assistant hears the command which we just configured. This will be decided by
setting “That” of the app. We click “That” and then select webhooks and click
connect. Webhooks service will allow us to send commands to the Blynk Server.
Now, in the URL we type the IP address of the Blynk server followed by the
Authentication token sent by the Blynk and then the pin number of the
microcontroller to which the device to be controlled is connected. The URL
should be in the following format:

http://188.166.206.43/AuthToken/pin/CorrespondingDigitalPinNo

Then in the method we select ‘PUT’ and the content type is ‘Application/JSON’
and in the body, we write [“0”] to turn ON and [“1”] to turn OFF. This creates
the action for the trigger i.e. the Google Assistant command. Finally, the
microcontroller is programmed with the actions it needs to do once it receives the
signal from the Blynk application. Before that action, the Blynk and the
microcontroller should communicate and the communication is done via the
internet and since the microcontroller. Figure 4-7 shows the initial page setup of
IFTTT application. Figure 4-8 shows the trigger creation.

Figure 3-8: IFTTT Application

39
Figure 3-9: Trigger creation in IFTTT.

40
Chapter 4 –Implementation and Results

41
4.1. Implementation

4.4.1. Implementation of the circuit on the Proteus program

 Resistor : They are used to control the speed of DC motors. Since they
provide flexible resistance, it varies current and voltage. The speed can
therefore be easily controlled by system or armature voltage control.
 we use relay in proteus circuit : to switch electrical devices and systems
on or off. It also serves to isolate the control circuit from the device or
system being controlled.
 Transistor : The basic application of a transistor is operating it as a switch.
One of the most common use is to drive a relay to switch ON/OFF a load.
The control signal may be obtained by manual input or may be generated
by another block in the circuit.
 A diode is an electronic component that directs the flow of electricity in a
single direction.
 Buzzer is normally used for given some indication and normally this
indication is kind of a warning.
Proteus has a builtin component for buzzer and its an animated component
means it gives a sound (beep) when its turned ON.

42
Figure 4-1: System block diagram.

Figure 4-2: Proteus system design.

The step by step working of the project is shown below:

 Step 1: Blynk
 Download the Blynk app from google play store
 Sign in using a valid E-mail address
 Create a new project

43
 Give a project name and choose NodeMCU from choose device
dropdown list.
 Then choose Wi-Fi from connection type dropdown list and press
Create.
 An Auth Token will be generated and send to the E-mail address which
you signed in.
 Copy and save the Auth Token somewhere safe, we will use it in the
next step DO NOT share it, anyone who is having it can control your
device.
 Now click on the "+" symbol to add widgets, then add a Button. Now
you can see a button will be added to the dashboard.
 Click on the Button widget from the dashboard to edit the button settings.
 Now from the settings choose the pin which you want to control, we are
choosing digital pin D11 for Fan, pin D12 for LED and pin D13 for L1.
 Change the ON state to 1 and OFF state to 0, by default ON will be 1 ie
HIGH and OFF will be 0 i.e. LOW. We are doing this because Our relay
will turn ON on LOW and turn OFF on HIGH.
 Change the mode to switch instead of push.
 The screen has been added in the blink to know the value of the sensor,
whatever its function. In our project it was used to find out the amount of
light falling on the sensor

44
Figure 4-3: Blynk control from a website

45
Figure 4-4: Control panel of home automation system in Blynk app

Figure 4-5: Settings of Blynk app

46
 Step 2: ARDUINO IDE
 Then paste the AuthToken generated from Blynk app to the Blynk
Arduino sketch.
 Type your Wi-Fi SSID and Password also to the Blynk Arduino sketch,
where it is mentioned.
 After validating the code in Arduino, we copied the hex connector Then
we passed it over to the Arduino Uno in the proteus circuit To make the
connection between Arduino IDE and Proteus.

Figure 4-6: hex link

 Step 3: IFFFT

47
Either you can use IFTTT website to IFTTT mobile app to create Applets. Here
I'm using IFTTT website. Before start create IFTTT applet we need to create two
HTTP request links, one for turning ON the relay and one for turning OFF the
relay.

http://188.166.206.43/blynkAuthToken/update/D14?value=0http://188.1
66.206.43/blynkAuthToken/update/D14?value=1 Here,

 The 188.166.206.43 is the IP address of blynk server.


 You need to replace your blynk Auth Token, where it is mentioned in the
request link.
 D14 is the pin which we have connected our relay, actually, we have
connected relay to the D 11 pin of NodeMCU but here in the HTTP request
link we need to address the GPIO pin number, so the GPIO pin number for
physical pin D5 is D14.
 When we call value=0 it will make the pin D5 LOW, the relay is ON.
 When we call value=1 it will make the pin D5 HIGH, the relay is OFF

Creating Applet for Relay ON

 Go to www.ifttt.com then login using your account or signup if you don't


have an account.
 Then under applets tab click on new applets button.

48
 Now, click on the +this button.
 Then choose a service page will open

 From "choose a service" page, search for Google Assistant and click on.
 Then "choose trigger" page will open.

49
 From "choose trigger" page click on Say Simple phrase.

 Now Write a sentence you want to say to google assistant ”Okay Google
activate Turrn Off” or “Okay Google activate LAMP“
 and also add response sentence
 and click create trigger button.

 Now, choose +that button

50
 Then like before, search for webhooks and click on it.

 Now from "choose action" click on Make a web request.


 and fill the details as shown below

51
 URL: In this filed paste the HTTP request link which is created before, don't
forget to edit the URL with your blynk Auth Token.
 Method: From the drop-down list choose GET.
 Content/Type: Choose text/plain from the dropdown list.
 Body: Leave it blank.
 Now, Click Create action Button

52
 Now we have successfully created an applet for turning the relay ON.
 like the same way, we need to create another applet for turning OFF the
relay.
 Paste the HTTP request URL for turning OFF the relay, that is the value=1.
 and click on create action button

53
 Now we have Successfully created Applets for both Relay ON and Relay
OFF. after that you login in google assistant using same Gmail account and
simply say " Okay Google activate Turrn Off” or “Okay Google activate
LAMP“. NOW USING google assistant you can turn on/off your Home
Applications in this project we connect lamps , LED and Fan You can also
connect More Devices based on your requirement so you create more
applets.

54
 Voice controlled Home Automation using Google Assistant, IFTTT and
Blynk

Figure 4-7: Voice controlled

55
Chapter 5 –Conclusion and Future works

56
5.1. Conclusion

This project has introduced a home management system. Our prototypical system
is applicable to real-time home security, automation, monitoring, and controlling
of remote systems.

This implementation provides an intelligent, comfortable, and energy-efficient


home automation system. It also assists the old and differently abled persons to
control the appliances in their home in a better and easier way.

5.2. Future Work

In future we can monitored all parameter using online web server. This project
can be implemented by using GPRS technology so that capture data can be send
anywhere in the world. We can turn it to a Smart Energy Meter by which
electricity parameters along with cost calculation can monitored by the user by
GSM or GPRS so they can minimize their electricity uses to optimum level. This
project can be extended by using GPRS technology, which helps in sending the
monitored and controlled data to any place in the world. The temperature
controlling systems like coolant can also use in places where temperature level
should be maintained. By connecting wireless camera in industries, factories etc.
we can see the entire equipment’s from our personal computer only by using
GPRS and GPS technology. The monitoring and controlling of the devices can
be done from the personal computer and we can use to handle so many situations.
By connecting temperature sensor, we can get the temperature of dangerous zones
in industries and we can use personal computer itself instead of sending human
to there and facing problems at the field

57
References
[1] Rathore, M.M.; Ahmad, A.; Paul, A.; Rho, S. Urban planning and building
smart cities based on the Internet of Things using Big Data analytics. Comput.
Netw. 2016, 101, 63–80.
[2] “Internet of Things - Cisco.” [Online]. Available:
http://www.cisco.com/c/r/en/us/internet-of-everything-ioe/internet-of-things-
iot/index.html.
[3] P. N. Howard, “Sketching out the Internet of Things trend line | Brookings
Institution,” 2015. [Online]. Available:
https://www.brookings.edu/blog/techtank/2015/06/09/sketching-out-the-
internet-of-things-trendline/
[4] Zhu, C.; Leung, V.C.M.; Shu, L.; Ngai, E.C.H. Green Internet of Things for
Smart World. IEEE Access 2015, 3, 2151–2162.
[5] The Smart Grid: An Introduction, http://www.oe.ener-
gy.gov/SmartGridIntroduction.htm.
[6] Simmons, Mobile Tips and Tricks, http://www.mobiletip-stricks.com/home-
control-centre/.
[7] O. Bello, S. Zeadally and M. Badra, "Network layer inter-operation of Device-
to-Device communication technologies in Internet of Things (IoT)”, Ad Hoc
Networks, vol. 57, pp. 52-62, 2017.
[8] M. Andersson, Short-range Low Power Wireless Devices and Internet of
Things (IoT), 1st ed. connectBlue, 2014, pp. 1-13.
[9] "11 Internet of Things (IoT) Protocols You Need to Know About", Rs-
online.com, 2015. [Online].
[10] "IoT Technology | 2017 Overview Guide on Protocols, Software, Hardware
and Network Trends", Postscapes.com, 2017. [Online].
[11] M. Andersson, Short-range Low Power Wireless Devices and Internet of
Things (IoT), 1st ed. connectBlue, 2014, pp. 1-13.
[12]IFTTT:https://ifttt.com/discoverhttps://www.pocketlint.com/SmartHome/S
marHomenews/.
[13] Blynk: https://www.blynk.cc/https://docs.blynk.cc/.
[14]NodeMCu:https://nodemcu.readthedocs.io/en/master
https://iotbytes.wordpress.com/nodemcupinout/ .

58

You might also like