0% found this document useful (0 votes)
2 views

Xerox Project

The project report discusses the development of an IoT-based wireless sensor network for monitoring air pollution, aimed at addressing the increasing pollution levels due to industrialization and urbanization. The system utilizes MQ135 and MQ6 sensors to detect harmful gases and displays air quality data on an LCD and a web server, triggering alarms when pollution exceeds safe levels. The report includes design, implementation details, and acknowledges the guidance of faculty members at Santhiram Engineering College, Nandyal.

Uploaded by

dudekulaidrush2
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)
2 views

Xerox Project

The project report discusses the development of an IoT-based wireless sensor network for monitoring air pollution, aimed at addressing the increasing pollution levels due to industrialization and urbanization. The system utilizes MQ135 and MQ6 sensors to detect harmful gases and displays air quality data on an LCD and a web server, triggering alarms when pollution exceeds safe levels. The report includes design, implementation details, and acknowledges the guidance of faculty members at Santhiram Engineering College, Nandyal.

Uploaded by

dudekulaidrush2
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/ 62

A PROJECT REPORT

ON
IoT BASED WIRELESS SENSOR NETWORK FOR AIR
POLLUTION MONITORING
Submitted in partial fulfilment of the requirement for the award
of the degree of

Bachelor of Technology
In
Electronics And Communication Engineering
Submitted by
C. VENKATA SUBBAIAH 19X51A0409
D. FAYAZ 19X51A0411
P. LOKESH 19X51A0444
P. MANOJ KUMAR 19X51A0443

Under the Esteemed Guidance of

Mr. N. SREENIVASA RAO, M. Tech.


Assistant Professor, SREC, Nandyal.
Department of ECE

(ESTD-2007)

SANTHIRAM ENGINEERING COLLEGE::NANDYAL


(Approved by AICTE, New Delhi: Permanently Affiliated to J.N.T. University,Anantapuramu,A.P.)
Accredited by NAAC (Grade-A), An ISO 9001:2015 Certified Institution,
2(f) and 12(b) recognition by UGC Act, 1956.

YEAR: 2019-2023
SANTHIRAM ENGINEERING COLLEGE::NANDYAL
(Approved by AICTE, New Delhi: Permanently Affiliated to J.N.T. University,Anantapuramu,A.P.)
Accredited by NAAC (Grade-A), An ISO 9001:2015 Certified Institution,
2(f) and 12(b) recognition by UGC Act, 1956

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

CERTIFICATE

This is to certify that the dissertation entitled “IoT BASED WIRELESS SENSOR NETWORK FOR
AIR POLLUTION MONITORING” that is being submitted by C.VENKATA SUBBAIAH
(19X51A0409), D.FAYAZ (19X51A0411), P.LOKESH (19X51A0444), P.MANOJ KUMAR
(19X51A0443) Under the Esteemed Guidance of Mr. N. SREENIVASA RAO, M. Tech. Assistant
Professor Dept. of ECE for Project in fulfilment of the award the of Bachelor of Technology Degree
in ELECTRONICS AND COMMUNICATION ENGINEERING in SANTHIRAM
ENGINEERING COLLEGE, Nandyal (Permanently to J.N.T. University, Anantapuramu) is a
record of bonafide work carried out by them under guidance and supervision. The results embodied in
this project have not been submitted to any other university for the award of any Degree.

Signature of the Head of the Department: Signature of the Project Guide:


Dr. Y. MALLIKARJUNA RAO , M.Tech ,Ph.D. Mr. N. SREENIVASA RAO, M.Tech.
Professor & HOD, Assistant Professor,
DEPT of ECE, DEPT of ECE,
SREC, Nandyal. SREC, Nandyal.

Signature of the External Examiner:


Date of Examination:
ACKNOWLEDGEMENT

This will certainly not be complete without acknowledgments paid to all those who have
helped us in doing our project work.

We manifest our heartier thankfulness pertaining to our contentment over Mr. N.


Sreenivasa Rao , as a project guide with whose adroit concomitance the excellence has
beenexemplified in bringing out this project work with artistry.

It is a great pleasure to acknowledge our profound sense of gratitude to our Head of


Department Dr. Y. Mallikarjuna Rao garu, and Coordinator Ms. V. Nagamani , for
her valuable and inspiring guidance, comments and suggestions, and encouragement
towards the course of this project.

Involuntarily, we are precious to divulge our sincere gratefulness to our principal,

Dr. M. V. Subramanyam garu, who has been observed posing valance in abundance
and forwards our individuality to acknowledge our project work tendentiously.

At the outset, we thank our Honorable chairman Dr. M. Santhiramudu garu,


correspondent, of Santhiram Engineering College for providing us with good facilities
and his moral support throughout the course.

We also express the overall exhilaration and gratitude to all the Teaching and Non-
Teaching staff of the ECE Dept., who admitted our project work and accentuated our
attitude.

We also extend our heartfelt and sincere gratitude to our beloved parents for their
tremendous motivation and moral support.

C.VENKATA SUBBAIAH (19X51A0409)


D.FAYAZ (19X51A0411)
P. LOKESH (19X51A0411)
P. MANOJ KUMAR (19X51A0443)
CONTENTS

PAGENO
ABSTRACT
CHAPTER-1
INTRODUCTION
1.1 Introduction 1

1.2 Literature survey 1


1.3 Design And Implementation of An Economic 2
Gas Leakage Detector
1.4 Electronic design of liquefied petroleum gas leakage monitoring alarm, 2
and protection system based on discrete components
1.5 Design and Development of Gas Leakage Monitoring System using 3
Arduino and ZigBee

CHAPTER- 2
PROPOSED SYSTEM
2.1 Proposed System 4

2.2 Block Diagram 4

2.3 Applications 5

2.4 Advantages 5
CHAPTER-3
EMBEDDED SYSTEMS

3.1 Introduction to Embedded systems 6

3.2 Definition of Embedded Systems 7

3.3 Example of An Embedded Systems 7

3.4 History of An Embedded Systems 8

3.5 Features of an Embedded systems 9

3.6 Characteristics of An Embedded System 9

3.7 Overview of An Embedded System Architecture 10

3.8 Debugging of An Embedded Systems 13


CHAPTER-4

Hardware CONSTRAINTS

4.1 NodeMCU 14

4.2 Power Supply 26

4.3 Transformer 28

4.4 Classification of Transformer 29

4.5 Application of Transformer 30

4.6 Rectifier circuit 31

4.7 Working of Bridge Rectifier 33

4.8 Filter Circuit 33

4.9 Capacitor Filter 34

CHAPTER -5

SOFTWARE CONSTRAINTS

5.1 Introduction to Arduino IDE 37

5.2 Key Features of Arduino IDE 37

5.3 Arduino Data Types 37

5.4 Steps to Upload the Program in Arduino Board 39

5.5 Arduino Programming Structure 46

CHAPTER-6
RESULT AND ANALYSIS 48

CONCLUSION 49

REFERENCES 50

ANNEXURE

PUBLICATION CERTIFICATE

CERTIFICATES
IoT Based Wireless Sensor Network for Air Pollution Monitoring

ABSTRACT:

The level of pollution is increasing rapidly due to factors like industries, urbanization,
increasing in population, vehicle use which can affect human health. IOT Based Air Pollution
Monitoring System is used to monitor the Air Quality over a web server using Internet. It will
trigger an alarm when the air quality goes down beyond a certain level, means when there are
sufficient amount of harmful gases present in the air like CO2, smoke, alcohol, benzene, NH3
and NOx. It will show the air quality in PPM on the LCD and as well as on webpage so that air
pollution can be monitored very easily.
The system uses MQ135 and MQ6 sensor for monitoring Air Quality as it detects most harmful
gases and can measure their amount accurately.
LIST OF FIGURES

FIG.NO NAME OF THE FIGURES PAGE NO

