Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
16 views45 pages

Societal Project Report

This project aims to design an IoT-based air pollution monitoring system using sensors to monitor air quality and send alerts when levels deteriorate. The system uses a Node MCU microcontroller programmed to read signals from a DHT11 temperature and humidity sensor and an MQ-135 gas sensor. Sensor data is displayed on an LED and sent to the ThingSpeak cloud platform where it can be accessed from anywhere via the internet. The system monitors carbon monoxide, carbon dioxide, smoke and other gases as well as temperature and humidity to analyze local air quality.

Uploaded by

Sudha
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)
16 views45 pages

Societal Project Report

This project aims to design an IoT-based air pollution monitoring system using sensors to monitor air quality and send alerts when levels deteriorate. The system uses a Node MCU microcontroller programmed to read signals from a DHT11 temperature and humidity sensor and an MQ-135 gas sensor. Sensor data is displayed on an LED and sent to the ThingSpeak cloud platform where it can be accessed from anywhere via the internet. The system monitors carbon monoxide, carbon dioxide, smoke and other gases as well as temperature and humidity to analyze local air quality.

Uploaded by

Sudha
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/ 45

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

JNANA SANGAMA, BELAGAVI-590014

SOCIETAL PROJECT REPORT ON

“IoT Based aIr PolluTIon MonITorIng sysTeM”


Submitted in partial fulfillment of the requirement for the award of the degree of

MASTER OF TECHNOLOGY

IN

DIGITAL COMMUNICATION AND NETWORKING

Submitted by

SUDHA S KATTEGOUDRA
[4UB22LDN07]
Under the guidance of
Smt. Dr. Geetha V M.tech, Phd
Associate Professor
Dept. of Electronics and Communication Engineering
UBDTCE, Davanagere

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING


UNIVERSITY B.D.T. COLLEGE OF ENGINEERIN DAVANAGERE-577004

2023-2024
UNIVERSITY B. D. T COLLEGE OF ENGINEERING,
DAVANAGERE-577004
( A constituent college of Visvesvaraya Technological University, Belagavi, Karnataka )

Department of Electronics and Communication Engineering


2023-2024

CERTIFICATE

This is to certify that the societal project work entitled “IOT BASED AIR POLLUTION
MONITORING SYSTEM” carried out by SUDHA S KATTEGOUDRA bearing USN
(4UB22LDN07), a bonafide student of University B D T College of Engineering, Davanagere in
partial fulfillment of the requirement for the award of Master of Technology in Digital
Communication And Networking of the Visvesvaraya Technological University, Belagavi during
the year 2023-2024. The societal project has approved as it satisfies the academic requirements for
the said degree.

------------------------------------ ---------------------------------------- ----------------------------


Dr. V GEETHA Dr. RAVINDRA P RAJPUT ASHA G M
Guide, Associate Professor Professor & Chairman Coordinator
Dept. of E&C Engineering Dept. of E & C Engineering
VISVESVARAYA TECHNOLOGICAL UNIVERSITY
UNIVERSITY B. D. T COLLEGE OF ENGINEERING,
DAVANAGERE-577004
Department of Electronics And Communication Engineering

2023-2024

DECLARATION

I hereby declare that the entire work embodied in societal project is IoT Based Air Pollution
Monitoring System using Internet of Things to Visvesvaraya Technological University as a part of
the M.Tech curriculum, is a record of an original work done by me under the guidance of Smt. Dr.
GEETHA V , Associate Professor and this societal project is submitted in the partial fulfillment of
requirements for the post graduation.

I also confirm that the report is only prepared for my academic year requirement, not for
any other purpose.

SUDHA S KATTEGOUDRA
[4UB22LDN07]
ACKNOWELEDGEMENT

I would like to thank our Principal Dr. D P NAGARAJAPPA, UBDTCE, Davanagere for providing
an inspiring environment to carry out academic works in the college.

I would like to thank our Dr. RAVINDRA P RAJPUTH, Professor and Chairman, Department of
studies in Electronics and Communication Engineering, UBDTCE Davanagere, who is inspiring
person and excellent advisor to carry out my project.

I would like to express my immense gratitude to my Guide Dr. GEETHA V Professor, Department
of studies in Electronics and Communication Engineering, UBDTCE, Davanagere, for his skillful
guidance, motivation, timely suggestion and also for providing the right ambience, constant
encouragement, guidance and support.

I thank our PG Coordinator ASHA G M, Associate professor, Department of studies in Electronics


and Communication Engineering, UBDTCE, Davanagere, who is the inspiring person and excellent
advisor to carry out my project.

I intend to thank all the teaching and non-teaching staff of our Department of Electronics &
Communication Engineering for their immense help and co-operation.

SUDHA S KATTEGOUDRA.
[4UB22LDN07]
TABLE OF CONTENTS

TOPICS PAGE NO.


List of figures i
List of acronyms ii
Abstract iii

CHAPTER1: Introduction.................................................................................01-02
1.1 Aim………………………………………………………..............................01
1.2 Literature Survey………………………………………….............................01-02

CHAPTER 2: Theory & Description of the Components .............................. 03-12


2.1 What is IoT?....................................................................................................03-04
2.2 Components Used…………………………………………………………....05
2.3 Brief Description of the Components……………………………………......05-11
2.4 Working Procedures ……………………………………………...................12

CHAPTER 3: Hardware Model .......................................................................13-16


3.1 Hardware Model to Preheat DHT11 Sensor Module…………….………......13
3.2 Hardware Model to Preheat and Calibrate MQ-135 Gas Sensor Module……14-15
3.3 Final Hardware Model…...…………………………………………………...15-16

