Soni Projectfinal
Soni Projectfinal
By
Sanna Praveen
Professor & HOD
Department of Electrical and Electronics Engineering
_____________________________ ____________________________
_______________________________
ACKNOWLEDGEMENT
It is our great fortune that we have had an opportunity to carry out this project work under
the supervision of Dr. Debasish Mondal in the Department of Electrical Engineering, RCC
Institute of Information Technology (RCCIIT), Canal South Road, Beliaghata, Kolkata-
700015, affiliated to Maulana Abul Kalam Azad University of Technology (MAKAUT),
West Bengal, India. We express our sincere thanks and deepest sense of gratitude to our guide
for his constant support, unparalleled guidance, and limitless encouragement.
We wish to convey our gratitude to Dr. Debasish Mondal, HOD, Department of Electrical
Engineering, RCCIIT, and the authority of RCCIIT for providing all kinds of infrastructural
facilities for the research work.
We would also like to convey our gratitude to all the faculty members and staff of the
Department of Electrical Engineering, RCCIIT for their wholehearted cooperation in making
this work turn into reality.
Place: Gaya
Date: 25th Feb, 2024
TABLE OF CONTENTS
ABSTRACT ................................................................................................................................... ii
1.1 Aim……………………………………………………………………….......................01
DEPARTMENT OF EEE, GCE
1.2 Literature Survey…………………………………………………………………..01-02
3.2 Hardware Model to Preheat and Calibrate MQ-135 Gas Sensor Module………12-13
REFERENCES .............................................................................................................................30
APPENDIX
i
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
ii
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 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, NodeMCU 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 NodeMCU which displays the monitored data in the
ThingSpeak 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.
iii
Chapter1
INTRODUCTION
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, and 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. The Internet of Things (IoT)is
nowadays finding profound use in every sector and 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.
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 concerning fresh air, alcohol, carbon dioxide, hydrogen,
and methane. In this project, it has been calibrated concerning fresh air [9], [10].
1|Page
In [4] the controlling action of NodeMCU 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]. ThingSpeak 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 withdraws 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 NodeMCU alone is not sufficient to drive two
sensors [9].
Chapter 2
THEORY & DESCRIPTION OF THE COMPONENTS
3|Page
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 processes, 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.
In this project, we have tried to implement the concept of IoT to monitor the temperature,
humidity, and air quality of the surroundings
SOFTWARE COMPONENTS
1. ThinkSpeak Cloud
2. Arduino IDE
4|Page
2.3 Brief Description of the Components
NodeMCU V3
NodeMCU 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 Espressif
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.
5|Page
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.
6|Page
Fig 2.4 (MQ-135 Gas Sensor Module)
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 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
7|Page
supply delivers electricity to devices that would typically run on batteries or have no other
Fig 2.6 AC-DC Power Adapter
power source.
Resistors
8|Page
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, 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 a 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 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
ThingSpeak Cloud
9|Page
ThingSpeak 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. ThingSpeak was
originally launched by ioBridge in 2010 as a
service in support of IoT applications.
ThingSpeak has integrated support from the
numerical computing software MATLAB
Fig 2.10 ThingSpeak Cloud
10 | P a g e
Chapter 3
HARDWARE MODEL
STEP 1: The Vcc pin of the DHT11 sensor module was connected with the VU pin of
NodeMCU.
STEP 2: The Gnd pin of the DHT11 sensor module was connected with the Gnd pin
of NodeMCU.
STEP 3: The NodeMCU is powered with a 12V DC via AC-DC adapter for 20 minutes.
STEP 4: The setup was then disconnected.
11 | P a g e
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 NodeMCU.
STEP 2: The Gnd pin of the MQ-135 gas sensor module was connected with the Gnd pin
of NodeMCU.
STEP 3: The NodeMCU is powered with a 12V DC via AC-DC adapter for a day.
STEP 4: The setup was then disconnected.
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 NodeMCU.
STEP 2: The Gnd pin of the MQ-135 gas sensor module was connected with the Gnd pin
of NodeMCU.
STEP 3: The analog DATA pin of the MQ-135 gas sensor module was connected with the
A0 Pin of the NodeMCU.
12 | P a g e
STEP 4: The software code to calibrate the sensor is then uploaded to the NodeMCU and
the value of R0in fresh air is collected from the serial monitor of the Arduino IDE.
STEP 5: The setup was then disconnected.
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
NodeMCU.
STEP 3: The analog DATA pin of the MQ-135 gas sensor module was connected with the
A0 Pin of the NodeMCU.
STEP 4: The DATA pin of the DHT11 sensor module was connected with the D0 pin of
the NodeMCU.
STEP 5: The anode of the three LED indicators (green, yellow, and red) were connected
to the D2, D3, and D4 pins of the NodeMCU respectively.
STEP 6: The software code to execute the project was then uploaded to the NodeMCU.
13 | P a g e
STEP 7: The setup was then powered with a 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.
14 | P a g e
Chapter 4
SOFTWARE IMPLEMENTATION
15 | P a g e
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,
16 | P a g e
Fig. 4.1 (Internal Circuit diagram of MQ-135 sensor)
I = ……………………………………………………..(1)
I= ……………………........................................... (2)
From Fig 4.1, we can obtain the output voltage at the load resistor using the value obtained
for me and Ohm’s Law at a constant temperature, V = I x R.
Eqn. 9 helps us to find the internal sensor resistance for fresh air.
17 | P a g e
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 ineqn. 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)
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:
18 | P a g e
m = {logy − log(y0)} / { log − log(x0)} ...........................(13)
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)
b=
1.13…………………………………………………………(19)
Now that we have m and b, we can find the gas concentration for any ratio with the
following formula:
However, 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 eq. 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 it into the NodeMCU giving proper
connections.
void setup()
{
19 | P a g e
Serial.begin(9600); //Baud rate
pinMode(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));
WiFiClient client;
20 | P a g e
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("NodeMCU is
connected!");
Serial.println(WiFi.localIP());
dht.begin();
ThingSpeak.begin(client);
}
void loop() { float sensor_volt; //Define a variable for sensor voltage float
RS_gas; //Define a variable for sensor resistance float ratio; //Define a
variable for ratio int sensor value;//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 ratio value float ppm; //Convert ppm value to log scale h =
dht. read humidity(); delay(4000); t = dht. read temperature(); delay(4000);
ThingSpeak.writeField(myChannelNumber, 1, t, myWriteAPIKey);
delay(20000);
ThingSpeak.writeField(myChannelNumber, 2, h, myWriteAPIKey);
delay(20000);
21 | P a g e
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);}
22 | P a g e
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.
23 | Page
Fig: 5.1 Observations for Experiment 1
Setup:
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.
24 | Page
Fig: 5.3 Observations for Experiment 2
Conclusion:
We can observe from the results that the presence of alcohol vapors 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
25 | Page
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 vapors with the help of this monitoring system.
EXPERIMENT 3:
Experimental Condition: The experiment was performed in the presence of smoke coming
from an incense stick placed near the setup.
26 | Page
Setup:
Conclusion:
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, a +4 error
with the humidity data, and a -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.
27 | Page
Fig: 5.7 Observations for Experiment 4
Setup:
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, a +5 error with the humidity data,
and a 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:
28 | Page
Fig: 5.9 Observations for Experiment 5
Setup:
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, a +2 error with the humidity data, and
a -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.
29 | Page
Expt. Samsung Samsung
No. Weather Samsung Weather
Project Project Project
App Error Weather App Error App Error
Reading Reading Reading
Reading Reading Reading
30 | Page
Chapter 6
CONCLUSION
In this project, IoT based on the measurement and display of Air Quality Index (AQI),
Humidity, and Temperature of the atmosphere has 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 can detect smoke, CO, CO2,
NH4, etc harmful gases.
After performing several experiments, it can be easily concluded that the setup can 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 ThinkSpeak 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 |
Page
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). ThingSpeak-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 |
Page
Appendix
Description:
33 | P a g e
Power Micro-USB, Micro-USB: NodeMCU can be powered through the
3.3V, GND, Vin USB port
34 |
Control Pins EN, RST The pin and the button reset the microcontroller
SPI Pins SD1, CMD, NodeMCU has four pins available for SPI
SD0, CLK communication.
UART Pins TXD0, RXD0, NodeMCU has two UART interfaces, UART0 (RXD0
TXD2, RXD2 & TXD0) and UART1 (RXD1 & TXD1). UART1 is
used to upload the firmware/program.
I2C Pins NodeMCU has I2C functionality support but due to the
internal functionality of these pins, you have to find
which pin is I2C.
35 | P a g e
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.
The DHT sensor library provides a wide collection of C++ methods (functions) and properties
to configure and operate the DHT11 sensor module.
ThinkSpeak Library
The ThinkSpeak library provides a wide collection of C++ methods (functions) and properties
to configure and operate the ThinkSpeak cloud.
36 | P a g e
• ThingSpeak.writeField(myChannelNumber, 1, t, myWriteAPIKey); To upload data in
the ThinkSpeak Field.
Total 982
37 | P a g e