iot air quality monitoring documentation
iot air quality monitoring documentation
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.
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 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.
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
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.
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.
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
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).
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.
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.
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.
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:
10
3 NC No Connection and hence not used
DHT11 Specifications
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:
Power Pins
PINS DETAILS
Pin2 VDD The power pin will use for voltage input to the 16X2 LCD.
12
Control Pins
PINS DETAILS
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
Pin1
-ve Pin16 is the ground pin of the LED.
6
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:
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.
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:
MQ135 Sensor: This sensor measures various air pollutants like ammonia,
benzene, smoke, and CO2.
Data Processing:
16
Threshold Comparison:
Predefined thresholds for air quality parameters (set for pollutants, temperature,
and humidity) are stored in the program.
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.
Display of Information:
The Wi-Fi connectivity enables users to access the system remotely through the
Telegram app.
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.
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.
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.
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