2.2 Block Diagram of IoT Based Wireless Sensor Network For Air Pollution 4
Monitoring
3.1 Embedded System Architecture 10

3.2 Block diagram of Embedded systems 11

4.1 1ESP-12E chip 14

4.2 ESP8266 Node MCU Parts 15

4.3 ESP8266’S Pin Multiplexing Feature 17

4.4 Switches and indicators 18

4.5 Serial Communication 19

4.6 ESP8266 Node MCU Point 19

4.7 ESP8266 LED Blinking 27

4.8 Block Diagram of Regulated Power Supply 28

4.9 Circuit Diagram of Regulated Power Supply 28

4.10 Working Principle of Transformer 29

4.11 Step Down Transformer 31

4.12 Step Up Transformer 31

4.13 Half Wave Rectifier 32

4.14 Centre Tapped Full wave Rectifier 33

4.15 Full Wave Bridge Rectifier 34

4.16 Output Wave Forms of Full Wave Bridge Rectifier 35

4.17 Capacitor Filter 36

4.18 12v Voltage Regulator 37

4.19 Air Quality Sensor 37

5.1 USB Cable 41

6.1 Result of This Project 49


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

CHAPTER-1
INTRODUCTION
1.1 Introduction:
Air pollution is the biggest problem of every nation, whether it is developed or developing.
Health problems have been growing at faster rate especially in urban areas of developing countries
where industrialization and growing number of vehicles leads to release of lot of gaseous
pollutants. Harmful effects of pollution include mild allergic reactions such as irritation of the
throat, eyes and nose as well as some serious problems like bronchitis, heart diseases, pneumonia,
lung and aggravated asthma. According to a survey, due to air pollution 50,000 to 100,000
premature deaths per year occur in the U.S. alone. Whereas in EU number reaches to 300,000 and
over 3,000,000 worldwide. IOT Based Air Pollution Monitoring System monitors the Air quality
over a web server using Internet and will trigger an alarm when the air quality goes down beyond
a certain threshold level, means when there are sufficient number of harmful gases present in the
air like CO2, smoke, alcohol, benzene, NH3, LPG and NOx. It will show the air quality in PPM
on the LCD and as well as on webpage so that it can monitor it very easily. LPG sensor is added
in this system which is used mostly in houses. The system will show temperature and humidity.
The system can be installed anywhere but mostly in industries and houses where gases are mostly
to be found and gives an alert message when the system crosses threshold limit.

1.2 Literature survey:

The explanation of the Air Quality Index (AQI) and its standard ranges are described in [1].
From 0-100 ppm the atmosphere is safe for living. If the ppm level increases above 100 then it
moves out of the safety zone. If the ppm value rises above 200 then it becomes extremely
dangerous for human life. The DHT11 sensor module is used to measure the temperature and the
humidity of the surroundings [2]. The MQ-135 gas sensor is used to measure the air quality of the
surroundings [3]. It can be calibrated with respect to fresh air, alcohol, carbon dioxide, hydrogen
and methane. In this project, it has been calibrated with respect to fresh air [9], [10]. In [4] the
controlling action of Node MCU has been described. This research has shown the uses of C++ as
the programming language for scripting the software code. It has an inbuilt Wi-Fi module which

Dept. of. E.C.E. SREC. Page 1


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

allows the project to implement IoT easily. Arduino IDE is used to implement the coding part of
the project [5], [8]. Thing Speak cloud is used for the cloud service. It has a free version which
requires a delay of 15 seconds to upload an entry in the cloud [6], [7]. As this project uses two
sensors, both of them have internal heater elements and withdraw more power(P=V*I), so though
both sensors are turned ON, their output voltage levels vary and show unpredictable values due to
insufficient power drive. So, we used a separate power supply for the sensors as Node MCU alone
is not sufficient to drive two sensors [9].

1.3 Design And Implementation Of An Economic Gas Leakage Detector:


Gas leakage is a major concern with residential, commercial premises and gas-powered
transportation vehicles. One of the preventive measures to avoid the danger associated with gas
leakage is to install a gas leakage detector at vulnerable locations. The objective of this work is to
present the design of a cost-effective automatic alarming system, which can detect liquefied
petroleum gas leakage in various premises. In particular, the alarming system designed has a high
sensitivity for primarily butane, which is also individually sold bottled as a fuel for cooking and
camping. The proposed system is designed to meet UK occupational health and safety standards.
Test results are demonstrated for an USB powered gas leakage detection system and it gives early
warning signals under less severe conditions and activates a high-pitched alarm in case of
emergency situations to safeguard the users.

1.4 Electronic design of liquefied petroleum gas leakage monitoring alarm, and
protection system based on discrete components:
Liquefied petroleum gas (LPG) is an important source of energy commonly used for domestic
purposes like cooking and heating in developing countries and for many commercial, industrial,
and agriculture purposes. LPG gas represents as an asphyxiant gas and because it is flammable, it
is very important for health and safety requirements monitor continuously the gas leakage and
doing the necessary actions at the cases of gas leakage. Many studies present a high-performance
gas leakage monitoring and protection systems through either microcontroller units or
computerized systems with wireless data communication technology. The high cost and the
complexity of these systems that are the main demerits. This paper presents an alternative
engineering solution of a simple system through a full electronic analog design based on discrete

Dept. of. E.C.E. SREC. Page 2


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

components. The proposed electronic system works on continuous detecting LPG gas leakage level
though suitable gas detector, then based on the electronic design, a suitable actions of gas valve
control signal and sound alarm signal will be produced at happing state of the gas leakage. Both
Electronic design and simulation results of discrete components based are done by using National
Instruments NI Multsim software for electronic circuits design. The simulation results reflect the
effectiveness of the presented design and give indication of promising prototype of monitoring and
protection system of LPG gas leakage for home and/or industrial applications.

1.5 Design and Development of Gas Leakage Monitoring System using Arduino
and ZigBee:
Gas leakage in industrial area causes many health issues. Thus, to prevent such disasters
happen, the atmosphere of a workplace should be regularly monitored and controlled, in order to
maintain the clean air environment. However, efforts in industrial air quality control have been
impeded by the lack of science-based approaches to identify and assess atmosphere air quality
and level of dangerous gas. Therefore, a monitoring system for gas leakage detection needs to be
developed. For the development of this system, the combustible gas sensor (MQ9) was used in
order to detect the present of methane (CH4) and carbon monoxide gas (CO).

This sensor will detect the concentration of the gas according to the voltage output of sensor
and operated in the alarm system, autonomous control system and monitoring system by using
Arduino uno as the microcontroller for the whole system. Whereas the Zigbee will send the data
reading from the gas sensor to monitoring system that display on LabVIEW Graphical User
Interface (GUI). Besides, user can take immediate action upon the leakage occurs, else the gas
supply and the system will shut down automatically within 10 minutes to prevent the condition
becoming worst.

Dept. of. E.C.E. SREC. Page 3


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

CHAPTER -2
PROPOSED SYSTEM

2.1 Proposed system:


Air is getting polluted because of the release of toxic gases by industries, vehicle emissions and
increased concentration of harmful gases and particulate matter in the atmosphere. The level of
pollution is increasing rapidly due to factors like industries, urbanization, increase in population,
vehicle use which can affect human health. Particulate matter is one of the most important
parameters having a significant contribution to the increase in air pollution. This creates a need for
measurement and analysis of real-time air quality monitoring so that appropriate decisions can be
taken in a timely period. This paper presents real-time standalone air quality monitoring. Internet
of Things (IoT)is nowadays finding profound use in each and every sector, plays a key role in our
air quality monitoring system too. The setup will show the air quality in PPM on the webpage so
that we can monitor it very easily. In this IoT project, we can monitor the pollution level from
anywhere using your computer or mobile.

2.2 Block Diagram:

Fig 2.1Block diagram of proposed system

Dept. of. E.C.E. SREC. Page 4


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

