0% found this document useful (0 votes)
137 views92 pages

Mini-Project Final Pavan

Uploaded by

pavan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views92 pages

Mini-Project Final Pavan

Uploaded by

pavan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 92

A Mini Project Report on

IOT BASED HOME AUTOMATION-SMART WAY TO


CONTROLLING YOUR HOME FROM ANYWHERE
Submitted to
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY
HYDERABAD

In partial fulfilment of the requirements for the award of the degree of


BACHELOR OF TECHNOLOGY
in
ELECTRICAL AND ELECTRONICS ENGINEERING

ANKARI PAVAN 20831A0202

Under the guidance of


MR. D. YESU RAJA
Assistant Professor
Department of EEE

Department of Electrical and Electronics Engineering [14]


GURU NANAK INSTITUTE OF TECHNOLOGY
(UGC Autonomous Institution, NAAC A+ & NBA Accredited for ECE, CSE &
MECH, Approved By AICTE, New Delhi & Affiliated to JNTUH Hyderabad)
Khanapur Village, Ibrahimpatnam, Manchal Mandal, Ranga Reddy Dist,
Telangana -501506.
2023-2024

i
GURU NANAK INSTITUTE OF TECHNOLOGY
(UGC Autonomous Institution, NAAC A+ & NBA Accredited for ECE, CSE &
MECH,Approved By AICTE, New Delhi & Affiliated to JNTUH Hyderabad)
Khanapur Village, Ibrahimpatnam, Manchal Mandal, Ranga Reddy Dist, Telangana -501506.
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

CERTIFICATE
This is to certify that the project report entitled “IOT BASED HOME
AUTOMATION-SMART WAY TO CONTROLLING YOUR HOME
FROM ANYWHERE” is being submitted by ANKARI PAVAN bearing roll
number 20831A0202in partial fulfilment for the award of the Degree of Bachelor
of Technology in Electrical and Electronics Engineering to the Jawaharlal Nehru
Technological University, Hyderabad.

Project Guide Project Coordinator

D.YESU RAJA M. SREEKANTH

Assistant Professor Assistant Professor

Head of the Department


Dr. NAGARAJA KUMARI. CH
Associate Professor

Mini Project Viva-Voce held on

External Examiner

ii
ACKNOWLEDGEMENT

This project is an acknowledgement to the inspiration, drive and technical assistance


contributed by many individuals. This project would have never seen light of this day without the
help and guidance we have received. We would like to express our gratitude to all the people
behind the screen who helped us to transform an idea into a real application.

It’s our privilege and pleasure to express our profound sense of gratitude to D. Yesu Raja,
Assistant Professor, Department of EEE for his/her guidance throughout this dissertation work.

We express our sincere thanks to Mr. M. Sreekanth, Project Coordinator for his precious
suggestions for the successful completion of this project.

We express our sincere thanks to our entire faculty, without their constant encouragement and
everlasting support this work would not have been possible.

We express our sincere gratitude to Dr. Nagaraja Kumari.CH, Head of the Department,
Electrical and Electronics Engineering for her precious suggestions for the successful completion
of this project. She is also a great source of inspiration to our work.

We would like to express our profound sense of gratitude to Dr. S. Sreenatha Reddy,
Principal for his constant and valuable guidance.

We would like to express our deep sense of gratitude to Dr. H. S. Saini, Managing
Director, Guru Nanak Group of Institutions for his tremendous support, encouragement and
inspiration. Lastly, we thank almighty, our parents, friends for their constant encouragement
without which this assignment would not be possible. We would like to thank all the other staff
members, both teaching and non- teaching, which have extended their timely help and eased my
work.

ANKARI PAVAN 20831A0202

iii
DECLARATION

We hereby declare that the result embodied in this project report entitled “IOT Based
Home Automation-Smart Way to Controlling Your Home from Anywhere” is
carried out by us during the year 2022-2023 for the partial fulfilment ofthe award
of Bachelor of Technology in Electrical and Electronics Engineering, from Guru
Nanak Institute of Technology. We have not submitted this project report to any other
Universities/ Institute for the award of any degree.

ANKARI PAVAN 20831A0202

iv
VISION OF THE INSTITUTION
To be a world class educational and research institution in the service of humanity
by promoting high quality Engineering and Management Education.

MISSION OF THE INSTITUTION

M1: Imbibe soft skills and technical skills.

M2: Develop the faculty to reach the international standards.

M3: Maintain high academic standards and teaching quality that promotes the analytical
thinking and independent judgment.

M4: Promote research, innovation, and Product development by collaboration with


reputed foreign universities.

M5: Offer collaborative industry programs in emerging areas and spirit of enterprise.

QUALITY POLICY

GNIT is committed to provide quality education through dedicated and talented


Faculty, world class infrastructure, Labs and Advanced Research center to the students.
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

VISION OF THE DEPARTMENT

To be recognized as one of the best EEE department in the region and to develop
the department to a level of par excellence that produces Electrical Engineers who can
be an asset to the country.

MISSION OF THE DEPARTMENT

 To nurture young individual into knowledge, skillful, and ethical professionals


in their pursuit of knowledge.
 To promote academic growth by offering state of the art programmers for the
students and faculties.
 To develop human potential to its fullest extent so that intellectuals capable of
being an asset to the country can emerge.
 To nurture the faculty and expose them to world class infrastructure.
 To sustain high performance by excellence in teaching, research and
innovations.
 To extensive partnership and collaborations with foreign universities for
technology up gradation.
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

PROGRAM EDUCATIONAL OBJECTIVES (PEO’S):

1. The main objective of Electrical and Electronics Engineering Program is the


upliftment of rural students through technical education. These technocrats should
be able to apply basic and contemporary science, engineering, experimentation
skills to identify Electrical/Electronic problems in the industry and academia and be
able to develop practical solutions to them and also, gain employment as an
Electrical and Electronics professional.

2. The graduates of Electrical and Electronics Engineering Program should be able to


establish themselves as practicing professionals in Electrical Transmission &
Distribution, Electrical grid, Generating Plant, or sustain a life-long career in related
areas. Also, the graduates of Electrical and Electronics Engineering Program should
be able to use their skills with a strong base to prepare them for higher education.

3. The graduates of Electrical and Electronics Engineering Program should be able to


develop an ability to analyze the requirements, understand the technical
specifications, design and provide economical & socially acceptable engineering
solutions and produce efficient product designs of equipment’s by means of
organized training or self-learning in areas related to Electrical and Electronics
Engineering.

4. The graduates of Electrical and Electronics Engineering Program should have an


exposure to emerging cutting-edge technologies, adequate training and
opportunities to work as team on multidisciplinary projects with effective
communication skills, individual, supportive and leadership qualities and also be
able to establish an understanding of professionalism, ethics, public policy and
aesthetics that allows them to become good professional engineers
PROGRAM OUTCOMES (PO’S):
Engineering Graduates will be able to:
1. Engineering knowledge: Apply the knowledge of mathematics, science,
engineering fundamentals, and an engineering specialization to the solution of
complex engineering problems.
2. Problem analysis: Identify, formulate, review research literature, and analyze
complex engineering problems reaching substantiated conclusions using first
principles of mathematics, natural sciences, and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering
problems and design system components or processes that meet the specified
needs with appropriate consideration for the public health and safety, and the
cultural, societal, and environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledge
and research methods including design of experiments, analysis and
interpretation of data, and synthesis of the information to provide valid
conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques,
resources, and modern engineering and IT tools including prediction and
modeling to complex engineering activities with an understanding of the
limitations.
6. The engineer and society: Apply reasoning informed by the contextual
knowledge to assess societal, health, safety, legal and cultural issues, and the
consequent responsibilities relevant to the professional engineering practice.
7. Environment and sustainability: Understand the impact of the professional
engineering solutions in societal and environmental contexts, and demonstrate
the knowledge of, and need for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and
responsibilities and norms of the engineering practice.
9. Individual and teamwork: Function effectively as an individual, and as a
member or leader in diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities
with the engineering community and with society at large, such as, being able
to comprehend and write effective reports and design documentation, make
effective presentations, and give and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding
of the engineering and management principles and apply these to one’s own
work, as a member and leader in a team, to manage projects and in
multidisciplinary environments.
12. Life-long learning: Recognize the need for and have the preparation and ability
to engage in independent and life-long learning in the broadest context of
technological change.
MAPPING OF PROGRAM EDUCATIONAL OBJECTIVES (PEO’S) AND
PROGRAM OUTCOMES (PO’S) FOR ELECTRICAL AND
ELECTRONICS ENGINEERING:
Program PROGRAM OUTCOMES (PO’S)
Educational
Objectives 1 2 3 4 5 6 7 8 9 10 11 12
(PEO’s)

1 * * * *
2 * * * * *
3 * * * * * * * *
4 * * * * * * * * * *

PROJECT MAPPING WITH POs AND PEOs


Sl. No. PROJECT NAME POs PEOs
1 IOT BASED HOME 1,2,3,5,6,9 1,3,4
AUTOMATION-SMART WAY
TO CONTROLLING YOUR
HOME FROM ANYWHERE
ABSTRACT

Home automation is a famous and most used technology in the world. The main object of this
project is to develop a home automation system with Android operating system using Wi-Fi
technology. The Automation technology, life is getting simpler and easier in all aspects. In today’s
world Automatic systems are being preferred over manual system. With the rapid increase in the
number of users of internet over the past decade has made Internet a part and parcel of life, and IOT
is the latest and emerging internet technology. Internet of things is a growing network of everyday
object-from industrial machine to consumer goods that can share information and complete tasks
while you are busy with other activities. Wireless Home Automation system (WHAS) using IOT is
a system that uses computers or mobile devices to control basic home functions and features
automatically through internet from anywhere around the world, an automated home is sometimes
called a smart home. It is meant to save the electric power and human energy. The home automation
system differs from other system by allowing the user to operate the system from anywhere around
the world through internet connection. In this paper we present a Home Automation system (HAS)
using Intel Galileo that employs the integration of cloud networking, wireless communication, to
provide the user with remote control of various lights, fans, and appliances within their home and
storing the data in the cloud. The system will automatically change on the basis of sensors’ data.
This system is designed to be low cost and expandable allowing a variety of devices to be controlled.
The process of controlling or operating various equipment, machinery, industrial processes, and
other applications using various control systems and also with less or no human intervention is
termed as automation. There are various types of automation based on the application they can be
categorized as home automation, industrial automation, autonomous automation, building
automation, etc.…In this project, we are discussing about wireless home automation. Home
Automation is the process of controlling home appliances automatically using various control
system techniques. The electrical and electronic appliances in the home such as fan, lights, outdoor
lights, fire alarm, kitchen timer, etc., can be controlled using various control techniques. In recent
years, wireless systems like Wi-Fi have become more and more common in-home networking. Also,
in home and building automation systems, the use of wireless technologies gives several advantages
that could not be achieved using a wired network only.
INDEX

TITLE PAGE NO
ABSTRACT i

LIST OF FIGURES ii
LIST OF TABLES iii

CHAPTER-1: INTRODUCTION 1-5


1.1 General 1

1.2 Existing System 2

1.3 Proposed System 2

1.4 Literature Survey 2


1.5 Conclusion 5

CHAPTER-2: PROJECT DESCRIPTION 6-53


2.1 General Introduction To Embedded System 6
2.2 Application Areas 6

2.2.1 Consumer appliances 6


2.2.2 Office Automation 7

2.2.3 Industrial Automation 7


2.2.4 Medical Electronics 7

2.2.5 Computer Networking 7


2.2.6 Telecommunications 8

2.2.7 Wireless Technologies 8


2.2.8 Insemination 8
2.2.9 Security 8

2.2.10 Finance 9
2.3 Overview Of Embedded System Architecture 9

2.3.1 Central Processing Unit (CPU) 10


2.3.2 Memory 10
2.3.3 Input Devices 11
2.3.4 Output Devices 11
2.3.5 Communication Interfaces 11
2.3.6 Application-Specific Circuitry 11

2.4 Block Diagram 12


2.5 Modules 13

2.5.1 Power Supply 13


2.5.2 Transformer 13

2.5.3 Rectifier 14
2.5.4 Bridge Rectifier 14

2.5.5 Smoothing 15
2.5.6 Voltage Regulator 15

2.6 Microcontroller 16
2.6.1 ESP32 17
2.6.2 Block Diagram 17

2.6.3 Introduction To ESP32 18


2.6.4 ESP32 Technical Specifications 19

2.6.5 ESP32 VS ARDUINO 19


2.6.6 ESP32 VS ESP8266 20

2.6.7 Power Pins 21


2.6.8 ADC Channels 21

2.6.9 DAC Channnels 21


2.6.10 UART Pins 21

2.6.11 SPI Pins 22


2.6.12 VSPI Pins 23
2.6.13 Specafication Of Esp32 Board 24

2.6.14 WIFI Key Features 24


2.6.15 Blutooth Key Features 24

2.7 Organic Light Emitting Diodes (Oled) 27


2.7.1 Introduction 27
2.7.2 OLED vs LCD 27
2.7.3 OLED white lighting 28
2.7.4 Specifications 28

2.8 Internet Of Things (IOT) 30


2.8.1 What is the internet of things (IoT) 31

2.8.2 How does IoT work 32


2.8.3 Why is IoT important 33

2.8.4 What are the benefits of IoT to organizations 33


2.8.5 What are the pros and cons of IoT 34

2.8.6 IoT standards and frameworks 34


2.8.7 Consumer and enterprise IoT applications 36

2.8.8 IoT security and privacy issues 37


2.9 DHT11 – Temperature And Humidity Sensor 37
2.9.1 Pin identification and Configuration 37

2.9.2 DHT11 Specifications 38

2.10 Gas Sensor 39

2.10.1 Features 39
2.10.2 Applications 40

2.11 Rain Sensor Module 40

2.11.1 Description 40

2.11.2 Specifications 41

2.12 Fire Sensor 41

2.12.1 Feature 41
2.13 Bluetooth 42
2.13.1 Some Specifications of Bluetooth 43

2.13.2 Difference 43
2.14 Communication 44

2.15 Bluetooth Module 45


2.16 Bluetooth Host 46

2.17 Security 52
2.18 Power Management 53
2.18.1 What is Bluetooth for 55

2.19 ULN2003 56
2.19.1 Features 57

2.20 Relay Introduction 57


2.20.1 History 58

2.20.2 Working 58
2.20.3 Advantages of Relay 59

2.21 Buzzer 59
2.21.1 Introduction 59

2.21.2 Uses 60
2.22 Conclusion 60
CHAPTER-3: SOFTWARE SPECIFICATIONS 61

3.1 The Arduino Integrated Development Environment 61


3.2 Writing Sketches 61

3.3 File 63
3.4 Edit 64

3.5 Sketch 65
3.5.1 Tools 66
3.5.2 HELP 67
3.5.3 Sketchbook 67

3.5.4 Uploading 68
3.5.5 Libraries 68
3.6 Serial Monitor 69

3.7 Preferences 69
3.7.1 Language Support 69

3.8 BOARDS 70
CHAPTER-4: IMPLEMENTATIONS 71

CHAPTER-5: SIMULATION AND DESIGN 73


5.1 Advantages 73
5.2 Applications 74

CHAPTER-6: CONCLUSION 75
REFERENCES 76

APPENDIX 78

LIST OF FIGURES
Figure No. Name of the Figure Page No.
Figure 1.1 IoT Based Smart Home 1
Figure 2.1 Layered Architecture Embedded System 9
Figure 2.2 Building Blocks of the Hardware of an
Embedded System 10
Figure 2.3 Block diagram 11
Figure 2.4 Block Diagram Of Power Supply 13
Figure 2.5 Bridge Rectifier 14
Figure 2.6 Output Waveform Of DC 15
Figure 2.7 Regulator 16
Figure 2.8 Circuit Diagram Of Power Supply 16
Figure 2.9 ARDUINO UNO 17
Figure 2.10 Pin Diagram 18
Figure 2.11 OLED vs LCD 27
Figure 2.12 Library to connect and communicate to
Module OLED 29
Figure 2.13 Arduino 29
Figure 2.14 Example of an IOT system. 32
Figure 2.15 DHT11 Sensor 38
Figure 2.16 DHT11 39
Figure 2.17 Gas Sensor 39
Figure 2.18 Fire sensor 41
Figure 2.19 Bluetooth packet structure 45
Figure 2.20 Discovering a Bluetooth device 46
Figure 2.21 Position of audio in the Bluetooth stack 47
Figure 2.22 Stages in setting up an SDP session 49
Figure 2.23 Bluetooth profiles 52
Figure 2.24 QoS Messaging 54
Figure 2.25 ULN2003 56
Figure 2.26 Logic Diagram of ULN2003 57
Figure 2.27 Relay 58
Figure 2.28 Representation of Relay 58
Figure 2.29 Buzzer 59
Figure 3.1 Creates a new sketch. 62
Figure 3.2 Saves your sketch 62
Figure 3.3 Open recent sketch 63
Figure 3.4 Verify and compile 65
Figure 3.5 Compiles and loads the binary file 65
Figure 3.6 Language Support 69
Figure 4.1 Implementations 71
Figure 5.1 Design 73

