organized
organized
We hereby declare that the project work entitled “IoT and Cloud Based Air
Monitoring System for Real-Time Air Quality Tracking and Alert System”
is an authentic record of our own work carried out as requirements of
Capstone Project for the award of B. Tech degree in Computer Science and
Engineering from Lovely Professional University, Phagwara, under the
guidance of Dr. Senthil Kumar Janahan, during August to November 2024.
All the information furnished in this capstone project report is based on our
own intensive work and is genuine.
ii
CERTIFICATE
This is to certify that the declaration statement made by this group of students
is correct to the best of my knowledge and belief. They have completed this
Capstone Project under my guidance and supervision. The present work is the
result of their original investigation, effort and study.
No part of the work has ever been submitted for any other degree at any
University. The Capstone Project is fit for the submission and partial
fulfillment of the conditions for the award of B. Tech degree in Information
Technology from Lovely Professional University, Phagwara.
iii
ACKNOWLEDGEMENT:
The success and final outcome of this project required a lot of guidance and
assistance from many people and we are extremely privileged to have got this
all along with the completion of this project. All that we have done is only
due to such supervision and assistance and we would not forget to thank
them. We respect and thank Lovely Professional University, for providing us
an opportunity to do the project work and giving all the support and guidance
required completing the project. We are extremely thankful to the whole team
for providing such a support and guidance. We express our deep gratitude to
our mentors and faculties, who took keen interest on our project work and
guided us all along, till the completion of this work by providing all the
necessary information for developing a good skill. We must be thankful and
fortunate enough to get constant encouragement, support and guidance from
the HOD, Teaching staff of School of Computer Science and Engineering
which helped us in the successful completion of the project work. At last, we
would also like to thank the teachers who will evaluate us for this project and
for spending their valuable time in evaluating us.
iv
TABLE OF CONTENTS
1. INTRODUCTION
1.1 Purpose of the Project
1.2 Existing System
1.3 Proposed System
2. LITERATURE SURVEY
3. AIM AND SCOPE OF THE PRESENT INVESTIGATION
3.1 Aim of the System
3.2 Scope of the System
5.1 Introduction
5.2 Hardware and Software requirements
5.3 Circuit Diagram
5.4 Arduino UNO Board
5.4.1 Overview
5.4.2 Summary
5.4.3 Power
5.4.4 Memory
5.4.5 Communication
5.4.6 Programming
5.4.7 USB Overcurrent Protection
5.4.8 Physical Characteristics
1
5.5. ESP8266 WIFI Module
5.5.1 ESP8266 – 01 Features
5.5.2 Working of WIFI Module
5.6 Buzzer Module
5.6.1 Specifications
5.6.2 Working
5.7 Dust Sensor
5.8 MQ135 Gas Sensor
5.9 DHT11 Temperature and Humidity Sensor
5.10 LCD Display
5.11 Thingspeak IoT Platform
5.12 Working Explanation
REFERENCES
A. SOURCE CODE
B. PLAGIARISM REPORT
2
1.INTRODUCTION
A healthy environment is the first and foremost thing for our happiness. We need a
pollution free surrounding for living a safe and secure life. The recent increase in
pollution levels in metropolitan cities, especially in Delhi, is a worrying sign. In the
world that is advancing rapidly with technology where cars could drive on their own
and drones could capture your food, air pollution should not be of much concern but
the above statistics just proves it wrong. Our application is one such thing which can
provide the surrounding air quality index to the user. This is a basic level system
which notifies the user of the various pollutants and their levels present in air. We
have also additionally included a buzzer alarm which notifies the user when the
pollutants level breaches a certain threshold mark. This will make the user
understand that the place is not healthy and safe to live. So, the user can now take
necessary steps to reduce air pollution, or move to a safer location. The concept of
IoT allows us to store the data containing the types and amount of pollutants present
in air so that the user can analyze the changes that happens over a period of time.
So the user can decide whether the air quality is improving or reducing over a period
of time. There is an urgent need for these kind of systems which can be availed by
any person especially in places which are heavily polluted. We can therefore think of
curbing our daily human activities which leads to air pollution after making thorough
analysis of the data. This gives us an opportunity to research on why pollution level
is increasing or what good things need to be continued when the pollution level is
decreasing. These kind of decisions could be arrived through the data that the user
gets through our system.
3
1.1 Purpose of the Project:
In this modern world, technology provides us many useful features which can be
implemented to have a healthy and safe environment. We all are aware of the fact
that in places like Delhi and other metropolitan cities, the air quality index is changing
from bad to worse. People living in such places should necessarily carry
an air pollution monitoring system consisting of all facilities to keep track of air quality
index and take necessary steps to improve quality of air in immediate surroundings.
The existing system is in such a way that it cannot store the data that the air pollution
monitoring system provides as an output. It naturally means that it just provides a
facility to display the data but the user cannot perform analysis on the data and
employ his own methods to tackle air pollution in his location. Also, the existing
system does not make use of dust sensor to detect particle pollution. Hence our
system would solve the aforementioned problems faced by the users in storing the
data apart from detecting particle pollution.
Demerits:
a) The existing system does not have provision for storing data.
b) Does not detect particle pollution.
c) There is no low cost affordable system available.
d) No system available for daily usage.
e) Complex systems and requires high maintenance.
4
temperature and humidity of the surrounding. The system also provides an alarm so
that the user is made aware of the fact that the surrounding air is not safe for living
and the user should take necessary actions to help reduce air pollution. This makes
it a simple system which effectively provides valuable inputs to the user regarding the
air quality.
Merits:
5
2.LITERATURE SURVEY
6
14. Chaturvedi, A., & Shrivastava, L. (2020, April). IOT Based Wireless Sensor
Network for Air Pollution Monitoring.
15. Kaivonen, S., & Ngai, E. C. H. (2020). Real-time air pollution monitoring with
sensors on city bus.
16. Srivastava, H., Mishra, S., Das, S. K., & Sarkar, S. (2020). An IoT-Based
Pollution Monitoring System Using Data Analytics Approach.
17. Patil, N. M., Jain, R., Sankhe, S., Vichare, K., & Wankhede, A. (2018). IoT
based Environment Pollution Monitoring System.
18. Guanochanga, B., Cachipuendo, R., Fuertes, W., Salvador, S., Benítez, D. S.,
Toulkeridis, T., ..... & Meneses, F. (2018, November). Real-time air pollution
monitoring systems using wireless sensor networks connected in a cloud-
computing, wrapped up web services.
19. Balasubramaniyan, C., & Manivannan, D. (2016). Iot enabled air quality
monitoring system (AQMS) using raspberry Pi.
20. Bapat, P., Sengunthar, K., Shenvi, K., & Khade, A. IOT based Air and Sound
Pollution Monitoring System.
We have also taken a cue from works done by Parveen Sulthana, Pramod
Sharma and Vijayakumar Sajjan. We have taken all these works as a reference
and have done it using different methodologies apart from doing as much as
possible to eliminate the cons in the related work.
One such work is an IoT-based real time air pollution monitoring system proposed
to monitor the pollution levels of various pollutants in Coimbatore city. The
geographical area is classified as industrial, residential and traffic zones. It
proposes an IoT system that could be deployed at any location and store the
measured value in a cloud database, perform pollution analysis, and display the
pollution level at any given location.
7
3.AIM AND SCOPE OF THE PRESENT INVESTIGATION
• The system focuses mainly on one thing, that is to ensure every person gets
to afford a low cost air pollution monitoring system for daily usage.
• To ensure the user gets to store the data containing the pollutant types and
their amount. This is necessary for the user to be aware of the surroundings
and how it has changed over the past few days or years in terms of air quality.
• To ensure that the user gets a warning when the pollution increases to an
extent where it is not feasible for survival.
• To cover all types of harmful gases present in air, apart from particle
pollutants.
• To keep track of the temperature and humidity readings to infer more about
the surrounding air.
• To facilitate the user in carrying out detailed analysis regarding the air quality
and take effective work to neutralize the shortcomings.
• To provide uninterrupted service even during power shutdowns.
• To visualize the data in whatever format the user wishes to, i.e., graphical
form, tables, bar graphs, etc.
• To provide a risk free experience throughout the time the user makes use of
the system.
• To ensure a provision to upgrade into a newer version consisting of additional
features.
3.2 Scope of the system:
• There are also other places where day by day the pollution level is increasing
rapidly.
8
• Since our system is a low cost one, it covers most of the people since it can
be afforded by anyone. And anybody with the knowledge of using smart
phones or computers can easily use our system.
• Since our system can also detect LPG gas, there is another scenario in which
our system can also be used for detecting LPG gas leakage. So, ours is a
multi-purpose system.
• Our system makes use of MQ135 Gas sensor. It can cover most of the harmful
gases including CO2, Ammonium gases, Nitrogen gases, and other harmful
gases.
• In the future, there is a provision to go even deeper by making use of additional
sensors and we can display indepth details of the surrounding air. By this way,
we can cover more properties of the air.
• We can also make use of other concepts like Big Data and Machine Learning
which can allow the system itself to perform predictive analysis on the air
quality and provide details like how the quality of air might turn out to be after
few years, by making use of the data collected over a period of time. These
kind of provisions are left in our system where we can do the necessary coding
and upload it to our Arduino UNO board, which in turn carries out the
instructions.
• We can also add features to send real-time data continuously without any
interruptions. And along with an alarm, we can also send a warning message
and email to the user.
9
4.SYSTEM DESIGN AND METHODOLOGY
User
10
4.3 Flowchart:
11
5.EXPERIMENTAL OR MATERIALS AND METHODS; ALGORITHMS
USED
5.1 Introduction:
This project is loaded with arduino software IDE which controls the microprocessor
connected with sensor and the ESP8266 WIFI module. This is connected to an IoT
cloud platform to display the result and the output data of the system. The Internet of
things (IoT) describes the network of physical objects, 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. The internet of
things helps people live and work smarter, as well as gain complete control over their
lives. In addition to offering smart devices to automate homes, IoT is essential to
business. IoT provides businesses with a real-time look into how their systems really
work, delivering insights into everything from the performance of machines to supply
chain and logistics operations.
.
5.2 Hardware and Software Requirements :
12
5.3 Circuit Diagram:
The hardware part of this project is very easy to put together. First of all, makethe
connections for all the sensors and the display board with the Arduino UNO board.
The illustration of all the sensors, buzzer and the display board connections with
Arduino UNO board is shown in the following figures. We have used analog pins to
recognize the variations in the values detected by the sensors.
The Dust Sensor needs to be connected to analog pin A2 of the Arduino UNO Board.
The MQ135 Gas Sensor needs to be connected with analog pin A0 of the Arduino
UNO board which has been demonstrated in the following figure.
13
(Fig: 5.2: Gas Sensor Connection)
The DHT11 Temperature and Humidity Sensor needs to be connected to the analog
pin A1 of the Arduino UNO Board.
Make the connections for the buzzer module and the Arduino. Connect the positive
pin on the buzzer with pin 7 on the Arduino and the buzzer's negative pin with the
GND pin on the Arduino as illustrated below.
14
(Fig: 5.4: Buzzer connection)
The analog pin A3 is used for connecting the display board to the Arduino UNO
Board. It is illustrated as in the following figure.
It is important to have a WIFI Module to send the data to the cloud platform for
visualization purposes. Hence, we have used an ESP8266 WIFI Module to send data
to Thingspeak IoT platform.
The WIFI module is connected to the Arduino board as follows:
15
(Fig : 5.6: WIFI Module Connection)
5.4.1. Overview:
The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It has
14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analogue inputs,
a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a
reset button. It contains everything needed to support the microcontroller; simply connect
it to a computer with a USB cable or power it with an AC-to-DC adapter or battery to
getstarted. The Uno differs from all preceding boards in that it does not use the FTDI
USB-to-serial driver chip. Instead, it features the ATmega16U2 (ATmega8U2 up to
version R2) Programmed as a USB-to-serial converter.
Pinout: added SDA and SCL pins that are near to the AREF pin and two othernew
pins placed near to the RESET pin, the IOREF that allow the shields to adapt to the
voltage provided from the board. In future, shields will be compatible both with the
board. In future, shields will be compatible with both the boards that use the AVR,
which operate with 5V and with the Arduino Due that operate with 3.3V.
16
The second one is not connected pin that is reserved for future purposes.
“Uno” means one in Italian and is named to mark the upcoming release of Arduino
1.0.
The Uno and version 1.0 will be the reference versions of Arduino, moving forward.
The Uno is the latest in a series of USB Arduino boards, and the reference model for
the Arduino platform; for a comparison with previous versions, see the index of
Arduino boards.
5.4.2 Summary:
• Microcontroller Atmega328
• Operating Voltage 5V
• Input Voltage (recommended) 7-12V
• Input Voltage (limits) 6-20V
• Digital I/O Pins 14 (of which 6 provide PWM output)
• Analog Input Pins 6
• DC Current per I/O Pin 40mA
• DC Current for 3.3V Pin 50mA
• Flash Memory 32 KB (Atmega328) of which 0.5KB used by boot loader
• SRAM 2KB (Atmega328)
• EEPROM 1KB (Atmega328)
• Clock Speed 16 MH
17
(Fig: 5.7: Arduino Uno PIN Description)
5.4.3 Power:
The Arduino Uno can be powered via the USB connection or with an external power
supply. The power source is selected automatically. External (non-USB) power can
come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be
connected by plugging a 2.1mm centre-positive plug into the board’s power jack.
Leads from a battery can be inserted in the ground and VIN pin headers of the
POWER connector. The board can operate on an external supply of 6 to 20 volts. If
supplied with less than 7V, however, the 5V pin may supply less than five volts and
the board may be unstable. If using more than 12V, the voltage regulator may
overheat and damage the board. The recommended range is 7 to 12 volts. The power
pins are as follows:
18
• VIN: The input voltage to the Arduino board when it’s using an external power
source (as opposed to 5 volts from the USB connection or other regulated
power source). You can supply voltage through this pin, or, if supplying voltag
evia the power jack, access it through this pin.
• 5V: This pin outputs a regulated 5V from the regulator on the board. The board
can be supplied with power either from DC power jack (7-12V), the USB
connector (5V), or the VIN pin of the board (7-12V). Supplying voltage viathe
5V or 3.3V pins bypasses the regulator, and can damage your board. We don’t
advice it.
• 3V3: A 3.3 volt supply generated by the on-board regulator. Maximum current
draw is 50mA.
• GND: Ground pins.
5.4.4 Memory:
The Atmega328 has 32 KB (with 0.5 KB used for the boot loader). It also has 2 KB of
SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).
Input and Output: Each of the digital pins on the Uno can be used as an input or
output, using pin mode (), Digital write (), and digital read () functions. They operate
at 5 volts. Each pin can provide or receive a maximum of 40mA and has an internal
pull-up resistor (disconnected by default) of 20-50 kms. In addition, some pins have
specialized functions:
• Serial: 0 (RX) and 1(TX). Used to receive (RX) and transmit (TX) TTL
serial data. These pins are connected to the corresponding pins of
Atmega8U2 USB-to-TTL Serial chip.
• External Interrupts: 2 and 3. These pins can be configured to trigger
an interrupt on a low value, a rising or falling edge, or a change in value.
See the attach interrupt () function for details.
• PWM: 3, 5, 6, 9, 10 and 11. Provide 8-bit PWM output with the analogue
write () function. SPI: 10(SS), 11 (MOSI), 12 (MISO), 13 (SCK). These
pins support SPI communication using the SPI library.
• LED: 13. There is a built-in LED connected to digital pin 13. When the
pin is HIGH value, the LED is on, when the pin is LOW, it’s off.
19
The Uno has 6 analogue inputs, labeled A0 through A5, each of which provides 10
bits of resolution (i.e. 1024 different values). By default they ensure from ground to 5
volts, though is it possible to change the upper end of their range using the AREF pin
and the analogue reference () function. Additionally, some pins have specialized
functionality:
5.4.5 Communication
• The ‘16U2’ firmware uses the standard USB COM drivers, and no external
driver is needed. However, on Windows, an .inf file is required. The Arduino
software includes a serial monitor which allows simple textual data to be sent
to and from the Arduino board. The RX and TX LEDS on the board will flash
when the data is being transmitted via the USB-to-serial chip and USB
connection to the computer (but not for serial communication on pins 0 and 1).
• A software serial library allows for serial communication on any of the UNO’s
digital pins.
20
• The ATmega328 also supports I2C (TWI) and SPI communication. The
Arduino software includes the wire library to simplify use of the I2C; see the
documentation for details. For SPI communication, use the SPI library.
5.4.6 Programming:
The Arduino UNO can be programmed with the Arduino software (download). Select
“Arduino UNO from the tools > Board menu” (according to the microcontroller on your
board). For details see the reference and tutorials.
The ATmega328 on the Arduino UNO comes pre-burned with a boot larder that
allows you to upload new code to it without the use of an external hardware
programmer. It communicates using the original STK500 protocol (reference header
files).
You can also bypass the boot loader and program the microcontroller through the
ICSP (in circuit serial programming) header; See these instructions for details.
The ATmega16U2 (or 8U2in the rev1 and rev2 boards) firmware code is available.
The Atmega16U2/8U2 is loaded with a DFU boot loader, which can be activated by:
21
code by simply pressing the upload button in the Arduino environment. This
means that the boot loader can have a shorter a timeout, as the lowering of
DTR can be well-coordinated with the start of the upload. This setup has other
implications. When the Uno is connected to either a computer running Mac
OS X or Linux, it resets each time a connection is made to it from software (via
USB).For the following half a second or so, the boot loader is running on the
Uno. While it is programmed to ignore malformed data (i.e., anything besides
an upload of the new code), it will intercept the first few bytes of data sent to
the board after a connection is opened. If a sketch running on the board
receives one time configuration or other data when it first starts, make sure
that the software with which it communicates waits a second after opening the
connection and before sending this data. The Uno contains a trace that can
be cut to disable the auto-reset. The pads on either side of the trace can be
soldered together to reenable it. It’s labeled “RESET-EN”. You may also be
able to disable the auto reset by connecting a 110 ohm resistor from 5V to the
reset line;
The Arduino Uno has a resettable polyfused that protects your computer’s USB ports
from shorts and overcurrent. Although most computers provide their own internal
protection, the fuse provides an extra layer of protection. If more than 500mA is
applied to the USB port, the fuse will automatically break the connection until the
short or overload is removed.
5.4.8 Physical Characteristics
The maximum length and width of the Uno PCB are 2.7 and 2.1 inches respectively,
with the USB connector and power jack extending beyond the former dimension. Four
screw holes allow the board to be attached to a surface or case. Note that the
distance between digital pins 7 and 8 is 160mil (0.16”), not an even multiple of the
100mil spacing of the other pins.
22
5.5 ESP8266 WIFI Module:
• The ESP8266 is a low-cost Wi-Fi microchip with full TCP/IP stack and
microcontroller capability produced by manufacturer Espressif Systems in
Shanghai, China.
• The chip first came to the attention of Western makers in August 2014 with the
ESP-01 module, made by a third-party manufacturer Ai-Thinker. This small
module allows microcontrollers to connect to a Wi-Fi network and make simple
TCP/IPconnections using Hayes-style commands.
• The ESP8285 is an ESP8266 with 1 MiB of built-in flash, allowing for single-
chip devices capable of connecting to Wi-Fi. The successor to these
microcontroller chips is the ESP32, released in 2016.
• To install additional ESP8266WiFi library: Click Sketch > Include Library >
Manage Libraries, search for ESP8266WiFi and then install with the latest
version.
• AP mode allows it to create its own network and have other devices (your
phone) connect to it and STA mode allows the ESP8266 to connect to a
Wi-Fi network (one created by your wireless router).
• SSID is simply the technical term for a network name. When you set up a
wireless home network, you give it a name to distinguish it from other
networks in your neighbourhood. You'll see this name when you connect your
computer to your wireless network. WPA2 is a standard for wireless security.
23
• It is mostly used for development of IoT (Internet of Things) embedded
applications. It employs a 32-bit RISC CPU based on the Tensilica Xtensa
L106 running at 80 MHz (or overclocked to 160 MHz)
• The ESP8266 is capable of either hosting an application or offloading all Wi-
Fi networking functions from another application processor.
24
TABLE 5.1: ESP8266 PIN Description
Pin
Name Description
1) UART_TXD, sending;
1 TXD
2 GND GND
3
CU_PD 1) Working at high level;
2) Pull-up by default;
5 GPIO16 External Reset signal, reset when low level is supplied;
work when high level is supplied (high level by default);
25
8 RXD
1) UART_RXD,Receiving
The ESP8266 WiFi Module is a self contained SOC with integrated TCP/IP protocol
stack that can give any microcontroller access to your WiFi network. The ESP8266
is capable of either hosting an application or offloading all Wi-Fi networking functions
from another application processor. Each ESP8266 module comes pre- programmed
with an AT command set firmware, meaning, you can simply hook this up to your
Arduino device and get about as much WiFi- ability as a WiFi Shield offers. This
module has a powerful enough on-board processing and storage capability that
allows it to be integrated with the sensors and other application specific devices
through its GPIOs with minimal development up-front and minimal loading during
runtime. Its high degree of on- chip integration allows for minimal external circuitry,
including the front-end module, is designed to occupy minimal PCB area. The
ESP8266 supports APSD for VoIP applications and Bluetooth co-existance
interfaces,it contains a self-calibrated RF allowing it to work under all operating
conditions, and requires no external RF
parts.
26
5.6.1 Specifications:
5.6.2 Working:
Buzzer is a kind of pronunciation device that can convert audio signal into sound
signal.
The vibrating disk in a magnetic buzzer is attracted to the pole by the magnetic field.
When an oscillating signal is moved through the coil, it produces a fluctuating
magnetic field which vibrates the disk at a frequency equal to that of the drive signal.
Dust Sensor is a simple air monitoring module with onboard Sharp GP2Y1010AU0F.
It is capable of detecting fine particle larger than 0.8μm in diameter, even like the
27
cigarette smoke. Analog voltage output of the sensor is linear with dust density. The
module has embedded voltage boost circuit to support wide range of power supply.
A dust sensor detects the dust particle concentration in air by using optical sensing
method. An infrared light emitting diode (IR LED) and a photo-sensor are optically
arranged in the device. The photo-sensor detects the reflected IR LED light by dust
particles in air. The SMART Dust Sensor can detect the small particles like cigarette
smoke and it can distinguish small particles like smoke from large house dust by
pulse pattern of signal output.
It works on the principle of laser scattering. The air enters through the air inlet where
a light source illuminates the particles and the scattered light is transformed into a
signal by a phototransistor. These signals are amplified by the amplifier circuit and
then processed to get the particle concentration. The intensity of the scattered light
depends on the dust particles. More the dust particles in the air, the greater will be
the intensity of light. Output voltage at the VOUT pin of the sensor
changes according to the intensity of scattered light.
A sensor and a beam of light sit at an angle to each other. As a particle passes in
front of the light, some light is reflected towards the sensor. The sensor registers a
pulse for as long as the particle reflects light to the sensor.
A dust sensor is able to distinguish small particles of cigarette smoke from large
particles of house dust. The Low pulse width is proportional to the particle size and
concentration. Constant forced air convection flow by heater resister in dust sensor.
• Air purifier
• Air conditioner
• Air monitor
• PM2.5 Detector
28
( Fig: 5.11: Dust Sensor)
5.8 MQ135 Gas Sensor:
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. They are often part of a larger embedded system, such as
hazmat and security systems, and they are normally connected to an audible alarm
or interface. Because gas sensors are constantly interacting with air and other
gasses, they have to be calibrated more often than many other types of sensors.
Depending on their intended environments and functions, the physical makeup and
sensing process can vary notably between sensors.
The MQ-135 sensor module comes with a Digital Pin which makes this sensor to
operate even without a microcontroller and that comes in handy when you are only
trying to detect one particular gas. It is highly sensitive to ammonia (NH3), sulphide
and benzene steams, smoke, NOx and CO2. Low cost sensor. To measure the gases
in PPM we need to use analog pin.
29
Sensitive for benzene, alcohol, smoke. Output voltage boosts along with the
concentration of the measured gases increases. It gives a Fast response and
recovery period is very small too. The sensitivity of the MQ135 gas sensor is
adjustable. It also contains an output indicator and provides the signal to the user.
Ideal sensor to detect the presence of a dangerous LPG leak in your car or in a
service station, storage tank environment. This unit can be easily incorporated into
an alarm unit, to sound an alarm or give a visual indication of the LPG concentration.
The sensor has excellent sensitivity combined with a quick response time. The
sensor can also sense iso-butane, propane, LNG and cigarette smoke.
The gas sensor output terminals are connected to non inverting input terminal of
the comparator.
Here the comparator is constructed with operational amplifier LM 358. The reference
voltage is given to inverting input terminal. The reference voltage depends on the
desired gas intensity. When there is no leakage the non inverting input is greater then
inverting input so the output of the comparator is positive voltage which is given to
the base of the switching transistor BC 547. Hence the transistor is conducting. Here
the transistor acts as switch so the collector and emitter will be closed. The output is
taken from collector terminal. Now the output is zero which is given to hex inverter
40106.
When there is gas leakage the inverting input voltage is greater than non inverting
input. Now the comparator output is -12V so the transistor is in cutoff region. The 5v
is given to hex inverter 40106 IC. Then the final output data is directly given to
microcontroller to determine the gas leakage.
30
( Fig: 5.12: MQ135 Gas Sensor)
31
temperature measurement devices, and connected with a high- performance 8bit
microcontroller.
DHT11 sensor consists of capacitive humidity sensor and thermistor for sensing
temperature. This composite sensor contains calibrated digital signal outputs of
temperature and humidity. The DHT11 only returns integers (e.g. 20). The
temperature range of DHT11 is from 0 to 50 degree Celsius with a 2-degree accuracy.
Humidity range of this sensor is from 20 to 80% with 5% accuracy. DHT11 is small in
size with operating voltage from 3 to 5 volts. The maximum current used while
measuring is 2.5mA.
32
with polarizers. Liquid crystals do not emit light directly, instead using a backlight or
reflector to produce images in color or monochrome.
An LCD (Liquid Crystal Display) screen is an electronic display module and has a
wide range of applications. A 16x2 LCD display is very basic module and is very
commonly used in various devices and circuits. A 16x2 LCD means it can display
16 characters per line and there are 2 such lines.
A liquid crystal display (LCD) has liquid crystal material sandwiched between two sheets
of glass. Without any voltage applied between transparent electrodes,
liquid crystal molecules are aligned in parallel with the glass surface. When voltage
is applied, they change their direction and they turn vertical to the glass surface. They
vary in optical characteristics, depending on their orientation. Therefore, the quantity
of light transmission can be controlled by combining the motion of liquid crystal
molecules and the direction of polarization of two polarizing plates attached to the
both outer sides of the glass sheets. LCDs utilize these characteristics to display
images.
• Thingspeak can control hardware remotely. It can display sensor data, store
and visualise it, among other useful things.
33
• Thingspeak app : It allows you to create amazing interfaces for your projects
using various widgets.
• Thingspeak server: It is responsible for all communication between the
smartphone and hardware.
• Thingspeak Libraries:
• These are available for all popular hardware platforms.
• The libraries enable communication with the server, process all incoming and
outgoing commands.
• The sensors and other components are connected to the Arduino UNO Board
as follows.
34
• The Arduino UNO is programmed to collect the data from the sensors ( Dust
Sensor, Gas Sensor, Temperature and Humidity Sensor ) and process the
signals.
• If the pollutant level is more than the threshold set in the Arduino program,
then an alarm is raised through the buzzer module.
• The values are sent to the Thingspeak IoT Cloud Platform through WIFI
Module. The WIFI credentials are set in the code. If the credentials matches
with the WIFI hotspot name and password, then the WIFI module is connected
to it and can now send the data to the URL, which is the Thingspeak Channel
API Key. The API Key is set in the code, and if it matches to the Thingspeak
Channel, then the data is processed by the IoT cloud platform.
• The user can now visualize the data in any form that the user wants to.
• The user can also export the data from Thingspeak to his system, where he
can make his own predictive analysis.
• Thingspeak stores the data and displays the data in graphical format which is
convenient for the user to understand the data.
• The system provides the temperature and humidity readings, amount of dust
present in air in mg / 𝑚3units, and the amount of harmful gases present in air.
These details can also be viewed from the LCD Display Module, which shows
the real time readings. The previous data can be viewed in the Thingspeak
Platform.
35
6.RESULTS AND DISCUSSION, PERFORMANCE ANALYSIS
The various functionalities used in the system are working fine. The Arduino UNO
board is used to implement the project. The code for the system is written and
embedded into the Arduino UNO board. The Arduino UNO board is programmed in
such a way that it processes the input from the three sensors viz. dust sensor,
temperature and humidity Sensor, and gas sensor. These three sensors detect
various possibilities of air pollution and provide the input to the Arduino board for
processing.
The sensors provide the input successfully to the Arduino Uno Board. The Arduino
UNO board is powered by an external power supply. It processes the input data from
the sensors which are in analog form. The data is processed and sent to the IoT cloud
Platform “Thingspeak” through ESP8266 WiFi Module. The Thingspeak platform can
be used to design our application interface, store and visualize it using various
widgets. It acts as a communication medium between the hardware and the
smartphone.
The WiFi module successfully transfers the data to the cloud platform (Thingspeak).
The Thingspeak Platform successfully displays the data in an user friendly and
visualised manner. So, the user can monitor the changes in air quality via a smart
phone seamlessly through the Thingspeak IoT platform.
The output expected is working seamlessly. The idea which we wanted to implement
earlier is what exactly we have done in this project successfully. So, this project
overcomes the demerits that we discussed in the existing projects.
The use of cost efficient sensors makes it an affordable system which is really
important for people living in metropolitan cities. The system works even during
power shutdown as it also uses an external battery apart from the power supply.
36
7.SUMMARY AND CONCLUSIONS
Everyone would agree to the fact that a healthy surrounding is the foremost thing
we need in our life. Here we provide a pollution detection system with the help of
technology. This proves the fact that technology is touching each and every field
which in turn shows that everything is dependent on technology. With the use of
technology, our system focuses on providing the air quality index of the
surroundings to the user. Since our system uses dust sensor, gas sensor and a
temperature and humidity sensor, it can be availed of low cost. The system also
alerts the user when the pollutants level reach a threshold value, so that the user
can take necessary action or move to a safe location. For Storage of Data and
detailed and visualized analysis, Thingspeak IoT platform is useful for future
analytics. Many inventions are taking place in the field of technology. With much
more innovations in the future, some interesting features could be added to our
system. Our system is developed in such a way that it can accommodate new
features for upgradation. Our air pollution monitoring system is implemented
successfully and could be enhanced with further developments and extended use
of technology.
REFERENCES
[1] https://create.arduino.cc/projecthub
[2] https://www.arduino.cc/en/Main/Software
[3] https://thingspeak.com/
[4] https://electronut.in/
[5] https://maker.pro/arduino/projects
37
SOURCE CODE:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int pin8 = 8;
int analogPin = A0;
int sensorValue = 0;
void setup() {
pinMode(analogPin, INPUT);
pinMode(pin8, OUTPUT);
lcd.begin(16, 2);
lcd.print("What is the air ");
lcd.print("quality today?");
Serial.begin(9600);
lcd.display();
}
void loop() {
delay(1000);
sensorValue = analogRead(analogPin);
Serial.print("Air Quality in PPM = ");
Serial.println(sensorValue);
lcd.clear();
lcd.setCursor(0,0);
lcd.print ("Air Quality: ");
lcd.print (sensorValue);
if (sensorValue<=500)
{
Serial.print("Fresh Air ");
Serial.print ("\r\n");
lcd.setCursor(0,1);
lcd.print("Fresh Air");
}
else if( sensorValue>=500 && sensorValue<=650 )
{
Serial.print("Poor Air");
Serial.print ("\r\n");
lcd.setCursor(0,1);
lcd.print("Poor Air");
}
else if (sensorValue>=650 )
{
Serial.print("Very Poor Air");
Serial.print ("\r\n");
lcd.setCursor(0,1);
lcd.print("Very Poor Air");
}
if (sensorValue >650) {
digitalWrite(pin8, HIGH);
}
else {
digitalWrite(pin8, LOW);
}
}
Screen shots of code :