CHAPTER 4: Algorithm and Software Program ............................................ 17-23


4.1 Working Algorithm…………………………………………………………...17
4.2 Calibration of MQ-135 Gas Sensor Module………………………………….18-21
4.3 Execution of the Main Program…………………………...………………….21-23

CHAPTER 5: Results ........................................................................................ 24-30


CHAPTER 6: Conclusion ……………………………………………………..31

REFERENCES ...............................................................................................32

APPENDIX

A.1 Pin Description of Node MCU ......................................................................33-34


A.2 Description of Software Libraries used .........................................................35
A.3 Cost Estimation .............................................................................................36
List of Figures
Figure No. Figure Title
1 IoT based air pollution monitoring system
2.1 Pinout Diagram of Node MCU V3
2.2 Pinout Diagram of DHT11 sensor
2.3 The structure of the humidity sensor
2.4 Mq-135 Gas Sensor Module
2.5 Veroboard
2.6 AC-DC Adapter
2.7 LEDs
2.8 Resistors
2.9 Arduino IDE
2.10 Thing Speak Cloud
3.1 Circuit Diagram to Pre-heat the DHT11 sensor module
3.2 Circuit Diagram to Pre-heat the MQ-135 gas sensor module
3.3 Circuit Diagram to Calibrate the MQ-135 Gas Sensor module
3.4 Circuit Diagram of the setup
5.1 Observations for Experiment 1
5.2 Setup for Experiment 1
5.3 Observations for Experiment 2 5.4 Setup for Experiment 2
5.5 Observations for Experiment 3
5.6 Setup for Experiment 3
5.7 Setup for Experiment 4
5.8 Observations for Experiment 4 5.9 Setup for Experiment 5
5.10 Observations for Experiment 5
List of Acronyms

DHT Digital Humidity and Temperature


IoT Internet of Things
PPM Parts Per Molecule
PM Particulate Matter
CO Carbon Monoxide
CO2 Carbon Dioxide
LED Light Emitting Diode
LPG Liquid Petroleum Gas
IDE Integrated Development Environment
ABSTRACT
Air pollution is one of the biggest threats to the present-day environment. Everyone is
being affected by air pollution day by day including humans, animals, crops, cities, forests
and aquatic ecosystems. Besides that, it should be controlled at a certain level to prevent
the increasing rate of global warming. This project aims to design an IOT-based air
pollution monitoring system using the internet from anywhere using a computer or mobile
to monitor the air quality of the surroundings and environment. There are various methods
and instruments available for the measurement and monitoring quality of air. The IoT-
based air pollution monitoring system would not only help us to monitor the air quality
but also be able to send alert signals whenever the air quality deteriorates and goes down
beyond a certain level. In this system, Node MCU plays the main controlling role.
It has been programmed in a manner, such that, it senses the sensory signals from the
sensors and shows the quality level via led indicators. Besides the harmful gases (such as
CO2, CO, smoke, etc) temperature and humidity can be monitored through the
temperature and humidity sensor by this system. Sensor responses are fed to the Node
MCU which displays the monitored data in the Thing Speak cloud which can be utilized
for analyzing the air quality of that area. The following simple flow diagram (as shown in
Fig. 1) indicates the working mechanism of the IoT-based Air Pollution Monitoring
System.
Fig.1. IoT based Air Pollution Monitoring System
IOT BASED AIR POLLUTION MONITORING SYSTEM

Chapter 1
INTRODUCTION

1.1 Aim of the Project

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.

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].

M.TECH IN DCN, UBDTCE DAVANAGERE pg. 1


IOT BASED AIR POLLUTION MONITORING SYSTEM

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 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].

M.TECH IN DCN, UBDTCE DAVANAGERE pg. 2


IOT BASED AIR POLLUTION MONITORING SYSTEM

Chapter 2
THEORY & DESCRIPTION OF THE COMPONENTS

2.1 What is IOT?


The Internet of Things (IoT) describes the network of physical objects—“things”—that are
embedded with sensors, software, and other technologies for the purpose of connecting and
exchanging data with other devices and systems over the internet. These devices range from
ordinary household objects to sophisticated industrial tools.
The field has evolved due to the convergence of multiple technologies, including ubiquitous
computing, commodity sensors, increasingly powerful embedded systems, and machine
learning.
Traditional fields of embedded systems, wireless sensor networks, control systems,
automation (including home and building automation), independently and collectively enable
the Internet of things. In the consumer market, IoT technology is most synonymous with
products pertaining to the concept of the "smart home", including devices and appliances
(such as lighting fixtures, thermostats, home security systems, cameras, and other home
appliances) that support one or more common ecosystems, and can be controlled via devices
associated with that ecosystem, such as smartphones and smart speakers. IoT is also used in
healthcare systems.
There are a number of concerns about the risks in the growth of IoT technologies and
products, especially in the areas of privacy and security, and consequently, industry and
governmental moves to address these concerns have begun, including the development of
international and local standards, guidelines, and regulatory frameworks.
IoT devices are a part of the larger concept of home automation, which can include lighting,
heating and air conditioning, media and security systems and camera systems. Long-term
benefits could include energy savings by automatically ensuring lights and electronics are
turned off or by making the residents in the home aware of usage.
A smart toilet seat that measures blood pressure, weight, pulse and oxygen levels. A smart
home or automated home could be based on a platform or hubs that control smart devices and
appliances. For instance, using Apple's HomeKit, manufacturers can have their home
products and accessories controlled by an application in iOS devices such as the iPhone and