2.3 Applications:

• IOT and Arduino based LPG leakage detection system can be installed in Homes, Hotels,
LPG Cylinder storage areas. The main advantage of this project is that it can determine the
leakage and send the data over to a website, where it can be monitored and corrective
actions can be taken.
• If appropriate measures are taken quickly after it is reported over the IOT, it can help in
saving the loss of lives and property.
• Industrial perimeter monitoring
• Indoor air quality monitoring.
• Site selection for reference monitoring stations.
• Making data available to users.

2.4 Advantages:

• Easy to Install
• Updates On mobile phone directly
• Accurate Pollution monitoring
• Remote location monitoring

Dept. of. E.C.E. SREC. Page 5


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

CHAPTER-3
EMBEDDED SYSTEMS

3.1 Introduction to Embedded systems:

Each day, our lives become more dependent on 'embedded systems', digital information
technology that is embedded in our environment. More than 98% of processors applied today
are in embedded systems, and are no longer visible to the customer as 'computers' in the
ordinary sense. An Embedded System is a special-purpose system in which the computer is
completely encapsulated by or dedicated to the device or system it controls. Unlike a general-
purpose computer, such as a personal computer, an embedded system performs one or a few
pre-defined tasks, usually with very specific requirements. Since the system is dedicated to
specific tasks, design engineers can optimize it, reducing the size and cost of the product.
Embedded systems are often mass- produced, benefiting from economies of scale.
The increasing use of PC hardware is one of the most important developments in high-end
embedded systems in recent years. Hardware costs of high-end systems have dropped
dramatically as a result of this trend, making feasible some projects which previously would
not have been done because of the high cost of non-PC-based embedded hardware. But
software choices for the embedded PC platform are not nearly as attractive as the hardware.
Typically, an embedded system is housed on a single microprocessor board with the
programs stored in ROM. Virtually all appliances that have a digital interface -- watches,
microwaves, VCRs, cars -- utilize embedded systems. Some embedded systems include an
operating system, but many are so specialized that the entire logic can be implemented as a
single program. Physically, Embedded Systems range from portable devices such as digital
watches and MP3 players, to large stationary installations like traffic lights, factory
controllers, or the systems controlling nuclear power plants. The applications software on such
processors is sometimes referred to as firmware. The simplest devices consist of a single
microprocessor (often called a "chip”), which may itself be packaged with other chips in a
hybrid system or Application Specific Integrated Circuit (ASIC). Its input comes from a
detector or sensor and its output goes to a switch or activator which (for example) may start
or stop the operation of a machine or, by operating a valve, may control the flow of fuel to an
Dept. of. E.C.E. SREC. Page 6
IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

engine. As the embedded system is the combination of both software and hardware.
3.2 Definition of An Embedded System:
Embedded system is defined as, for a particular/specific application implementing the
software code to interact directly with that particular hardware what we built. Software is used for
providing features and flexibility.
Hardware = {Processors, ASICs, Memory...} is used for Performance (& sometimes
security).There are many definitions of embedded system but all of these can be combined into a
single concept. An embedded system is a special purpose computer system that is used for
particular task.
3.3 Example of An Embedded Systems:
Embedded systems are found in wide range of application areas. Originally they were used only
for expensive industrial control applications, but as technology brought down the cost of dedicated
processors, they began to appear in moderately expensive applications such as automobiles,
communication and office equipment and television Today's embedded systems are so inexpensive
that they are used in almost every electronic product in our life. Embedded systems are often
designed for mass production.

1. Automatic Teller Machines

2. Cellular telephone and telephone switches

3. Computer network equipment

4. Computer printers

5. Disk drives

6. Home automation products

7. Handheld calculators

8. Household appliances

9. Medical equipment

10. Measurement equipment

Dept. of. E.C.E. SREC. Page 7


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

11. Multifunction wrist watches

12. Multifunction printers

3.4 History of An Embedded Systems:

The first recognizably modern embedded systems were the Apollo Guidance Computer,
developed by “Charles Stark Draper” at the MIT Instrumentation Laboratory. At the project
inception, the Apollo guidance computer was considered the riskiest item in the Apollo project
as it employed the then newly developed monolithic integrated circuits to reduce the size and
weight. An early mass-produced embedded system was the Autonoetic D-17 guidance computer
for the Minuteman missile, released in 1961.It was built from transistor logic and had a hard disk
for main memory. When the Minuteman II went into production in 1966, the D-17 was replaced
with a new computer that was the first high volume use of integrated circuits. This program alone
reduced prices on quad and gate ICs from $1000/ each to $3/ each permitting their use in
commercial products.

Since these early applications in the 1960s, embedded systems have come down in price and
there has been a dramatic rise in processing power and functionality. The first microprocessor
for example, the Intel 4004, was designed for calculators and other small systems but still
required many external memory and support chips. In 1978 National Engineering Manufactures
Association released a “standard” for programmable microcontrollers, including almost any
computer-based controllers, such as single board computers, numerical and event-based
controllers. Embedded Systems are designed to some specific task rather than be a general-
purpose computer for multitasks. Some also have real-time performances constraints that must
be met, for reasons such as safety and usability; others may have low or no performance
requirement, allowing the system hardware to be simplified to reduce cost.
3.5 Features of An Embedded System:
The versatility of the embedded computer system lends itself to utility in all kinds of enterprises,
from the simplification of deliverable products to a reduction in costs in their development and
manufacture. Complex systems with rich functionality employ special Operating systems that
consider major characteristics of embedded systems. Embedded operating systems have
Dept. of. E.C.E. SREC. Page 8
IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

minimized footprint and may follow real-time operating system specifics.


The special computers system is usually less powerful than general-purpose systems, although
some expectations do exist where embedded systems are very powerful and complicated. Usually,
a low power consumption CPU with a limited amount of memory is used in embedded systems.
Many embedded systems use very small operating systems; most of these provide very limited
operating system capabilities.
Since the embedded system is dedicated to specific tasks, design engineers can optimize it,
reducing the size and cost of the product, or increasing the reliability and performance. Some
embedded systems are mass-produced, benefiting from economies of scale. Some embedded
systems have to operate in extreme environment conditions such as very high temperature &
humidity. For high volume systems such as portable music players or mobile phones, minimizing.
cost is usually the primary design consideration. Engineers typically select hardware that is
just “good enough” to implement the necessary functions. For low volume or prototype embedded
systems, general purpose computers may be adapted by limiting the programs or by replacing the
operating system with a real-time operating system.
3.6 Characteristics of An Embedded System:
Embedded computing systems generally exhibit rich functionality; complex functionality is
usually the reason for introducing CPUs into the design. However, they also exhibit many non-
functional requirements that make the task especially challenging:
• Real-time deadlines that will cause system failure if not met
• Multi-rate operation

• In many cases, low power consumption


• Low manufacturing cost, which often means limited code size
Workstation programmers often concentrate on functionality. They may consider the
performance characteristics of a few computational kernels of their software, but rarely
analyze the total application. They almost never consider power consumption and
manufacturing cost. The need to juggle all these requirements makes embedded system
programming very challenging and is the reason why embedded system designers need to
understand computer architecture.

Dept. of. E.C.E. SREC. Page 9


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

3.7 Overview of An 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 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.

Fig 3.1 Embedded System Architecture

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.

Dept. of. E.C.E. SREC. Page 10


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Fig 3.2 Block diagram of Embedded systems

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 interface

• Application-specific circuitry

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

Dept. of. E.C.E. SREC. Page 11


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

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.
Memory:
The memory is categorized as Random Access 11emory (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.
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.
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.
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.
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

Dept. of. E.C.E. SREC. Page 12


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

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.
3.8 Debugging of An Embedded Systems:
Embedded debugging may be performed at different levels, depending on the facilities
available. From simplest to most sophisticate, they can be roughly grouped into the following
areas:

• Interactive resident debugging using the simple shell provided by the embedded
operating system (e.g., Forth and Basic)
• External debugging using logging or serial port output to trace operating using
either a monitor in flash or using a debug server like the Remedy Debugger which
even works for heterogeneous multi core systems.
• An in-circuit debugger (ICD), a hardware device that connects to the
microprocessor via a JTAG or NEXUS interface. This allows the operation of the
microprocessor to be controlled externally, but is typically restricted to specific
debugging capabilities in the processor.

Dept. of. E.C.E. SREC. Page 13


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

CHAPTER-4
HARDWARE CONSTRAINTS

4.1 Node MCU:

The Internet of Things (IoT) has been a trending field in the world of technology. It has
changed the way we work. Physical objects and the digital world are connected now more than
ever. Keeping this in mind, Expressive (A Shanghai-based Semiconductor Company) has released
an adorable, bite-sized Wi-Fi enabled microcontroller – ESP8266, at an unbelievable price! For
less than $3, it can monitor and control things from anywhere in the world – perfect for just about
any IoT project.

The development board equips the ESP-12E module containing ESP8266 chip having Ten
silica xtensa® 32-bit LX106 RISC microprocessor which operates at 80 to 160 MHz adjustable
clock frequency and supports RTOS.

ESP-12E Chip

• Tensilica Xtensa® 32-bit LX106


• 80 to 160 MHz Clock Freq.
• 128kB internal RAM
• 4MB external flash

Dept. of. E.C.E. SREC. Page 14


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

• 802.11b/g/n Wi-Fi transceiver

Figure 4.1ESP-12E chip

There’s also 128 KB RAM and 4MB of Flash memory (for program and data storage) just
enough to cope with the large strings that make up web pages, JSON/XML data, and everything
we throw at IoT devices nowadays.

The ESP8266 Integrates 802.11b/g/n HT40 Wi-Fi transceiver, so it can not only connect to a
Wi-Fi network and interact with the Internet, but it can also set up a network of its own, allowing
other devices to connect directly to it. This makes the ESP8266 Node MCU even more versatile.

• Power Requirement

As the operating voltage range of ESP8266 is 3V to 3.6V, the board comes with a LDO voltage
regulator to keep the voltage steady at 3.3V. It can reliably supply up to 600mA, which should be
more than enough when ESP8266 pulls as much as 80mA during RF transmissions. The output
of the regulator is also broken out to one of the sides of the board and labeled as 3V3. This pin can
be used to supply power to external components.

Power Requirement

• Operating Voltage: 2.5V to 3.6V

Dept. of. E.C.E. SREC. Page 15


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

• On-board 3.3V 600mA regulator


• 80mA Operating Current
• 20 µA during Sleep Mode

Figure 4.2 ESP8266 Node MCU parts

Power to the ESP8266 Node MCU is supplied via the on-board MicroB USB connector.
Alternatively, if you have a regulated 5V voltage source, the VIN pin can be used to directly
supply the ESP8266 and its peripherals.

Warning:

The ESP8266 requires a 3.3V power supply and 3.3V logic levels for communication. The
GPIO pins are not 5V-tolerant! If you want to interface the board with 5V (or higher) components,
you’ll need to do some level shifting.

• Peripherals and I/O

The ESP8266 Node MCU has total 17 GPIO pins broken out to the pin headers on both sides of
the development board. These pins can be assigned to all sorts of peripheral duties, including:

Dept. of. E.C.E. SREC. Page 16


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

• ADC channel – A 10-bit ADC channel.

• UART interface – UART interface is used to load code serially.

• PWM outputs – PWM pins for dimming LEDs or controlling motors.

• SPI, I2C & I2S interface – SPI and I2C interface to hook up all sorts of sensors and peripherals.

• I2S interface – I2S interface if you want to add sound to your project.

Multiplexed I/Os
• 1 ADC channels
• 2 UART interfaces
• 4 PWM outputs
• SPI, I2C & I2S interface

Figure 4.3 ESP8266’s pin multiplexing feature

Thanks to the ESP8266’s pin multiplexing feature (Multiple peripherals multiplexed on a single
GPIO pin). Meaning a single GPIO pin can act as PWM/UART/SPI.

• On-board Switches & LED Indicator

Dept. of. E.C.E. SREC. Page 17


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

The ESP8266 Node MCU features two buttons. One marked as RST located on the
top left corner is the Reset button, used of course to reset the ESP8266 chip. The
other FLASH button on the bottom left corner is the download button used while
upgrading firmware.

Switches & Indicators

• RST – Reset the ESP8266 chip


• FLASH – Download new programs
• Blue LED – User Programmable

Figure 4.4 Switches and indicators

The board also has a LED indicator which is user programmable and is connected to the D0 pin
of the board.

• Serial Communication

The board includes CP2102 USB-to-UART Bridge Controller from Silicon Labs, which
converts USB signal to serial and allows your computer to program and communicate with the
ESP8266 chip.

Dept. of. E.C.E. SREC. Page 18


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Serial Communication

• CP2102 USB-to-UART converter


• 4.5 Mbps communication speed
• Flow Control support

Figure 4.5 serial communication

• ESP8266 Node MCU Pinout

The ESP8266 Node MCU has total 30 pins that interface it to the outside world. The
connections are as follows:

Dept. of. E.C.E. SREC. Page 19


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Figure 4.6 ESP8266 Node MCU Pinou

Power Pins There are four power pins viz. one VIN pin & three 3.3V pins. The VIN pin can be
used to directly supply the ESP8266 and its peripherals, if you have a regulated 5V voltage source.
The 3.3V pins are the output of an on-board voltage regulator. These pins can be used to supply
power to external components.

GND is a ground pin of ESP8266 Node MCU development board.

I2C Pins are used to hook up all sorts of I2C sensors and peripherals in your project. Both I2C
Master and I2C Slave are supported. I2C interface functionality can be realized programmatically,
and the clock frequency is 100 kHz at a maximum. It should be noted that I2C clock frequency
should be higher than the slowest clock frequency of the slave device.

GPIO Pins ESP8266 Node MCU has 17 GPIO pins which can be assigned to various functions
such as I2C, I2S, UART, PWM, IR Remote Control, LED Light and Button programmatically.
Each digital enabled GPIO can be configured to internal pull-up or pull-down, or set to high
impedance. When configured as an input, it can also be set to edge-trigger or level-trigger to
generate CPU interrupts.
ADC Channel the Node MCU is embedded with a 10-bit precision SAR ADC. The two
functions can be implemented using ADC viz. Testing power supply voltage of VDD3P3 pin and
testing input voltage of TOUT pin. However, they cannot be implemented at the same time.
UART Pins ESP8266 Node MCU has 2 UART interfaces, i.e., UART0 and UART1, which
provide asynchronous communication (RS232 and RS485), and can communicate at up to 4.5
Mbps. UART0 (TXD0, RXD0, RST0 & CTS0 pins) can be used for communication. It supports
fluid control. However, UART1 (TXD1 pin) features only data transmit signal so, it is usually used
for printing log.
SPI Pins ESP8266 features two SPIs (SPI and HSPI) in slave and master modes. These SPIs also
support the following general-purpose SPI features:

• 4 timing modes of the SPI format transfer

• Up to 80 MHz and the divided clocks of 80 MHz

Dept. of. E.C.E. SREC. Page 20


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

• Up to 64-Byte FIFO

SDIO Pins ESP8266 features Secure Digital Input/Output Interface (SDIO) which is used to
directly interface SD cards. 4-bit 25 MHz SDIO v1.1 and 4-bit 50 MHz SDIO v2.0 are supported.
PWM Pins The board has 4 channels of Pulse Width Modulation (PWM). The PWM output can
be implemented programmatically and used for driving digital motors and LEDs. PWM frequency
range is adjustable from 1000 μs to 10000 μs, i.e., between 100 Hz and 1 kHz.
Control Pins are used to control ESP8266. These pins include Chip Enable pin (EN), Reset pin (RST) and
WAKE pin.

• EN pin – The ESP8266 chip is enabled when EN pin is pulled HIGH. When pulled LOW the chip
works at minimum power.

• RST pin – RST pin is used to reset the ESP8266 chip.

• WAKE pin – Wake pin is used to wake the chip from deep-sleep.

ESP8266 Development Platforms

Now, let’s move on to the interesting stuff!

There are a variety of development platforms that can be equipped to program the ESP8266. You
can go with Esperion – JavaScript SDK and firmware closely emulating Node.js, or use Mongoose
OS – An operating system for IoT devices (recommended platform by Expressive Systems and
Google Cloud IoT) or use a software development kit (SDK) provided by Expressive or one of the
platforms listed on wikipedia.

Fortunately, the amazing ESP8266 community took the IDE selection a step further by creating
an Arduino add-on. If you’re just getting started programming the ESP8266, this is the
environment we recommend beginning with, and the one we’ll document in this tutorial.

This ESP8266 add-on for Arduino is based on the amazing work by Ivan Grok hotkey and the
rest of the ESP8266 community. Check out the ESP8266 Arduino GitHub repository for more
information.

Dept. of. E.C.E. SREC. Page 21


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Installing the ESP8266 Core on Windows OS.

Let’s proceed with installing ESP8266 Arduino core.

The first thing is having latest Arduino IDE (Arduino 1.6.4 or higher) installed on your PC. If
don’t have it, we recommend upgrading now.

To begin, we’ll need to update the board manager with a custom URL. Open up Arduino IDE
and go to File > Preferences. Then, copy below URL into the Additional Board Manager
URLs text box situated on the bottom of the window:

http://arduino.esp8266.com/stable/package_esp8266com_index.json

Dept. of. E.C.E. SREC. Page 22


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Hit OK. Then navigate to the Board Manager by going to Tools > Boards > Boards Manager.
There should be a couple new entries in addition to the standard Arduino boards. Filter your search
by typing esp8266. Click on that entry and select Install.

The board definitions and tools for the ESP8266 include a whole new set of gcc, g++, and other
reasonably large, compiled binaries, so it may take a few minutes to download and install (the
archived file is ~110MB). Once the installation has completed, a small INSTALLED text will
appear next to the entry. You can now close the Board Manager.

Arduino Example: Blink

To make sure ESP8266 Arduino core and the Node MCU are properly set up, we’ll upload the
simplest sketch of all – The Blink!

We will use the on-board LED for this test. As mentioned earlier in this tutorial, D0 pin of the
board is connected to on-board Blue LED & is user programmable.

Before we get to uploading sketch & playing with LED, we need to make sure that the board is
selected properly in Arduino IDE. Open Arduino IDE and select Node MCU 0.9 (ESP-12
Module) option under your Arduino IDE > Tools > Board menu.

Dept. of. E.C.E. SREC. Page 23


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Now, plug your ESP8266 Node MCU into your computer via micro-B USB cable. Once the
board is plugged in, it should be assigned a unique COM port. On Windows machines, this will be
something like COM#, and on Mac/Linux computers it will come in the form of /dev/ tty ,usb
serial-XXXXXX. Select this serial port under the Arduino IDE > Tools > Port menu. Also select
the Upload Speed: 115200

Dept. of. E.C.E. SREC. Page 24


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Warning:

More attention needs to be given to selecting board, choosing COM port and selecting Upload
speed. You may get espcomm_upload_mem error while uploading new sketches, if failed to do
so.

Once you are done, try the example sketch below.

void setup ()
{
pinMode(D0, OUTPUT);
}
void loop ()
{
digitalWrite(D0, HIGH);

Dept. of. E.C.E. SREC. Page 25


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

delay (500);
digital Write (D0, LOW);
delay (500);
}

Once the code is uploaded, LED will start blinking. You may need to tap the RST button to get
your ESP8266 to begin running the sketch.

Figure 4.7 ESP8266 LED blinking


4.2 Power Supply:
• Regulated power supply:
The DC power supply is practically converted to each and every stage in an electronic
system. Thus, a common requirement for all these phases will be the DC power supply. All
low power system can be run with a battery. But, for a long time operating devices, batteries
could prove to be costly and complicated. The best method used is in the form of an unregulated
power supply –a combination of a transformer, rectifier and a filter. The diagram is shown
below.
All devices will have a certain power supply limit and the electronic circuits inside these
devices must be able to supply a constant DC voltage within this limit. This DC supply is
regulated and limited in terms of voltage and current. But the supply provided from mains may
be fluctuating and could easily break down the electronic equipment, if not properly limited.
This work of converting an unregulated alternating current (AC) or voltage to a limited Direct

Dept. of. E.C.E. SREC. Page 26


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

current (DC) or voltage to make the output constant regardless of the fluctuations in input, is
done by a regulated power supply circuit.

Fig 4.8 Block diagram of Regulated power supply


All the active and passive electronic devices will have a certain DC operating point
(Q-point or Quiescent point), and this point must be achieved by the source of DC power.
A step-down transformer is used to reduce the voltage level to the devices needs. In India,
a 1 Ø supply is available at 230 volts. The output of the transformer is a pulsating sinusoidal
AC voltage, which is converted to pulsating DC with the help of a rectifier.This output is
given to a filter circuit which reduces the AC ripples, and passes the DC components. But
here are certain disadvantages in using an unregulated power supply.
Regulated power supply is an electronic circuit that is designed to provide a
constant dc voltage of predetermined value across load terminals irrespective of ac mains
fluctuations or load variations. A regulated power supply essentially consists of an ordinary
power supply and a voltage regulating device, as illustrated in the figure. The output from
an ordinary power supply is fed to the voltage regulating device that provides the final
output. The output voltage remains constant irrespective of variations in the ac input voltage
or variations in output (or load) current.

Fig 4.9 Circuit diagram of Regulated power supply

Dept. of. E.C.E. SREC. Page 27


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

4.3 Transformer:
A transformer can be defined as a static device which helps in the transformation of electric
power in one circuit to electric power of the same frequency in another circuit. The voltage can be
raised or lowered in a circuit, but with a proportional increase or decrease in the current ratings.
Transformer Working Principle:
The main principle of operation of a transformer is mutual inductance between two circuits
which is linked by a common magnetic flux. A basic transformer consists of two coils that are
electrically separate and inductive, but are magnetically linked through a path of reluctance. The
working principle of the transformer can be understood from the figure below.
As shown below the electrical transformer has primary and secondary windings. The core
laminations are joined in the form of strips in between the strips you can see that there are some
narrow gaps right through the cross-section of the core. These staggered joints are said to be
‘imbricated’. Both the coils have high mutual inductance.A mutual electro-motive force is induced
in the transformer from the alternating flux that is set up in the laminated core, due to the coil that
is connected to a source of alternating voltage.

Fig 4.10 Working principle of Transformer

Most of the alternating flux developed by this coil is linked with the other coil
and thus produces the mutual induced electro-motive force. The so produced electro-
motive force can be explained with the help of Faraday’s laws of Electromagnetic
Induction as

Dept. of. E.C.E. SREC. Page 28


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

e=M*dI/

If the second coil circuit is closed, a current flows in it and thus electrical energy is transferred
magnetically from the first to the second coil.The alternating current supply is given to the first
coil and hence it can be called as the primary winding. The energy is drawn out from the second
coil and thus can be called as the secondary winding.

In short, a transformer carries the operations shown below:

• Transfer of electric power from one circuit to another.

• Transfer of electric power without any change in frequency.

• Transfer with the principle of electromagnetic induction.

• The two electrical circuits are linked by mutual induction

4.4 Classification of Transformer:

• Step-Up Transformer

• Step-Down Transformer
Step-Down Transformer
Step down transformers convert electrical voltage from one level or phase configuration
usually down to a lower level. They can include features for electrical isolation, power
distribution, and control and instrumentation applications. Step down transformers typically
rely on the principle of magnetic induction between coils to convert voltage and/or current
levels. An example of this would be: 100 turns on the primary and 50 turns on the secondary,
a ratio of 2 to 1. Step down transformers can be considered nothing more than a voltage ratio

Fig 4.11Step Down Transformer

Dept. of. E.C.E. SREC. Page 29


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Step-Up Transformer:
A step up transformer has more turns of wire on the secondary coil, which makes a larger
induced voltage in the secondary coil. It is called a step up transformer because the voltage output
is larger than the voltage input. Step-up transformer 110v 220v design is one whose secondary
voltage is greater than its primary voltage. This kind of transformer "steps up" the voltage applied
to it. For instance, a step up transformer is needed to use a 220v product in a country with a 110v
supply. A step up transformer 110v 220v converts alternating current (AC) from one voltage to
another voltage. It has no moving parts and works on a magnetic induction principle; it can be
designed to "step- up" or "step-down" voltage. So a step up transformer increases the voltage and
a step down transformer decreases the voltage.

Fig 4.12 Step Up Transformer


4.5 Application of Transformer:
• The transformer used for impedance matching.

• The transformer used for isolate two circuits electrically.

• It is used to increase or decrease the alternating voltages in electric


power applications.
• The transformer used in voltmeter, ammeters, protective relay etc.

• The transformer used for step up low voltage in case of measurement.

• The transformer used for step down high voltage for safety.

• The transformer used in rectifier.

• It is used in voltage regulators, voltage stabilizers, power supplies etc.

Dept. of. E.C.E. SREC. Page 30


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

4.6 Rectifier circuit:


A rectifier is an electrical device that converts alternating current (AC), which periodically reverses
direction, to direct current (DC), which flows in only one direction. The process is known as
rectification.
Half Wave Rectifier:
A simple Half Wave Rectifier is nothing more than a single pn junction diode
connected in series to the load resistor. As you know a diode is to electric current like a
one-way valve is to water, it allows electric current to flow in only one direction.

This property of the diode is very useful in creating simple rectifiers which are used to
convert AC to DC. If you look at the Half Wave Rectifier diagram, we are giving an
alternating current as input

Fig 4.13 Half wave Rectifier


Input voltage is given to a step-down transformer and the resulting reduced
output of the transformer is given to the diode ‘D’ and load resistor RL. The output
voltage is measured across load resistor RL.
Full Wave Rectifier:
Full wave rectifier rectifies the full cycle in the waveform i.e. it rectifies both the positive
and negative cycles in the waveform. This Full wave rectifier has an advantage over the
half wave i.e. it has average output higher than that of half wave rectifier. The number of
AC components in the output is less than that of the input.
The full wave rectifier can be further divided mainly into following types.
• Centre Tapped Full Wave Rectifier
• Full wave Bridge Rectifier

Dept. of. E.C.E. SREC. Page 31


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Center Tapped Full Wave Rectifier:


Centre tap is the contact made at the middle of the winding of the transformer. In the
center tapped full wave rectifier two diodes were used. These are connected to the center
tapped secondary winding of the transformer. Above circuit diagram shows the center tapped
full wave rectifier. It has two diodes. The positive terminal of two diodes is connected to the
two ends of the transformer. Centre tap divides the total secondary voltage into equal parts.

Fig 4.14 Centre Tapped Full Wave Rectifier

Full Wave Bridge Rectifier:


Bridge is a type of electrical circuit. Bridge rectifier is a type of rectifier in which diodes were
arranged in the form of a bridge. This provides full wave rectification and is of low cost. So it is
used in many applications.

Fig 4.15 Full Wave Bridge Rectifier

Dept. of. E.C.E. SREC. Page 32


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

4.7 Working of Bridge Rectifier:


The working of a bridge rectifier is simple. The circuit diagram of bridge rectifier is given
above. The secondary winding of the transformer is connected to the two diametrically opposite
points of the bridge at points 1 and 3. Assume that a load is connected at the output. The load
RLoad is connected to bridge through points 2 and 4.

During first half cycle of the AC input, the upper portion of the transformer secondary winding
is positive with respect to the lower portion. Thus during the first half cycle diodes D1 and D4 are
forward biased. Current flows through path 1-2, enter the load RL. It returns flowing through path
4-3. During this half input cycle, the diodes D2 and D3 are reverse biased. Hence there is no current
flow through the path 2-3 and 1-4.

Fig 4.16 Output Wave Forms of Full Wave Bridge Rectifier


During the next cycle lower portion of the transformer is positive with respect to the
upper portion. Hence during this cycle diodes D2 and D3 are forward biased. Current flows
through the path 3-2 and flows back through the path 4-1.The diodes D1 and D4 are reverse
biased. So there is no current flow through the path 1-2 and 3-4.Thus negative cycle is
rectified and it appears across the load.

4.8 Filter Circuit:


A filter circuit is a device to remove the A.C components of the rectified output, but allows the
D.C components to reach the load. A filter circuit is in general a combination of inductor (L) and
Capacitor (C) called LC filter circuit. A capacitor allows A.C only and inductor allows D.C only
to pass.

Dept. of. E.C.E. SREC. Page 33


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Components involved in filter Circuit:


A filter circuit comprises of generally inductor and capacitor. The inductor allows DC only to
pass through it and capacitor allows AC only to pass through it. Thus, a circuit formed by the
combination of inductors and capacitors can effectively filter the signal according to the
application.
4.9 Capacitor Filter:
This filter consists of a high value capacitor placed directly across the load resistor. This
capacitor then gets charged i.e. it stores energy during the conducting period and delivers this
energy to the load during the non-conducting period. Through this process, the time duration
during which the current flows through the load resistor gets prolonged and ripple component gets
considerably reduces.

Fig 4.17 Capacitor Filter

The function of the capacitor filter may be viewed in terms of Impedance to


the ripple component of frequency f. this ripple, component of current, therefore, gets
bypassed through C and only dc component flows through the load resistor RL.
Voltage Regulator:
A voltage regulator is an electrical regulator designed to automatically maintain a
constant voltage level. It may use an electromechanical mechanism, or passive or active
electronic components. Depending on the design, it may be used to regulate one or more AC
or DC voltages.
A voltage regulator is designed to automatically ‘regulate’ voltage level. It basically

Dept. of. E.C.E. SREC. Page 34


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

steps down the input voltage to the desired level and keeps that in that same level during the
supply. This makes sure that even when a load is applied the voltage doesn’t drop.

These regulators consist the three pins thereare


Pin1: It is used for input pin.
Pin2: This is ground pin for regulator
Pin3: It is used for output pin. Through this pin we get the output.

Fig 4.18 12 V Voltage Regulator

There are two types of regulator are they.


• Positive Voltage Series (78xx) and

• Negative Voltage Series (79xx)


Positive Voltage Series (78xx)
‘78’ indicate the positive series and ‘05’indicates the voltage rating. In this proiect we
have to used two voltage regulators there are 7802 and 7812 voltage regulators.
Negative Voltage Series (79xx)
’78’ indicate the negative series and ‘xx’ indicates the voltage rating. Suppose 7905
produces the maximum -5V.’05’indicates the regulator output is -5V0.

Dept. of. E.C.E. SREC. Page 35


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Air Quality sensors:


Gas sensors (also known as gas detectors) are electronic devices that detect and
identify different types of gasses. They are commonly used to detect toxic or explosive gasses
and measure gas concentration. Gas sensors are employed in factories and manufacturing
facilities to identify gas leaks, and to detect smoke and carbon monoxide in homes. Gas
sensors vary widely in size (portable and fixed), range, and sensing ability.

Figure 4.19 Air Quality sensor

Dept. of. E.C.E. SREC. Page 36


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

CHAPTER -5
SOFTWARE CONSTRAINTS
5.1 Introduction to Arduino IDE:
Arduino is a prototype platform (open-source) based on an easy-to-use hardware and
software. It consists of a circuit board, which can be programmed (referred to as a
microcontroller) and a ready-made software called Arduino IDE (Integrated Development
Environment), which is used to write and upload the computer code to the physical board.
5.2 Key Features of Arduino IDE:
Arduino boards able to read analog or digital input signals from different sensors and
turn it into an output such as activating a motor, turning LED on/off, connect to the cloud and
many other actions.
You can control your board functions by sending a set of instructions to the
microcontroller on the board via Arduino IDE (referred to as uploading software). Unlike
most previous programmable circuit boards, Arduino does not need an extra piece of
hardware (called a programmer) in order to load a new code onto the board. You can simply
use a USB cable. Additionally, the Arduino IDE uses a simplified version of C++, making it
easier to learn to program.
Finally, Arduino provides a standard form factor that breaks the functions of the micro-
controller into a more accessible package. After learning about the main parts of the Arduino
UNO board, we are ready to learn how to set up the Arduino IDE. Once we learn this, we
will be ready to upload our program on the Arduino board.

5.3 Arduino Data Types:

Data types in C refers to an extensive system used for declaring variables or functions of
different types. The type of a variable determines how much space it occupies in the storage
and how the bit pattern stored is interpreted.
The following table provides all the data types that you will use During Arduino
programming.
Void:
The void keyword is used only in function declarations. It indicates that the function is

Dept. of. E.C.E. SREC. Page 37


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

expected to return no information to the function from which it was called.


Boolean:
A Boolean holds one of two values, true or false. Each Boolean variable occupies one
byte of memory.
Char:
A data type that takes up one byte of memory that stores a character value. Character literals are
written in single quotes like this: 'A' and for multiple characters, strings use double quotes: "ABC".

However, characters are stored as numbers. You can see the specific encoding in the
ASCII chart. This means that it is possible to do arithmetic operations on characters, in which
the ASCII value of the character is used. For example, 'A' + 1 has the value 66, since the
ASCII value of the capital letter A is 65.
Unsigned char:
Unsigned char is an unsigned data type that occupies one byte of memory. The
unsigned char data type encodes numbers from 0 to 255.
Byte
A byte stores an 8-bit unsigned number, from 0 to 255.
Example:
byte m = 25 ;//declaration of variable with type byte and initialize it with 25
int:

Integers are the primary data-type for number storage. int stores a 16-bit (2-byte) value.
This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of
(2^15) - 1).The int size varies from board to board. On the Arduino Due, for example, an int
stores a 32-bit (4-byte) value. This yields a range of -2,147,483,648 to 2,147,483,647
(minimum value of -2^31 and a maximum value of (2^31) - 1).
Unsigned int:
Unsigned int’s (unsigned integers) are the same as int in the way that they store a 2 byte
value. Instead of storing negative numbers, however, they only store positive values, yielding
a useful range of 0 to 65,535 (2^16) - 1). The Due stores a 4 byte (32-bit) value, ranging from
0 to 4,294,967,295 (2^32 - 1).