LIST OF TABLES
Table No. Name of the Table Page No.
Table 2.1 ESP32 Technical Specifications 19

Table 2.2 Name and Function of Pin of OLED 29

Table 2.3 PIR pin Definition and Ratings 44


CHAPTER 1
INTRODUCTION
1.1 GENERAL

Smart Home means home appliance with a cloud-controlled electrical system. A smart home is
a time- and money-saving. It will allow you to feel more relaxed with the ability to monitor the
temp before you climb out of bed or protect your home even though you’re not in there.
Essentially, a smart home will help make your house smarter, it’s the place where after a long
boring day one choice or reasons to be. The System overview is shown in Fig. 1.1 below. A small
Internet of Things device to help them monitor their appliances at home, or play their favourite
music, etc. Smart lighting uses LED bulbs that use less energy than an incandescent bulb equal
to wattage. Remote notifications: Have you left your bedroom with the light on? A connected
smart home will warn you if you have the home appliance remotely controlled and allow you to
do so. It’s movie night and you’re already cuddling up on the couch with your significant other.
Simply use your phone, tablet, or laptop to change the lighting, video streaming capable of
allowing live television to your smartphone, tablet, or desktop from inside or around your smart
home. You will get a warning notification.
In the IoT based Smart home ecosystem also known as the IoT Home automation ecosystem,
which is based on several essential sensors installed in the home collecting the home information
and sending it to a remote server pre-installed in the cloud.
Moreover, it would be safer if anything like heating water from the bath and changing the room
temperature had already been completed before they could achieve their house simply by giving
a controlled speech.

Fig 1.1: IoT based Smart home

1
A number of works have been performed but most of them managed using Bluetooth or GSM
technology. Now information technology is helpful enough that only the good to do culture
people are blessed with these modern home gadgets, as these gadgets cost a little bit. Not
everyone is rich enough to the ability for a human companion, or any smart home package,
though.

Therefore the need for normal families to find affordable and smart assistants continues to grow.
This paper provides such a cost-effective method. It uses the voice along with the webapplication
and the android version. All the components are connected to the cloud using the internet which
puts this device under the IoT.

1.2 EXISTING SYSTEM


A variety of research studies concerning the Smart Home have been carried out. All the proposed
works, however, are based on different environments and needs. Some of them operate on
Bluetooth Module Some of them use GSM technology. They are not completely IoT Dependent
In addition, most of these research works do not include diversification use and two more
separate control systems such as android apps and web apps like voice.

1.3 PROPOSED SYSTEM


Smart home control system has a lot to come. But most of them are designed for a specific IoT
environment. Some of them are dependent on only android application, some of them are
dependent on web application and highly expensive is their framework. They have no such need
for diversification and two more separate control systems including android applications and
web applications like voice control. Our main concern is to make multiple platforms such as
android application and web applications, including voice-enabled, additionally low cost
frameworks at a time.

1.4 LITERATURE SURVEY


A variety of research studies concerning the Smart Home have been carried out. All the proposed
works, however, are based on different environments and needs. Some of them operate on
Bluetooth Module Some of them use GSM technology. They are not completely IoT Dependent In
addition, most of these research works do not include diversification use and two more separate
control systems such as android apps and web apps like voice.
A cost management criteria for the smart home management system. At this load is also considered
to be controllable, while the comfort of inhabitants is considered. To counter this need, the smart
home paradigm attracts the attention of both academia and industry. Huge volumes of data are
available nowadays in the Smart home sense, driven by the growth of devices based on the IoT
2
and advanced sensing infrastructure. Hence, useful knowledge must be derived automatically from
this information For cost-effective domestic energy use. This work introduces a smart-home
device, in this context This helps to reduce household electricity use.
Analyze common approaches against these forms of traffic independent connection padding. That
none adequately conceals user activities with an overhead of rational results. The potential
obstacles customers encounter when implementing smart home services. All four categories of
risk are influenced by technical instability and service intangibility, and the perceived risks, with
the exception of financial risk Resistance to smart home systems has beneficial results.

A prototype built with an algorithm to allow home conditions to be monitored and home appliance
controls to be automated over the Internet at any time and anywhere. This device microcontroller
unit is an internet gateway for the communication of various sensors.
The data obtained from various sensors Identification, ultrasonic, temperature, moisture sensors
can be accessed via If this is the case then The over the Internet on user devices, regardless of
where they are located. Now days, the developments in Technology are mostly focused on the IoT.
Nowadays, technological advances concentrate more on the Internet of Things. IoT-based systems
improve the home-based setting in a real-world situation and are used in different applications.
IoT-based home automation is common in applications. Furthermore, BC-based smart home
platform. They demonstrate that their planned BC-based smart home platform is safe by thoroughly
evaluating its protection with respect to key confidentiality, integrity, and availability security
objectives. In the end, they present simulation results to illustrate that the overheads posed by their
strategy are small compared to their gains in protection and privacy.

Title: Smart home energy management using hybrid robust-stochastic optimization


Authors: A. Akbari-Dibavar, S. Nojavan, B. Mohammadi-Ivatloo, and K. Zare.
ABSTRACT:
This paper proposes a hybrid robust-stochastic optimization model for smart home
energy management in day-ahead (DA) and real-time (RT) energy markets which the
uncertainties of energy prices and PV generation are investigated in the proposed
model. A flexible robust optimization approach (ROA) is employed to create a tractable
equivalent of the problem and manages the uncertainty of DA market prices when the
PV generation is assumed in the worst-case. The ROA conservatism level can be
adjusted by a control parameter and solutions with different levels of conservatism are
obtained. Also, the proposed optimization framework considers the RT energy market
and takes into account the associated uncertainties using stochastic programming (SP).
At this stage, probable scenarios are used to model the uncertain characteristics of PV
3
generation and energy prices. Loads are also considered to be controllable, while the
comfort of inhabitants is considered. Results analysis show the advantage of the
proposed hybrid method which makes sure decision-maker about the profitability of
energy management.

Title: Keeping the Smart Home Private with Smart(er) IoT Traffic Shaping
Authors: N. Apthorpe, D. Y. Huang, D. Reisman, A. Narayanan, and N. Feamster.
ABSTRACT:
The proliferation of smart home Internet of things (IoT) devices presents unprecedented challenges
for preserving privacy within the home. In this paper, we demonstrate that a passive network
observer (e.g., an Internet service provider) can infer private in-home activities by analyzing
Internet traffic from commercially available smart home devices even when the devices use end-
to-end transport-layer encryption. We evaluate common approaches for defending against these
types of traffic analysis attacks, including firewalls, virtual private networks, and independent link
padding, and find that none sufficiently conceal user activities with reasonable data overhead. We
develop a new defense, “stochastic traffic padding” (STP), that makes it difficult for a passive
network adversary to reliably distinguish genuine user activities from generated traffic patterns
designed to look like user interactions. Our analysis provides a theoretical bound on an adversary’s
ability to accurately detect genuine user activities as a function of the amount of additional cover
traffic generated by the defense technique.

Title: Iot based smart home automation system using sensor node
Authors: H. Singh, V. Pallagani, V. Khandelwal, and U. Venkanna.
ABSTRACT:
In recent years, the advancements in Information and Communication Technology (ICT) are
mainly focused on the Internet of Things (IoT). In a real-world scenario, IoT based services
improve the domestic environment and are used in various applications. Home automation based
IoT is versatile and popular applications. In home automation, all home appliances are networked
together and able to operate without human involvement. Home automation gives a significant
change in humans life which gives smart operating of home appliances. This motivated us to
develop a new solution which controls some home appliances like light, fan, door cartons, energy
consumption, and level of the Gas cylinder using various sensors like LM35, IR sensors, LDR
module, Node MCU ESP8266, and Arduino UNO. The proposed solution uses the sensor and
detects the presence or absence of a human object in the housework accordingly. Our solution also
provides information about the energy consumed by the house owner regularly in the form of
message. Also, it checks, the level of gas in the gas cylinder if it reaches lesser than the threshold,
4
it automatically books the gas and sends a reference number as a message to the house owner. The
proposed solution is deployed and tested for various conditions. Finally, in this paper, the working
model of our proposed solution is developed as a prototype and explained as a working model

References:
[1] Khan Mohammad Shayshab Aza, Nayon Hossai , Nafisa Anjum Sami , Arif Hossai,”A Cost-
Effective Internet of Things Based Smart Home System for Upcoming Technologies”, IEEE,
June 2021.
[2] A. Akbari-Dibavar, S. Nojavan, B. Mohammadi-Ivatloo, and K. Zare, “Smart home energy
management using hybrid robust-stochastic optimization,” Computers & Industrial
Engineering, p. 106425, 2020.
[3] N. Apthorpe, D. Y. Huang, D. Reisman, A. Narayanan, and N. Feamster, “Keeping the smart
home private with smart (er) iot traffic shaping,” Proceedings on Privacy Enhancing Technologies,
vol. 2019, no. 3, pp. 128–148, 2019.
[4] H. Singh, V. Pallagani, V. Khandelwal, and U. Venkanna, “Iot based smart home automation
system using sensor node,” in 2018 4th International Conference on Recent Advances in
Information Technology (RAIT). IEEE, 2018, pp. 1–5.

1.5 Conclusion
Chapter 1 deals with Literature Review, this chapter reflects a comprehended form of the existing
projects related to the topic. It credits the projects along with a brief paragraph of summery about
the project. This reflects the various people worked on this area, how different and advanced
each project is from one another.

5
CHAPTER 2
PROJECT DESCRIPTION

An embedded system can be defined as a computing device that does a specific focused job.
Appliances such as the air-conditioner, VCD player, DVD player, printer, fax machine, mobile
phone etc. are examples of embedded systems. Each of these appliances will have a processor
and special hardware to meet the specific requirement of the application along with the
embedded software that is executed by the processor for meeting that specific requirement. The
embedded software is also called “firm ware”. The desktop/laptop computer is a general purpose
computer. You can use it for a variety of applications such as playing games, word processing,
accounting, software development and so on.
In contrast, the software in the embedded systems is always fixed listed below:
• Embedded systems do a very specific task, they cannot be programmed to do different
things.
• Embedded systems have very limited resources, particularly the memory. Generally, they
do not have secondary storage devices such as the CDROM or the floppy disk. Embedded
systems have to work against some deadlines. A specific job has to be completed within
a specific time. In some embedded systems, called real-time systems, the deadlines are
stringent. Missing a deadline may cause a catastrophe-loss of life or damage to property.
Embedded systems are constrained for power. As many embedded systems operate
through a battery, the power consumption has to be very low.
• Some embedded systems have to operate in extreme environmental conditions such as
very high temperatures and humidity.

2.2 Application Areas


Nearly 99 per cent of the processors manufactured end up in embedded systems. The embedded
system market is one of the highest growth areas as these systems are used in very market
segment- consumer electronics, office automation, industrial automation, biomedical
engineering, wireless communication, data communication, telecommunications, transportation,
military and so on.

2.2.1 Consumer appliances


At home we use a number of embedded systems which include digital camera, digital diary,
DVD player, electronic toys, microwave oven, remote controls for TV and air-conditioner, VCO
player, video game consoles, video recorders etc. Today’s high-tech car has about 20 embedded
systems for transmission control, engine spark control, air-conditioning, navigation etc. Even
6
wristwatches are now becoming embedded systems. The palmtops are powerful embedded
systems using which we can carry out many general-purpose tasks such as playing games and
word processing.

2.2.2 Office Automation


The office automation products using embedded systems are copying machine, fax machine, key
telephone, modem, printer, scanner etc.
2.2.3 Industrial Automation
Today a lot of industries use embedded systems for process control. These include
pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and
transmission. The embedded systems for industrial use are designed to carry out specific tasks
such as monitoring the temperature, pressure, humidity, voltage, current etc., and then take
appropriate action based on the monitored levels to control other devices or to send information
to a centralized monitoring station. In hazardous industrial environment, where human presence
has to be avoided, robots are used, which are programmed to do specific jobs. The robots are
now becoming very powerful and carry out many interesting and complicated tasks such as
hardware assembly.

2.2.4 Medical Electronics


Almost every medical equipment in the hospital is an embedded system. These equipment’s
include diagnostic aids such as ECG, EEG, blood pressure measuring devices, X-ray scanners;
equipment used in blood analysis, radiation, colonoscopy, endoscopy etc. Developments in
medical electronics have paved way for more accurate diagnosis of diseases.

2.2.5 Computer Networking