M.TECH IN DCN, UBDTCE DAVANAGERE pg. 3


IOT BASED AIR POLLUTION MONITORING SYSTEM

the Apple Watch. This could be a dedicated app or iOS native applications such as Siri. This
can be demonstrated in the case of Lenovo's Smart Home Essentials, which is a line of smart
home devices that are controlled through Apple's Home app or Siri without the need for a
Wi-Fi bridge. There are also dedicated smart home hubs that are offered as standalone
platforms to connect different smart home products and these include the Amazon Echo,
Google Home, Apple's Home Pod, and Samsung's SmartThings Hub. In addition to the
commercial systems, there are many non-proprietary, open-source ecosystems; including
Home Assistant, Open HAB and Domoticz.
Significant numbers of energy-consuming devices (e.g. lamps, household appliances, motors,
pumps, etc.) already integrate Internet connectivity, which can allow them to communicate
with utilities not only to balance power generation but also helps optimize the energy
consumption as a whole. These devices allow for remote control by users, or central
management via a cloud-based interface, and enable functions like scheduling (e.g., remotely
powering on or off heating systems, controlling ovens, changing lighting conditions, etc.)
.The smart grid is a utility-side IoT application; systems gather and act on energy and power
related information to improve the efficiency of the production and distribution of electricity.
Using advanced metering infrastructure (AMI) Internet-connected devices, electric utilities
not only collect data from end-users but also manage distribution automation devices like
transformers.
Another example of integrating the IoT is Living Lab which integrates and combines research
and innovation processes, establishing a public-private-people-partnership. There are
currently 320 Living Labs that use the IoT to collaborate and share knowledge between
stakeholders to co-create innovative and technological products. For companies to implement
and develop IoT services for smart cities, they need to have incentives. The governments play
key roles in smart city projects as changes in policies will help cities to implement the IoT
which provides effectiveness, efficiency, and accuracy of the resources that are being used.
For instance, the government provides tax incentives and cheap rent, improves public
transport, and offers an environment where start-up companies, creative industries, and
multinationals may co-create, share a common infrastructure and labor markets, and take
advantage of locally embedded technologies, production process, and transaction costs. The
relationship between the technology developers and governments who manage the city's
assets is key to providing open access to resources to users in an efficient way.

M.TECH IN DCN, UBDTCE DAVANAGERE pg. 4


IOT BASED AIR POLLUTION MONITORING SYSTEM

In this project, we have tried to implement the concept of IoT to monitor the temperature,
humidity and air quality of the surroundings

2.2 Components Used

Hardware Components
1. Node MCU V3
2. DHT11 Sensor Module
3. MQ-135 Gas Sensor Module
4. Veroboard(KS100)
5. Breadboard
6. Connecting Wires
7. AC-DC Adapters
8. LEDs emitting green, yellow and red colours
9. Resistors

SOFTWARE COMPONENTS
1. Think Speak Cloud
2. Arduino IDE

2.3 Brief Description of the Components

Node MCU V3
Node MCU V3 is an open-source ESP8266 development kit, armed with the CH340G
USBTTL Serial chip. It has firmware that runs on ESP8266 Wi-Fi SoC from Es press if
Systems. Whilst cheaper, CH340 is super reliable even in industrial applications. It is tested
to be stable on all supported platforms as well. It can be simply coded in Arduino IDE. It has
a very low current consumption between 15 µA to 400 mA.
The pinout Diagram of NodeMC3 is shown in Fig. 2.1.

M.TECH IN DCN, UBDTCE DAVANAGERE pg. 5


IOT BASED AIR POLLUTION MONITORING SYSTEM

Fig. 2.1 (Pinout Diagram of Node MCU V3)

DHT11 Sensor Module


The DHT11 is a temperature and humidity sensor that
gives digital output in terms of voltage. It uses a
capacitive humidity sensor and a thermistor to measure
the surrounding air.
As shown in Fig. 2.2, we need to supply a voltage of 5V
(DC) to the Vcc pin and ground it to the GND pin. The
sensor output can be easily read from the Data pin in
terms of voltage (in digital mode).
Fig 2.2 (Pinout Diagram of
The humidity sensing capacitor DHT11sensor)

Humidity Measurement: has Two electrodes with a moisture-holding substrate as a dielectric


between them as shown in Fig 2.3. Change in the capacitance value occurs with the change
in humidity levels. The IC measure, process these changed resistance values and then
converts them into digital form.

Temperature Measurement: For measuring the temperature, the DHT11 sensor uses a
negative temperature coefficient thermistor, which causes a decrease in its resistance value
with an increase in temperature. To get a wide range of resistance values, the sensor is made
up of semiconductor ceramics or polymers.

M.TECH IN DCN, UBDTCE DAVANAGERE pg. 6


IOT BASED AIR POLLUTION MONITORING SYSTEM

Fig 2.3(The structure of the humidity sensor)

MQ-135 Gas Sensor Module


The material of MQ135 is SnO2, it is a special material: when exposed to clean air, it is hardly
being conducted, however, when put in an environment with combustible gas, it has a pretty
performance of conductivity. Just make a simple electronic circuit, and convert the change of
conductivity to a corresponding output signal. MQ135 gas sensor is sensitive to Ammonia,
Sulphide, Benzene steam, smoke and other harmful gases. Used for family, surrounding
environment noxious gas detection device, apply to ammonia, aromatics, sulphur, benzene
vapor, and other harmful gases/smoke, gas detection, tested concentration range: 10 to
1000ppm. In a normal environment, the environment which doesn’t have detected gas set the
sensor’s output voltage as the reference voltage, the analog output voltage will be about 1V,
when the sensor detects gas, harmful gas concentration increases by 20ppm per voltage
increase by 0.1V.