Dept. of. E.C.E. SREC. Page 38


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Word:
On the Uno and other ATMEGA based boards, a word stores a 16-bit unsigned number.
On the Due and Zero, it stores a 32-bit unsigned number.

Unsigned long:
Unsigned long variables are extended size variables for number storage and store 32 bits
(4 bytes). Unlike standard longs, unsigned longs will not store negative numbers, making
their range from 0 to 4,294,967,295 (2^32 - 1).
Short:
A short is a 16-bit data-type. On all Arduinos (AT Mega and ARM based), a short stores
a 16-bit (2-byte) value. This yields a range of -32,768 to 32,767 (minimum value of -2^15
and a maximum value of (2^15) - 1).
Float:
Data type for floating-point number is a number that has a decimal point. Floating-point
numbers are often used to approximate the analog and continuous values because they have
greater resolution than integers.
Floating-point numbers can be as large as 3.4028235E+38 and as low as
3.4028235E+38. They are stored as 32 bits (4 bytes) of information.

Double:
On the Uno and other ATMEGA based boards, Double precision floating-point number
occupies four bytes. That is, the double implementation is exactly the same as the float, with
no gain in precision. On the Arduino Due, doubles have 8-byte (64 bit) precision.
5.4 Steps to Upload the Program in Arduino Board:
In this section, we will learn in easy steps, how to set up the Arduino IDE on our computer and
prepare the board to receive the program via USB cable.
Step 1: First you must have your Arduino board (you can choose your favorite board) and
a USB cable. In case you use Arduino UNO, Arduino Demilune, Nano, Arduino Mega2560,
or Decimal, you will need a standard USB cable (A plug to B plug), the kind you would
connect to a USB printer as shown in the following image.

