0% found this document useful (0 votes)
2 views20 pages

iot air quality monitoring documentation

The document outlines an IoT-based air quality monitoring system using an ESP8266 microcontroller, MQ135 gas sensor, and DHT11 temperature/humidity sensor to provide real-time environmental data and alerts. It emphasizes the importance of air quality monitoring due to urbanization and industrialization, detailing the system's components, programming, and data visualization methods. The project aims to empower users with immediate insights and notifications to promote healthier living environments and proactive management of air quality.

Uploaded by

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

iot air quality monitoring documentation

The document outlines an IoT-based air quality monitoring system using an ESP8266 microcontroller, MQ135 gas sensor, and DHT11 temperature/humidity sensor to provide real-time environmental data and alerts. It emphasizes the importance of air quality monitoring due to urbanization and industrialization, detailing the system's components, programming, and data visualization methods. The project aims to empower users with immediate insights and notifications to promote healthier living environments and proactive management of air quality.

Uploaded by

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

IoT based Air Quality Monitoring system

Abstract:
This project demonstrates an affordable and accessible solution for real-time air
quality monitoring, empowering users with vital environmental data and alerts
to promote healthier living spaces and prompt action in response to air quality
fluctuations.
This project introduces an IoT-based air quality monitoring system
utilizing an ESP8266 microcontroller to collect data from environmental
sensors. The system integrates a gas sensor (MQ135) and a
temperature/humidity sensor (DHT11) to continuously assess air quality
parameters. Data visualization is facilitated through an LCD I2C display, while
alerts are triggered via Telegram notifications and local indicators.
Through the ESP8266 microcontroller, the MQ135 gas sensor gauges
various air pollutants, while the DHT11 sensor measures temperature and
humidity levels. Real-time data is processed and showcased on an LCD I2C
screen, providing immediate on-site analysis. The system employs LED
indicators and a buzzer to signify abnormal air quality conditions and
temperature variations. Moreover, Telegram notifications are dispatched to
remotely notify users about critical changes in air quality.

Implementation involves programming the ESP8266 using Arduino IDE


to gather sensor data, evaluate it against predefined thresholds, and activate
alerts and notifications accordingly. The system establishes a Wi-Fi connection
to support Telegram notifications, enabling remote monitoring and proactive
responses to air quality and temperature fluctuations.

Calibration and rigorous testing ensure accurate sensor readings,


addressing challenges related to sensor precision and software integration. This
project showcases an accessible solution for real-time air quality monitoring,
empowering users with essential environmental data and immediate alerts to
foster healthier living environments and prompt action in response to air quality
changes.

1
Introduction:
The degradation of air quality poses a significant threat to human health and the
environment. Rapid urbanization and industrialization have led to an increase in
air pollutants, necessitating the development of efficient monitoring systems.
This project introduces an Internet of Things (IoT) based air quality monitoring
system that utilizes cutting-edge technology to enable real-time assessment and
proactive management of air quality parameters.

The fundamental objective of this project is to design and implement a cost-


effective, accessible, and efficient system that continuously measures air quality
in indoor environments. The system incorporates an ESP8266 microcontroller
coupled with specialized sensors—such as the MQ135 gas sensor for detecting
various air pollutants and the DHT11 sensor for monitoring temperature and
humidity levels. Integration of these sensors allows for comprehensive
monitoring of environmental conditions crucial for ensuring a healthy living
space.

The ESP8266 microcontroller serves as the core processing unit, collecting data
from the sensors and employing predefined thresholds to evaluate air quality.
Visual representation of this data is achieved through an LCD I2C display,
providing users with immediate on-site insights into air quality parameters.
Furthermore, the system triggers alerts—such as LED indicators, a buzzer, and
Telegram notifications—when air quality deviates from predefined thresholds,
ensuring timely response and proactive management.

This project not only focuses on the hardware and sensor integration but also
emphasizes software development. Programming the ESP8266 using Arduino
IDE facilitates data analysis, threshold comparison, and the activation of alerts.
Additionally, the system connects to Wi-Fi, enabling remote monitoring and
notifications through the Telegram platform, ensuring users are informed of
critical changes in air quality, regardless of their location.