Fig 2.4 (MQ-135 Gas Sensor Module)

M.TECH IN DCN, UBDTCE DAVANAGERE pg. 7


IOT BASED AIR POLLUTION MONITORING SYSTEM

Veroboard (KS100)
Veroboard is the original prototyping board.
Sometimes referred to as ‘stripboard’ or ‘matrix
board’ these offer total flexibility for hard wiring
discrete components. Manufactured from a
copper clad laminate board or Epoxy based
substrate, it is offered in both single and double
sided formats. Vero boards are available in a
wide range of board sizes and in both imperial
and metric pitch – Veroboard is an ideal base for
circuit construction and offers even greater
adaptability using our range of terminal pins and (Fig 2.5 Veroboard assemblies.)
As with other stripboards, in using
Veroboard, components are suitably positioned and soldered to the conductors to form the
required circuit. Breaks can be made in the tracks, usually around holes, to divide the strips
into multiple electrical nodes enabling increased circuit complexity. This type of wiring board
may be used for initial electronic circuit development, to construct prototypes for bench
testing or in the production of complete electronic units in small quantities.

AC-DC Power Adapter


An AC-DC power supply or adapter is an electrical device that obtains electricity from a grid-
based power supply and converts it into a different current, frequency, and voltage. AC-DC
power supplies are necessary to provide the right power that an electrical component needs.
The ACDC power supply delivers electricity to devices that would typically run-on batteries
or have no other

M.TECH IN DCN, UBDTCE DAVANAGERE pg. 8


IOT BASED AIR POLLUTION MONITORING SYSTEM

Fig 2.6 (AC-DC Power Adapter power source.)

LED (Red, Green & Yellow)


A light-emitting diode (LED) is a semiconductor light source that emits light when current
flows through it. Electrons in the semiconductor recombine with electron holes, releasing
energy in the form of photons. The colour of the light (corresponding to the energy of the
photons) is determined by the energy required for electrons to cross the band gap of the
semiconductor. White light is obtained by using multiple semiconductors or a layer of light
emitting phosphor on the semiconductor device. LEDs have many advantages over
incandescent light sources, including lower power consumption, longer lifetime, improved
physical robustness, smaller size, and faster
switching. In exchange for these generally
favourable attributes, disadvantages of LEDs
include electrical limitations to low voltage and
generally to DC (not AC) power, inability to
provide steady illumination from a pulsing DC
or an AC electrical supply source, and lesser
maximum operating temperature and storage
temperature. In contrast to LEDs, incandescent
lamps can be made to intrinsically run at virtually
Fig 2.7(LEDs)
any supply voltage, can utilize either AC or DC
current interchangeably, and will provide steady illumination when powered by AC or
pulsing DC even at a frequency as low as 50 Hz. LEDs usually need electronic support

M.TECH IN DCN, UBDTCE DAVANAGERE pg. 9


IOT BASED AIR POLLUTION MONITORING SYSTEM

components to function, while an incandescent bulb can and usually does operate directly
from an unregulated DC or AC power source.

Resistors
A resistor is a passive two-terminal electrical
component that implements electrical resistance as
a circuit element. In electronic circuits, resistors
are used to reduce current flow, adjust signal
levels, to divide voltages, bias active elements,
and terminate transmission lines, among other
uses. High-power resistors that can dissipate many
watts of electrical power as heat may be used as
part of motor controls, in power distribution systems, or as test (Fig 2.8 Resistors)
loads for generators. Fixed resistors have resistances that only change slightly
with temperature, time or operating voltage.

Arduino IDE
The Arduino IDE is open-source
software, which is used to write
and upload code to the Arduino
boards. The IDE application is
suitable for different operating
systems such as Windows, Mac
OS X, and Linux. It supports the
programming languages C and
C++. Here, IDE stands for

Integrated Development Fig 2.9Arduino IDE


Environment. The program or
code written in the Arduino IDE is often called sketching. We need to connect the Genuino
and Arduino board with the IDE to upload the sketch written in the Arduino IDE software.
The sketch is saved with the extension 'ino.'

M.TECH IN DCN, UBDTCE DAVANAGERE pg. 10


IOT BASED AIR POLLUTION MONITORING SYSTEM

Thing Speak Cloud


Thing Speak is open-source software written in Ruby which allows users to communicate
with internet-enabled devices. It facilitates
data access, retrieval and logging of data by
providing an API to both the devices and
social network websites. Thing Speak was
originally launched by io Bridge in 2010 as
a service in support of IoT applications.
Thing Speak has integrated support from the
numerical computing software MATLAB
Fig 2.10(Thing Speak Cloud )
from MathWorks, allowing Thing Speak users
to analyse and visualize uploaded data using MATLAB without requiring the purchase of a
MATLAB license from MathWorks.

M.TECH IN DCN, UBDTCE DAVANAGERE pg. 11


IOT BASED AIR POLLUTION MONITORING SYSTEM

2.4 Working Procedures


Node MCU plays the main controlling role in this project. It has been programmed in a
manner, such that, it senses the sensory signals from the sensors and shows the quality level
via led indicators. The DHT11 sensor module is used to measure the temperature and the
humidity of the surroundings. With the help of the MQ-135 gas sensor module, air quality is
measured in ppm. These data are fed to the Think Speak cloud over the internet. We have
also provided LED indicators to indicate the safety levels.