Dept. of. E.C.E. SREC. Page 39


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Fig 5.1 USB Cable

Step 2: Download Arduino IDE Software.


You can get different versions of Arduino IDE from the Download page on the Arduino
Official website. You must select your software, which is compatible with your operating
system (Windows, IOS, or Linux). After your file download is complete, unzip the file.

Step 3: Power up your board.

The Arduino Uno, Mega, Demilune and Arduino Nano automatically draw power from
either, the USB connection to the computer or an external power supply. If you are using an
Arduino Decimal, you have to make sure that the board is configured to draw power from the
USB connection. The power source is selected with a jumper, a small piece of plastic that fits

Dept. of. E.C.E. SREC. Page 40


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

onto two of the three pins between the USB and power jacks. Check that it is on the two pins
closest to the USB port. Connect the Arduino board to your computer using the USB cable. The
green power LED (labeled PWR) should glow.

Step 4: Launch Arduino IDE.

After your Arduino IDE software is downloaded, you need to unzip the folder. Inside the
folder, you can find the application icon with an infinity label (application.exe). DoubleClick the
icon to start the IDE.

Step 5: Open your first project.


Once the software starts, you have two options: Create a
new project.

Open an existing project example.


To create a new project, select File --> New.To open

Dept. of. E.C.E. SREC. Page 41


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