In summary, this project endeavors to provide an efficient and accessible


solution for real-time air quality monitoring, empowering individuals and

2
communities to make informed decisions regarding their living environments
and take proactive measures to mitigate air quality concerns.

List of components:
1. ESP 8266 (Node MCU)
2. MQ 135 Air quality sensor
3. DHT 11 Sensor
4. 16x2 LCD display
5. I2C module

1. ESP 8266 (Node MCU):

This Photo by Unknown Author is licensed under CC BY-SA

The ESP8266 is a cost-effective and highly integrated system-on-a-chip (SoC)


microcontroller that has become a staple in the world of IoT (Internet of
Things) development. Developed by Espressif Systems, the ESP8266 has
gained widespread popularity due to its compact size, low power consumption,
built-in Wi-Fi connectivity, and considerable processing power. This
microcontroller has opened the door to a wide range of IoT applications, from
smart home devices to industrial automation.

 power Pins There are four power pins. VIN pin and three 3.3V pins.
 VIN can be used to directly supply the NodeMCU/ESP8266 and its
peripherals. Power delivered on VIN is regulated through the onboard
3
regulator on the NodeMCU module – you can also supply 5V
regulated to the VIN pin
 3.3V pins are the output of the onboard voltage regulator and can be
used to supply power to external components.

 GND are the ground pins of NodeMCU/ESP8266

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

 GPIO Pins NodeMCU/ESP8266 has 17 GPIO pins which can be assigned to


functions such as I2C, I2S, UART, PWM, IR Remote Control, LED Light
and Button programmatically. Each digital enabled GPIO can be configured
to internal pull-up or pull-down, or set to high impedance. When configured
as an input, it can also be set to edge-trigger or level-trigger to generate CPU
interrupts.

 ADC Channel The NodeMCU is embedded with a 10-bit precision SAR


ADC. The two functions can be implemented using ADC. Testing power
supply voltage of VDD3P3 pin and testing input voltage of TOUT pin.
However, they cannot be implemented at the same time.

 UART Pins NodeMCU/ESP8266 has 2 UART interfaces (UART0 and


UART1) which provide asynchronous communication (RS232 and RS485),
and can communicate at up to 4.5 Mbps. UART0 (TXD0, RXD0, RST0 &
CTS0 pins) can be used for communication. However, UART1 (TXD1 pin)
features only data transmit signal so, it is usually used for printing log.

 SPI Pins NodeMCU/ESP8266 features two SPIs (SPI and HSPI) in slave
and master modes. These SPIs also support the following general-purpose
SPI features:
 4 timing modes of the SPI format transfer
 Up to 80 MHz and the divided clocks of 80 MHz
 Up to 64-Byte FIFO

 SDIO Pins NodeMCU/ESP8266 features Secure Digital Input/Output


Interface (SDIO) which is used to directly interface SD cards. 4-bit 25 MHz
SDIO v1.1 and 4-bit 50 MHz SDIO v2.0 are supported

 PWM Pins The board has 4 channels of Pulse Width Modulation (PWM).
The PWM output can be implemented programmatically and used for
4
driving digital motors and LEDs. PWM frequency range is adjustable from
1000 μs to 10000 μs (100 Hz and 1 kHz).

 Control Pins are used to control the NodeMCU/ESP8266. These pins


include Chip Enable pin (EN), Reset pin (RST) and WAKE pin.
 EN: The ESP8266 chip is enabled when EN pin is pulled HIGH.
When pulled LOW the chip works at minimum power.
 RST: RST pin is used to reset the ESP8266 chip.
 WAKE: Wake pin is used to wake the chip from deep-sleep.

 Control Pins are used to control the NodeMCU/ESP8266. These pins


include Chip Enable pin (EN), Reset pin (RST) and WAKE pin.
 EN: The ESP8266 chip is enabled when EN pin is pulled HIGH.