Computer networking products such as bridges, routers, Integrated Services Digital Networks
(ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay switches are embedded
systems which implement the necessary data communication protocols. For example, a router
interconnects two networks. The two networks may be running different protocol stacks. The
router’s function is to obtain the data packets from incoming pores, analyze the packets and send
them towards the destination after doing necessary protocol conversion. Most networking
equipment’s, other than the end systems (desktop computers) we use to access the networks, are
embedded systems.

7
2.2.6 Telecommunications
In the field of telecommunications, the embedded systems can be categorized as subscriber
terminals and network equipment. The subscriber terminals such as key telephones, ISDN
phones, terminal adapters, web cameras are embedded systems. The network equipment includes
multiplexers, multiple access systems, Packet Assemblers Dissemblers (PADs), sate11ite
modems etc. IP phone, IP gateway, IP gatekeeper etc. are the latest embedded systems that
provide very low-cost voice communication over the Internet.

2.2.7 Wireless Technologies


Advances in mobile communications are paving way for many interesting applications using
embedded systems. The mobile phone is one of the marvels of the last decade of the 20’h century.
It is a very powerful embedded system that provides voice communication while we are on the
move. The Personal Digital Assistants and the palmtops can now be used to access multimedia
service over the Internet. Mobile communication infrastructure such as base station controllers,
mobile switching centers are also powerful embedded systems.

2.2.8 Insemination
Testing and measurement are the fundamental requirements in all scientific and engineering
activities. The measuring equipment we use in laboratories to measure parameters such as
weight, temperature, pressure, humidity, voltage, current etc. are all embedded systems. Test
equipment such as oscilloscope, spectrum analyzer, logic analyzer, protocol analyzer, radio
communication test set etc. are embedded systems built around powerful processors. Thank to
miniaturization, the test and measuring equipment are now becoming portable facilitating easy
testing and measurement in the field by field-personnel.

2.2.9 Security
Security of persons and information has always been a major issue. We need to protect our homes
and offices; and also, the information we transmit and store. Developing embedded systems for
security applications is one of the most lucrative businesses nowadays. Security devices at
homes, offices, airports etc. for authentication and verification are embedded systems.
Encryption devices are nearly 99 per cent of the processors that are manufactured end up in~
embedded systems. Embedded systems find applications in every industrial segment- consumer
electronics, transportation, avionics, biomedical engineering, manufacturing, process control
and industrial automation, data communication, telecommunication, defense, security etc. Used
to encrypt the data/voice being transmitted on communication links such as telephone lines.
Biometric systems using fingerprint and face recognition are now being extensively used for

8
user authentication in banking applications as well as for access control in high security
buildings.

2.2.9 Finance
Financial dealing through cash and cheques are now slowly paving way for transactions using
smart cards and ATM (Automatic Teller Machine, also expanded as Any Time Money) machines.
Smart card, of the size of a credit card, has a small micro-controller and memory; and it interacts
with the smart card reader! ATM machine and acts as an electronic wallet. Smart card technology
has the capability of ushering in a cashless society. Well, the list goes on. It is no exaggeration
to say that eyes wherever you go, you can see, or at least feel, the work of an embedded system.

2.3 Overview of Embedded System Architecture


Every embedded system consists of custom-built hardware built around a Central Processing
Unit (CPU). This hardware also contains memory chips onto which the software is loaded. The
software residing on the memory chip is also called the ‘firmware’. The embedded system
architecture can be represented as a layered architecture as shown in Fig. The operating system
runs above the hardware, and the application software runs above the operating system. The
same architecture is applicable to any computer including a desktop computer. However, there
are significant differences. It is not compulsory to have an operating system in every embedded
system. For small appliances such as remote control units, air conditioners, toys etc., there is no
need for an operating system and you can write only the software specific to that application.
For applications involving complex processing, it is advisable to have an operating system. In
such a case, you need to integrate the application software with the operating system and then
transfer the entire software on to the memory chip. Once the software is transferred to the
memory chip, the software will continue to run for a long time you don’t need to reload new
software.

Fig 2.1: Layered Architecture of an Embedded System

9
Now, let us see the details of the various building blocks of the hardware of an embedded system.
As shown in Fig. the building blocks are;
· Central Processing Unit (CPU)
· Memory (Read-only Memory and Random Access Memory)
· Input Devices
· Output devices
· Communication interfaces
· Application-specific circuitry

Fig 2.2: Building Blocks of the hardware of an Embedded System.

2.3.1 Central Processing Unit (CPU)


The Central Processing Unit (processor, in short) can be any of the following: microcontroller,
microprocessor or Digital Signal Processor (DSP). A micro-controller is a low-cost processor.
Its main attraction is that on the chip itself, there will be many other components such as memory,
serial communication interface, analog-to digital converter etc. So, for small applications, a
micro-controller is the best choice as the number of external components required will be very
less. On the other hand, microprocessors are more powerful, but you need to use many external
components with them. D5P is used mainly for applications in which signal processing is
involved such as audio and video processing.

2.3.2 Memory
The memory is categorized as Random Access Memory (RAM) and Read Only Memory (ROM).
The contents of the RAM will be erased if power is switched off to the chip, whereas ROM
retains the contents even if the power is switched off. So, the firmware is stored in the ROM.
When power is switched on, the processor reads the ROM; the program is program is executed.

10
2.3.3 Input Devices
Unlike the desktops, the input devices to an embedded system have very limited capability. There
will be no keyboard or a mouse, and hence interacting with the embedded system is no easy task.
Many embedded systems will have a small keypad-you press one key to give a specific
command. A keypad may be used to input only the digits. Many embedded systems used in
process control do not have any input device for user interaction; they take inputs from sensors
or transducers 1’fnd produce electrical signals that are in turn fed to other systems.

2.3.4 Output Devices


The output devices of the embedded systems also have very limited capability. Some embedded
systems will have a few Light Emitting Diodes (LEDs) to indicate the health status of the system
modules, or for visual indication of alarms. A small Liquid Crystal Display (LCD) may also be
used to display some important parameters.

2.3.5 Communication Interfaces


The embedded systems may need to, interact with other embedded systems at they may have to
transmit data to a desktop. To facilitate this, the embedded systems are provided with one or a
few communication interfaces such as RS232, RS422, RS485, Universal Serial Bus (USB), IEEE
1394, Ethernet etc.

2.3.6 Application-Specific Circuitry


Sensors, transducers, special processing and control circuitry may be required fat an embedded
system, depending on its application. This circuitry interacts with the processor to carry out the
necessary work. The entire hardware has to be given power supply either through the 230 volts
main supply or through a battery. The hardware has to design in such a way that the power
consumption is minimized.

11
2.4 BLOCK DIAGRAM

Power IOT
Supply

OLED

NODEMCU
Driver Exhaust
Circuit motor

Driver Appliance
Circuit

Alarm

Fig 2.3: Block Diagram


The system process is made up of the NodeMCU microcontroller and the Channel Relay board.
The Relay board manages the relays using ULN 2803 IC. The Android device unit conveys the
desired signal through the internet with the microcontroller. The so-called Control Unit
hardware also includes the NodeMCU microcontroller and the Relay monitor. Digital output
pins of NodeMCU are attached to Relay board relay pins. Each Relay is essentially linked to
an appliance. The flow chart of implementations

After designing the program induce, i.e. we need to set the What exactly does it take to perform
when the voice senses the power that we are only setting up? This is determined by setting out
the app’s” Who.” We click on the” What” button, then pick [15] webhooks, and then click the
link. Webhooks allow us to send instructions to the Remote Server. Now we type the remote
server’s IP address in the URL followed by the Authentication token given by the remote server
and then the pin of the Nedelcu to which the computer is being controlled is connected. Then

12
we pick ’PUT’ in the technique and the content material form is JSON and we write ”1” to turn
ON in the body and ”0” to switch OFF. That creates the trigger action i.e. the voice order. The
action it takes is to quickly send a request to the remote server app in order to either turn the
connected gadget on or off. Finally, the microcontroller is programmed with the behavior that it
needs to perform until the remote server application transmits it. Before that, both the remote
server and the microcontroller can communicate and the conversation is conducted over the
internet, and because the microcontroller contains NodeMCU with the built-in Wi-Fi module, it
is designed to connect to the chosen network until it is plugged in. Hardware implementation.
The language ’C’ is used to program the microcontroller and is built in the Arduino IDE.

2.5 MODULES
2.5.1 POWER SUPPLY
The power supply section is the section which provide +5V for the components to work.
IC LM7805 is used for providing a constant power of +5V.
The ac voltage, typically 220V, is connected to a transformer, which steps down that ac voltage
down to the level of the desired dc output. A diode rectifier then provides a full-wave rectified
voltage that is initially filtered by a simple capacitor filter to produce a dc voltage. This resulting
dc voltage usually has some ripple or ac voltage variation.
A regulator circuit removes the ripples and also retains the same dc value even if the input dc
voltage varies, or the load connected to the output dc voltage changes. This voltage regulation is
usually obtained using one of the popular voltage regulator IC units.

Fig 2.4: Block Diagram of Power Supply

2.5.2 Transformer
Transformers convert AC electricity from one voltage to another with little loss of power.
Transformers work only with AC and this is one of the reasons why mains electricity is AC.
Step-up transformers increase voltage, step-down transformers reduce voltage. Most power
supplies use a step-down transformer to reduce the dangerously high mains voltage (230V in
India) to a safer low voltage.
The input coil is called the primary and the output coil is called the secondary. There is no
electrical connection between the two coils; instead, they are linked by an alternating magnetic
field created in the soft-iron core of the transformer. Transformers waste very little power so the

13
power out is (almost) equal to the power in. Note that as voltage is stepped down current is
stepped up.
The transformer will step down the power supply voltage (0-230V) to (0- 6V) level. Then the
secondary of the potential transformer will be connected to the bridge rectifier, which is
constructed with the help of PN junction diodes. The advantages of using bridge rectifier are it
will give peak voltage output as DC.

2.5.3 Rectifier
There are several ways of connecting diodes to make a rectifier to convert AC to DC.
The bridge rectifier is the most important and it produces full-wave varying DC. A full-wave
rectifier can also be made from just two diodes if a centre-tap transformer is used, but this method
is rarely used now that diodes are cheaper. A single diode can be used as a rectifier but it only
uses the positive (+) parts of the AC wave to produce half-wave varying Dc.

2.5.4 Bridge Rectifier


When four diodes are connected as shown in figure, the circuit is called as bridge rectifier.
The input to the circuit is applied to the diagonally opposite corners of the network, and the
output is taken from the remaining two corners. Let us assume that the transformer is working
properly and there is a positive potential, at point A and a negative potential at point B. the
positive potential at point A will forward bias D3 and reverse bias D4.

Fig 2.5: Bridge Rectifier


The negative potential at point B will forward bias D1 and reverse D2. At this time D3 and D1
are forward biased and will allow current flow to pass through them; D4 and D2 are reverse
biased and will block current flow.
One advantage of a bridge rectifier over a conventional full-wave rectifier is that with a given
transformer the bridge rectifier produces a voltage output that is nearly twice that of the
conventional full-wave circuit.
i. The main advantage of this bridge circuit is that it does not require a special center tapped
transformer, thereby reducing its size and cost.

14
ii. The single secondary winding is connected to one side of the diode bridge network and the
load to the other side as shown below.
iii. The result is still a pulsating direct current but with double the frequency.

Fig 2.6: Output Waveform Of DC

2.5.5 Smoothing
Smoothing is performed by a large value electrolytic capacitor connected across the DC
supply to act as a reservoir, supplying current to the output when the varying DC voltage from
the rectifier is falling. The capacitor charges quickly near the peak of the varying DC, and then
discharges as it supplies current to the output.

2.5.6 Voltage Regulators


Voltage regulators comprise a class of widely used ICs. Regulator IC units contain the circuitry
for reference source, comparator amplifier, control device, and overload protection all in a single
IC. IC units provide regulation of either a fixed positive voltage, a fixed negative voltage, or an
adjustably set voltage. The regulators can be selected for operation with load currents from
hundreds of milli amperes to tens of amperes, corresponding to power ratings from milli watts
totens of watts.
A fixed three-terminal voltage regulator has an unregulated dc input voltage, Vi, applied to one
input terminal, a regulated dc output voltage, Vo, from a second terminal, with the third terminal
connected to ground.
The series 78 regulators provide fixed positive regulated voltages from 5 to 24 volts. Similarly,
the series 79 regulators provide fixed negative regulated voltages from 5 to 24 volts. Voltage
regulator ICs are available with fixed (typically 5, 12 and 15V) or variable output voltages. They
are also rated by the maximum current they can pass. Negative voltage regulators are available,
mainly for use in dual supplies. Most regulators include some automatic protection from
excessive current ('overload protection') and overheating ('thermal protection').
Many of the fixed voltage regulator ICs has 3 leads and look like power transistors, such as the
7805 +5V 1Amp regulator. They include a hole for attaching a heat sink if necessary.

15
Fig 2.7: Regulator

Fig 2.8: Circuit Diagram Of Power Supply

2.6 MICROCONTROLLER
2.6.1 ESP32
Overview ESP32 is a single 2.4 GHz Wi-Fi-and-Bluetooth combo chip designed with the
TSMC ultra-low-power 40 nm technology. It is designed to achieve the best power and RF
performance, showing robustness, versatility and reliability in a wide variety of applications and
power scenarios. The ESP32 series of chips includes ESP32-D0WD-V3, ESP32-U4WDH,
ESP32-S0WD, ESP32-D0WDQ6-V3 (NRND), ESP32-D0WD (NRND), and ESP32-D0WDQ6
(NRND), among which, ESP32-D0WD-V3, ESP32-D0WDQ6-V3 (NRND), and ESP32-
U4WDH are based on ECO
V3 wafer. For details on part numbers and ordering information, please refer to Section 7. For
details on ECO V3 instructions, please refer to ESP32 ECO V3 User Guide. 1.1 Featured
Solutions 1.1.1 Ultralow Power Solution ESP32 is designed for mobile, wearable electronics,
and Internet-of-Things (IoT) applications. It features all the state-of-the-art characteristics of
low-power chips, including fine-grained clock gating, multiple power modes, and dynamic power
scaling. For instance, in a low-power IoT sensor hub application scenario, ESP32 is woken up
periodically only when a specified condition is detected. Low-duty cycle is used to minimize the
amount of energy that the chip expends. The output of the power amplifier is also adjustable,
thus contributing to an optimal trade-off between communication range, data rate and power
consumption.
ESP32 is a series of powerful, power-efficient, cheap microcontrollers that comes with
integrated Wi-Fi and dual-mode Bluetooth. In this post, you will find ESP32 Dev board Pinout,
Specifications, datasheet, and Schematic in detail.

16
The ESP32 series consist of a Ten silica Xena LX6 32-bit, dual-core microprocessor (has
two processors) running at 240MHz and includes built-in antenna switches, RF balun, power
amplifier, low-noise receive amplifier, filters, and power management modules. ESP32 is
developed by a semiconductor-based company Espressif Systems in China, and it is
manufactured by TSMC (Taiwan Semiconductor Manufacturing Company). It is a successor to
their previous ESP8266 microcontroller module.
2.6.2 Block Diagram

Fig 2.9: ARDUINO UNO


ESP32 has 34 GPIO pins which can be assigned various functions by programming the
appropriate registers. There are several kinds of GPIOs: digital-only, analog-enabled, capacitive-
touch-enabled, etc. Analog-enabled GPIOs and Capacitive-touch-enabled GPIOs can be
configured as digital GPIOs. Most of the digital GPIOs can be configured as internal pull-up or
pull-down, or set to high impedance. When configured as an input, the input value can be read
through the register. The input can also be set to edge-trigger or level-trigger to generate CPU
interrupts. Most of the digital IO pins are bidirectional, non-inverting and tristate, including input
and output buffers with tristate control. These pins can be multiplexed with other functions, such
as the SDIO, UART, SPI, etc. For low-power operations, the GPIOs can be set to hold their
states.
17
2.6.3 Introduction to ESP32 Development board
NOTE: The details given here holds true for all development boards: NodeMCU ESP32-S board
by AI Thinker, ESP32 DOIT board by Espressif, Sparkfun ESP32 Thing board, Adafruit ESP32
board, etc.
ESP WROOM-32 Chip: The ESP32 board comes with a powerful WROOM-32 module having
capabilities like 802.11b/g/n Wi-Fi |BT 4.0|BLE. The chip consists of a dual-core processor and
both can be controlled individually, operating at 240Mhz, 520KB of SRAM. It is compatible
with Arduino IDE, LUA, MicroPython, etc.

Fig 2.10: Pin Diagram


NOTE: Not all development boards expose all the pins on the chip. The ESP32 board (breakout
board) shown here has all the pins of the ESP-WROOM-32 chip exposed. Whereas some ESP32
boards have only 30 or 36 pins exposed (available for external connection), although they have
the same WROOM32 chip installed in them.
Boot Button: This button is used to upload the new sketch/programs to the ESP32
microcontroller. During the upload, we have to HOLD down the Boot Button.
Micro USB: The board is powered using an onboard Micro USB port. This port can also be used
to connect the board to the computer to upload programs. RESET Button: This button is simply
used to reset the board.

18
2.6.4 ESP32 Technical Specifications
Microprocessor Tensilica Xtensa LX6

Maximum Operating Frequency 240MHz

Operating Voltage 3.3V

Analog Input Pins 12-bit, 18 Channel

DAC Pins 8-bit, 2 Channel

Digital I/O Pins 39 (of which 34 is normal GPIO pin)

DC Current on I/O Pins 40 mA

DC Current on 3.3V Pin 50 mA

SRAM 520 KB

Communication SPI(4), I2C(2), I2S(2), CAN, UART(3)

Wi-Fi 802.11 b/g/n

Bluetooth V4.2 – Supports BLE and Classic Bluetooth

Table 2.1: ESP32 Technical Specifications

2.6.5 ESP32 vs Arduino


It is completely unfair to compare ESP32 with Arduino; both are advantageous and functional
on its own. In terms of power and features, obviously the dual cored microprocessor powered
ESP32 will surely take down the microcontroller powered Arduino UNO. The ESP32 has built
in Bluetooth and Wi-Fi with a good number of GPIO pins and communication protocols for a
very cheap price. The Arduino might look a bit handicapped when competing with ESP32 but it
has a large number of shields in the market which can be readily used, also advanced Arduino
boards like Yun has good processing power as well.

19
The ESP32 operates on 3.3V and can be programmed with ESP-IDF or with Arduino IDE which
is still under development; the Arduino operates at 5V and is known for its easy-to-use Arduino
IDE and strong community support. So to conclude, if you have prior experience with
programming and your project really requires some heavy processing with IoT capabilities, then
ESP32 can be preferred over Arduino.

2.6.6 ESP32 VS ESP8266


Both the ESP32 and ESP8266 are Wi-Fi development boards from Espressif systems. They can
be programmed using the ESP-IDF or the Arduino IDE. The ESP8266 is inferior in terms of
performance compared with the ESP32, but it is cheaper and has a smaller form factor than the
ESP32. Also, the ESP8266 was launched into the market earlier than ESP32, so you will get
enough community support for ESP8266.
The main difference would be that ESP8266 does not have an in-built Bluetooth module and also
does not feature CAN protocol and has no SRAM. So if your project requires more processing
power with Bluetooth or CAN functionalities then you can prefer ESP32 over ESP8266.

Touch Sensor: The ESP32 comes with 10 capacitive touch sensors connected to GPIO pins-
• Touch0 (GPIO4)
• Touch1 (GPIO0)
• Touch2 (GPIO2)
• Touch3 (GPIO15)
• Touch4 (GPIO13)
• Touch5 (GPIO12)
• Touch6 (GPIO14)
• Touch7 (GPIO27)
• Touch8 (GPIO33)
• Touch9 (GPIO32)
These GPIO pins can sense variations if it touches anything that conducts electricity like the
human skin. So, when we touch the GPIO pin with our finger it generates this variation that is
read by the sensor. We can use the touchRead(GPIO) function to read the value from the touch
sensor.
The ESP 32 board consists of a set of 38 pins that can be used to connect it with the external
sensors and components. Out of these 38 pins, 25 pins are GPIO pins that can be used for a
number of different functions

20
2.6.7 Power Pins:
The board comes with two power pins – a 5V pin & a 3.3V pin. The 5V pin can be used to
directly supply the ESP32 and its peripherals if you have a regulated 5V voltage source. While
the 3.3V pin is the output of a voltage regulator (CP2102), it can be used to power up the external
components.
GND: The ground pin of ESP32 is used to complete the circuit.

2.6.8 ADC (Analog to digital) Channels


The board has 18, 12-bit SAR ADCs and supports measurements on 15 channels (analog enabled
pins. ADC1_CH0 (GPIO 36)
• ADC1_CH1 (GPIO 37)
• ADC1_CH2 (GPIO 38)
• ADC1_CH3 (GPIO 39)
• ADC1_CH4 (GPIO 32)
• ADC1_CH5 (GPIO 33)
• ADC1_CH6 (GPIO 34)
• ADC1_CH7 (GPIO 35)
• ADC2_CH0 (GPIO 4)
• ADC2_CH1 (GPIO 0)
• ADC2_CH2 (GPIO 2)
• ADC2_CH3 (GPIO 15)
• ADC2_CH4 (GPIO 13)
• ADC2_CH5 (GPIO 12)
• ADC2_CH6 (GPIO 14)
• ADC2_CH7 (GPIO 27)
• ADC2_CH8 (GPIO 25)
• ADC2_CH9 (GPIO 26)

2.6.9 DAC (Digital to Analog) Channels


The board comes with two 8-bit DAC channels that can be used to convert digital signals into
an analog voltage.
• DAC_1 (GPIO25)
• DAC_2 (GPIO26)
2.6.10 UART (Universal Asynchronous Receiver-Transmitter) Pins:
ESP32 dev board has three UART interfaces, – UART0, UART1 and, UART2, which provide
asynchronous communication between the UART-enabled devices up to a speed of 5 Mbps.
21
UART interface in the dev board also consists of two extra pins that allow receiver and sender
to alert each other of their current state – CTS and RTS signals pins.
UART0 Pins:
• U0 TXD (GPIO1)
• U0 RXD (GPIO3)
• U0 CTS (GPIO19)
• U0 RTS (GPIO22) UART1 Pins:
• U1 TXD (GPIO10)
• U1 RXD (GPIO9)
• U1 CTS (GPIO6)
• U1 RTS (GPIO11)

2.6.10 UART2 Pins:


• U2 TXD (GPIO17)
• U2 RXD (GPIO16)
• U2 CTS (GPIO8)
• U2 RTS (GPIO7)

2.6.11 SPI Pins:


The board features three SPIs (SPI, HSPI, and VSPI) in slave and master modes. These pins are
used to connect to the external SPI-enabled devices.
SPI Pins on board:
• SPI_D (GPIO8)
• SPI_WP (GPIO10)
• SPI_HD (GPIO9)
• SPI_Q (GPIO7)
• SPI_CLK (GPIO6)
• SPI_CS0 (GPIO11) HSPI Pins:
• V_SPI_ID (GPIO23)
• V_SPI_WP (GPIO22)
• V_SPI_HD (GPIO21)
• V_SPI_Q (GPIO19)
• V_SPI_CLK (GPIO18)
• V_SPI_CS0 (GPIO5)

22
2.6.12 VSPI Pins:
• HSPI_ID (GPIO13)
• HSPI_WP (GPIO2)
• HSPI_HD (GPIO4)
• HSPI_Q (GPIO12)
• HSPI_CLK (GPIO14)
• HSPI_CS0 (GPIO15) PWM Pins:
The board comes with 25 PWM enabled pins (Nearly All GPIO pins) The PWM output can be
used for driving digital motors and LEDs.
EN or Enable Pin:
EN stands for Enable, this pin is a 3.3 V regulator enable pin. When this is pulled LOW it resets
the micro-controller.
NOTE: Not all development boards expose all the pins on the chip. The ESP32 board(breakout
board) shown here has all the pins of the ESP-WROOM-32 chip exposed. Whereas some ESP32
boards have only 30 or 36 pins exposed(available for external connection), although they have
the same WROOM32 chip installed in them.

2.6.13 Specifications of ESP32 Board:


• Xtensa dual-core (or single-core) 32-bit LX6 microprocessor, running at 160 or
240 MHz
• Memory: 520 KB SRAM
• Wi-Fi: 802.11 b/g/n
• Bluetooth: v4.2 BR/EDR and BLE
• 12-bit × 18 ADC channels
• 2 × 8-bit DACs
• 10 × touch sensors (capacitive sensing GPIOs)
• 4 × SPI
• 2 × I²S interfaces
• 2 × I²C interfaces
• 3 × UART
• SD/SDIO/CE-ATA/MMC/eMMC host controller
• SDIO/SPI slave controller
• CAN bus 2.0
• Infrared remote controller (TX/RX, up to 8 channels)
• Motor PWM
• LED PWM (up to 16 channels)

23
• Hall effect sensor
• Ultra-low-power analog pre-amplifier
• All security feature of IEEE 802.11 standard, like WFA, WPA/WPA2, and WAPI,
secure boot, Flash encryption
• Cryptographic hardware acceleration method like AES, SHA-2, RSA, elliptic curve
cryptography (ECC), random number generator (RNG)

2.6.14 WiFi Key Features


• 802.11 b/g/n
• 802.11 n (2.4 GHz), up to 150 Mbps
• WMM • TX/RX A-MPDU, RX A-MSDU
• Immediate Block ACK
• Defragmentation
• Automatic Beacon monitoring (hardware TSF)
• 4 × virtual Wi-Fi interfaces
• Simultaneous support for Infrastructure Station, SoftAP, and Promiscuous modes Note that
when ESP32 is in Station mode, performing a scan, the SoftAP channel will be changed.
• Antenna diversity

2.6.15 Bluetooth Key Features


• Compliant with Bluetooth v4.2 BR/EDR and Bluetooth LE specifications
• Class-1, class-2 and class-3 transmitter without external power amplifier
• Enhanced Power Control
• +9 dBm transmitting power
• NZIF receiver with –94 dBm Bluetooth LE sensitivity
• Adaptive Frequency Hopping (AFH)
• Standard HCI based on SDIO/SPI/UART
• High-speed UART HCI, up to 4 Mbps
• Bluetooth 4.2 BR/EDR Bluetooth LE dual mode controller
• Synchronous Connection-Oriented/Extended (SCO/eSCO)
• CVSD and SBC for audio codec
• Bluetooth Piconet and Scatternet
• Multi-connections in Classic Bluetooth and Bluetooth LE
• Simultaneous advertising and scanning Clocks and Timers

24
• Internal 8 MHz oscillator with calibration
• Internal RC oscillator with calibration
• External 2 MHz ~ 60 MHz crystal oscillator (40 MHz only for Wi-Fi/Bluetooth functionality)
• External 32 kHz crystal oscillator for RTC with calibration
• Two timer groups, including 2 × 64-bit timers and 1 × main watchdog in each group
• One RTC timer
• RTC watchdog
Advanced Peripheral Interfaces
• 34 × programmable GPIOs
• 12-bit SAR ADC up to 18 channels
• 2 × 8-bit DAC
• 10 × touch sensors
• 4 × SPI
• 2 × I2S
• 2 × I2C
• 3 × UART
• 1 host (SD/eMMC/SDIO)
• 1 slave (SDIO/SPI)
• Ethernet MAC interface with dedicated DMA and IEEE 1588 support
• TWAI®, compatible with ISO 11898-1 (CAN Specification 2.0)
• RMT (TX/RX)
• Motor PWM
• LED PWM up to 16 channels
• Hall sensor Security
• Secure boot
• Flash encryption
• 1024-bit OTP, up to 768-bit for customers
• Cryptographic hardware acceleration:
– AES
– Hash (SHA-2)
– RSA
– ECC
– Random Number Generator (RNG)
Applications (A Non-exhaustive List)
25
• Generic Low-power IoT Sensor Hub
• Generic Low-power IoT Data Loggers
• Cameras for Video Streaming
• Over-the-top (OTT) Devices
• Speech Recognition
• Image Recognition
• Mesh Network
• Home Automation
– Light control
– Smart plugs
– Smart door locks
• Smart Building
– Smart lighting
– Energy monitoring
• Industrial Automation
– Industrial wireless control
– Industrial robotics
• Smart Agriculture
– Smart greenhouses
– Smart irrigation
– Agriculture robotics
• Audio Applications
– Internet music players
– Live streaming devices
– Internet radio players – Audio headsets
• Health Care Applications
– Health monitoring
– Baby monitors
• Wi-Fi-enabled Toys
– Remote control toys
– Proximity sensing toys
– Educational toys
• Wearable Electronics
– Smart watches
– Smart bracelets
26
• Retail & Catering Applications
– POS machines
– Service robots

2.7 OLED (Organic Light Emitting Diodes)


2.7.1 INTRODUCTION
OLED (Organic Light Emitting Diodes) is a flat light emitting technology, made by placing a
series of organic thin films between two conductors. When electrical current is applied, a bright
light is emitted. OLEDs are emissive displays that do not require a backlight and so are thinner
and more efficient than LCD displays (which do require a white backlight).
OLED displays are not just thin and efficient - they provide the best image quality ever and they
can also be made transparent, flexible, foldable and even rollable and stretchable in the future.
OLEDs represent the future of display technology!
2.7.2 OLED vs LCD
An OLED display have the following advantages over an LCD display:
• Improved image quality - better contrast, higher brightness, fuller viewing angle, a wider
color range and much faster refresh rates.
• Lower power consumption.
• Simpler design that enables ultra-thin, flexible, foldable and transparent displays
• Better durability - OLEDs are very durable and can operate in a broader temperature range

Fig 2.11: OLED vs LCD

The future - flexible and transparent OLED displays


As we said, OLEDs can be used to create flexible and transparent displays. This is pretty exciting
as it opens up a whole world of possibilities:
• Curved OLED displays, placed on non-flat surfaces

27
• Wearable OLEDs
• Foldable OLEDs and rollable OLEDs which can be used to create new mobile devices
• Transparent OLEDs embedded in windows or car windshdields
• And many more we cannot even imagine today...
Flexible OLEDs are already on the market for many years (in smartphones, wearables and other
devices) and since 2019, with the introduction of the Samsung Galaxy Fold, foldable devices are
increasing in popularity. In 2019 LG also announced the world's first rollable OLED - its 65"
OLED R TV that can roll into its base!
An OLED is made by placing a series of organic thin films between two conductors. When
electrical current is applied, a bright light is emitted. Click here for a more detailed view of the
OLED technology. OLEDs are organic because they are made from carbon and hydrogen. There's
no connection to organic food or farming - although OLEDs are very efficient and do not contain
any bad metals - so it's a real green technology.
OLED is the best display technology - and indeed OLED panels are used today to create the
most stunning TVs ever - with the best image quality combined with the thinnest sets ever. And
this is only the beginning, as in the future OLED will enable large rollable and transparent TVs!
Currently the only company that produces OLED TV panels is LG Display. The Korean display
maker is producing a wide range of OLED TV panels, offering these to LG
Electronics, Panasonic, Sony, Philips and others.

2.7.3 OLED white lighting


OLEDs can be used to create excellent light source. OLEDs offer diffuse area lighting and can be flexible,
efficient, light, thin, transparent, color-tunable and more. OLEDs enable new designs and these devices emit
healthier light compared to CFLs and LED lighting devices.

2.7.4 Specifications
 Use CHIP No.SH1106
 Use 3.3V-5V POWER SUPPLY
 Graphic LCD 1.3” in width with 128x64 Dot Resolution
 White Display is used for the model OLED 1.3 I2C WHITE and blue Display is used for
the model OLED 1.3 I2C BLUE
 Use I2C Interface
 Directly connect signal to Microcontroller 3.3V and 5V without connecting through
Voltage Regulator Circuit
 Total Current when running together is 8 mA - PCB Size: 33.7 mm x 35.5 mm

28
Table shows name and function of Pin OLED

Table 2.2: Name and Function of Pin OLED.


Example of connecting with Board Arduino This example illustrates how to connect together
with Board Arduino, in this case, it is Board ET-BASE AVR EASY328. It is used together with
Program Arduino and Library to connect and communicate to Module OLED.
- Firstly, install Library “u8glib”; go to Menu Sketch > Include Library > Add.ZIP Library...

Fig 2.12 : Library to connect and communicate to Module


OLED

- Go to Folder Lib_Arduino\u8glib in CD-ROM; next, choose hown in the picture below.

Fig 2.13: Arduino

29
2.8 Internet of things (IoT)
Internet of things (IoT), is another advance technology in IT sector, provides
internetworking for numerous of devices such as sensors, actuators, PLCs and other electronic
embedded smart devices and controls, and various software’s’ and provides systems network
configuration and connectivity, which enables communication between these numerous devices
for information exchanging.
In 1995, “thing to thing” was coined by BILL GATES. In 1999, IoT (Internet of Things)
was come up by EPC global. IOT interconnects human to thing, thing to thing and human to
human. The goal of IoT is bring out a huge network by combining different types connected
devices. IoT targets three aspects Communication, automation, cost saving in a system. IOT
empowers people to carry out routine activities using internet and thus saves time and cost
making them more productive. IOT enables the objects to be sensed and/or controlled remotely
across existing network model. IOT in environmental monitoring helps to know about the air
and water quality, temperature and conditions of the soil, and also monitor the intrusion of
animals in to the field. IOT can also play a significant role in precision farming to enhance the
productivity of the farm.
Recent advancements, such as the vision of the Internet of Things (IoT), the cloud computing
model, and cyber-physical systems, provide support for the transmission and management of
huge amounts of data regarding the trends observed in environmental parameters. In this context,
the current work presents three different IoT-based wireless sensors
for environmental and ambient monitoring: one employing User Datagram Protocol (UDP)-
based WiFi communication, one communicating through Wi-Fi and Hypertext Transfer Protocol
(HTTP), and a third one using Bluetooth Smart. All of the presented systems provide the
possibility of recording data at remote locations and of visualizing them from every device with
an Internet connection, enabling the monitoring of geographically large areas. The development
details of these systems are described, along with the major differences and similarities between
them. The feasibility of the three developed systems for implementing monitoring applications,
taking into account their energy autonomy, ease of use, solution complexity, and Internet
connectivity facility, was analysed, and revealed that they make good candidates for IoT-based
solutions.
Nowadays, IoT is one of the most advanced, efficient, and cost less technological solution
which encompasses various hardware and software resources; and allows remotely connected
sensing devices to sense with more capabilities, provides efficiency and can be monitored and
controlled through deployed of existing systems or infrastructures, resulting the physical World
integration with computer controllers (or systems).

30
As IoT provides interconnectivity among various real-time sensing sensors and PLC and
other intelligent devices, therefore this technology will be an entity indicated for the more
advance cybersystems encircling the significant developments, “such as smart grid, smart
vehicle systems, smart medical systems, smart cities, and others smart systems.” In early future,
IoT has striven to provide advance or smart connectivity for variety of electronic and intelligent
equipment’s or devices, ITbased systems and the more advanced services through deploying of
various traditional and real-time protocols, networks domains, and system software/hardware
applications, which will be an work followed by machine-to-machine technological concept.
Through interconnection of various devices and managing of the internet of things (IoT)
is the network of physical devices, vehicles, buildings and other items embedded with
electronics, software, sensors, actuators, and network connectivity that enable these objects to
collect and exchange data. In 2013 the Global Standards Initiative on Internet of Things (IoT-
GSI) defined the IoT as "the infrastructure of the information society. The IoT allows objects to
be sensed and controlled remotely across existing network infrastructure, creating opportunities
for more direct integration of the physical world into computer-based systems, and resulting in
improved efficiency, accuracy and economic benefit.
When IoT is augmented with sensors and actuators, the technology becomes an instance
of the more general class of cyber-physical systems, which also encompasses technologies such
as smart grids, smart homes, intelligent transportation and smart cities. Each thing is uniquely
identifiable through its embedded computing system but is able to interoperate within the
existing Internet infrastructure. Experts estimate that the IoT will consist of almost 50 billion
objects by 2020.
IoT is a system defines an environment that encompasses numerous of objects; sensors
that connected with these objects are accessible over the Internet through employing of various
Networks connections, such wired or wireless. IoT can be able to carry information from various
embedded sensors attached with the physical World, human and any inanimate object, and then
transmit them to a system for further analyses. In early future, IoT will be able to connect almost
components or parts of industrial infrastructures, smart medical tele monitoring systems, and
smart transportation systems; and will provide the information sharing facilities in order to make
systems and peoples always updated.

2.8.1 What is the internet of things (IoT)


The internet of things, or IoT, is a system of interrelated computing devices, mechanical and
digital machines, objects, animals or people that are provided with unique identifiers (UIDs) and
the ability to transfer data over a network without requiring human-to-human or human-to-
computer interaction. A thing in the internet of things can be a person with a heart monitor
31
implant, a farm animal with a biochip transponder, an automobile that has built-in sensors to
alert the driver when tire pressure is low or any other natural or man-made object that can be
assigned an Internet Protocol (IP) address and is able to transfer data over a network.
Increasingly, organizations in a variety of industries are using IoT to operate more efficiently,
better understand customers to deliver enhanced customer service, improve decision-making and
increase the value of the business.

2.8.2 How does IoT work


An IoT ecosystem consists of web-enabled smart devices that use embedded systems, such as
processors, sensors and communication hardware, to collect, send and act on data they acquire
from their environments. IoT devices share the sensor data they collect by connecting to an IoT
gateway or other edge device where data is either sent to the cloud to be analyzed or analyzed
locally. Sometimes, these devices communicate with other related devices and act on the
information they get from one another. The devices do most of the work without human
intervention, although people can interact with the devices -- for instance, to set them up, give
them instructions or access the data.
The connectivity, networking and communication protocols used with these web-enabled
devices largely depend on the specific IoT applications deployed.
IoT can also make use of artificial intelligence (AI) and machine learning to aid in making data
collecting processes easier and more dynamic.

Fig 2.14 : Example of an IOT system.

32
2.8.3 Why is IoT important
The internet of things helps people live and work smarter, as well as gain complete control over
their lives. In addition to offering smart devices to automate homes, IoT is essential to business.
IoT provides businesses with a real-time look into how their systems really work, delivering
insights into everything from the performance of machines to supply chain and logistics
operations.
IoT enables companies to automate processes and reduce labor costs. It also cuts down on waste
and improves service delivery, making it less expensive to manufacture and deliver goods, as
well as offering transparency into customer transactions.
As such, IoT is one of the most important technologies of everyday life, and it will continue to
pick up steam as more businesses realize the potential of connected devices to keep them
competitive.

2.8.4 What are the benefits of IoT to organizations


The internet of things offers several benefits to organizations. Some benefits are industry-
specific, and some are applicable across multiple industries. Some of the common benefits of IoT
enable businesses to:
• monitor their overall business processes;
• improve the customer experience (CX);
• save time and money;
• enhance employee productivity;
• integrate and adapt business models;
• make better business decisions; and
• generate more revenue.
IoT encourages companies to rethink the ways they approach their businesses and gives them
the tools to improve their business strategies.
Generally, IoT is most abundant in manufacturing, transportation and utility organizations,
making use of sensors and other IoT devices; however, it has also found use cases for
organizations within the agriculture, infrastructure and home automation industries, leading
some organizations toward digital transformation.
IoT can benefit farmers in agriculture by making their job easier. Sensors can collect data on
rainfall, humidity, temperature and soil content, as well as other factors, that would help
automate farming techniques.
The ability to monitor operations surrounding infrastructure is also a factor that IoT can help
with. Sensors, for example, could be used to monitor events or changes within structural

33
buildings, bridges and other infrastructure. This brings benefits with it, such as cost saving, saved
time, quality-of-life workflow changes and paperless workflow.
A home automation business can utilize IoT to monitor and manipulate mechanical and electrical
systems in a building. On a broader scale, smart cities can help citizens reduce waste and energy
consumption.
IoT touches every industry, including businesses within healthcare, finance, retail and
manufacturing.

2.8.5 What are the pros and cons of IoT


Some of the advantages of IoT include the following:
• ability to access information from anywhere at any time on any device;
• improved communication between connected electronic devices;
• transferring data packets over a connected network saving time and money; and
• automating tasks helping to improve the quality of a business's services and reducing the
need for human intervention.
Some disadvantages of IoT include the following:
• As the number of connected devices increases and more information is shared between
devices, the potential that a hacker could steal confidential information also increases.
• Enterprises may eventually have to deal with massive numbers -- maybe even millions -
- of IoT devices, and collecting and managing the data from all those devices will be
challenging.
• If there's a bug in the system, it's likely that every connected device will become
corrupted.
• Since there's no international standard of compatibility for IoT, it's difficult for devices
from different manufacturers to communicate with each other.

2.8.6 IoT standards and frameworks


There are several emerging IoT standards, including the following:
• IPv6 over Low-Power Wireless Personal Area Networks (6LoWPAN) is an open
standard defined by the Internet Engineering Task Force (IETF). The 6LoWPAN standard
enables any low-power radio to communicate to the internet, including 804.15.4,
Bluetooth Low Energy (BLE) and Z-Wave (for home automation).
• ZigBee is a low-power, low-data rate wireless network used mainly in industrial settings.
ZigBee is based on the Institute of Electrical and Electronics Engineers (IEEE) 802.15.4
standard. The ZigBee Alliance created Dotdot, the universal language for IoT that enables
smart objects to work securely on any network and understand each other.

34
• LiteOS is a Unix-like operating system (OS) for wireless sensor networks. LiteOS
supports smartphones, wearables, intelligent manufacturing applications, smart homes
and the internet of vehicles (IoV). The OS also serves as a smart device development
platform.
• OneM2M is a machine-to-machine service layer that can be embedded in software and
hardware to connect devices. The global standardization body, OneM2M, was created to
develop reusable standards to enable IoT applications across different verticals to
communicate.
• Data Distribution Service (DDS) was developed by the Object Management Group
(OMG) and is an IoT standard for real-time, scalable and high-performance M2M
communication.
• Advanced Message Queuing Protocol (AMQP) is an open source published standard
for asynchronous messaging by wire. AMQP enables encrypted and interoperable
messaging between organizations and applications. The protocol is used in client-server
messaging and in IoT device management.
• Constrained Application Protocol (CoAP) is a protocol designed by the IETF that
specifies how low-power, compute-constrained devices can operate in the internet of
things.
• Long Range Wide Area Network (LoRaWAN) is a protocol for WANs designed to
support huge networks, such as smart cities, with millions of low-power devices.

IoT frameworks include the following:


• Amazon Web Services (AWS) IoT is a cloud computing platform for IoT released by
Amazon. This framework is designed to enable smart devices to easily connect and
securely interact with the AWS cloud and other connected devices.
• Arm Mbed IoT is a platform to develop apps for IoT based on Arm microcontrollers.
The goal of the Arm Mbed IoT platform is to provide a scalable, connected and secure
environment for IoT devices by integrating Mbed tools and services.
• Microsoft's Azure IoT Suite is a platform that consists of a set of services that enables
users to interact with and receive data from their IoT devices, as well as perform various
operations over data, such as multidimensional analysis, transformation and aggregation,
and visualize those operations in a way that's suitable for business.
• Google's Brillo/Weave is a platform for the rapid implementation of IoT applications.
The platform consists of two main backbones: Brillo, an Android-based OS for the
development of embedded low-power devices, and Weave, an IoT-oriented

35
communication protocol that serves as the communication language between the device
and the cloud.
• Calvin is an open source IoT platform released by Ericsson designed for building and
managing distributed applications that enable devices to talk to each other. Calvin
includes a development framework for application developers, as well as a runtime
environment for handling the running application.

2.8.7 Consumer and enterprise IoT applications


There are numerous real-world applications of the internet of things, ranging from consumer IoT
and enterprise IoT to manufacturing and industrial IoT (IIoT). IoT applications span numerous
verticals, including automotive, telecom and energy.
In the consumer segment, for example, smart homes that are equipped with smart thermostats,
smart appliances and connected heating, lighting and electronic devices can be controlled
remotely via computers and smartphones.
Wearable devices with sensors and software can collect and analyze user data, sending messages
to other technologies about the users with the aim of making users' lives easier and more
comfortable. Wearable devices are also used for public safety -- for example, improving first
responders' response times during emergencies by providing optimized routes to a location or
by tracking construction workers' or firefighters' vital signs at life-threatening sites.
In healthcare, IoT offers many benefits, including the ability to monitor patients more closely
using an analysis of the data that's generated. Hospitals often use IoT systems to complete tasks
such as inventory management for both pharmaceuticals and medical instruments.
Smart buildings can, for instance, reduce energy costs using sensors that detect how many
occupants are in a room. The temperature can adjust automatically -- for example, turning the
air conditioner on if sensors detect a conference room is full or turning the heat down if everyone
in the office has gone home.
In agriculture, IoT-based smart farming systems can help monitor, for instance, light,
temperature, humidity and soil moisture of crop fields using connected sensors. IoT is also
instrumental in automating irrigation systems.
In a smart city, IoT sensors and deployments, such as smart streetlights and smart meters, can
help alleviate traffic, conserve energy, monitor and address environmental concerns, and
improve sanitation.

36
2.8.8 IoT security and privacy issues
The internet of things connects billions of devices to the internet and involves the use of billions
of data points, all of which need to be secured. Due to its expanded attack surface, IoT security
and IoT privacy are cited as major concerns.
In 2016, one of the most notorious recent IoT attacks was Mirai, a botnet that infiltrated domain
name server provider Dyn and took down many websites for an extended period of time in one
of the biggest distributed denial-of-service (DDoS) attacks ever seen. Attackers gained access to
the network by exploiting poorly secured IoT devices.
Because IoT devices are closely connected, all a hacker has to do is exploit one vulnerability to
manipulate all the data, rendering it unusable. Manufacturers that don't update their devices
regularly - or at all -- leave them vulnerable to cybercriminals.
Additionally, connected devices often ask users to input their personal information, including
names, ages, addresses, phone numbers and even social media accounts -- information that's
invaluable to hackers.
Hackers aren't the only threat to the internet of things; privacy is another major concern for IoT
users. For instance, companies that make and distribute consumer IoT devices could use those
devices to obtain and sell users' personal data.
Beyond leaking personal data, IoT poses a risk to critical infrastructure, including electricity,
transportation and financial services.

2.9 DHT11 – TEMPERATURE AND HUMIDITY SENSOR


2.9.1Pin Identification and Configuration

No: Pin Name Description


For DHT11 Sensor
1 Vcc Power supply 3.5V to 5.5V
2 Data Outputs both Temperature and Humidity through serial Data
3 NC No Connection and hence not used
4 Ground Connected to the ground of the circuit
For DHT11 Sensor module
1 Vcc Power supply 3.5V to 5.5V
2 Data Outputs both Temperature and Humidity through serial Data
3 Ground Connected to the ground of the circuit

37
Fig 2.15: DHT11 Sensor

2.9.2 DHT11 Specifications

• Operating Voltage: 3.5V to 5.5V


• Operating current: 0.3mA (measuring) 60uA (standby)
• Output: Serial data
• Temperature Range: 0°C to 50°C
• Humidity Range: 20% to 90%
• Resolution: Temperature and Humidity both are 16-bit
• Accuracy: ±1°C and ±1%
The DHT11 sensor can either be purchased as a sensor or as a module. Either way, the
performance of the sensor is same. The sensor will come as a 4-pin package out of which only
three pins will be used whereas the module will come with three pins as shown above.
The only difference between the sensor and module is that the module will have a filtering
capacitor and pull-up resistor inbuilt, and for the sensor, you have to use them externally if
required.
The DHT11 is a commonly used Temperature and humidity sensor. The sensor comes with a
dedicated NTC to measure temperature and an 8-bit microcontroller to output the values of
temperature and humidity as serial data. The sensor is also factory calibrated and hence easy to
interface with other microcontrollers.
The sensor can measure temperature from 0°C to 50°C and humidity from 20% to 90% with an
accuracy of ±1°C and ±1%. So if you are looking to measure in this range then this sensor might
be the right choice for you.
The DHT11 Sensor is factory calibrated and outputs serial data and hence it is highly easy to set
it up. The connection diagram for this sensor is shown below.

38
Fig 2.16: DHT11

As you can see the data pin is connected to an I/O pin of the MCU and a 5K pull-up resistor is
used. This data pin outputs the value of both temperature and humidity as serial data. If you are
trying to interface DHT11 with Arduino then there are ready-made libraries for it which will give
you a quick start.
If you are trying to interface it with some other MCU then the datasheet given below will come
in handy. The output given out by the data pin will be in the order of 8bit humidity integer data
+ 8bit the Humidity decimal data +8 bit temperature integer data + 8bit fractional temperature
data +8 bit parity bit.

2.10 GAS SENSOR


A gas detector is a device which detects the presence of various gases within an area, usually as
part of a safety system. This type of equipment is used to detect a gas leak and interface with a
control system so a process can be automatically shut down. A gas detector can also sound an
alarm to operators in the area where the leak is occurring, giving them the opportunity to leave
the area. This type of device is important because there are many gases that can be harmful to
organic life, such as humans or animals.

Fig 2.15: Gas Sensor


In current technology scenario, monitoring of gases produced is very important. From home
appliances such as air conditioners to electric chimneys and safety systems at industries
39
monitoring of gases is very crucial. Gas sensors are very important part of such systems. Small
like a nose, gas sensors spontaneously react to the gas present, thus keeping the system updated
about any alterations that occur in the concentration of molecules at gaseous state.
Gas sensors are available in wide specifications depending on the sensitivity levels, type of gas
to be sensed, physical dimensions and numerous other factors. This Insight covers a methane gas
sensor that can sense gases such as ammonia which might get produced from methane. Whena gas
interacts with this sensor, it is first ionized into its constituents and is then adsorbed by thesensing
element. This adsorption creates a potential difference on the element which is conveyedto the
processor unit through output pins in form of current.

2.10.1 FEATURES
* High sensitivity to LPG, natural gas , town gas .
* Small sensitivity to alcohol, smoke.
* Fast response .
* Stable and long life.
* Simple drive circuit.

2.10.2 APPLICATION
They are used in gas leakage detecting equipments in family and industry, are suitable for
detecting of LPG, natural gas , town gas, avoid the noise of alcohol and cooking fumes and
cigarette smoke.

2.11 RAIN SENSOR MODULE


2.11.1 Description
The rain sensor module is an easy tool for rain detection. It can be used as a switch when raindrop
falls through the raining board and also for measuring rainfall intensity. The module features, a
rain board and the control board that is separate for more convenience, power indicator LED and
an adjustable sensitivity though a potentiometer.
The analog output is used in detection of drops in the amount of rainfall. Connected to 5V power
supply, the LED will turn on when induction board has no rain drop, and DO output is high.
When dropping a little amount water, DO output is low, the switch indicator will turn on. Brush
off the water droplets, and when restored to the initial state, outputs high level.

40
2.11.2 Specifications
Adopts high quality of RF-04 double sided material.
Area: 5cm x 4cm nickel plate on side,
Anti-oxidation, anti-conductivity, with long use time;
Comparator output signal clean waveform is good, driving ability, over 15mA;
Potentiometer adjust the sensitivity;
Working voltage 5V;
Output format: Digital switching output (0 and 1) and analog voltage output AO;
With bolt holes for easy installation;
Small board PCB size: 3.2cm x 1.4cm;
Uses a wide voltage LM393 comparator

2.12 FIRE SENSOR


The Fire sensor, as the name suggests, is used as a simple and compact device for protection
against fire. The module makes use of IR sensor and comparator to detect fire up to a range of
1-2 meters. The device, weighing about 5 grams, can be easily mounted on the device body. It
gives a high output on detecting fire. This output can then be used to take the requisite action.
An on-board LED is also provided for visual indication.

2.12.1 Feature
• Typical Maximum Range :2 m .
• Indicator LED with 3 pin easy interface connector.
• Operating Voltage 5v
An automatic fire sensor sense the unwanted presence of fire by monitoring environmental
changes associated with combustion. In general, a fire alert system is classified as either
automatically actuated, manually actuated, or both. Fire sensor are intended to notify the fire in
the building occupants to evacuate in the event of a fire or other emergency, report the event to
an off-premises location in order to summon emergency services, and to prepare the structure
and associated systems to control the spread of fire and smoke.

Fig 2.16: Fire sensor


41
• Fire alarm control panel: This component, the hub of the system, monitors inputs and
system integrity, controls outputs and relays information.
• Primary Power supply: Commonly the non-switched 120 or 240 Volt Alternating Current
source supplied from a commercial power utility. In non-residential applications, a
branch circuit is dedicated to the fire alarm system and its constituents. "Dedicated branch
circuits" should not be confused with "Individual branch circuits" which supply energy
to a single appliance.
• Secondary (backup) Power supplies: This component, commonly consisting of sealed
leadacid storage batteries or other emergency sources including generators, is used to
supply energy in the event of a primary power failure.
• Initiating Devices: This component acts as an input to the fire alarm control unit and are
either manually or automatically actuated. Examples would be devices like pull stations
or smoke detectors.
• Notification appliances: This component uses energy supplied from the fire alarm system
or other stored energy source, to inform the proximate persons of the need to take action,
usually to evacuate. This is done by means of a flashing light, strobe light,
electromechanical horn, speaker, or a combination of these devices.
• Building Safety Interfaces: This interface allows the fire alarm system to control aspects
of the built environment and to prepare the building for fire and to control the spread of
smoke fumes and fire by influencing air movement, lighting, process control, human
transport and exit.
Manually actuated devices; Break glass stations, Buttons and manual fire alarm activation are
constructed to be readily located (near the exits), identified, and operated.
Automatically actuated devices can take many forms intended to respond to any number of
detectable physical changes associated with fire: convicted thermal energy; heat detector,
products of combustion; smoke detector, radiant energy; flame detector, combustion gasses;
carbon monoxide detector and release of extinguishing agents; water-flow detector. The newest
innovations can use cameras and computer algorithms to analyze the visible effects of fire and
movement in applications inappropriate for or hostile to other detection methods.

2.13 BLUETOOTH
Bluetooth is a wireless technology standard for exchanging data over short distances
(using short-wavelength UHF radio waves in the ISM band from 2.4 to 2.485 GHz) from fixed
and mobile devices and building personal area networks (PANs). In 1994 a group of engineers
at Ericsson, a Swedish company, invented a wireless communication technology, later called

42
Bluetooth. In 1998, the original group of Promoter companies—Ericsson, Intel, Nokia, Toshiba
and IBM—came together to form the Bluetooth Special Interest Group (SIG).
Bluetooth networking transmits data via low-power radio waves. It communicates on a
frequency of 2.45 gigahertz (actually between 2.402 GHz and 2.480 GHz, to be exact). This
frequency band has been set aside by international agreement for the use of industrial, scientific
and medical devices (ISM). By comparison, the most powerful cell phones can transmit a signal
of 3 watts. The low power limits the range of a Bluetooth device to about 10 meters (32 feet),
cutting the chances of interference between your computer system and your portable telephone
or television.

2.13.1 Some specification of Bluetooth


• Operates in the 2.4 GHZ band which is globally available
• It has 79 channels
• Uses FHSS ,GFSK modulation
• 1600 hops per second
• Can support up to 8 devices in a piconet
• Omni-directional, non-line of sight transmission through walls
• 10m to 100m range
• Low cost, $20
• 1mW power
• Extended range with external power amplifier (100 meters)

2.13.2 DIFFERENCE
There are many other wireless communication techniques are available in the market like IEEE
802.11 (Wi-Fi), IrDA, GSM, GPRS etc. But still Bluetooth is very popular among them. There
are many reasons like some techniques required huge infrastructure like GSM, GPRS etc. and
also they are not suitable for Adhoc networks like Bluetooth. But some wireless communications
techniques are there that are the competitors of Bluetooth. Some main competitors are IEEE
802.11 and IrDA (Infrared Data Association). In this section we will discuss the differences b/w
these and Bluetooth.
It is a family of IEEE standards for wireless LANs that were designed to extend 802.3 (wired
Ethernet) into the wireless domain. The 802.11 standard is more widely known as "Wi-Fi". Based
on the Bluetooth Specification, is now an IEEE standard under the denomination of 802.15
WPANs

43
The first 802.11 specifications were introduced in 1997 and included two spread spectrum
methods for transmission in the unlicensed 2.4GHz band: 1 Mbps frequency hopping (FHSS)
and 1 and 2 Mbps direct sequence (DSSS).
In 1999, 802.11b boosted speed to 11 Mbps using DSSS. The 1 and 2 Mbps DSSS modes are
still valid, and devices can throttle down to the lower speeds to maintain a connection when
signals are weak.
An 802.11 system works in two modes. In "infrastructure" mode, wireless devices communicate
to a wired LAN via base stations known as "access points." Each access point and its wireless
devices are known as a Basic Service Set (BSS). An Extended Service Set (ESS) is two or more
BSSs in the same subnet.
In "ad hoc" mode, also known as "peer-to-peer" mode, wireless devices communicate with each
other directly without an access point. This is an Independent BSS (IBSS).

Peak Data Relative Voice network Data network


Rate Range Cost support support
IEEE
802.11 2 Mbps 50m Medium Via IP TCP / IP

IrDA 16 Mbps < 2m Low Via IP Via PPP


Bluetooth 1 Mbps < 10m Medium Via IP and cellular Via PPP
HomeRF 1.6 Mbps 50m Medium Via IP and PSTN TCP / IP
Table 2.3: PIR pin Definition and Ratings.

2.14 COMMUNICATION
A Bluetooth transceiver is a frequency hopping spread-spectrum (FHSS) device that uses
the unlicensed (worldwide) 2.4 GHz ISM (Industrial, Scientific, Medical) frequency band. In
most countries, there are 79 channels available. The nominal bandwidth for each channel is
1MHz. When connected to other Bluetooth devices, a Bluetooth device hops (changes
frequencies) at the rate of 1600 times per second for typical use, with a residence time of 625
µsec.
When in inquiry or page mode, it hops at 3200 hops per second with a residence time of
312.5 µsec. A Bluetooth transceiver uses all 79 channels, and hops pseudo-randomly across all
channels at a rate of 1600 hops per second for standard transmissions. It has a range of
approximately10 meters, although ranges up to 100 meters can be achieved with amplifiers.
Because the transceiver has an extremely small footprint, it is easily embedded into physical
devices, making it a truly ubiquitous radio link. The Bluetooth specification uses time division
duplexing (TDD) and time division multiple access (TDMA) for device communication.

44
A single time slot is 625 µ sec in length, representing the length of a single-slot packet.
At the Baseband layer, a packet consists of an access code, a header, and the payload, as shown
in Fig. 3. The access code contains the piconet address (to filter out messages from other
piconets) and is usually 72 bits in length. The header contains link control data, encoded with a
forward error-correcting code (FEC) with a 1/3 rate for high reliability. Such code is a repetition
code and thus every bit in the header is transmitted three times. The header is usually 18 bits in
length, and includes the active member address for a currently active slave.
The payload can contain from 0 to 2745 bits of data, and may be protected by a 1/3 rate
FEC (simple bit repetition, for SCO packets only), a 2/3 rate FEC (which is a (15,10) shortened
Hamming code capable of correcting all one-bit errors and detecting all two-bit errors), or a 3/3/
rate (no FEC). For SCO connections, packets must be exactly one time-slot in length. For ACL
links, packets may be 1, 3, or 5 time slots in length. Bluetooth uses polling-based packet
transmission. All communication between devices takes place between a master and a slave,
using time-division duplex (TDD), with no direct slave-to slave communication.
The master will poll each active slave to determine if it has data to transmit. The slave
may only transmit data when it has been polled. Also, it must send its data in the time slot
immediately following the one in which it was polled. The master transmits only in even
numbered time slots, while the slaves transmit only in odd-numbered time slots. In each time
slot, a different frequency channel f is used (a hop in the hopping sequence).

2.15 BLUETOOTH MODULE


Baseband - There are two basic types of physical links that can be established between a master
and a slave:
• Synchronous Connection Oriented (SCO)
• Asynchronous Connection-Less (ACL)
An SCO link provides a symmetric link between the master and the slave, with regular
periodic exchange of data in the form of reserved slots. Thus, the SCO link provides a circuit-
switched connection where data are regularly exchanged, and as such it is intended for use with
time-bounded information as audio. A master can support up to three SCO links to the same or
to different slaves. A slave can support up to three SCO links from the same master.
An ACI link is a point-to-multipoint link between the master and all the slaves on the
piconet. It can use all of the remaining slots on the channel not used for SCO links. The ACL
link provides a packet-switched connection where data are exchanged sporadically, as they
become available from higher layers of the stack. The traffic over the ACL link is completely
scheduled by the master.

45
Each Bluetooth device has a 48 bit IEEE MAC address that is used for the derivation of
the access code. The access code has pseudo-random properties and includes the identity of the
piconet master. All the packets exchanged on the channel are identified by this master identity.
That prevents packets sent in one piconet to be falsely accepted by devices in another piconet
that happens to use the same hopping frequency in the certain time slot. . All packets have the
same format, starting with an access code, followed by a packet header and ending with the user
payload.

Access Code Header Payload

68 or 72 bits 54 bits 0 - 2745 bits


Fig 2.16: Bluetooth packet structure
The access code is used to address the packet to a specific device. The header contains all
the control information associated with the packet and the link. The payload contains the actual
message information. The Bluetooth packets can be 1, 3, or 5 slots long, but the multi slot
packets are always sent on a single-hop carrier.

The Link Controller - The link control layer is responsible for managing device discoverability,
establishing connections and maintaining them. In Bluetooth, three elements have been defined
to support connection establishment: scan, page and inquiry.
Inquiry is a process in which a device attempts to discover all the Bluetooth enabled
devices in its local area. A unit that wants to make a connection broadcasts an inquiry message
that induces the recipients to return their addresses. Units that receive the inquiry message return
an FHS (FHsynchronization) packet which includes, among other things, their identity and clock
information. The identity of the recipient is required to determine the page message and wake-
up sequence. For the return of FHS packets, a random back off mechanism is used to prevent
collisions.
Inquiry
o
o
o
Laptop Mobile
Inquiry
Computer Phone
FHS

Fig 2.18: Discovering a Bluetooth device

A unit in idle mode wants to sleep most of the time to save power, but, from time to time,
it also has to listen whether other units want to connect (page scan). In truly ad hoc system, there
46
is no common control channel a unit can lock to in order to listen for page messages. So, every
time the unit wakes up, it scans at a different hop carrier for an extended time. A trade-off has to
be made between idle mode power consumption and response time: increasing the sleep time
reduces power consumption but prolongs the time before an access can be made. The unit that
wants to connect has to solve the frequency-time uncertainty: it doesn't know when the idle unit
will wake up and on which frequency. For that reason, the paging unit transmits the access code
repeatedly at different frequencies: every 1.25ms the paging unit transmits two access codes and
listens twice for a response. In 10ms period, 16 different hop carriers are visited. If the idle unit
wakes up in any of these 16 frequencies, it will receive the access code and start with a
connection setup procedure. First, it will notify the paging unit by returning a message, and then
it will transmit a FHS packet which contains all of the pager's information. This information is
then used by both units to establish the piconet. Once a baseband link is established, the master
and slave can exchange roles if they wish, so that slave becomes master and master becomes
slave.
It should be noted that the control of links rests completely with the local device. If it
doesn't make itself discoverable by page scanning it cannot be found, if it does not make itself
connectable by page scanning it cannot be linked with, and once in a connection it is free to
disconnect without warning at any time.

Audio - Audio data is carried via SCO (Synchronous Connection Oriented) channels. These SCO
channels use pre-reserved slots to maintain temporal consistency of the audio carried on them.
This allows us to build devices such as wireless headsets, microphones and headphones using
Bluetooth for many consumer products such as cellular phones, call centre switchboards, or even
personal musical playback.
There are two routes for audio to pass through a Bluetooth system: through the HCI as
data in HCI packets, and via direct PCM connection to the baseband CODECs.

Higher Layers and Applications

Control
Audio L2CAP
Host Controller Interface
Link Manager
Baseband
Radio

Fig 2.19: Position of audio in the Bluetooth stack

47
The HCI route has some deficiencies in carrying audio data, i.e. packets crossing the HCL
are subject to flow control and therefore to variable latency due to microcontroller executing the
HCI and LM (Link Manager) tasks. The direct PCM route is not well specified in the Bluetooth
specifications, but is very common in commercial implementations.

The Link Manager - The host drives a Bluetooth device through Host Controller Interface
(HCI) commands, but it is the link manager that translates those commands into operations at
the baseband level. Its main functions are to control piconet management (establishing and
destruction of the links and role change), link configuration, and security and QoS functions.
Link manager communicates with its peers on other devices using the Link Management
Protocol (LMP). Every LMP message begins with a flag bit which is 0 if a master initiated the
transaction and 1 if the slave initiated the transaction. That bit is followed by a 7-bit Operation
Code, and by the message's parameters.
When a link is first set up, it uses single-slot packets by default. Multi-slot packets make
more efficient use of the band, but there are some occasions when they can't be used, for example
on noisy links or if SCO links don't leave sufficient space between their slots for multi-slot
packets.
LMP also provides a mechanism for negotiating encryption modes and coordinating
encryption keys used by devices on both ends of the link. In addition, LMP supports messages
for configuration of the quality of service on a connection. Packet types can automatically change
according to the channel quality, so that the data can be transferred at a higher rate when the
channel quality is good, and on lower rates with more error protection if the channel quality
deteriorates.

2.16 BLUETOOTH HOST


Logical Link Control and Adaptation Protocol (L2CAP) - Logical Link Control and
Adaptation Protocol takes data from higher layers of the Bluetooth stack and from applications
and sends them over the lower layers of the stack. It passes packets either to the HCI, or in a
host-less system directly to the Link Manager. The major functions of the L2CAP are:
• Multiplexing between different higher layer protocols to allow several higher layer links
to share a single ACL connection. L2CAP uses channel numbers to label packets so that,
when they are received, they can be routed to the correct place.
• Segmentation and reassembly to allow transfer of larger packets than lower layers support.
• Quality of service management for higher layer protocols.
All applications must use L2CAP to send data. It is also used by Bluetooth's higher layers
such as RFCOMM and SDP, so L2CAP is a compulsory part of every Bluetooth system.

48
RFCOMM - RFCOMM is a simple, reliable transport protocol that provides emulation of the
serial cable line settings and status of an RS-232 serial port. It provides connections to multiple
devices by relying on L2CAP to handle multiplexing over single connection. RFCOMM
supports two types of devices:
• Type 1 - Internal emulated serial port. These devices usually are the end of a
communication path, for example a PC or printer.
• Type 2 - Intermediate device with physical serial port. These are devices that sit in the
middle of a communication path, for example a modem.
Up to 30 data channels can be set up, so RFCOMM can theoretically support 30 different
services at once. RFCOMM is based on GSM TS 07.10 standard, which is an asymmetric
protocol used by GSM cellular phones to multiplex several streams of data onto one physical
serial cable. The Service Discovery Protocol - One of the most important members of the
Bluetooth protocol stack is Service Discovery Protocol (SDP). It provides a means for an SDP
client to access information about services offered by SDP servers. An SDP server is any
Bluetooth device which offers services to other Bluetooth devices. Information about services is
maintained in SDP databases. There is no centralized database, so each SDP server maintains its
own database. The SDP database is simply a set of records describing all the services which a
Bluetooth device can offer to another Bluetooth device, and service discovery protocol provides
a means for another device to look at these records. To make it easier to find the service you
want, services are arranged in a hierarchy structure as a tree which can be browsed. Clients begin
by examining the root of the tree, then follow the hierarchy out to the leaf nodes where individual
services are described.
To browse service classes, or get information about a specific service, SDP clients and
servers exchange messages which are carried in SDP Protocol Data Units (PDUs). The first byte
of PDU is an ID, identifying the message in the PDU. Services have Universally Unique
Identifiers (UUIDs) that describe them. The services defined by the Bluetooth profiles have
UUIDs assigned by the standard, but service providers can define their own services and assign
their own UUIDs to those services.
SDP relies on L2CAP links being established between SDP client and server, before
retrieving SDP information. Stages in setting up an SDP connection are shown on a figure.

49
Inquiry
Link Controller Paging

Connection Setup
LMP_host connection_req

LMP_accepted

LMP_name_req

LMP_name_res
Link Manager

Connection Setup Authentication

LMP_Setup_complete

LMP_Setup_complete

L2CAP_connection_req
L2CAP
L2CAP_connection_res
Connection Setup

SDP_inquires
SDP Session SDP_responses

Disconnect Terminate Connection

Fig 2.20: Stages in setting up an SDP session


Supported Protocols - As mentioned at the beginning of this paper, one of the most important
characteristics of the Bluetooth specification is that it should allow devices from lots of different
manufacturers to work with one another. For that reason, Bluetooth is designed in such a way to
allow many different protocols to be run on top of it. Some of these protocols are:

The Wireless Access Protocol (WAP) - WAP provides a protocol stack similar to the IP stack,
but it is tailored for the needs of mobile devices. It supports the limited display size and resolution
typically found on mobile devices by providing special formats for Web pages whichsuit their
capabilities. It also provides for the low bandwidth of mobile devices by defining a method for
WAP content to be compressed before it is transmitted across a wireless link. WAP can use
Bluetooth as a bearer layer in the same way as it can use GSM, CDMA and other wirelessservices.
The WAP stack is joined to the Bluetooth stack using User Datagram Protocol (UDP),Internet
Protocol (IP) and Point to Point Protocol (PPP).

50
Object Exchange Protocol (OBEX) - OBEX is a protocol designed to allow a variety of devices
to exchange data simply and spontaneously. Bluetooth has adopted this protocol from the
Infrared Data Association (IrDA) specifications. OBEX has a client/server architecture and
allows a client to push data to a server or pull data from the server. For example, a PDA might
pull a file from a laptop, or a phone synchronizing an address book might push it to a PDA. The
similarities between the two communications protocols' lower layers mean that IrDA's OBEX
protocol is ideally suited to transferring objects between Bluetooth devices.

The Telephony Control Protocol - Bluetooth's Telephony Control protocol Specification (TCS)
defines how telephone calls should be sent across a Bluetooth link. It gives guidelines for the
signaling needed to set up both point to point and point to multipoint calls. By use of TCS, calls
from an external network can be directed to other Bluetooth devices. For instance, a cellular
phone could receive a call and use TCS to redirect the call to a laptop, allowing the laptop to be
used as a hands-free phone. TCS is driven by a telephony application which provides the user
interface, and provides the source of voice or data transferred across the connection set up by
TCS.
Applications: The Bluetooth Profiles - In addition to protocols which guarantee that two units
speak the same language, Bluetooth specification defines the profiles. They are associated with
applications. The profiles specify which protocol elements are mandatory in certain applications.
This concept prevents devices with little memory and processing power implementing the entire
Bluetooth stack when they only require a small fraction of it. Simple devices like a headset or
mouse can thus be implemented with a strongly reduced protocol stack.

The Bluetooth profiles are organized into groups, with each profile building upon the one
beneath and inheriting features from below. For developers, this means that key features of one
Bluetooth solution can be reused in other solutions, bringing down development costs and
speeding up the development cycle.

51
Generic Access Profile Telephony Control Protocol Specification

Service Discovery Cordless Intercom

Application Profile Telephony Profile Profile

Serial Port Profile


Generic Object Exchange Profile
Dial-Up Networking
File Transfer

FAX

Object Push
Headset

Synchronization
LAN Access

Fig 2.21: Bluetooth profiles


The profiles implemented by Bluetooth version 1.0 are:
• Generic Access - It defines the basic rules for using the protocol stack.
• Serial Port - How to use RFCOMM's serial port emulation capabilities in Bluetooth
products.
• Dial-up Networking - A Bluetooth link to a modem.
• FAX - How to transfer a fax over Bluetooth.
• Headset - A duplex link to a headset, controlled by an audio gateway such as cellular
phone.
• LAN Access Point - A link to LAN via Bluetooth.
• Generic Object Exchange - A set of rules for using OBEX, which supports file transfer,
object push and synchronization profiles.
• File Transfer - Transferring files between Bluetooth devices.
• Object Push - Pushing objects from a Bluetooth enabled server to a client.
• Synchronization - Synchronizing objects between Bluetooth devices.
• Cordless Telephony - Forwarding telephone calls to Bluetooth devices.
• Intercom - Short range voice connections between Bluetooth devices.

2.17 SECURITY
Basic security elements need to be considered to prevent unauthorized usage and
eavesdropping in Bluetooth system though it is mainly intended for short-range connectivity
between personal devices. Security features are included at the link level and are based on a

52
secret link key that is shared by a pair of devices. To generate this key a pairing procedure is
used when the two devices communication for the first time.
At connection establishment, an authentication process is carried out to verify the
identities of the units involved. The authentication process uses a conventional challenge-
response routine. The verifier compares signed response (SRES) produced by the claimant with
its own SRES and decides if the challenger may continue with connection establishment. To
prevent eavesdropping on the link, which is a danger inherent to radio communications, the
payload of each packet is encrypted. Encryption is based on stream ciphering; the payload bits
are modulo-2 added to a binary key stream.
The central element in the security process is the 128-bit link key. This link key is a secret
key residing in the Bluetooth hardware and is not accessible by the user. The link key is generated
during an initialization phase. Once the initialization has been carried out, the 128-bit link keys
reside in the devices and can from then on be used for automatic authentication without user
interaction. In addition, methods are available to use the same encryption keys for all slaves in a
single piconet.
Bluetooth provides limited number of security elements at the lowest level. More
advanced security procedures can be implemented at higher layers.

2.18 POWER MANAGEMENT


As many Bluetooth devices are operated by batteries, special attention has been paid to
the reduction of power consumption in the design. And many tests have been done to prove that
Bluetooth devices are too low in power to have any negative impact on health. Three low-power
modes, which extend battery life by reducing activity on a connection, have been defined. These
modes are called Park, Hold, and Sniff.
Park mode provides the greatest opportunities for power saving. The device only wakes
up in periodic beacon slots when it listens for unpark transmission from the Master. If it is not
unparked, it goes back to sleep, switching off its receiver. Devices that are parked give up their
active member addresses, so one Master can have more devices in Park mode at once. In Sniff
mode, the slave does not scan at every master-to-slave slot, but has a larger interval between
scans. Devices in Sniff mode keep their active member address. Typically, sniffing devices will
be active more often than parked devices. Both Park and Sniff modes involve putting devices
into a state where they wake up periodically while Hold mode just puts a connection in a low-
power state for a single period. So a Master needs to perform an inquiry to be able to service the
connections again.
In the connection state, current consumption is minimized and wasteful interference
prevented by only transmitting when data is available. In longer periods of silence, the master

53
needs to send a packet on the channel once in a while such that all slaves can resynchronize their
clocks and compensate for drift. During continuous TX/RX operations, a unit starts to scan for
the access code at the beginning of the RX slot. If the access code is not found, or even if it is
found but the slave address does not match the recipient, the unit goes to sleep until the next slot.
The header indicates what type of packet it is and how long the packet will last; therefore, the
non-addressed recipients can determine how long they can sleep.
The nominal transmit power used by most Bluetooth applications for short-range
connectivity is 0 dBm. This restricts current consumption and keeps interference to other systems
to a minimum. However, the Bluetooth radio specifications allow TX power up to 20 dBm.
Above 0 dBm, closedloop received signal strength indication power control is mandatory. This
power control can compensate for propagation losses and slow fading.
In low-power modes many layers of the Bluetooth protocol stack are involved: as after
periods of inactivity, the device may lose synchronization and need to listen for transmissions
over a wider window than usual, the baseband layer alters correlator properties. The link manager
provides a variety of messages to configure and negotiate the low-power modes between ends
of a connection. HCI provides a set of commands that may be used by a host to configure and
control the power-saving capabilities of a module. L2CAP must be aware of low-power modes
for its quality of service commitments.
Different Bluetooth devices may have different requirements for data rate, delay
variance, and reliability. The specification provides Quality Of Service (QOS) configuration for
the properties of links according to the requirements of higher layer applications or protocols.
These properties include the type of QOS, token rate, token rate bucket size, peak bandwidth,
latency and delay variation.

High Layer Protocols and High Layer Protocols and

Logical Link Control and Adaptation L2CAP QOS Logical Link Control and Adaptation

Host Controller Interface Host Controller Interface

Link Manager LMP QOS Link Manager

Link Manager Link Manager


Fig 2.22: QoS Messaging

54
Figure shows how to use message throughout the Bluetooth protocol stack to control QOS.
Messages configuring and setting up QOS flow vertically up and down the layers of the stack,
while Link manager and Logical Link control and Adaptation layer (L2CAP) configure QOS in
peer to peer negotiations. Link Manager actually implements QOS policies for it configures and
controls the baseband links and has various means to try to meet the QOS which L2CAP
requests.
When a link is first set up, QOS is requested from the higher layer to L2CAP. Then the
negotiation packets of QOS configuration are sent between local and remote L2CAP. The link
manager provides QOS capabilities according to the requests from L2CAP. On systems with an
HCI, this interaction between L2CAP and Link Manager is accomplished through a series of
HCI commands and events. LMP commands can be used to configure the poll interval, the
maximum interval between packets sent from Master to Slave, and the broadcast packet repeat
times. QOS setup completion is generated when LMP has finished setting. If failed, message
will be sent back to higher layer to decide whether to try again or to give up. If succeeded, the
channel will then open for transferring data at the desired QOS.
Even a channel has been configured, it is important that applications are aware whether
their QOS is not as requested, as they may wish to either shut down the link rather than run it at
an inappropriate quality, or shut down other links to improve this link. In such case, lower layers
send QOS violation events to tell the higher layers and let them decide what to do about it.

2.18.1 WHAT IS BLUETOOTH FOR


Although originally thought of simply as a replacement for the nest of wires that connects
PCs to keyboards and printers, Bluetooth quickly evolved into a system that will allow people to
detect and communicate with each other through a variety of mainly portable devices without
their users' intervention. Bluetooth devices will be able to talk to each other as they come into
range, which is about 10 meters, although this can be extended to more than 100 meters by
increasing the transmit power from a nominal 1mW to as much as 100mW. Bluetooth technology
is expected to make its debut in cell phones and Palm-type personal digital assistants (PDAs),
but then will move quickly into notebook and laptop computers, printers, scanners, digital
cameras, household appliances, games, toys, and more.
With Bluetooth technology, one can send e-mail from the computer on his lap to the
cellular phone in his briefcase. Bluetooth-linked cell phone or similarly equipped PDA can
automatically synchronize with desktop PC whenever the cell phone passes it within the
Bluetooth range. Or, one can have hands-free communication between a Bluetooth enabled
headset and a cell phone. Or download images from a digital camera to a PC or a cell phone...

55
Presently, Nokia and Fujifilm are working on a mobile imaging technology that should
enable Nokia to add a Bluetooth chip to its clamshell-shaped 9110 Communicator so that it can
receive images taken on a Bluetooth-equipped Fujifilm digital camera.
Finnish telecom operator Sonera has even demonstrated a Bluetooth enabled vending
machine - consumers buy products out of the machine by simply signaling an account code from
a Bluetooth cell phone or PDA.
Many other applications can be also thought of Bluetooth can serve as a means for
connecting laptop computers or other devices to the public Internet in airport lounges and
conference centres through permanent access points. It can also enable its users to exchange
business cards with everyone who passed on a street through a Bluetooth enabled Palm - but not
unless it has been given permission to identify the user to anyone. Maybe it would be neat to
have a system that would automatically reset all the digital clocks in a house following the power
outage. Or, to have a Bluetooth link between the roller blades and a speedometer in a digital
watch. But all these applications will have to wait for some more time before they hit the market,
since there is still a lot of work to be done, mostly regarding interoperability issues and final test
procedures for Bluetooth products.

2.19 ULN2003
The ULN2003 is a monolithic IC consists of seven NPN darlington transistor pairs with high
voltage and current capability. It is commonly used for applications such as relay drivers, motor,
display drivers, led lamp drivers, logic buffers, line drivers, hammer drivers and other high
voltage current applications. It consists of common cathode clamp diodes for each NPN
darlington pair which makes this driver IC useful for switching inductive loads.

Fig 2.23: ULN2003

56
The output of the driver is open collector and the collector current rating of each darlington pair
is 500mA. Darlington pairs may be paralleled if higher current is required. The driver IC also
consists of a 2.7KΩ base resistor for each darlington pair. Thus each darlington pair can be
operated directly with TTL or 5V CMOS devices. This driver IC can be used for high voltage
applications up to 50V.

Fig 2.22 Logic Diagram of ULN2003


Note that the driver provides open collector output, so it can only sink current, cannot source.
Thus when a 5V is given to 1B terminal, 1C terminal will be connected to ground via darlington
pair and the maximum current that it can handle is 500A. From the above logic diagram we can
see that cathode of protection diodes are shorted to 9th pin called COM. So for driving inductive
loads, it must connect to the supply voltage.
ULN2003 is widely used in relay driving and stepper motor driving applications.

2.19.1 FEATURES
* 500mA rated collector current (Single output)
* High-voltage outputs: 50V
* Inputs compatible with various types of logic.
* Relay driver application

2.20 RELAY INTRODUCTION


A relay is an electromechanical switch, which perform ON and OFF operations without
any human interaction. General representation of double contact relay is shown in fig. 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.

57
Fig2.24: Relay

2.20.1 History

The first relay was invented by Joseph Henry in 1835. The name relay derives from the
French noun relays’ that indicates the horse exchange place of the postman. Generally a relay is
an electrical hardware device having an input and output gate. The output gate consists in one or
more electrical contacts that switch when the input gate is electrically excited. It can implement
a decoupled, a router or breaker for the electrical power, a negation, and, on the base of the
wiring, complicated logical functions containing and, or, and flip-flop. In the past relays had a
wide use, for instance the telephone switching or the railway routing and crossing systems. In
spite of electronic progresses (as programmable devices), relays are still used in applications
where ruggedness, simplicity, long life and high reliability are important factors (for instance in
safety applications)

2.20.2 Working
Generally, the relay consists a inductor coil, a spring (not shown in the figure), Swing
terminal, and two high power contacts named as normally closed (NC) and normally opened
(NO). Relay uses an Electromagnet to move swing terminal between two contacts (NO and NC).
When there is no power applied to the inductor coil (Relay is OFF), the spring holds the swing
terminal is attached to NC contact.

Fig2.25: Representation of Relay

58
Whenever required power is applied to the inductor coil, the current flowing through the
coil generates a magnetic field which is helpful to move the swing terminal and attached it to the
normally open (NO) contact. Again when power is OFF, the spring restores the swing terminal
position to NC.

2.20.3 Advantage of relay


A relay takes small power to turn ON, but it can control high power devices to switch
ON and OFF. Consider an example; a relay is used to control the ceiling FAN at our home. The
ceiling FAN may runs at 230V AC and draws a current maximum of 4A. Therefore the power
required is 4X230 = 920 watts. Off course we can control AC, lights, etc., depend up on the relay
ratings. Relays can be used to control DC motors in ROBOTICs.

2.21 BUZZER
2.21.1 Introduction
A buzzer or beeper is a signaling device, usually electronic, typically used in automobiles, house
hold appliances such as a microwave oven, or game shows.
It most commonly consists of a number of switches or sensors connected to a control unit that
determines if and which button was pushed or a preset time has lapsed, and usually illuminates
a light on the appropriate button or control panel, and sounds a warning in the form of a
continuous or intermittent buzzing or beeping sound. Initially this device was based on an
electromechanical system which was identical to an electric bell without the metal gong (which
makes the ringing noise). Often these units were anchored to a wall or ceiling and used the ceiling
or wall as a sounding board. Another implementation with some AC-connected devices was to
implement a circuit to make the AC current into a noise loud enough to drive a loudspeaker and
hook this circuit up to a cheap 8-ohm speaker. Nowadays, it is more popular touse a ceramic-
based piezoelectric sounder like a Sonalert which makes a high-pitched tone. Usually these were
hooked up to “driver” circuits which varied the pitch of the sound or pulsedthe sound on and off.
In game shows it is also known as a “lockout system,” because when one person signals (“buzzes
in”), all others are locked out from signalling. Several game shows have large buzzer buttons
which are identified as “plungers”.

Fig 2.26: Buzzer

59
2.21.2 USES
• Annunciator panels
• Electronic metronomes
• Game shows
• Microwave ovens and other household appliances
• Sporting events such as basketball games
• Electrical alarms
2.22 Conclusion
Chapter 2 deals with the projects along with a brief paragraph of summery about the project. This
reflects the various people worked on this area, how different and advanced each project isfrom
one another. It has the Theory that has been acquired to commence the project work. This
discussed about IOT, the advantages, disadvantages the network topologies and communication
protocols. This chapter also briefs about the main microcontroller unit of the prototype, Node
MCU. Its pin configuration, various functional units of the development board and the
installation process of the device. The chapter further giver a brief overview of the project, a
block diagram of the system and the circuit diagram.

60
CHAPTER 3
SOFTWARE SPECIFICATIONS
3.1 THE ARDUINO INTEGRATED DEVELOPMENT ENVIRONMENT
Arduino Software (IDE) - contains a text editor for writing code, a message area, a text console,
a toolbar with buttons for common functions and a series of menus. It connects to the Arduino
and Genuino hardware to upload programs and communicate with them.

3.2 WRITING SKETCHES


Programs written using Arduino Software (IDE) are called sketches. These sketches are written
in the text editor and are saved with the file extension .ino. The editor has features for
cutting/pasting and for searching/replacing text. The message area gives feedback while saving
and exporting and also displays errors. The console displays text output by the Arduino Software
(IDE), including complete error messages and other information. The bottom righthand corner
of the window displays the configured board and serial port. The toolbar buttons allow you to
verify and upload programs, create, open, and save sketches, and open the serial monitor.
NB: Versions of the Arduino Software (IDE) prior to 1.0 saved sketches with the extension .pde.
It is possible to open these files with version 1.0, you will be prompted to save the sketch with
the .ino extension on save.
Verify
Checks your code for errors compiling it.

Upload

Compiles your code and uploads it to the configured board.


Note: If you are using an external programmer with your board, you can hold down
the "shift" key on your computer when using this icon. The text will change to
"Upload using
Programmer

New
Creates a new sketch.

61
Fig 3.1: Creates a new sketch.

Open
Presents a menu of all the sketches in your sketchbook. Clicking one will open it
within the current window overwriting its content.
Note: due to a bug in Java, this menu doesn't scroll; if you need to open a sketch late
in the list, use the File | Sketch book menu instead.

Save
Saves your sketch.

Fig 3.2: Saves your sketch.

Serial Monitor

Opens the serial monitor.

62
Additional commands are found within the five menus: File, Edit, Sketch, Tools, Help. The
menus are context sensitive, which means only those items relevant to the work currently being
carried out are available.
3.3 FILE
• New
Creates a new instance of the editor, with the bare minimum structure of a sketch already in
place.
• Open

Allows to load a sketch file browsing through the computer drives and
folders.
• Open Recent
Provides a short list of the most recent sketches, ready to be opened.

Fig 3.3: Open Recent


• Sketchbook
Shows the current sketches within the sketchbook folder structure; clicking on any name opens
the corresponding sketch in a new editor instance.
• Examples
Any example provided by the Arduino Software (IDE) or library shows up in this menu item.
All the examples are structured in a tree that allows easy access by topic or library.
• Close
Closes the instance of the Arduino Software from which it is clicked.
• Save
Saves the sketch with the current name. If the file hasn't been named before, a name will be
provided in a "Save as.." window.
• Save as...
Allows to save the current sketch with a different name.
• Page Setup

63
It shows the Page Setup window for printing.
• Print
Sends the current sketch to the printer according to the settings defined in Page Setup.
• Preferences
Opens the Preferences window where some settings of the IDE may be customized, as the
language of the IDE interface.
• Quit
Closes all IDE windows. The same sketches open when Quit was chosen will be automatically
reopened the next time you start the IDE.

3.4 EDIT
• Undo/Redo
Goes back of one or more steps you did while editing; when you go back, you may go forward
with Redo.
• Cut
Removes the selected text from the editor and places it into the clipboard.
• Copy
Duplicates the selected text in the editor and places it into the clipboard.
• Copy for Forum
Copies the code of your sketch to the clipboard in a form suitable for posting to the forum,
complete with syntax coloring.
• Copy as HTML
Copies the code of your sketch to the clipboard as HTML, suitable for embedding in web pages.
• Paste
Puts the contents of the clipboard at the cursor position, in the editor.
• Select All
Selects and highlights the whole content of the editor.
• Comment/Uncomment
Puts or removes the // comment marker at the beginning of each selected line.
• Increase/Decrease Indent
Adds or subtracts a space at the beginning of each selected line, moving the text one space on
the right or eliminating a space at the beginning.
• Find
Opens the Find and Replace window where you can specify text to search inside the current
sketch according to several options.
• Find Next
64
Highlights the next occurrence - if any - of the string specified as the search item in the Find
window, relative to the cursor position.
• Find Previous
Highlights the previous occurrence - if any - of the string specified as the search item in the Find
window relative to the cursor position.

3.5 SKETCH
• Verify/Compile
Checks your sketch for errors compiling it; it will report memory usage for code and variables
in the console area.

Fig 3.4: Verify and Compile.


• Upload
Compiles and loads the binary file onto the configured board through the configured Port.

Fig 3.5: Compiles and loads the binary file.

• Upload Using Programmer

65
This will overwrite the bootloader on the board; you will need to use Tools > Burn Bootloader
to restore it and be able to Upload to USB serial port again. However, it allows you to use the
full capacity of the Flash memory for your sketch. Please note that this command will NOT burn
the fuses. To do so a Tools -> Burn Bootloader command must be executed.
• Export Compiled Binary
Saves a .hex file that may be kept as archive or sent to the board using other tools.
• Show Sketch Folder
Opens the current sketch folder.
• Include Library
Adds a library to your sketch by inserting #include statements at the start of your code. For more
details, see libraries below. Additionally, from this menu item you can access the Library
Manager and import new libraries from .zip files.
• Add File...
Adds a source file to the sketch (it will be copied from its current location). The new file appears
in a new tab in the sketch window. Files can be removed from the sketch using the tab menu
accessible clicking on the small triangle icon below the serial monitor one on the right side o the
toolbar.

3.5.1 TOOLS
• Auto Format
This formats your code nicely: i.e. indents it so that opening and closing curly braces line up,
and that the statements inside curly braces are indented more.
• Archive Sketch
Archives a copy of the current sketch in .zip format. The archive is placed in the same directory
as the sketch.
• Fix Encoding & Reload
Fixes possible discrepancies between the editor char map encoding and other operating systems
char maps.
• Serial Monitor
Opens the serial monitor window and initiates the exchange of data with any connected board
on the currently selected Port. This usually resets the board, if the board supports Reset over
serial port opening.
• Board
Select the board that you're using. See below for descriptions of the various boards.
• Port

66
This menu contains all the serial devices (real or virtual) on your machine. It should
automatically refresh every time you open the top-level tools menu.
• Programmer
For selecting a harware programmer when programming a board or chip and not using the
onboard USB-serial connection. Normally you won't need this, but if you're burning a bootloader
to a new microcontroller, you will use this.
• Burn Bootloader
The items in this menu allow you to burn a bootloader onto the microcontroller on an Arduino
board. This is not required for normal use of an Arduino or Genuino board but is useful if you
purchase a new ATmega microcontroller (which normally come without a bootloader). Ensure
that you've selected the correct board from the Boards menu before burning the bootloader on
the target board.

This command also set the right fuses.

3.5.2 Help
Here you find easy access to a number of documents that come with the Arduino Software (IDE).
You have access to Getting Started, Reference, this guide to the IDE and other documents locally,
without an internet connection. The documents are a local copy of the online ones and may link
back to our online website. • Find in Reference
This is the only interactive function of the Help menu: it directly selects the relevant page in the
local copy of the Reference for the function or command under the cursor.

3.5.3 SKETCHBOOK
The Arduino Software (IDE) uses the concept of a sketchbook: a standard place to store your
programs (or sketches). The sketches in your sketchbook can be opened from the File
>Sketchbook menu or from the Open button on the toolbar. The first time you run the Arduino
software, it will automatically create a directory for your sketchbook. You can view or change
the location of the sketchbook location from with the Preferences dialog.
Beginning with version 1.0, files are saved with a .ino file extension. Previous versions use the
.pde extension. You may still open .pde named files in version 1.0 and later, the software will
automatically rename the extension to .ino.
Tabs, Multiple Files, and Compilation
Allows you to manage sketches with more than one file (each of which appears in its own tab).
These can be normal Arduino code files (no visible extension), C files (.c extension), C++ files
(.cpp), or header files (.h).

67
3.5.4 UPLOADING
Before uploading your sketch, you need to select the correct items from the Tools > Board and
Tools > Port menus. The boards are described below. On the Mac, the serial port is probably
something like /dev/tty.usbmodem241 (for an Uno or Mega2560 or Leonardo) or
/dev/tty.usbserial-1B1 (for a Duemilanove or earlier USB board), or /dev/tty.USA19QW1b1P1.1
(for a serial board connected with a Keyspan USB-to-Serial adapter). On Windows, it's probably
COM1 or COM2 (for a serial board) or COM4, COM5, COM7, or higher (for a USB board) - to
find out, you look for USB serial device in the ports section of the Windows Device Manager.
On Linux, it should
be /dev/ttyACMx , /dev/ttyUSBx or similar. Once you've selected the correct serial port and
board, press the upload button in the toolbar or select the Upload item from the Sketch menu.
Current Arduino boards will reset automatically and begin the upload. With older boards (pre-
Diecimila) that lack auto-reset, you'll need to press the reset button on the board just before
starting the upload. On most boards, you'll see the RX and TX LEDs blink as the sketch is
uploaded. The Arduino Software (IDE) will display a message when the upload is complete, or
show an error.
When you upload a sketch, you're using the Arduino bootloader, a small program that has been
loaded on to the microcontroller on your board. It allows you to upload code without using any
additional hardware. The bootloader is active for a few seconds when the board resets; then it
starts whichever sketch was most recently uploaded to the microcontroller. The bootloader will
blink the on-board (pin 13) LED when it starts (i.e. when the board resets).

3.5.5 LIBRARIES
Libraries provide extra functionality for use in sketches, e.g. working with hardware or
manipulating data. To use a library in a sketch, select it from the Sketch > Import Library menu.
This will insert one or more #include statements at the top of the sketch and compile the library
with your sketch. Because libraries are uploaded to the board with your sketch, they increase the
amount of space it takes up. If a sketch no longer needs a library, simply delete its
#includestatements from the top of your code. There is a list of libraries in the reference. Some
libraries are included with the Arduino software. Others can be downloaded from a variety of
sources or through the Library Manager. Starting with version 1.0.5 of the IDE, you do can
import a library from a zip file and use it in an open sketch. See these instructions for installing
a third-party library.
To write your own library, see this tutorial.
Third-Party Hardware

68
Support for third-party hardware can be added to the hardware directory of your sketchbook
directory. Platforms installed there may include board definitions (which appear in the board
menu), core libraries, bootloaders, and programmer definitions. To install, create the hardware
directory, then unzip the third-party platform into its own sub-directory. (Don't use "arduino" as
the sub-directory name or you'll override the built-in Arduino platform.) To uninstall, simply
delete its directory. For details on creating packages for third-party hardware, see the Arduino
IDE 1.5 3rd party Hardware specification.

3.6 SERIAL MONITOR


Displays serial data being sent from the Arduino or Genuino board (USB or serial board). To
send data to the board, enter text and click on the "send" button or press enter. Choose the baud
rate from the drop-down that matches the rate passed to Serial.begin in your sketch. Note that
on Windows, Mac or Linux, the Arduino or Genuino board will reset (rerun your sketch
execution to the beginning) when you connect with the serial monitor.
You can also talk to the board from Processing, Flash, MaxMSP, etc (see the interfacing page for
details).

3.7 PREFERENCES
Some preferences can be set in the preferences dialog (found under the Arduino menu on the
Mac, or File on Windows and Linux). The rest can be found in the preferences file, whose
location is shown in the preference dialog.
3.7.1 LANGUAGE SUPPORT

Fig 3.6: Language Support

69
Since version 1.0.1, the Arduino Software (IDE) has been translated into 30+ different languages.
By default, the IDE loads in the language selected by your operating system. (Note: on Windows
and possibly Linux, this is determined by the locale setting which controls currency and date
formats, not by the language the operating system is displayed in.)
If you would like to change the language manually, start the Arduino Software (IDE) and open
the Preferences window. Next to the Editor Language there is a dropdown menu of currently
supported languages. Select your preferred language from the menu, and restart the software to
use the selected language. If your operating system language is not supported, the Arduino
Software (IDE) will default to English.
You can return the software to its default setting of selecting its language based on your operating
system by selecting System Default from the Editor Language drop-down. This setting will take
effect when you restart the Arduino Software (IDE). Similarly, after changing your operating
system's settings, you must restart the Arduino Software (IDE) to update it to the new default
language.
3.8 BOARDS
The board selection has two effects: it sets the parameters (e.g. CPU speed and baud rate) used
when compiling and uploading sketches; and sets and the file and fuse settings used by the burn
bootloader command. Some of the board definitions differ only in the latter, so even if you've
been uploading successfully with a particular selection you'll want to check it before burning the
bootloader. You can find a comparison table between the various boards here.
Arduino Software (IDE) includes the built in support for the boards in the following list, all based
on the AVR Core. The Boards Manager included in the standard installation allows to addsupport
for the growing number of new boards based on different cores like Arduino Due, Arduino Zero,
Edison, Galileo and so on.
Conclusion
Chapter 3 describes the Hardware Modelling and setup of the project. The chapter
points the main features of the prototype, gives a layout of the project, lists the
components requires. It briefly describes the various setup processes involved with
the project, including hardware interfacing and software installation and setup
according to our requirement. It finally gives the hardware assembly involved.

70
CHAPTER 4
IMPLEMENTATION

The system process is made up of the NodeMCU microcontroller and the Channel Relay
board. The Relay board manages the relays using ULN 2803 IC. The Android device unit
conveys the desired signal through the internet with the microcontroller. The so-called
Control Unit hardware also includes the NodeMCU microcontroller and the Realy monitor.
Digital output pins of NodeMCU are attached to Relay board relay pins. Each Relay is
essentially linked to an appliance. The flow chart of implementations.
After designing the program induce, i.e. we need to set the What exactly does it
take to perform when the voice senses the power that we are only setting up? This is
determined by setting out the app’s ”Who.” We click on the ”What” button, then pick
webhooks, and then click the link. Webhooks allow us to send instructions to the Remote
Server. Now we type the remote server’s IP address in the URL followed by the
Authentication token given by the remote server and then the pin of the nodemcu to which
the computer is being controlled is connected. Then we pick ’PUT’ in the technique and
the content material form is JSON and we write ”1” to turn ON in the body and ”0” to
switch OFF. That creates the trigger action i.e. the voice order. The action it takes is to
quickly send a request to the remote server app in order to either turn the connected gadget
on or off. Finally, the microcontroller is programmed with the behavior that it needs to

71
perform until the remote server application transmits it. Before that, both the remote server
and the microcontroller can communicate and the conversation is conducted over the
internet, and because the microcontroller contains NodeMCU with the built-in Wi-Fi
module, it is designed to connect to the chosen network until it is plugged in. Hardware
implementation is shown in Fig. 4. The language ’C’ is used to program the microcontroller
and is built in the Arduino IDE.

Internet of Things (IoT) is an improvement of existing internet networking between


different types of devices and electronic appliances. Great access to high-speed internet
makes IoT easier. We can control and monitor electronic devices easily. This paper presents
a cost-efficient smart home applying diversification usage and an increased number of
multiple control systems. Compared to other existing schemes, our proposed system
reduces extra costs, making it more affordable. This smart system can handle unlimited
devices and can be operated from anywhere. The UI of our system is very userfriendly and
everybody can access it smoothly. The microcontroller used is MCU (ESP32) which in
case of implementation is cheaper than any other microcontroller on the market and
therefore more effective to other devices. The microcontroller and application
communications are developed via WiFi (Internet).

Conclusion

Chapter 4 is the Logic and operation of the project. A flow chart presents the actions describe
the working process of the prototype. It discussed the principle of operation of the system
with the advantages and disadvantages of the microcontroller unit.

72
CHAPTER 5
SIMULATION AND DESIGN
5.1 OUTPUT SCREEN SHOTS

Fig 5.1: Design

5.1 ADVANTAGES
1. You can manage all the home devices from one place at the same time.
Wireless home automation systems give you enormous amount of convenience and help
you to use modern technology for home management. All you have to do is to learn using
an app on your smart phone or tablet, and you’ll be able control myriad of functions and
devices in your home with a single click.
2. Your home security is maximized.
When you integrate security in your smart home network, your home security can be
significantly maximized. There are a number of devices which can help you in securing your
home. For instance, motion detectors, surveillance cameras, smart door locks, and many
others. Also, you can receive security alerts on your devices and supervise the activities in
your home from any location.

3. You can remotely control your home functions.


Being able to control your home functions from a distance is a boon. At times, when you are
stuck in traffic and late for dinner, you can get your oven started to preheat while you travel
your way home.
73
Also, you can even check to if you have turned the lights off, or who has arrived at your
front door.

4. Energy efficiency is increased.


Your smart wireless home automation technology can make your home more energy-
efficient. For instance, you can have more defined regulation on the heating and cooling
through the smart thermostat as it adapts to your schedule and temperature choice, and then
recommends the best suited energy efficient settings your home. Also, the smart lights and
shades can be controlled according to your time.

5.2 APPLICATIONS

➢ Manufacturing
➢ Energy Management
➢ Environmental Monitoring
➢ Office Automation and Smart Buildings
➢ Medical & Healthcare

5.3 FUTURE SCOPE

There is a major potential market for cost-efficient voicecontrolled and Software-controlled


home automation. There are several factors that can be improved to make voicecontrolled
and software-controlled home automation more effective, smarter, worldwide, and to make
home automation much better general. For example, make Artificial intelligencebased To
help make the system react faster, we can build our system more strong. Even the system
building can be improved to make it suitable for future marketing. Our next study would use
solar panels to power the control box and not batteries to make the planned energy-efficient
and environmentally friendly device.In reality, no system is the strongest. our system has
bugs and vulnerabilities. We will work on it. It still has new development opportunities. we
just need to put our self on a considered limit and try to make the operation even easier.

5.4 Conclusion
Chapter 5 is the conclusion and Future scope. This chapter includes the result of the project
work carried, the limitations it possesses, the further enhancements and modification that
can be integrated into the prototype and finally concludes the project work carried so far. It
consists of lists the References that have been used for the commencement of the project
work.

74
CHAPTER 6
CONCLUSION

It is evident from this project work that an individual control home automation system can be cheaply
made from low-cost locally available components and can be used to control multifarious home
appliances ranging from the security lamps, the television to the air conditioning system and even the
entire house lighting system. And better still, the components required are so small and few that they can
be packaged into a small inconspicuous container. The designed home automation system was tested a
number of times and certified to control different home appliances used in the lighting system, air
conditioning system, home entertainment system and many more . Hence, this system is scalable and
flexible.

75
REFERENCES
1. “Smart Energy Efficient Home Automation System using IOT”, by Satyendra K. Vishwakarma,
Prashant Upadhyaya, Babita Kumari, Arun Kumar Mishra.
2. “IOT Based Smart Security and Home Automation”, by Shardha Somani, Parikshit Solanke, Shaunak
Oke, Parth Medhi, Prof. P. P. Laturkar.
3. “A Dynamic Distributed Energy Management Algorithm of Home Sensor Network for Home
Automation System”, by Tui-Yi Yang, Chu-Sing Yang, Tien-Wen Sung; in 2016 Third International
Conference on Computing Measurement Control and Sensor Network.
4. “Enhance Smart Home Automation System based on Internet of Things”, by Tushar Churasia and
Prashant Kumar Jain; in Proceedings of the Third International Conference on I-SMAC (IoT in Social,
Mobile, Analytics and Cloud) (I-SMAC 2019) IEEE Xplore Part Number: CFP19OSVART; ISBN:978-
1-7281-4365-1
5. “Visual Machine Intelligence for Home Automation”, by Suraj, Ish Kool, Dharmendra Kumar, Shovan
Barman.
6. “A Low-Cost Home Automation System Using Wi-Fi based Wireless Sensor Network Incorporating
internet of Things”, by Vikram, Harish’s, Nihal’s. S, Raksha Umesh, Shetty Aashik Ashok Kumar; in
2017 IEEE 7th International Advance Computing Conference.
7. “Voice Controlled Home Automation System using Natural Language Processing and Internet of
Things”, by Mrs. Paul Jasmin Rani, Jason Bakthakumar, Praveen Kumar, Praveen Kumar, Santhosh
Kumar; in 2017 Third International Conference on Science Technology Engineering & Management
(ICONSTEM)
8. Wikipedia (2009). HomeAutomation. From https://en.wikipedia.org/wiki/Home_automation 9. Theory
of IOT from: https://internetofthingsagenda.techtarget.com/definition/Internet-of-Things-IoT 10. About
Node MCU from: https://lastminuteengineers.com/esp8266-nodemcu-arduino-tutorial.

76

You might also like