• To open an existing project example, select File -> Example -> Basics -> Blink.

Dept. of. E.C.E. SREC. Page 42


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Here, we are selecting just one of the examples with the name Blink. It turns the LED on and
off with some time delay. You can select any other example from the list.
Step 6: Select your Arduino board.

To avoid any error while uploading your program to the board, you must select the correct
Arduino board name, which matches with the board connected to your computer.

• Go to Tools -> Board and select your board

Here, we have selected Arduino Uno board according to our tutorial, but you must select the
name matching the board that you are using

Dept. of. E.C.E. SREC. Page 43


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Step 7: Select your serial port.

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

Dept. of. E.C.E. SREC. Page 44


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

Step 8: Upload the program to your board.

Before explaining how we can upload our program to the board, we must demonstrate
the function of each symbol appearing in the Arduino IDE toolbar.

A- Used to check if there is any compilation error.


B- Used to upload a program to the Arduino board.
C- Shortcut used to create a new sketch.

D-Used to directly open one of the example sketches.

E- Used to save your sketch.


F- Serial monitor used to receive serial data from the board and send the serial data to the
board.
Now, simply click the "Upload" button in the environment. Wait a few seconds; you will
see the RX and TX LEDs on the board, flashing. If the upload is successful, the message
"Done uploading" will appear in the status bar.
Note: If you have an Arduino Mini, NG, or other board, you need to press the reset button
physically on the board, immediately before clicking the upload button on the Arduino
Software.

