FINAL SEMESTER PROJECT REPORT
Project Title: Outdoor Air Quality Monitor
Project By: Ubaid Ahmed
Supervised By: Sir Abid Hussain
Submitted To: Sir Abid Hussain
1
Contents
Abstract................................................................................................................................................... 5
1. Introduction ..................................................................................................................................... 6
1.1 Background and Motivation ....................................................................................................... 6
1.2 Importance of Air Quality Monitoring ......................................................................................... 7
1.3 Air Quality Management in Pakistan ........................................................................................... 8
1.4 Types of Monitors Selling In Pakistan : ...................................................................................... 10
1.5 Recent Initiatives and Trends .................................................................................................... 10
1.6 Challenges and Opportunities................................................................................................... 11
1.7 Project Objectives .................................................................................................................... 11
1.8 Scope and Limitations .............................................................................................................. 11
Report Structure: ............................................................................................................................... 12
2. Literature Review ........................................................................................................................... 12
2.1 History of Air Quality Monitoring ............................................................................................. 12
2.2 Traditional Monitoring Systems ................................................................................................ 12
2.3 Emergence of Low-Cost Monitors ............................................................................................. 12
2
2.4 Sensor Technologies Used ........................................................................................................ 13
2.4.1 NDIR Sensors ................................................................................................................... 13
2.4.2 Optical Particle Counters .................................................................................................. 13
2.5 Research and Development ...................................................................................................... 13
2.6 Future Trends........................................................................................................................... 13
2.7 Summary ................................................................................................................................. 14
3. Hardware Components and Design ................................................................................................. 14
3.1 PMS5003 Particulate Matter Sensor.......................................................................................... 14
Key Features: .................................................................................................................................. 14
Working Principle: .......................................................................................................................... 14
3.2 Senseair S8 CO₂ Sensor ............................................................................................................. 15
Key Features: .................................................................................................................................. 15
Working Principle: .......................................................................................................................... 16
3.3 ESP32 WROOM32 Microcontroller ............................................................................................ 17
Key Features: .................................................................................................................................. 17
Working Principle: .......................................................................................................................... 18
4. Software Design and Arduino IDE .................................................................................................... 19
4.1 Development Environment....................................................................................................... 19
4.2 Sensor Integration.................................................................................................................... 19
4.3 Data Processing and Display ..................................................................................................... 20
4.4 Web Server Interface................................................................................................................ 20
3
4.5 Full Code:................................................................................................................................. 20
5. System Implementation .................................................................................................................. 20
5.1 Hardware Assembly ................................................................................................................. 20
5.2 Circuit Diagram ........................................................................................................................ 21
5.3 Software Deployment .............................................................................................................. 23
5.4 Webpage and Wi-Fi Access ....................................................................................................... 23
6. Results and Discussion .................................................................................................................... 23
6.1 Field Testing ............................................................................................................................. 23
6.2 Data Reliability ........................................................................................................................ 26
6.3 Challenges Faced...................................................................................................................... 26
6.4 Advantages of the System ........................................................................................................ 26
6.5 Limitations............................................................................................................................... 26
7. Conclusion and Future Work ........................................................................................................... 26
7.1 Conclusion ............................................................................................................................... 26
7.2 Future Work ............................................................................................................................ 27
8. References ..................................................................................................................................... 27
4
Abstract
This report presents the design and development of a low-cost, real-time
outdoor air quality monitoring system. The system measures key pollutants,
including PM1.0, PM2.5, PM10, and CO₂, using a PMS5003 particulate matter
sensor and a Senseair S8 CO₂ sensor. An ESP32 WROOM32 microcontroller
processes the sensor data and hosts a local web server, enabling users to view
air quality readings via Wi-Fi in real time. Developed using the Arduino IDE,
the project emphasizes accessibility, affordability, and educational value. Field
tests in urban environments showed that the system could detect significant
variations in pollutant levels with reasonable accuracy. While not a replacement
for industrial-grade equipment, the system demonstrates the potential of lowcost
electronics in promoting environmental awareness and community-driven
monitoring solutions.
5
1. Introduction
1.1 Background and Motivation
Air pollution is one of the most critical environmental challenges worldwide.
Rapid urbanization and industrial growth have significantly increased the
presence of harmful air pollutants, leading to severe health risks and
environmental degradation. According to the World Health Organization
(WHO), air pollution is responsible for approximately 7 million premature
deaths annually. In countries like Pakistan, industrial emissions, vehicle
exhaust, and inadequate waste management contribute substantially to
deteriorating air quality. Cities such as Lahore, Karachi, and Islamabad
frequently report AQI values in the hazardous range.
This project aims to develop a cost-effective, accurate, and easily deployable
outdoor air quality monitoring system using readily available components and
open-source tools. It is designed for educational, environmental, and research
applications, offering real-time measurements of key pollutants such as PM1.0,
PM2.5, PM10, and CO₂.
6
1.2 Importance of Air Quality Monitoring
Air quality monitoring plays a vital role in:
• Detecting and quantifying airborne pollutants
• Evaluating public health risks
• Informing urban planning and environmental policy
• Raising awareness about environmental conditions
Accurate and accessible data empower communities and decision-makers to
take action against air pollution.
7
1.3 Air Quality Management in Pakistan
• Current Situation:
Pakistan suffers from severe air pollution causing about 235,000
premature deaths annually, mainly due to PM2.5 and ozone from vehicles,
crop burning, industry, and household fuels.
• Policies and Governance:
8
In 2023, Pakistan launched the National Clean Air Policy (NCAP) and
Punjab Clean Air Plan (PbCAP) aiming to revise emission standards and
reduce pollution. However, these policies face criticism for relaxed
standards, weak legal backing, insufficient emission reduction focus, and
ignoring transboundary pollution. The Punjab Environmental Protection
Act 2023 enforces stricter bans on substandard fuels, polluting vehicles,
and open burning.
• Recommended Improvements:
Enhance nationwide air quality monitoring, tighten standards to
international levels, develop dynamic multi-level action plans, and adopt
emission load reduction strategies addressing local and cross-border
pollution.
9
1.4 Types of Monitors Selling In Pakistan :
Device/Brand Pollutants Measured Features Applications
ECOMSMART PM1, PM2.5, PM10, Real-time, remote Smart cities,
(Ecomesure) O3, NOx, SO2, VOCs, control, GPS, industry, roads
CO2, others solar/battery powered
Device/Brand Pollutants Measured Features Applications
AQM 65 O3, NO2, CO, SO2, Near-reference, compact, Urban/industrial
VOCs, PM1, PM2.5, networked monitoring
noise, weather
Analytical Industrial SO2, NOx, CO, O3, Customizable, real-time Roadside, citywide,
Solutions (AIS) PM10, PM2.5, VOCs, & gravimetric industrial
BTEX, others
Portable Meters PM2.5, PM10, CO2, Affordable, portable Homes, schools,
(Uni-T, Lutron, TES) VOCs, gases (varies) spot checks
• Key Features:
Multi-pollutant detection, real-time data with remote access, GPS mapping, flexible
power options, and compliance with international standards.
• Market and Pricing:
Devices range from affordable handheld units (~Rs. 20,000) to advanced networked
stations (~Rs. 350,000+), serving government, industry, and research sectors.
1.5 Recent Initiatives and Trends
• Punjab’s $300 million World Bank-supported Clean Air Program (PCAP)
targets a 35% PM2.5 reduction by 2035 through electric buses, crop
burning controls, expanded monitoring, and fuel testing labs.
10
• Stricter enforcement against polluting vehicles and promotion of electric
motorcycles.
• Expansion of regulatory-grade monitoring networks in major cities like
Lahore, Karachi, and Islamabad.
• Growing collaboration between government, private sector, and civil
society to modernize air quality governance and infrastructure.
1.6 Challenges and Opportunities
• Challenges:
Weak enforcement, fragmented standards, limited legal authority, insufficient
monitoring coverage, and high pollution in urban/industrial hotspots.
• Opportunities:
Adopt advanced multi-parameter monitors, strengthen regulatory frameworks,
integrate air quality data with smart city and health initiatives, and foster publicprivate
partnerships to enhance monitoring and mitigation efforts.
1.7 Project Objectives
• Develop a low-cost air quality monitoring device using PMS5003 and Senseair
S8 sensors
• Integrate sensors with the ESP32 WROOM32 microcontroller
• Program the system using the Arduino IDE
• Host a local webpage to display real-time data
• Store recent data to analyze short-term trends
1.8 Scope and Limitations
Scope:
• Monitor key outdoor air pollutants: CO₂, PM1.0, PM2.5, PM10
• Provide real-time data via Wi-Fi-enabled ESP32
• Display data on a locally hosted web page
11
Limitations:
• Not calibrated for hazardous or industrial environments
• Does not include cloud connectivity (subject to future work)
• Limited data storage capabilities
Report Structure:
The report comprises chapters covering literature review, system design
(hardware and software), implementation, results, conclusion, and future work.
Each section provides insights into the development and functioning of the
monitoring system.
2. Literature Review
2.1 History of Air Quality Monitoring
Air quality monitoring emerged in the mid-20th century in response to growing
pollution in industrial cities. Initially, it involved manual sampling and
laboratory analysis. With technological advances, automated real-time
monitoring became possible. Laws like the U.S. Clean Air Act (1970) further
accelerated the development of precise monitoring systems.
2.2 Traditional Monitoring Systems
Conventional systems use high-grade analyzers to detect gases like NO₂, SO₂,
CO, and O₃, and to measure particulate matter. These systems offer high
accuracy but are expensive and stationary, making them impractical for
widespread use in developing regions.
2.3 Emergence of Low-Cost Monitors
Recent technological progress has led to the availability of low-cost sensors
such as optical particle counters and NDIR CO₂ sensors. While they lack the
12
precision of laboratory-grade devices, they offer a scalable and affordable
method to gather actionable environmental data.
2.4 Sensor Technologies Used
2.4.1 NDIR Sensors
NDIR (Non-Dispersive Infrared) sensors, like the Senseair S8, detect carbon
dioxide by measuring IR light absorption by CO₂ molecules. These sensors are
valued for their low power consumption and high reliability, making them
suitable for indoor and outdoor applications.
2.4.2 Optical Particle Counters
The PMS5003 is an optical particle counter that uses laser scattering to detect
PM1.0, PM2.5, and PM10. It draws air through a laser beam and measures the
scattered light to estimate particulate concentration. It is compact, responsive,
and well-suited to low-cost monitoring applications.
2.5 Research and Development
Many research initiatives and open-source projects have demonstrated the utility
of low-cost air monitoring systems:
• Luftdaten Project (Germany): Crowdsourced particulate data using SDS011
sensors
• OpenAQ: Aggregates air quality data globally for public access
• MIT CityAir: Mobile air quality sensors used for urban data visualization
2.6 Future Trends
Future developments will likely include:
• More compact and power-efficient sensors
• Enhanced calibration algorithms
13
• Integration with IoT and cloud analytics
• Mobile deployment (e.g., on drones or vehicles)
• Use of AI and machine learning for predictive analysis
2.7 Summary
The field of low-cost air quality monitoring is evolving rapidly, driven by
innovations in sensor technology and data communication. This project
contributes to that evolution by implementing commercially available sensors
and a microcontroller to create a web-enabled monitoring system.
3. Hardware Components and Design
3.1 PMS5003 Particulate Matter Sensor
The PMS5003 sensor, developed by Plantower, detects PM1.0, PM2.5, and
PM10 concentrations in real time using laser scattering. As air is drawn through
the sensor, particles scatter a laser beam. A photodetector measures this
scattered light to determine particle concentration in µg/m³.
Key Features:
• Measures PM1.0, PM2.5, and PM10
• UART communication (3.3V)
• Compact size and low power use
• Fast response and good sensitivity
Working Principle:
It senses particulates of various sizes (PM1, PM2. 5, PM10) from sources like
smoke, dust, pollen, metal and organic particles, and more. Plantower PMS5003
is a laser dust sensor. Sensor uses laser light scattering principle to measure
14
value of dust particles suspended in the air
3.2 Senseair S8 CO₂ Sensor
The Senseair S8 is a CO₂ sensor that utilizes NDIR technology for accurate CO₂
detection. It emits infrared light and measures how much is absorbed by CO₂
molecules in the sampled air.
Key Features:
• Accuracy: ±(30 ppm + 3% of reading)
• Range: 400 to 5000 ppm
• UART digital output
• Long operating life
15
Working Principle:
The SenseAir S8 CO2 sensor uses non-dispersive infrared (NDIR) technology to
measure CO2 levels in the air. It works by shining infrared light through a
sample of air and detecting the amount of light absorbed by CO2 molecules.
The more CO2 present, the less infrared light is transmitted, allowing the sensor
to determine the CO2 concentration.
16
3.3 ESP32 WROOM32 Microcontroller
The ESP32 WROOM32 is a dual-core microcontroller with integrated Wi-Fi
and Bluetooth. It acts as the system’s central unit, managing sensor
communication, data processing, and web interface.
Key Features:
• Dual-core 32-bit processor
• Built-in Wi-Fi and Bluetooth 520 KB SRAM, 4 MB Flash memory
• Multiple interfaces: UART, I2C, SPI
17
Working Principle:
• Powered by 3.3V supply
• Runs user program stored in flash memory
• Reads inputs from sensors using GPIO, ADC, or communication
protocols (I2C, SPI, UART)
• Controls outputs like LEDs, motors, and relays through GPIO and PWM
Connects to Wi-Fi to send or receive data over the internet
• Supports Bluetooth (Classic and BLE) for wireless communication with
nearby devices
18
• Communicates with cloud platforms like Firebase, AWS, or Blynk using
MQTT or HTTP
• Can enter sleep modes to reduce power consumption
• Commonly used in IoT, smart home, and automation projects
4. Software Design and Arduino IDE
4.1 Development Environment
The project was developed using the Arduino IDE due to its simplicity,
extensive library support, and compatibility with the ESP32 platform. The
ESP32 board package and relevant sensor libraries were installed via the
Arduino Boards Manager and Library Manager, respectively.
4.2 Sensor Integration
Sensor data acquisition was achieved through UART communication. Both the
PMS5003 and Senseair S8 sensors were connected to the ESP32's UART pins.
Libraries specific to each sensor were used to simplify data parsing and error
handling.
19
4.3 Data Processing and Display
After data acquisition, the ESP32 processes and formats the data for display.
The values are updated periodically and converted into user-friendly units
(µg/m³ and ppm). The formatted values are then embedded into an HTML
template hosted by the ESP32.
4.4 Web Server Interface
A lightweight web server was implemented on the ESP32 using the
ESPAsyncWebServer library. Upon connecting to the ESP32's Wi-Fi hotspot,
users can access the real-time air quality data through a browser.
4.5 Full Code:
https://gist.github.com/ubaid12348
5. System Implementation
5.1 Hardware Assembly
The hardware will mounted inside a weather-resistant enclosure with proper
ventilation for accurate air sampling. The PMS5003 sensor will positioned to
ensure unobstructed airflow, while the Senseair S8 will placed with sufficient
clearance to minimize heat interference from other components. The ESP32 will
centrally mounted and connected to both sensors using jumper wires and UART
communication lines. Power will supplied through a USB cable connected to a
5V power adapter.
20
5.2 Circuit Diagram
The connections were made as follows:
PMS5003
• VCC to 5V (via a regulator)
• GND to ESP32 GND
• TX to ESP32 RX
• RX to ESP32 TX
Senseair S8
• VCC to 5V
• GND to ESP32 GND
• TX to ESP32 RX2
• RX to ESP32 TX2
21
22
5.3 Software Deployment
The firmware was uploaded to the ESP32 using the Arduino IDE. Key libraries
included:
• SoftwareSerial for UART communication
• ESPAsyncWebServer for hosting the webpage
• WiFi.h for access point setup
5.4 Webpage and Wi-Fi Access
Once powered on, the ESP32 creates a local Wi-Fi access point (e.g.,
“AirQualityMonitor”). Users connect via their smartphone or laptop and
navigate to a preset IP in my case ( 172.16.1.123) to view the air quality
data in real time.
6. Results and Discussion
6.1 Field Testing
The system was tested outdoors in both residential and roadside environments
in Lahore. Over several days, it recorded varying levels of PM2.5 and CO₂,
showing clear spikes during high traffic hours and dust events. The average CO₂
level in residential areas remained below 700 ppm, while roadside testing
showed levels exceeding 1000 ppm. PM2.5 concentrations were consistently
higher near construction zones.
23
Figure 1 Inside Lab_Factory
24
Figure 2 Outside Lab_Factory
25
6.2 Data Reliability
Although the sensors are not laboratory-grade, the readings followed expected
environmental patterns and aligned reasonably with local air quality reports.
Calibration against a known reference unit showed deviations within ±10%,
which is acceptable for community-level awareness and education.
6.3 Challenges Faced
6.4 Advantages of the System
• Low cost and easy replication
• Real-time, wireless data viewing
• Adaptable to indoor or outdoor use
• Useful for awareness campaigns and academic use
6.5 Limitations
• No long-term data logging
• No cloud integration (can be added in future)
• Lacks temperature/humidity compensation
7. Conclusion and Future Work
7.1 Conclusion
This project successfully demonstrates the design and implementation of a
lowcost outdoor air quality monitoring system using the PMS5003 and Senseair
S8 sensors with an ESP32 microcontroller. The system provides real-time data
PM1.0, PM2.5, PM10, and CO₂ levels through a locally hosted web interface
accessible over Wi-Fi. It serves as a scalable and educational tool to increase
awareness about air quality and its impact on public health, especially in
pollution-prone regions like Pakistan.
26
7.2 Future Work
Several improvements and extensions are possible:
• Cloud Integration: Enable long-term data storage and remote access via
cloud services.
• Mobile App Interface: Develop a smartphone app for improved usability.
• Additional Sensors: Integrate temperature, humidity, and VOC sensors for a
more complete picture.
• Battery and Solar Power: Make the system suitable for off-grid and remote
installations.
• AI-based Analysis: Incorporate machine learning to detect pollution patterns
and provide alerts.
8. References
1. World Health Organization (WHO) – Air pollution fact sheets and statistics.
2. Pakistan Environmental Protection Agency (Pak-EPA) reports and data.
3. OpenAQ – Open global air quality data.
4. Senseair S8 Technical Documentation.
5. Plantower PMS5003 Datasheet.
6. Luftdaten Project https://luftdaten.info
7. Arduino IDE Documentation – https://www.arduino.cc/en/Guide
8. MIT CityAir Project.
9. Live Air Quality Index Reports – https://aqicn.org
10.News coverage on Lahore/Karachi smog crises – Dawn, The Express Tribune.
11.IQAir Global and Pakistan-specific air quality statistics
– https://www.iqair.com/pakistan
12.CO2 Meter:https://www.co2meter.com/CO2levelChart
27
28