When pulled LOW the chip works at minimum power.
 RST: RST pin is used to reset the ESP8266 chip.
 WAKE: Wake pin is used to wake the chip from deep-sleep.

2. MQ 135 Air quality sensor:


An MQ135 air quality sensor is one type of MQ gas sensor used to detect,
measure, and monitor a wide range of gases present in air like ammonia,
alcohol, benzene, smoke, carbon dioxide, etc. It operates at a 5V supply with
150mA consumption. Preheating of 20 seconds is required before the operation,
to obtain the accurate output.

MQ135 Air Quality Sensor


It is a semiconductor air quality check sensor suitable for monitoring
applications of air quality. It is highly sensitive to NH3, NOx, CO2, benzene,
smoke, and other dangerous gases in the atmosphere. It is available at a low
cost for harmful gas detection and monitoring applications.

5
If the concentration of gases exceeds the threshold limit in the air, then the
digital output pin goes high. The threshold value can be varied by using the
potentiometer of the sensor. The analog output voltage is obtained from the
analog pin of the sensor, which gives the approximate value of the gas level
present in the air.

Pin Configuration:

The MQ135 air quality sensor is a 4-pin sensor module that features both
analog and digital output from the corresponding pins. The MQ135 air quality
sensor pin configuration is shown below.

For MQ135 Air Quality Sensor Module:

The MQ135 air quality sensor module is shown below.

MQ135 Air Quality Sensor Pin


Configuration
Pin 1: VCC: This pin refers to a positive power supply of 5V that power up the
MQ135 sensor module.
Pin 2: GND (Ground): This is a reference potential pin, which connects the
MQ135 sensor module to the ground.
Pin 3: Digital Out (Do): This pin refers to the digital output pin that gives the
digital output by adjusting the threshold value with the help of a potentiometer.
This pin is used to detect and measure any one particular gas and makes the
MQ135 sensor work without a microcontroller.
Pin 4: Analog Out (Ao): This pin generates the analog output signal of 0V to
5V and it depends on the gas intensity. This analog output signal is proportional
to the gas vapor concentration, which is measured by the MQ135 sensor
module. This pin is used to measure the gases in PPM. It is driven by TTL
logic, operates with 5V, and is mostly interfaced with microcontrollers.
For the MQ135 Air Quality Sensor:

The MQ135 air quality sensor is shown below.

6
MQ135 Air Quality Sensor
H-pins: There are 2 H-pins, where one is connected to the voltage supply and
the other is connected to the ground.
A-pins: Here A-pins and B-pins can be interchanged. These are connected to
the voltage supply.
B-pins: Here A-pins and B-pins can be interchanged. One pin is used to
generate output while the other pin is connected to the ground.

Specifications and Features:

The MQ135 air quality sensor specifications and features are listed below.
 It has a wide detection scope.
 High sensitivity and faster response.
 Long life and stability.
 The operating voltage: +5V.
 Measures and detects NH3, alcohol, NOx, Benzene, CO2, smoke etc.
 Range of analog output voltage: 0V-5V.
 Range of digital output voltage: 0V-5V (TTL logic).
 Duration of preheating: 20 seconds.
 Used as an analog or digital sensor.
 The potentiometer is used to vary the sensitivity of the digital pin.
 Heating Voltage: 5V±0.1.
 Load resistance is adjustable.
 Heater resistance: 33ohms±5%.
 Heating consumption:<800mW.
 Operating temperature: -10°C to -45°C.
 Storage temperature: -20°C to -70°C.
 Related humidity: <95%Rh.
 Oxygen concentration: 21% (affects the sensitivity).
 Sensing resistance: 30kiloohms to 200kiloohms.

7
Concentration slope rate: ≤0.65.
 Preheat time: over 24 hrs.
 Simple drive circuit.
How to Detect and Measure Gases using the MQ135 Air Quality Sensor:

To measure or detect the gases, use analog pins or digital pins. Just apply 5V to
the module and you can observe that the module’s power LED turns ON
(glows) and the output LED turns OFF when no gas is detected by the module.
This means that the output of the digital pin is 0V. Note that the sensor must be
kept for preheating time for 20seconds (as mentioned in the specifications)
before the actual operation.

Now, once when the MQ135 sensor is operated to detect, then the LED output
goes high along with the digital output pin. Otherwise, use the potentiometer
until the output increases. Whenever the sensor detects a certain gas
concentration, the digital pin goes high (5V), otherwise it stays low (0V).
We can also use analog pins to get the same result. The output analog values (0-
5V) are read from the microcontroller. This value is directly proportional to the
gas concentration detected by the sensor. By the experimental values, we can
observe the working and reaction of the MQ135 sensor with different gas
concentrations and the programming developed accordingly.

How to Measure PPM (parts per million) using the MQ135 Air Quality
Sensor:

The MQ-135 gas sensor uses SnO2, a gas-sensitive material that has higher
resistance in clean air. An increase in the number of harmful gases decreases
the resistance of the gas MQ135 sensor. To measure PPM with the MQ-135 air
quality sensor, observe the graph between (Rs/Ro) and PPM shown below.

MQ135 Air Quality Sensor – PPM Graph

8
 The typical sensitivity characteristics of the MQ135 sensor are shown
in the above graph.
 Temperature is 20°C, humidity is 65%, the concentration of O2 is 21%
and load resistance RL is 20kilo ohms.
 Here Ro refers to the resistance value of the sensor at 100ppm of NH3
in clean air or fresh air.
 Rs refers to the resistance of the sensor at several gas concentrations.
 We can calibrate the MQ135 sensor by determining the Rs value from
the below formula,
 Resistance of sensor Rs = (Vc/VRL-1)RL
 After calculating the Ro and Rs values, the ratio is found, and using
the above graph we can calculate the PPM value of the particular gas,
which is to be measured.

9
3. DHT 11 sensor:

DHT11–Temperature and Humidity Sensor


DHT11 Sensor Pinout

The DHT11 is a commonly used Temperature and humidity sensor


that comes with a dedicated NTC to measure temperature and an 8-bit
microcontroller to output the values of temperature and humidity as serial data.

DHT11 Pinout Configuration

No: Pin Name Description

For DHT11 Sensor

1 Vcc Power supply 3.5V to 5.5V

2 Data Outputs both Temperature and Humidity through serial Data

10
3 NC No Connection and hence not used

4 Ground Connected to the ground of the circuit

For DHT11 Sensor module

1 Vcc Power supply 3.5V to 5.5V

2 Data Outputs both Temperature and Humidity through serial Data

3 Ground Connected to the ground of the circuit

DHT11 Specifications

 Operating Voltage: 3.5V to 5.5V


 Operating current: 0.3mA (measuring) 60uA (standby)
 Output: Serial data
 Temperature Range: 0°C to 50°C
 Humidity Range: 20% to 90%
 Resolution: Temperature and Humidity both are 16-bit
 Accuracy: ±1°C and ±1%

4. 16x2 LCD display:


16×2 LCD is a 32 digits display screen for all kinds of CMOS/TTL devices.
This word comes from the liquid crystal and 16X2 represents its screen size.
In Liquid crystal display 16×2, there are 2 rows and 16 columns. Besides,
5×8 pixel makes a single digit. Any digit from ASCII code is viewable on
the module. It supports the custom signs and designs but those require some
specific methods and have some limitations. This display module has too
much use in most of the commercial projects and there is almost a library in
every programming language about it. The premade libraries made it easy to
interface with other devices.

11
Pinout Diagram 16×2 LCD
There are two sections pins on the whole 16×2 LCD module. Some of
them are data pins and some are command pin. Somehow, every pin has
a role in controlling a single pixel on the display. Additionally, all the
input/output pins of this module are shown in the pinout diagram:

16×2 LCD Pin Configuration and Working of Each Pin

Power Pins

PINS DETAILS