Dept. of. E.C.E. SREC. Page 45


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

5.5 Arduino Programming Structure:


In this chapter, we will study, the Arduino program structure and we will learn more new
terminologies used in the Arduino world. The Arduino software is open- source. The code

for
Void setup ()

}
the Java environment is released under the GPL and the C/C++ microcontroller libraries are
under the LGPL.
Sketch: The first new terminology is the Arduino program called “sketch”. Structure
Arduino programs can be divided in three main parts: Structure, Values (variables and
constants), and Functions. In this tutorial, we will learn about the Arduino software program,
Dept. of. E.C.E. SREC. Page 46
IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

step by step, and how we can write the program without any syntax or compilation error. Let
us start with the Structure. Software structure consist of two main functions: Setup()function.

PURPOSE:
The setup() function is called when a sketch starts. Use it to initialize the variables, pin
modes, start using libraries, etc. The setup function will only run once, after each power up
or reset of the Arduino board.

INPUT
OUTP
UT
RETU
RN
Void Loop ()

}
PURPOSE:
After creating a setup() function, which initializes and sets the initial values, the loop()
function does precisely what its name suggests, and loops seductively, allowing your program
to change and respond. Use it to actively control the Arduino board.
INPUT
OUTPUT
RETURN

Dept. of. E.C.E. SREC. Page 47


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