STEP 1. Firstly, the calibration of the MQ-135 gas sensor module is done. The sensor
is set to preheat for 24 minutes. Then the software code is uploaded to the
Node MCU followed by the hardware circuit to calibrate the sensor has been
performed.

STEP 2. Then, the DHT11 sensor is set to preheat for 10 minutes.


STEP 3. The result of calibration found in STEP 1 is used to configure the final working
code.

STEP 4. The final working code is then uploaded to the Node MCU.
STEP 5. Finally, the complete hardware circuit is implemented.
The software codes and the hardware circuits are described in the following chapters.

M.TECH IN DCN, UBDTCE DAVANAGERE pg. 12


IOT BASED AIR POLLUTION MONITORING SYSTEM

Chapter 3
HARDWARE MODEL

3.1 Hardware Model to Preheat DHT11 Sensor Module


As discussed earlier, we need to preheat the DHT11 sensor so that it can work accurately.
The following steps were performed to preheat the DHT11 sensor module:

STEP 1 : The Vcc pin of the DHT11 sensor module was connected with the VU pin of
Node MCU.
STEP 2 : The Gnd pin of the DHT11 sensor module was connected with the Gnd pin
of Node MCU.
STEP 3 : The Node MCU is powered with a 12V DC via AC-DC adapter for 20 minutes.
STEP 4 : The setup was then disconnected.

Fig. 3.1 shown below describes the foresaid connections.

13 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

3.2 Hardware Model to Preheat and Calibrate MQ-135 Gas Sensor


Module
The following steps were performed to preheat the MQ-135 gas sensor module

STEP 1 : The Vcc pin of the MQ-135 gas sensor module was connected with the VU pin
of Node MCU.
STEP 2 : The Gnd pin of the MQ-135 gas sensor module was connected with the Gnd pin
of Node MCU.
STEP 3 : The Node MCU is powered with a 12V DC via AC-DC adapter for a day.
STEP 4 : The setup was then disconnected.

Fig. 3.2 shown below describes the foresaid connections.

Fig. 3.2(Circuit Diagram to Preheat the MQ-135 Gas sensor module)

The following steps were performed to calibrate the MQ-135 gas sensor module

STEP 1 : The Vcc pin of the MQ-135 gas sensor module was connected with the VU pin
of Node MCU.
STEP 2 : The Gnd pin of the MQ-135 gas sensor module was connected with the Gnd pin
of Node MCU.
STEP 3 : The analog DATA pin of the MQ-135 gas sensor module was connected with
the A0 Pin of the Node MCU.

14 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

STEP 4 : The software code to calibrate the sensor is then uploaded to the Node MCU
and the value of R0 in fresh air is collected from the serial monitor of the Arduino IDE.
STEP 5 : The setup was then disconnected.

Fig. 3.3 shown below describes the foresaid connections.

Fig.3.3(Circuit Diagram to Calibrate the MQ-135 Gas sensor module)

3.3 Final Hardware Model


The following steps were performed to execute the project

STEP 1 : The Vcc pin of the MQ-135 gas sensor module and DHT11 sensor module was
connected via Veroboard with an adapter delivering around 5V.
STEP 2 : The Gnd pin of the MQ-135 gas sensor module, DHT11 sensor module and the
cathode of the LED indicators was connected via Veroboard with the Gnd pin of the
Node MCU.
STEP 3 : The analog DATA pin of the MQ-135 gas sensor module was connected with
the A0 Pin of the Node MCU.
STEP 4 : The DATA pin of the DHT11 sensor module was connected with the D0 pin of
the Node MCU.
STEP 5 : The anode of the three LED indicators (green, yellow, and red) were connected
to the D2, D3, and D4 pins of the Node MCU respectively.
STEP 6 : The software code to execute the project was then uploaded to the Node MCU.

15 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

STEP 7 : The setup was then powered with 9V DC via AC-DC adapter.
It can be now turned ON/OFF as per the requirements. Fig 3.4 represents the circuit diagram
of the setup.

Fig. 3.4(Circuit Diagram of the setup)

16 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

Chapter 4
SOFTWARE IMPLEMENTATION

4.1 Working Algorithm

17 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

4.2 Calibration of MQ-135 Gas Sensor Module


Theory of Calibration [10]
The most important step is to calibrate the sensor in the fresh air and then draw an equation
that converts the sensor output voltage value into our convenient units PPM (parts per
million). Here are the mathematical calculations derived,

Fig. 4.1 (Internal Circuit diagram of MQ-135 sensor)

From Ohm’s Law, at a constant temperature, we can derive I as follows:

I=V/R………………………… ……(1)

From Fig 4.1, eqn. 1 is equivalent to

I=V/R ……………………........................................... (2)

From Fig 4.1, we can obtain the output voltage at the load resistor using the value obtained
for I and Ohm’s Law at a constant temperature, V = I x R.

VRL = [ VC/ (RS + RL)] x RL ………….………………….… (3)

VRL = [(VC∗ RL)/(RS + RL)]................................................ (4)

So now we solve for RS:

VRLx (RS + RL) = VCx RL…………………………….……. (5)

(VRLx RS) + (VRL x RL) = VC x RL.…………………..…… (6)

VRLx RS = (VC∗ RL) − (VRL∗ RL)....................................... (7)

18 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