Pin1 VSS It’s a ground pin for common grounds.

Pin2 VDD The power pin will use for voltage input to the 16X2 LCD.

12
Control Pins

PINS DETAILS

Pin 3 will connect with power and ground through 3 pin


Pin3 VE potentiometers. It will help to control the contrast of
PIXELS according to the 16X2 LCD light.

This pin is known as a register select pin. It helps to toggle


Pin4 RS
the command/data register.

The signal on Pin5 will decide whether it is going to read


Pin5 R/W
from LCD or write on it.

Enable pin will help to transfer the instruction from the


Pin6 EN data pins and another command pin to the LCD. It act as
permission to internal registers.

Data Pins

PINS DETAILS

D0-D1 is the first 4 bits input pins of the 8-bit input data to
Pin7 D0
the LCD.

Pin8 D1

Pin9 D2

Pin1
D3
0

Pin11 D4 D4-D7 pins use to give the input of least 4-bit of the data.

13
In some cases, alone usage of the least 4-pins can make the
device functional.

Pin1
D5
2

Pin1
D6
3

Pin1
D7
4

Led Pins

PINS DETAILS

The LCD comes in multiple colors and every time in


Pin1
+ve different LCD the color will depend on the internal LED.
5
Pin15 is for the power input of the LED.

Pin1
-ve Pin16 is the ground pin of the LED.
6

16×2 Liquid Crystal Display Constructions


In the LCD the registers are used to store the data and commands. The
command registers store the data of different functions that can be
performed on the screen. The Data registers help to store the data and
then pass it to the controller. The Data and command registers are only

14
able to store the operation of basic light control. The liquid crystals are
placed between the two glass sheets on the screen. The two sheets are
also placed between these sheets. The sheets are used to stop the light.

Working Principal
The basic principle in LCD is by the passing of light from one layer
(sheet) to another layer with the use of modules. The modules vibrate and
align their position at 90 degrees, which allows the polarized sheet to
pass the light through it. The molecules are responsible for showing the
data on each pixel. Each pixel uses the light-absorbing method to show
the digit. To show the value, molecules need to change their position to
change the angle of light. So this deflection of light will make the human
eye see the light of the remaining part which will make the dark part as a
value and digits on the grid pixels. The data, we can see, will be the part
where the light gets absorbed. The data will pass towards the molecules
and will be there until they are changed

5 . I2C module:

I2C Serial Interface Adapter Module


I2C Serial Interface Adapter Module Pinout

15
Due to limited pin resources in a microcontroller/microprocessor, controlling an
LCD panel could be tedious. Serial to Parallel adapters such as the I2C serial
interface adapter module with PCF8574 chip makes the work easy with just two
pins. The serial interface adapter can be connected to a 16x2 LCD and provides
two signal output pins (SDA and SCL) which can be used to communicate with
an MCU/MPU.

Features and Specifications of I2C Serial Interface Adapter Module

This section mentions some of the features and specifications of the I2C Serial
Interface Adapter Module.

1. Operating Voltage: 5V DC
2. I2C control using PCF8574
3. Can have 8 modules on a single I2C bus
4. I2C Address: 0X20~0X27 (the original address is 0X20, you can change
it yourself via the onboard jumper pins)

Working:

The working of your IoT-based air quality monitoring system involves several
stages from data collection to user notification. Here's an overview:

Sensor Data Acquisition:

MQ135 Sensor: This sensor measures various air pollutants like ammonia,
benzene, smoke, and CO2.

DHT11 Sensor: Measures temperature and humidity.

Data Processing:

The ESP8266 microcontroller collects data from these sensors at regular


intervals.

Sensor readings are processed within the microcontroller to convert analog


sensor data into usable values.

16
Threshold Comparison:

Predefined thresholds for air quality parameters (set for pollutants, temperature,
and humidity) are stored in the program.

The collected sensor data is compared against these predefined thresholds.

Alert Generation:

If the sensor readings surpass the predefined thresholds, indicating poor air
quality or abnormal temperature/humidity levels, the system triggers alerts.