CHAPTER-6
RESULT AND ANALYSIS
After all the connections we could dump the code in to Arduino board. When we will give the
power supply to the kit through the USB cable, it can easily detect the temperature, humidity, air
pressure, air levels, it is an IoT related project.

So initially we have connected the project to the internet after connecting to internet it sends
to IoT with the value temperature, humidity, air pressure, air levels and also it will display the
connection of our Wi-Fi with a blinking light. And the results also we can observe in the LCD
which connect to the kit.

Figure 6.1 Output


Dept. of. E.C.E. SREC. Page 48
IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

CONCLUSION
The level of pollution is increasing rapidly due to factors like industries, urbanization,
increasing in population, vehicle use which can affect human health. IOT Based Air Pollution
Monitoring System is used to monitor the Air Quality over a web server using Internet. It will
trigger an alarm when the air quality goes down beyond a certain level, means when there are
sufficient number of harmful gases present in the air like CO2, smoke, alcohol, benzene, NH3 and
NOx. It will show the air quality in PPM on the LCD and as well as on webpage so that air pollution
can be monitored very easily.

The system uses MQ135 and MQ6 sensor for monitoring Air Quality as it detects most
harmful gases and can measure their amount accurately.

Dept. of. E.C.E. SREC. Page 49


IoT BASED WIRELESS SENSOR NETWORK FOR AIR POLLUTION MONITORING

REFERENCES

1. Mahalingam, A.; Naayagi, R.T.; Mastorakis, N.E. Design and implementation of an economic
gas leakage detector. In Proceedings of 6th International Conference on Circuits, Systems and
Signals, Athens, Greece, 7–9 March 2012; pp. 20–24.

2. Attia, H.A.; Halah, Y.A. Electronic Design of Liquefied Petroleum Gas Leakage Monitoring,
Alarm, and Protection System Based on Discrete Components. Int. J. Appl. Eng. Res. 2016, 11,
9721–9726.

3. Apeh, S.T.; Erameh, K.B.; Iruansi, U. Design and Development of Kitchen Gas Leakage
Detection and Automatic Gas Shut off System. J. Emerg. Trends Eng. Appl. Sci. 2014, 5, 222–
228. Eng. Proc. 2020, 2, 28 6 of 6

4. Soundarya, T.; Anchitaalagammai, J.V.; Priya, G.D.; Karthickkumar, S.S. C-Leakage: Cylinder
LPG Gas Leakage Detection for Home Safety. IOSR J. Electron. Commun. Eng. 2014, 9, 53–58.

5. Shrivastava, A.; Prabhaker, R.; Kumar, R.; Verma, R. GSM based gas leakage detection system.
Int. J. Emerg. Trends Electr. Electron. 2013, 3, 42–45.

6. Anurupa, A.; Gunasegaram, M.; Amsaveni, M. Efficient Gas Leakage Detection and Control
System using GSM Module. Int. J. Eng. Res. Technol.2015,3, 1–4.

7. Meenakshi, A.A.; Meghana, R.B.N.; Krishna, P.R. LPG Gas Leakage Detection and Prevention
System. Int. J. Future Revolut. Comput. Sci. Commun. Eng. 2017, 3, 1–4. 8. All Answers Ltd.
GSM Based LPG Detection [Internet]. November 2018. Available online:
https://ukdiss.com/examples/gsm-based-lpg-detection.php?vref=1 (accessed on 15 October 2020).

Dept. of. E.C.E. SREC. Page 50


International Journal of Research
Publication and Reviews
(Open Access, Peer Reviewed, International Journal)

ISSN 2582-7421 Sr. No: IJRPR 53579

Certificate of Acceptance & Publication

This certificate is awarded to Chakali Venkata Subbaiah, and certifies the


acceptance for publication of research paper entitled “IoT Based Wireless
Sensor Network for Air Pollution Monitoring” in “International Journal of
Research Publication and Reviews”, Volume 4, Issue 4, 2023 .

Signed Date 23/04/2023


Editor-in-Chief
International Journal of Research Publication and Reviews
International Journal of Research
Publication and Reviews
(Open Access, Peer Reviewed, International Journal)
(A+ Grade, Impact Factor 5.536)
ISSN 2582-7421 Sr. No: IJRPR 23845

Certificate of Acceptance & Publication

This certificate is awarded to Dudekula Fayaz, and certifies the acceptance


for publication of research paper entitled “IoT Based Wireless Sensor
Network for Air Pollution Monitoring” in “International Journal of Research
Publication and Reviews”, Volume 4, Issue 4, 2023.

Signed Date 23/04/2023


Editor-in-Chief
International Journal of Research Publication and Reviews
International Journal of Research
Publication and Reviews
(Open Access, Peer Reviewed, International Journal)

ISSN 2582-7421 Sr. No: IJRPR 53580

Certificate of Acceptance & Publication

This certificate is awarded to Lokesh Kumar, and certifies the acceptance for
publication of research paper entitled “IoT Based Wireless Sensor Network
for Air Pollution Monitoring” in “International Journal of Research
Publication and Reviews”, Volume 4, Issue 4, 2023 .

Signed Date 23/04/2023


Editor-in-Chief
International Journal of Research Publication and Reviews
International Journal of Research
Publication and Reviews
(Open Access, Peer Reviewed, International Journal)
(A+ Grade, Impact Factor 5.536)
ISSN 2582-7421 Sr. No: IJRPR 23846

Certificate of Acceptance & Publication

This certificate is awarded to Pulivarthi Manoj Kumar, and certifies the


acceptance for publication of research paper entitled “IoT Based Wireless
Sensor Network for Air Pollution Monitoring” in “International Journal of
Research Publication and Reviews”, Volume 4, Issue 4, 2023.

Signed Date 23/04/2023


Editor-in-Chief
International Journal of Research Publication and Reviews
IEEE
EAA
SANTHIRAM ENGINEERING COLLEGE
AAALAASA
Approved by AICTE, New Delhi: Permanently Affiliated to JNT University, Anantapuramu.
Accredited by NAAC with Grade-A, An ISO 9001:2015 Certified Institution,
Recognition of the college under 2 () &12 (B) of the UGC ACT, 1956
NH-40, NANDYAL - 518501, NANDYAL (Dist), A.P.
A
NAAC

Certrificate Participation.
SIGIMA-2KK23
of
This is to certify that M/Ms. Cvenkata Subbaiah
Regd. No. L9x5LB0yo9 studying -£CE branch of _ix year, I_ sem in
-Sanhiam brginengcallkgardyat has participated in
-Paijeckbpe event in the 12th National Level Technical Symposium
(SIGMA-2 K23) during 3rd &4th of March, 2023, held at Santhiram Engineering
College, Nandyal.

M
coORDINATOR HOD RRINCIPAL

You might also like