RS = {(VC∗ RL − (VRL∗ RL)} / VRL..…………………..….. (8)

RS = {(VC∗ RL) VRL} – RL ..….…………………………….. (9)

Eqn. 9 helps us to find the internal sensor resistance for fresh air.

Fig. 4.2 (Graph representing ratio vs ppm variations)

From the graph shown in fig 4.2, we can see that the resistance ratio in fresh air is a
constant:

RS / R0 = 3.6…………………………..………… (10)

Value 3.6 which is mentioned in eqn. 10 is depicted in the datasheet shown in Fig 4.2. To
calculate R0, we will need to find the value of the RS in the fresh air. This will be done by
taking the analog average readings from the sensor and converting them to voltage. Then we
will use the RS formula to find R0. First of all, we will treat the lines as if they were linear.
This way we can use one formula that linearly relates the ratio and the concentration. By
doing so, we can find the concentration of a gas at any ratio value even outside of the graph’s
boundaries. The formula we will be using is the equation for a line, but for a log-log scale.
From above Figure 4.2, we try to derive the following calculations.

y = mx + b…………………..…………………….(11)

For a log-log scale, the formula looks like this:

19 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

log10 y = m ∗ log10x + b…………………………….. (12)

Let’s find the slope. To do so, we need to choose 2 points from the graph. In our case, we
chose the points (200,2.6) and (10000,0.75). The formula to calculate slope m(here) is the
following:

m = {logy − log(y0)} / { logx − log(x0)} ...........................(13)

If we apply the logarithmic quotient rule, we get the following:

m = log( ) / log( ) ..............................................................(14)

Now we substitute the values for x, x0, y, and y0:

m = log(0.75/2.6) / log(10000/200).................................. (15)

m = −0.318……………………………………………………(16)

Now that we have m, we can calculate the y-intercept. To do so, we need to choose one
point from the graph (once again from the CO2 line). In our case, we chose (5000,0.9)

log(y) = m ∗ log(x) + b……………………………………


…(17)

b = log(0.9) − (−0.318) ∗ log(5000)............................................ (18)

b=1.13 ((19)

Now that we have m and b, we can find the gas concentration for any ratio with the
following formula:

log(x) = {log(y) − b} / m……………………………………..(20)

However, in order to get the real value of the gas concentration according to the log-log plot
we need to find the inverse log of x:

x = 10 ^ [{log(y)−b] / m] ……………………………………(21)

Using eqns. 9 and 21, we will be able to convert the sensor output values into PPM (Parts per
Million). Now we developed the Code and flashed into the Node MCU giving proper
connections.

20 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

SOFTWARE CODE for Calibration of MQ135 Sensor:

void setup()
{
Serial. begin(9600); //Baud rate
Pin Mode(A0,INPUT);
}

void loop()
{
float sensor_volt; //Define variable for sensor
voltage float RS_air; //Define variable for sensor
resistance float R0; //Define variable for R0
float sensorValue=0.0; //Define variable for analog readings
Serial.print("Sensor Reading = ");
Serial.println(analogRead(A0));

for(int x = 0 ; x < 500 ; x++) //Start for loop


{
sensorValue = sensorValue + analogRead(A0); //Add analog values of sensor 500 times
}
sensorValue = sensorValue/500.0; //Take average of readings
sensor_volt = sensorValue*(5.0/1023.0); //Convert average to voltage
RS_air = ((5.0*1.0)/sensor_volt)-1.0; //Calculate RS in fresh air
R0 = RS_air/3.7; //Calculate R0

Serial.print("R0 = "); //Display "R0"


Serial.println(R0); //Display value of R0
delay(1000); //Wait 1 second

4.3 Execution of the Main Program

#include <ESP8266WiFi.h>
#include <DHT.h>
#include <Thing Speak.h>

DHT dht(D5, DHT11);


#define LED_GREEN D2
#define LED_YELLOW D3
#define LED_RED D4
#define MQ_135 A0 int
ppm=0; float m = -0.3376;

21 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

//Slope float b = 0.7165;


//Y-Intercept
float R0 = 3.12;
//Sensor Resistance in fresh air from previous code

WiFiClient client;

long myChannelNumber = 123456; // Channel id


const char myWriteAPIKey[] = "API_Key";

void setup()
{
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(LED_GREEN,OUTPUT);
pinMode(LED_YELLOW,OUTPUT);
pinMode(LED_RED,OUTPUT);
pinMode(MQ_135, INPUT);
WiFi.begin("WiFi_Name", "WiFi_Password");
while(WiFi.status() != WL_CONNECTED)
{
delay(200);
Serial.print(".");
}
Serial.println();
Serial.println("Node MCU is
connected!");
Serial.println(WiFi.localIP());
dht.begin();
Thing Speak.begin(client);
}

void loop()
{
float sensor_volt; //Define variable for sensor voltage
float RS_gas; //Define variable for sensor resistance
float ratio; //Define variable for ratio
int sensorValue;//Variable to store the analog values from MQ-135
float h;
float t;
float ppm_log; //Get ppm value in linear scale according to the the ratio
value float ppm; //Convert ppm value to log scale
h = dht.readHumidity();
delay(4000);
t = dht.readTemperature();

22 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

delay(4000);
sensorValue = analogRead(gas_sensor); //Read analog values of sensor
sensor_volt = sensorValue*(5.0/1023.0); //Convert analog values to voltage
RS_gas = ((5.0*1.0)/sensor_volt)-1.0; //Get value of RS in a gas
ratio = RS_gas/R0; // Get ratio RS_gas/RS_air
ppm_log = (log10(ratio)-b)/m; //Get ppm value in linear scale according to the ratio value
ppm = pow(10, ppm_log); //Convert ppm value to log scale

Serial.println("Temperature: " + (String) t);


Serial.println("Humidity: " + (String) h);
Serial.println("Our desired PPM = "+ (String) ppm);

ThingSpeak.writeField(myChannelNumber, 1, t, myWriteAPIKey);
delay(20000);
ThingSpeak.writeField(myChannelNumber, 2, h, myWriteAPIKey);
delay(20000);
ThingSpeak.writeField(myChannelNumber, 3, ppm, myWriteAPIKey);
delay(20000);

if(ppm<=100)
{
digitalWrite(LED_GREEN,HIGH);
digitalWrite(LED_YELLOW,LOW);
digitalWrite(LED_RED,LOW);
}
else if(ppm<=200)
{
digitalWrite(LED_GREEN,LOW);
digitalWrite(LED_YELLOW,HIGH);
digitalWrite(LED_RED,LOW);
}
else
{
digitalWrite(LED_GREEN,LOW);
digitalWrite(LED_YELLOW,LOW);
digitalWrite(LED_RED,HIGH);
}
delay(2000);
}

23 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

Chapter 5

RESULTS

The working of the designed prototype has been investigated for the 5 sets of experiments as
described in the following sections

EXPERIMENT 1:

Aim: To demonstrate the working of the system in a warm and humid outdoor atmosphere.

Experimental Condition: The experiment was performed on a warm sunny day in a local
outdoor area.

Observations in Thing Speak Cloud:

Fig: 5.1 Observations for Experiment 1

24 | Page
IOT BASED AIR POLLUTION MONITORING SYSTEM

Setup:

Fig: 5.2 Setup for Experiment 1

Conclusion: We have taken the reference from the Samsung mobile weather app for
verifying the values. It matched with a +1.20 error with the temperature data, +5 error with
the humidity data and +0.11 error with the PPM data. Hence, we can conclude that the setup
has measured the temperature and humidity around the setup area successfully.

EXPERIMENT 2:

Aim: To demonstrate the working of the system in the presence of alcoholic gases.

Experimental Condition: The experiment was performed indoor in the presence of


alcoholic gases. Drops of an alcoholic mixture (hand sanitiser) were used to produce
alcoholic vapours.

Observations in Thing Speak Cloud:

25 | Page
IOT BASED AIR POLLUTION MONITORING SYSTEM

Fig: 5.3 Observations for Experiment 2

Conclusion:

We can observe from the results that the presence of alcohol vapours near the setup can be
easily detected by the system. We have taken the reference from the Samsung mobile weather
app for verifying the values. It matched with a +1.30 error with the temperature data, +5 error
with the humidity data and +0.25 error with the PPM data. Hence, it can be concluded that
we can detect the presence of alcoholic vapours with the help of this monitoring system.

EXPERIMENT 3:

Aim: To demonstrate the working of the system in smoky conditions.

Experimental Condition: The experiment was performed in the presence of smoke coming
from an incense stick placed near the setup.

26 | Page
IOT BASED AIR POLLUTION MONITORING SYSTEM

Observations in Thing Speak Cloud

Fig: 5.5 Observations for Experiment 3

Setup:

Conclusion:

27 | Page
IOT BASED AIR POLLUTION MONITORING SYSTEM

We can observe from the results that the presence of smoke near the setup can be easily
detected by the system. We have taken the reference from the Samsung mobile weather app
for verifying the values. It matched with a +1.80 error with the temperature data, +4 error
with the humidity data and -0.7 error with the PPM data. Hence, it can be concluded that we
can detect the presence of smoke with the help of this monitoring system.

EXPERIMENT 4:

Aim: To demonstrate the working of the system in a warm and humid outdoor atmosphere.

Experimental Condition: The experiment was performed at night.

Observations in Thing Speak Cloud:

Fig: 5.7 Observations for Experiment 4

28 | Page
IOT BASED AIR POLLUTION MONITORING SYSTEM

Setup:

Fig: 5.8 Setup for Experiment 4

Conclusion:

We have taken the reference from the Samsung mobile weather app for verifying the values.
It matched with a +1.20 error with the temperature data, +5 error with the humidity data and
0.08 error with the PPM data. Hence, we can conclude that the setup has measured the
temperature and humidity around the setup area successfully.

EXPERIMENT 5:

Aim: To demonstrate the working of the system in an air-conditioned indoor atmosphere.

Experimental Condition: The experiment was performed at room temperature.

Observations in Thing Speak Cloud:

29 | Page
IOT BASED AIR POLLUTION MONITORING SYSTEM

Fig: 5.9 Observations for Experiment 5

Setup:

Fig: 5.10 Setup for Experiment 5

Conclusion:

We have taken the reference from the Samsung mobile weather app for verifying the values.
It matched with a +0.6 error with the temperature data, +2 error with the humidity data and -
0.03 error with the PPM data. Hence, we can conclude that the setup has measured the
temperature and humidity around the setup area successfully.

Table 5.1: Experimental Results


Temperature (in celsius) Humidity (in %) Air Quality (in ppm)
Samsung Samsung
Expt. Samsung
Project Weather Project Project Weather
No. Error Weather App Error Error
Reading App Reading Reading App
Reading Reading Reading

1 34.2 33 1.2 70 65 5 8.61 8.5 0.11


2 33.3 32 1.3 70 65 5 42.25 42 0.25
3 33.8 32 1.8 74 70 4 52.3 53 -0.7
4 34.2 33 1.2 74 69 5 4.26 4.34 -0.08
5 22.6 22 0.6 59 57 2 0.67 0.7 -0.03

30 | Page
Chapter 6
CONCLUSION

In this project IoT based on measurement and display of Air Quality Index (AQI), Humidity
and Temperature of the atmosphere have been performed. From the information obtained
from the project, it is possible to calculate Air Quality in PPM. The disadvantage of the
MQ135 sensor is that specifically it can’t tell the Carbon Monoxide or Carbon Dioxide level
in the atmosphere, but the advantage of MQ135 is that it is able to detect smoke, CO, CO2,
NH4, etc harmful gases.

After performing several experiments, it can be easily concluded that the setup is able to
measure the air quality in ppm, the temperature in Celsius and humidity in percentage with
considerable accuracy. The results obtained from the experiments are verified through
Google data. Moreover, the led indicators help us to detect the air quality level around the
setup. However, the project experiences a drawback that is it cannot measure the ppm values
of the pollutant components separately. This could have been improved by adding gas sensors
for different pollutants. But eventually, it would increase the cost of the setup and not be a
necessary provision to monitor the air quality. Since it’s an IOT-based project, it will require
a stable internet connection for uploading the data to the Thing Speak cloud. Therefore, it is
possible to conclude that the designed prototype can be utilized for air quality, humidity and
temperature of the surrounding atmosphere successfully.

31 |
IOT BASED AIR POLLUTION MONITORING SYSTEM

REFERENCES

[1] https://gaslab.com/blogs/articles/carbon-monoxide-levels
[2] https://www.instructables.com/Measuring-Humidity-Using-Sensor-DHT11
[3] https://pdf1.alldatasheet.com/datasheet-pdf/view/1307647/WINSEN/MQ135.html
[4] https://components101.com/development-boards/nodemcu-esp8266-pinout-
featuresand-datasheet
[5] https://www.arduino.cc
[6] https://thingspeak.com
[ 7 ] Pasha, S. (2016). Thing Speak based sensing and monitoring system for IoT with Matlab
Analysis. International Journal of New Technology and Research, 2(6).
[ 8 ] Kumar, N. S., Vuayalakshmi, B., Prarthana, R. J., & Shankar, A. (2016, November).
IOT based smart garbage alert system using Arduino UNO. In 2016 IEEE Region 10
Conference (TENCON) (pp. 1028-1034). IEEE.
[ 9 ] IoT based Air Quality monitoring system using MQ135 & MQ7 with Machine Learning
analysis by Kinnera Bharath Kumar Sai M.Tech CSE VIT University, Vellore Subhaditya
Mukherjee B.Tech CSE VIT University, Vellore Dr. Parveen Sultana H Associate
Professor Department of CSE, VIT University.
[ 10 ] https://www.codrey.com/electronic-circuits/how-to-use-mq-135-gas-sensor

32 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

Page

Appendix

A.1 PIN DESCRIPTION OF NODEMCU


Pinout diagram of the Node MCU:

Description:

Pin Category Name Description

Power Micro-USB, Micro-USB: Node MCU can be powered through the


3.3V, GND, Vin USB port

3.3V: Regulated 3.3V can be supplied to this pin to


power the board

GND: Ground pins

Vin: External Power Supply

33 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

Control Pins EN, RST The pin and the button reset the microcontroller

Analog Pin A0 Used to measure analog voltage in the range of 0-3.3V

GPIO Pins GPIO1 to Node MCU has 16 general purpose input-output pins on
GPIO16 its board

SPI Pins SD1, CMD, Node MCU has four pins available
for SPI communication.
SD0, CLK

UART Pins TXD0, RXD0, Node MCU has two UART interfaces, UART0 (RXD0
TXD2, RXD2 & TXD0) and UART1 (RXD1 & TXD1). UART1 is
used to upload the firmware/program.

I2C Pins Node MCU has I2C functionality support but due to the
internal functionality of these pins, you have to find
which pin is I2C.

34 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

A.2 DESCRIPTION OF SOFTWARE LIBRARIES USED


ESP8226WiFi Library

The ESP8266WiFi library provides a wide collection of C++ methods (functions) and
properties to configure and operate an ESP8266 module.

Commands used are as follows:

• WiFi.begin(“ WiFi Name”, “WiFiPassword”); Command to connect with WiFi


network.
• WiFi.status(); To check the status of the connection.
If it returns – WL_CONNECTED WiFi is connected
If it returns – WL_IDLE_STATUS WiFi is connected but no internet found
If it returns – WL_CONNECT_FAILED WiFi is not connected

DHT11 sensor Library

The DHT sensor library provides a wide collection of C++ methods (functions) and properties
to configure and operate the DHT11 sensor module.

The commands used are as follows:

• DHT dht(D5, DHT11); Set the pin for reading data.


• dht.begin(); Command to connect with DHT11 sensor module.
• dht.readTemperature(); Returns the value of the temperature in Celsius.
• dht.readHumidity(); Returns the value of humidity in percentage.

Thing Speak Library

The Thing Speak library provides a wide collection of C++ methods (functions) and
properties to configure and operate the Thing Speak cloud.

The commands used are as follows:

• ThingSpeak.writeField(myChannelNumber, 1, t, myWriteAPIKey); To upload data in


the Thing Speak Field.

35 | P a g e
IOT BASED AIR POLLUTION MONITORING SYSTEM

A.3 COST ESTIMATION OF THE PROJECT


For making the project we have used the following components (as mentioned in Table 2).
As per the pricing on the online websites for electronic components, we have formulated a
cost estimation.

Table 2: Cost Estimation of the Project


Components Price (in Rs)
NodeMCU V3 288
DHT11 Sensor Module 120
MQ135 Gas Sensor Module 135
Connecting Wires 60
LEDs (Red, Green & Yellow) 9
AC-DC Power Adapter 120
Female PCB Berg Terminal and cable 80
Veroboard 100
Breadboard 70

Total 982

36 | P a g e

You might also like