Local Indicators: LED lights (red for poor air quality, green for normal) and a
buzzer are activated to notify individuals in the immediate vicinity.

Telegram Notification: The ESP8266 establishes a Wi-Fi connection and


sends notifications via Telegram to alert users remotely about the detected
environmental changes.

Display of Information:

Real-time sensor data, including air quality parameters, temperature, and


humidity, is showcased on the LCD I2C display.

Users can readily observe the current environmental conditions on-site.

Continuous Monitoring and Feedback Loop:

The system continuously monitors air quality and environmental parameters.

If conditions return to normal levels, indicating improved air quality or


temperature, the system turns off the alerts and indicators accordingly.

Remote Access and Monitoring:

The Wi-Fi connectivity enables users to access the system remotely through the
Telegram app.

Notifications regarding air quality changes and abnormal temperature/humidity


levels are sent to users' Telegram accounts, allowing them to stay informed
regardless of their physical location.

This working process ensures that the system constantly evaluates air quality
parameters, processes sensor data, triggers alerts when necessary, displays real-

17
time information on-site, and provides remote notifications to keep users
updated about environmental changes.

This comprehensive approach facilitates not only on-site monitoring but also
empowers users to take timely actions and make informed decisions to maintain
a healthier living environment.

Applications:

Indoor Air Quality Monitoring: This system is ideal for homes, offices,
schools, and indoor environments where monitoring and maintaining good air
quality are crucial for occupants' health and productivity.

Environmental Monitoring in Workplaces: Industries dealing with hazardous


materials or environments can use this system to ensure worker safety by
continuously monitoring air quality.

Smart Cities and Urban Planning: Deploying these systems across a city
allows for a city-wide assessment of air quality, aiding urban planners in
making informed decisions to improve public health and reduce pollution.

Healthcare Facilities: Hospitals and healthcare centers can benefit from


continuous air quality monitoring, ensuring patients' well-being, especially
those with respiratory conditions.

Research and Development: Researchers studying air quality, environmental


sciences, or conducting experiments related to pollution can use this system for
data collection and analysis.

IoT Integration in Smart Homes: Integrating this system into smart home
setups allows for automation based on air quality triggers, such as adjusting
ventilation systems or air purifiers.

18
Educational Purposes: Schools and educational institutions can utilize these
systems for educational purposes, teaching students about environmental
monitoring and the importance of air quality.

Conclusion:
The development of an IoT-based air quality monitoring system using the
ESP8266 microcontroller has culminated in a versatile and impactful solution
for continuous environmental assessment. This project aimed to address the
critical need for real-time air quality monitoring, providing users with
actionable data to promote healthier living environments.

By integrating the ESP8266 microcontroller with specialized sensors like the


MQ135 gas sensor and the DHT11 sensor, this system successfully measures
various air pollutants, temperature, and humidity levels. The effective
processing of sensor data, coupled with predefined thresholds, ensures timely
alerts and notifications, allowing users to respond promptly to changes in air
quality.

The project's implementation, encompassing hardware assembly, software


development, and calibration, encountered challenges that were mitigated
through rigorous testing and refinement. The system's ability to display real-
time data on-site via an LCD I2C display and dispatch notifications remotely
through Telegram signifies its practicality and accessibility for users.

The applications of this system span across diverse domains, including


residential, industrial, educational, and urban planning sectors, promising far-
reaching benefits. Whether for personal health management, workplace safety,
city-wide environmental assessments, or educational purposes, the system's
versatility and scalability make it a valuable asset.

In conclusion, this project underscores the significance of leveraging IoT


technology to monitor and manage air quality. It empowers individuals,
communities, and governing bodies with vital environmental data, fostering

19
informed decision-making and proactive measures towards creating healthier
and sustainable living environments.

The successful execution of this project not only showcases an effective air
quality monitoring system but also prompts further exploration and
development in the realm of IoT-based solutions for environmental monitoring
and public health enhancement.

20

You might also like