0% found this document useful (0 votes)
5 views45 pages

IoT-Based Air Quality Monitoring System

The document presents a mini project report on an IoT-based Air Quality Monitoring System aimed at providing real-time data on air quality, temperature, and humidity. The system utilizes low-cost sensors and Wi-Fi connectivity to transmit data to the ThingSpeak platform for analysis, making it accessible for personal use. The project addresses the limitations of existing air quality monitoring systems, such as high costs and complexity, by offering a simpler and more affordable solution for various environments.

Uploaded by

srinivasarao9973
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)
5 views45 pages

IoT-Based Air Quality Monitoring System

The document presents a mini project report on an IoT-based Air Quality Monitoring System aimed at providing real-time data on air quality, temperature, and humidity. The system utilizes low-cost sensors and Wi-Fi connectivity to transmit data to the ThingSpeak platform for analysis, making it accessible for personal use. The project addresses the limitations of existing air quality monitoring systems, such as high costs and complexity, by offering a simpler and more affordable solution for various environments.

Uploaded by

srinivasarao9973
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

AIR QUALITY MONITORING SYSTEM USING IoT

A Mini Project Report 1 submitted in partial fulfilment of


the requirements for the award of degree of

BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION (ECE)
Submitted By
C. Sai Vaishnavi 23251A0437
V. Mani Sai Deepika 23251A0464
M. Harini 23251A1250
D. Pranathi 23251A1254
Under the esteemed guidance of
Dr. L. Nagaraju,
Asst. Professor, ECE Dept, GNITS

Department of Electronics and Communication Engineering


G. Narayanamma Institute of Technology & Science
(Autonomous) (For Women)
Shaikpet, Hyderabad – 500104.
Affiliated to
Jawaharlal Nehru Technological University Hyderabad
Hyderabad - 500085
April, 2025
G. Narayanamma Institute of Technology & Science
(Autonomous) (For Women)
Shaikpet, Hyderabad - 500104.
Department of Electronics and Communication (ECE)

CERTIFICATE
This is to certify that the Mini-Project 1 report on “Air Quality Monitoring System
using IoT” is a bonafide work carried out by C. Sai Vaishnavi(23251A0437) and
[Link] Sai Deepika(23251A0464) in the partial fulfilment for the award of [Link]
degree in Electronics & Communication Engineering, G. Narayanamma Institute of
Technology & Science (Autonomous), Shaikpet, Hyderabad, affiliated to Jawaharlal
Nehru Technological University, Hyderabad under our guidance and supervision.

The results embodied in the project work have not been submitted to any other University
Institute for the award of any degree or diploma.

Internal Guide Head of the Department


[Link], Dr. K. Ragini
Asst. Prof, Associate Professor&Head
Dept. of ECE Dept. of ECE
ACKNOWLEDGEMENTS

We would like to express our sincere thanks to Dr. K. Ramesh Reddy, Principal, GNITS,
for providing the working facilities in the college.

Our sincere thanks and gratitude to Dr. K. Rama Linga Reddy, Professor in ETE & Dean
Academics, Dr. M. Seetha, Professor in CSE & Dean R&D, Dr. N. Kalyani, Professor in
CSE & Dean of Innovation and Incubation, GNITS for all the timely support and valuable
suggestions during the period of our project.

Our sincere thanks and gratitude to Dr. K. Ragini, Associate Professor & Head, Department
of ECE, GNITS for all the timely support and valuable suggestions during the period of our
project.

We are extremely thankful to overall coordinator of Mini-Project Dr. P. ChandraSekhar,


Assistant Professor, Department of ECE, GNITS encouragement and support throughout the
project.

We are extremely thankful to our Mini-Project Coordinators Dr. L. Nagaraju, Assistant


Professor, Department of ECE, for the encouragement and support throughout the project.

Finally, we are extremely thankful to all the faculty members and staff of ECE Department
who helped us directly or indirectly, parents and friends for their cooperation in completing
the project work.

C. Sai Vaishnavi 23251A0437


V. Mani Sai Deepika 23251A0464
M. Harini 23251A1250
D. Pranathi 23251A1254
ABSTRACT

Air pollution has become a significant concern worldwide, affecting human health and the

environment. This project proposes a real-time air quality monitoring system using Internet

of Things (IoT) technology. The system utilizes sensors to measure pollutant levels, such as

air quality with concentration of various gases (dht11, MQ135 sensor and ESP32 module).

and transmits the data to a platform using WIFI connectivity (ThingSpeak).

Platform analyses the data and provides real-time updates on air quality indexes, enabling

users to take necessary precautions.


CONTENTS
Acknowledgments…………………………………………………………..…………..……iii
Absract………………………………………………………………………………………. iv
1. INTRODUCTION .............................................................................................................. 1
1.1 General Description……………………………………................................................... 1
1.2 Problem Statement............................................................................................................. 2
1.3Objectives and Scope of the Project…………................................................................... 2
1.4 Organization of Project Report.......................................................................................... 3
2. Literature Survey…………................................................................................................4
2.1 Existing System.................................................................................................................. 4
2.2 Drawbacks in Existing Systems......................................................................................... 6
2.3 Motivation for Proposed System........................................................................................ 7
3. Required Specification……………….................................................................................12
3.1 Introduction to Proposed System.......................................................................................12
3.2 System Environment......................................................................................................... 12
3.3 Functional Requirement Specification………….............................................................. 13
3.3.1 Use Case Descriptions.....................................................................................................13
3.3.2 List of Functional Requirements……….........................................................................13
3.4 Non-Functional Requirement Specification.......................................................................14
3.5 Software and Hardware Requirements……......................................................................15
3.5.1 Software Requirements…………………......................................................................15
3.5.2 Hardware Requirements………………….....................................................................15
4. Design Specification…………………………………........................................................16
4.1 Overall Use Case Diagram.................................................................................................16
4.2 Use Case Descriptions........................................................................................................16
4.3 Class Diagram…............................................................................................................... 17

v
4.4 Sequence Diagram.............................................................................................................17
4.5 Activity Diagram Idea........................................................................................................17
5. Proposed System................................................................................................................18
5.1 Methodology with Flowchart.............................................................................................19
5.1.1 Methodology Description……………............................................................................19
5.1.2 Methodology Flowchart……………..............................................................................20
5.1.3 Flowchart Explanation……………………....................................................................21
5.2 System Architecture…………….......................................................................................21
5.3 Modules Descrption…………………...............................................................................22
5.3.1 Wifi-Connection Module………………………............................................................22
5.3.2 Sensor Reading…………………………………………………………………………23
5.3.3 Data Display Module (LCD)…………………………………………………………...24
5.3.4 Cloud Data Upload Module (ThingSpeak)………………………………………….....25
5.3.5 Systems Control and monitoring………………………………………………………27
5.4 Implementation…………………………………………………………………………..27
5.4.1 Source Code……………………………………………………………………………28
5.4.2 Outputs…………………………………………………………………………………33
References……………………………………………………………………………………37

vi
1. Introduction

1.1 General Description:

Air pollution has become a serious problem in many parts of the world. Poor air quality
affects people’s health and the environment. So, there is a need for ways to measure and
monitor it easily. However, most air quality monitoring systems available today are either
very expensive or too complicated for normal people to use. Because of this, there is a strong
need for a simple, low-cost system that anyone can use to check the air quality around them.

Our project, the IoT-based Air Quality Monitoring System, solves this problem by using a
simple setup that includes an ESP32 microcontroller, an MQ135 gas sensor, a DHT11
temperature and humidity sensor, and an LCD screen. The system reads the temperature,
humidity, and air quality in real time. It shows the results on the LCD screen using easy to
understand alert lines and emojis (happy, neutral, or sad faces) based on how good or bad the
air is. As a result, a non-technical person can also understand the displayed information.

The device is connected to the Wi-Fi. The system sends the collected data to a cloud platform
called ThingSpeak for every few seconds. Here, the data can be viewed as graphs and charts.
This is helpful for the user in tracking the air quality and notice any patterns.

This project is especially useful for homes, schools, offices, and small public places. It is
affordable, portable, and easy to set up, making it ideal for personal or community use. With
this device, people can make better decisions, like opening windows, turning on air purifiers,
or avoiding outdoor activities if the air quality is poor.

Overall, our Air Quality Monitoring System is designed to be simple, smart, and user-friendly,
bringing important environmental information straight to people's fingertips without needing
expensive or complicated systems.

1
1.2 Problem Statement:

Air pollution is becoming a serious issue and affects human health in many ways. Most people
do not have an easy access to information about the air quality around them. Existing air
quality monitoring systems are expensive, complicated, and specifically made for large
organizations, not for personal use.

There is a need for a simple, low-cost, and real-time system that can help ordinary users check
air quality easily and make better decisions to stay safe.

Our project focuses on building an easy-to-use IoT based air quality monitoring system that
displays air conditions like temperature, humidity, the air quality on the LCD screen and to
save the obtained data in the graphical form online in Thing Speak(IOT).

1.3 Objectives and Scope of the Project:

o Primary Objective: Building an affordable, IoT-based air quality monitoring


system that can be used to measure the temperature, humidity, and air quality,
and to display the results on an LCD screen. To upload the obtained data to the
IoT platform for the graphical data.

o Secondary Objective: For the awareness of the public about environmental


issues by providing real-time feedback about their immediate surroundings.

o Scope:
o The system can be implemented in any environment requiring air quality
monitoring (e.g., homes, offices, schools).

o The platform used for data visualization is ThingSpeak, making it accessible


for users to track data from anywhere with an internet connection.

o The proposed system is focused on recording the temperature, humidity, and


air quality values.
2
1.4 Organization of Project Report:
The project report is organized into the following chapters:

Chapter 1: Introduction
This chapter introduces the Air Quality Monitoring System project. It explains the
general background, defines the problem we are solving, outlines the objectives, and
gives an overview of the scope of the project.
• Chapter 2: Literature Survey
This chapter reviews previous research and existing systems related to air quality
monitoring. It highlights their methods, limitations, and explains the motivation for
building the proposed system.
• Chapter 3: Requirement Specification
This chapter details the system requirements. It covers the system environment,
functional and non-functional specifications, and lists the hardware and software tools
used in the project.
• Chapter 4: Design Specification
This chapter contains the design diagrams like use case diagrams, class diagrams,
sequence diagrams, and activity diagrams. Each diagram is explained briefly to
understand the system flow.
• Chapter 5: Proposed System
This chapter discusses the methodology, flowchart, system architecture, module-wise
description, and the implementation details of the project. It gives a full picture of
how the system was built and how it functions.
• Chapter 6: References
This chapter lists all the research papers, articles, and resources that were referred to
during the making of the project, formatted properly as per the academic guidelines.

3
2. Literature Survey

2.1 Existing System:


IoT-based air quality monitoring systems have become increasingly common, utilizing
networks of sensors to measure pollutants like particulate matter (PM), carbon dioxide (CO2),
nitrogen dioxide (NO2), and ozone (O3), alongside environmental factors such as
temperature and humidity. These sensors send data to cloud platforms for real-time
processing, providing air quality indices and environmental trends. While these systems
are effective at tracking pollution, they often rely on machine learning and computationally
expensive algorithms to make predictions, leading to high operational costs and cost
requirements.

In urban areas, many systems use wireless sensors which are brought as part of smart city
project. These networks help monitor air quality across large cities, providing valuable
insights for city officials. However, the accuracy of these systems can be impacted by
environmental factors like weather conditions, maintaining and including large sensor
networks can become costly and cumbersome.

Few systems integrate gas sensors with cloud platforms for remote monitoring and
visualization of air quality data. This is particularly useful in industrial applications, where
worker safety is a worry. However, the power consumption of these sensors requires frequent
battery replacements, and the dependency on reliable internet connections can be a challenge
in areas with poor connectivity.

Though there are many uses with the existing air quality monitoring systems, they face many
limitations such as high costs, environmental interference, power consumption issues, and the
need for stable internet access. Due to these challenges, the need for more efficient, cost-
effective solutions that can provide real-time air quality data with less complexity and lower
operational costs has increased.
4
2.2 Drawbacks in Existing Systems:

While existing air quality monitoring systems have contributed significantly to environmental
monitoring, they come with several drawbacks that limit their widespread adoption and
effectiveness.
1. High Operational Costs: Many systems rely on complex algorithms and machine
learning for air quality prediction, which requires significant computational resources.
This increases both the cost and energy consumption, making such systems expensive
to deploy and maintain.
2. Power Consumption: Sensors, particularly gas sensors, tend to consume a
considerable amount of power. This necessitates frequent battery replacements or
recharging, leading to higher operational costs and potential downtime.
3. Maintenance and Calibration: Wireless sensor networks often require constant
maintenance and calibration to ensure accuracy, adding to the cost and complexity of
these systems. This is especially true in large-scale deployments, such as in smart
cities.
4. Dependency on Stable Internet Connections: Many systems rely on continuous
internet connectivity to transmit data to cloud servers. In areas with unstable or
limited internet coverage, this reliance can lead to system failures or gaps in
monitoring.
5. Complex Setup and Management: Setting up and managing these systems often
requires specialized knowledge, making them difficult to implement and maintain for
non-experts or smaller-scale applications.
Overall, the current systems have significant limitations, especially in terms of cost, accuracy,
energy consumption, and operational complexity. These challenges point to the need for more
efficient, cost-effective, and user-friendly solutions for air quality monitoring.
5
2.3 Motivation for Proposed System:

The need for a more efficient, cost-effective, and accessible air quality monitoring system has
become increasingly urgent due to the rising concerns about pollution and its impact on
public health. While existing systems provide valuable data, their limitations—such
as high operational costs, sensor accuracy issues, power consumption, and dependency
on stable internet connections—create barriers to widespread adoption, especially in less
resourceful areas.

Our proposed system aims to address these challenges by offering a solution that simplifies the
process of air quality monitoring while reducing costs and enhancing accessibility.
The primary motivation for this project stems from the following factors:

Cost Efficiency: By using low-power sensors and a straightforward design, the system can be
deployed at a fraction of the cost compared to current systems. This makes it more accessible
for a variety of users, including schools, residential areas, and small businesses.

Energy Efficiency: The system focuses on minimizing power consumption, ensuring long-
lasting functionality without frequent battery changes or energy-intensive operations.

Real-time Data Accessibility: Our system provides real-time air quality data through a
simple interface, enabling users to make quick, informed decisions about their health and
environment.

Simplified Setup and Maintenance: By leveraging easily accessible technology such as the
ESP32, we can reduce the complexity of setup and maintenance, allowing even non-experts to
implement and manage the system.

Accuracy and Reliability: Through careful calibration and the integration of multiple sensor
types (such as the MQ135 for air quality and the DHT11 for temperature and humidity), we
aim to improve data accuracy, making the system more reliable even in challenging
environmental conditions.
6
Ultimately, this proposed system aims to offer a more affordable, user-friendly, and reliable
solution for monitoring air quality in a variety of environments, with the potential for
widespread implementation to benefit communities and industries alike.

Title Year Research Paper Method Limitation


IoT-Based Air 2024 Nature The paper presents an The major limitation
Quality Communications IoT-based system that is the high
Monitoring uses a distributed computational cost
and network of involved
in Prediction environmental sensors to processing large
data System monitor air quality in sets for
real-time
real-time. It also employs prediction, making it
machine learning models less feasible for low-
to predict future pollution resource
levels based on historical environments.
data patterns and
meteorological factors.
7
Real-Time Air 2024 MDPI Processes This research discusses Environmental
Quality the deployment of factors such as
Monitoring in wireless sensor networks temperature,
Smart Cities across smart cities to humidity, and
collect and transmit air interference from
quality data to centralized buildings or traffic
servers. The system cause fluctuations in
focuses on scalability and sensor readings,
urban integration for reducing data
dynamic, real-time air accuracy.
quality mapping.

IoT-Based 2024 IEEE Xplore In this study, IoT-enabled The sensors used
Real-Time Air gas sensors are used consume a
Pollution alongside cloud considerable amount
Monitoring platforms to visualize and of power,
requiring System analyze pollution data. frequent
Real-time readings are maintenance and
uploaded to cloud limiting long-term
dashboards, enabling deployment
without immediate public access stable power
sources. to air quality information.
Wireless 2025 Elsevier Sensors Proposes a compact air Limited battery
life Sensor-Based and Actuators B: surveillance system that of wireless
nodes Air Quality Chemical uses energy-efficient restricts
continuous Surveillance wireless nodes for AQI
monitoring over System (Air Quality Index)
extended periods measurement in without manual
industrial zones. Data is intervention.
collected periodically and
processed on edge
devices before cloud
upload.

8
Urban Air 2025 Springer IoT Combines low-cost Limited geographical
Pollution Journal sensors and cloud range due to low-
Analysis analytics platforms to power transmission;
Using IoT and collect, store, and analyze struggles with
signal Cloud urban air pollution data, loss in
dense city Computing with dashboards for
infrastructure.
policymakers. Utilizes
REST APIs for flexible
data handling
and visualization.
Smart Air 2025 IEEE Sensors Implements an edge- The system
has Monitoring Letters computing approach difficulty
handling Using Edge where initial data filtering unexpected
surges in Computing and preprocessing are pollution,
leading to Techniques done directly on the
potential data loss if sensor nodes to reduce edge nodes are
cloud server load. Only overwhelmed.
significant changes in
AQI are sent to cloud
storage.
Energy- 2025 ACM Designs an IoT network Sensor calibration
Efficient IoT Transactions on that emphasizes ultra-low drift over time
leads System for Air Internet of Things power consumption to a decrease in data
Quality sensors combined with accuracy,
Assessment AI models for pollution necessitating
forecasting, tailored for frequent
rural deployment where recalibration or
resources are scarce. replacements.
9
3. Requirement Specification

3.1 Introduction to Proposed System:


The proposed air quality monitoring system is designed to provide real-time monitoring of air
quality, temperature, and humidity. By integrating an MQ135 air quality sensor, DHT11
temperature and humidity sensor, and ESP32 microcontroller, the system offers an affordable,
easy-to-use solution for environmental monitoring.
The system displays real-time data on an LCD screen and sends the data to the cloud via Wi-
Fi for remote monitoring. This cloud feature allows users to access the data from anywhere,
ensuring continuous awareness of air quality conditions. The display also includes simple
indicators (smiley, neutral, and sad faces) to visually represent air quality levels, making it
easy for users to interpret the data.
Designed to be cost-effective and energy-efficient, the system is ideal for use in homes,
schools, offices, and public spaces. It aims to make air quality monitoring accessible to a
wide audience, offering a simple setup and minimal maintenance. By providing real-time
feedback, the system empowers users to take proactive steps in maintaining healthy air
quality.

3.2 System Environment:


The system operates in a Wi-Fi enabled environment. It requires an ESP32 board, connected
to Wi-Fi, and powered through a USB cable. It also involves integration with the ThingSpeak
platform, which allows data visualization and monitoring from any internet-enabled device.

3.3 Functional Requirement Specification


3.3.1 Use Case Descriptions
• Use Case 1: Monitor Air Quality
o Description: The user will be able to monitor real-time air quality, which is
displayed on the LCD. The air quality is measured by the MQ135 sensor and
classified as "Good Air," "Moderate," or "Polluted."
o Actors: User, Air Quality Monitoring System
o Preconditions: System is powered on and connected to Wi-Fi.
o Postconditions: Air quality is displayed on the LCD, and data is uploaded to
ThingSpeak.
10
• Use Case 2: View Environmental Data on ThingSpeak
o Description: The user can log in to ThingSpeak to view the environmental data
(temperature, humidity, and air quality).
o Actors: User, ThingSpeak platform
o Preconditions: The system must be connected to Wi-Fi.
o Postconditions: The environmental data is available on ThingSpeak.
3.3.2 List of Functional Requirements
1. Real-Time Data Collection: The system must continuously collect data from the
MQ135 sensor (air quality), DHT11 sensor (temperature and humidity), and display it
on the LCD screen.
2. Data Display: The system must display the temperature, humidity, and air quality
status (good, moderate, or polluted) on the LCD screen. The display should also
include emoticons (smiley, neutral, sad) to represent air quality levels.
3. Cloud Integration: The system must send the collected data (temperature, humidity,
air quality) to the ThingSpeak cloud platform in real-time via HTTP requests. The
data must be sent at regular intervals (e.g., every 10 seconds).
4. Wi-Fi Connectivity: The system must be capable of connecting to a Wi-Fi network to
enable communication between the ESP32 microcontroller and the cloud platform.
5. Status Indicators: The system must display appropriate status indicators on the LCD
screen based on the air quality readings, such as "Good Air," "Moderate," or "Polluted."

3.4 Non-Functional Requirement Specification


1. Performance: The system should process data from the sensors in real-time and
display it on the LCD with minimal delay. Data should be sent to the cloud platform
within a few seconds of being collected.
2. Scalability: The system should be capable of supporting additional sensors or devices
if required in the future without requiring significant redesign.
3. Reliability: The system must be reliable in terms of data accuracy, stability of the Wi-
Fi connection, and continuous operation over extended periods. It should operate 24/7
with minimal downtime.
4. Maintainability: The system should be designed in a way that allows
easy maintenance and troubleshooting. The code and hardware should be modular to
facilitate updates and repairs.

11
5. Usability: The system must be easy to set up and use. The interface (LCD screen)
should be user-friendly, and the data should be presented in an easily understandable
format.
6. Power Efficiency: The system should be energy-efficient to ensure long-term use
without excessive power consumption. The sensors and microcontroller should not
consume more power than necessary, making it suitable for continuous operation.
7. Cost-Effectiveness: The system should be affordable for a wide range of users. The
components used (e.g., ESP32, DHT11, MQ135) should be low-cost yet effective in
monitoring air quality.

3.5 Software and Hardware Requirements


3.5.1 Software Requirements:
• Arduino IDE for writing and uploading code to the ESP32.
• ThingSpeak platform for cloud data storage and visualization.
3.5.2 Hardware Requirements:
• ESP32 board.
• MQ135 Gas Sensor.
• DHT11 Temperature and Humidity Sensor.
• LCD Display (16x2 with I2C interface).
• Wi-Fi Network for cloud connectivity.

12
4. Design Specification
4.1 Overall Use Case Diagram:

Fig.4.1

4.2 Use Case Descriptions:


Use Case 1: Display Sensor Data on LCD
• Actor: User
• Description: This use case involves displaying sensor data (temperature, humidity,
and air quality) on the LCD.
• Pre-condition: System is powered on and Wi-Fi is connected.
• Post-condition: Data is displayed on LCD.
• Basic Flow: Reads data from sensors and shows it on the LCD.
Use Case 2: Send Data to ThingSpeak
• Actor: User
• Description: The system sends sensor data to the ThingSpeak cloud platform.
• Pre-condition: Wi-Fi must be connected.
• Post-condition: Data uploaded to ThingSpeak.
• Basic Flow: Collects data and sends it via HTTP requests to ThingSpeak.

13
4.3 Class Diagram:

fig.4.3
4.4 Sequence Diagram:

fig.4.4

14
4.5 Activity Diagram:

fig.4.5

15
5. Proposed System

5.1 Methodology with Flowchart:


5.1.1 Methodology Description:
The methodology for this project follows a structured approach starting from sensor data
acquisition to displaying and uploading the data to ThingSpeak. The entire process can be
broken down into the following steps:
1. Initialize the System:
o The system is powered on and initialized, including the setup of sensors, LCD,
and Wi-Fi module.
o The LCD screen is initialized to display initial connection messages.
2. Connect to Wi-Fi:
o The system attempts to connect to a predefined Wi-Fi network using the
credentials stored in the code.
o If the connection is successful, it proceeds to data acquisition; otherwise, it
continues retrying the connection.
3. Read Sensor Data:
o Once the Wi-Fi connection is established, the system starts reading data from
the temperature and humidity sensor (DHT11) and the air quality sensor
(MQ135).
o The sensor values are then processed to ensure they are within an acceptable
range.
4. Display Data on LCD:
o After reading the sensor data, the system displays the values on the LCD
screen. This includes:
▪ Temperature (in °C)
▪ Humidity (in %)
▪ Air Quality (categorized as Good, Moderate, or Polluted)
5. Upload Data to ThingSpeak:
o The system sends the sensor data (temperature, humidity, air quality) to the
ThingSpeak cloud platform using an HTTP POST request.
o It ensures that the data is uploaded periodically without exceeding the
platform's rate limits.
16
6. Continuous Monitoring:
o The system continuously monitors the sensor data and updates the LCD screen
and ThingSpeak in real time.
The entire process loops continuously to ensure that the system provides up-to-date
information to the users.

5.1.2 Methodology Flowchart:

fig.5.1.2

17
5.1.3 Flowchart Explanation:
1. Start: The process begins once the system is powered on.
2. Initialize System Components: Initializing all necessary components like the sensor
(DHT11, MQ135), LCD screen, and Wi-Fi module.
3. Connect to Wi-Fi: The system connects to the Wi-Fi network using the pre-
configured credentials.
4. Wi-Fi Connection Check: If the Wi-Fi connection is successful, the system proceeds
to read sensor data. Otherwise, it displays a Wi-Fi connection error on the LCD and
tries to reconnect.
5. Read Sensor Data: The system reads temperature, humidity, and air quality data from
the respective sensors.
6. Display Data on LCD: The acquired data is displayed on the LCD screen in real-time.
7. Send Data to ThingSpeak: The system uploads the sensor data to ThingSpeak using
an HTTP request.
8. End: The process loops continuously, constantly monitoring and updating the LCD
and ThingSpeak.

5.2 System Architecture:


Sensors:
• The DHT11 sensor measures temperature and humidity.
• The MQ135 sensor measures air quality.
Microcontroller (ESP32):
• It is the brain of the system, collecting data from sensors, processing the data, and
sending it to the cloud (ThingSpeak).
• It also connects to the Wi-Fi and manages the LCD display.
LCD Display:
• Displays real-time sensor readings to the user.
• It shows the temperature, humidity, and air quality status.
Wi-Fi Module:
• The ESP32 has built-in Wi-Fi, allowing the system to connect to a wireless network
for sending data to ThingSpeak.
ThingSpeak Cloud Platform:

18
• It stores the sensor data online and provides a real-time dashboard where the data can
be visualized.

5.3 Modules Description:


The Air Quality Monitoring System is composed of several key modules, each responsible for
specific tasks and functionalities. Below is a detailed explanation of each module, their
operations, and their interactions within the system.
5.3.1 Wi-Fi Connection Module
Purpose:
The Wi-Fi Connection Module is crucial for ensuring that the system can connect to the
internet and send data to the cloud-based platform (ThingSpeak). It acts as a
communication bridge between the hardware (ESP32 microcontroller) and the web.
Responsibilities:
• Establishing Wi-Fi Connection:
The module starts by using predefined credentials (SSID and password) to establish a
connection to a Wi-Fi network.
o If the Wi-Fi connection fails, the system continuously attempts to reconnect.
o If successful, it moves on to the next module—reading sensor data.
• Connectivity Status Display:
It ensures that the LCD screen reflects the status of the Wi-Fi connection. If the
connection is established, it displays "WiFi Connected"; otherwise, it shows
"Connecting Wi-Fi..." or "Wi-Fi not connected."
• Communication:
The ESP32 microcontroller communicates over the network to send data to
ThingSpeak, a cloud platform for real-time data visualization.
Challenges:
• Ensuring stable connectivity, especially in low-signal areas, and handling interruptions
in Wi-Fi connection.
• Managing potential delays in response time when reattempting connections.

5.3.2 Sensor Reading Module


Purpose:
The Sensor Reading Module is responsible for interfacing with the physical sensors (DHT11

19
for temperature and humidity and MQ135 for air quality). It collects environmental data that
reflects the current air quality and weather conditions in the monitored area.
Responsibilities:
• Temperature and Humidity Reading (DHT11):
The DHT11 sensor is a low-cost temperature and humidity sensor that measures the
environmental conditions. The module continuously reads data from the DHT11
sensor and stores it in the system for further processing.
o Temperature: Measured in Celsius (°C).
o Humidity: Measured in percentage (%).
• Air Quality Reading (MQ135):
The MQ135 sensor measures the concentration of harmful gases in the air (such as
ammonia, benzene, alcohol, carbon dioxide). This module reads the analog output of
the MQ135 sensor and processes it to produce a numeric value representing air
quality.
o The raw data from the MQ135 is mapped to a range (0-400) and categorized
into three ranges:
▪ Good Air (0-200): Ideal air quality.
▪ Moderate (200-400): Some pollution.
▪ Polluted (400+): Poor air quality, indicating the need for the user to
take action.
• Data Validation:
The module also ensures that the data from the sensors is accurate by performing
checks and validation. If invalid readings are detected (e.g., sensor error or unstable
values), it can either attempt to re-read the sensor or display an error message on the
LCD screen.
Challenges:
• Calibration of sensors is critical for obtaining accurate readings. Sensors like MQ135
require calibration for different environments.
• Ensuring that temperature and humidity readings are consistent with environmental
changes.
20
5.3.3 Data Display Module (LCD)
Purpose:
The Data Display Module is responsible for visually presenting the sensor readings on an
LCD screen for real-time user monitoring. This allows users to quickly assess
environmental conditions without needing to check a mobile app or cloud platform.
Responsibilities:
• Display Sensor Data: The LCD displays the current temperature, humidity, and air
quality status in a readable format.
o Temperature and humidity are displayed on the first line.
o The air quality status (Good, Moderate, Polluted) is shown on the second line.
o A corresponding emoji (happy, neutral, sad) is displayed next to the air quality
status for a more intuitive understanding.
• Visual Feedback: The module provides users with a visual representation of the
current air quality:
o Good Air: Displays a smiley face.
o Moderate: Displays a neutral face.
o Polluted: Displays a sad face.
• User Interaction: The LCD provides real-time feedback, allowing users to
immediately recognize the quality of the air and decide whether to take action (e.g.,
open a window or use an air purifier).
Challenges:
• Limited space on the LCD screen to display detailed information.
• Managing scrolling or updating the LCD in a way that doesn’t clutter the display with
unnecessary information.

5.3.4 Cloud Data Upload Module (ThingSpeak)


Purpose:
The Cloud Data Upload Module is responsible for sending sensor data to the ThingSpeak
cloud platform for data logging and visualization. This module enables the system to
store and retrieve historical data for future analysis.
Responsibilities:

21
• Data Uploading:
The module uploads the data to ThingSpeak at regular intervals. It sends the data over
an HTTP request (GET) to a pre-configured API endpoint using the ThingSpeak API
key. The data includes:
o Temperature (°C)
o Humidity (%)
o Air Quality (0-400)
• Data Logging: Once uploaded, the data is stored on ThingSpeak and can be accessed
through a real-time dashboard that visualizes the temperature, humidity, and air
quality over time.
• HTTP Request Handling: The module uses the HTTPClient library to send requests.
It checks the response code to verify whether the data was successfully uploaded or
if an error occurred. If the upload fails, it attempts again after a brief delay.
• Rate Limiting Management: ThingSpeak imposes rate limits for uploading data. The
module ensures that the system does not exceed the allowed frequency of uploads
by including delays between requests.
Challenges:
• Ensuring that the HTTP request to ThingSpeak is properly formatted and the server
responds correctly.
• Handling rate limits and ensuring that the system only uploads data when it is
permitted by the platform.

5.3.5 System Control and Monitoring


Purpose:
The System Control and Monitoring Module oversees the smooth operation of the entire
system. It ensures that all the submodules (Wi-Fi, sensors, LCD, and cloud uploading) work
together in a coordinated manner, without conflicts or errors.
Responsibilities:
• Monitoring System Status: This module continuously monitors the health of the
system, ensuring that components like the Wi-Fi connection, sensors, and cloud
upload are functioning correctly.

22
• Error Handling: It is responsible for identifying issues like failed sensor readings or
cloud connection issues and providing feedback to the user. If something goes
wrong, it can show appropriate error messages on the LCD screen and log them for
debugging purposes.
• Power Management: Ensuring efficient use of power in a system that relies on a
battery or a limited power source. This includes handling the sleep mode for sensors
when not actively in use to save energy.
Challenges:
• Managing interactions between modules so they function seamlessly.
• Handling errors gracefully without crashing the system or causing a poor user
experience.

5.4 Implementation:
5.4.1 Source Code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#include <WiFi.h>
#include <HTTPClient.h>

#define DHTPIN 4
#define DHTTYPE DHT11
#define MQ135_PIN 32

const char* ssid = "HUAWEI nova 9 SE";


const char* password = "muske019";
const char* server = "[Link]
String apiKey = "VO99NFVIBHBMWVY9";

DHT dht(DHTPIN, DHTTYPE);


LiquidCrystal_I2C lcd(0x27, 16, 2);

23
byte smiley[8] = {0b00000, 0b01010, 0b00000, 0b00000, 0b10001, 0b01110, 0b00000};
byte neutral[8] = {0b00000, 0b01010, 0b00000, 0b00000, 0b11111, 0b00000, 0b00000};
byte sad[8] = {0b00000, 0b01010, 0b00000, 0b00000, 0b01110, 0b10001, 0b00000};

void setup() {
[Link](115200);
[Link]();
[Link]();
[Link]();
[Link](0, smiley);
[Link](1, neutral);
[Link](2, sad);

[Link](0,0);
[Link]("Connecting WiFi...");
[Link](ssid, password);

while ([Link]() != WL_CONNECTED) {


delay(500);
[Link](".");
}

[Link]();
[Link](0,0);
[Link]("WiFi Connected!");
delay(2000);
}

void loop() {
float h = [Link]();
float t = [Link]();
int airQualityRaw = analogRead(MQ135_PIN);
int airQuality = map(airQualityRaw, 0, 4095, 0, 400);

24
byte emoji;
String status;

if (airQuality < 200) {


emoji = 0; status = "Good
Air"; } else if (airQuality <=
400) {
emoji = 1; status =
"Moderate"; } else {
emoji = 2; status =
"Polluted!"; }

[Link]();
[Link](0, 0);
[Link]("T:"); [Link](t); [Link]("C H:"); [Link](h);
[Link](0, 1);
[Link](status); [Link](" "); [Link](emoji);

// Debug prints to serial monitor


[Link]("Temperature: ");
[Link](t);
[Link]("Humidity: ");
[Link](h);
[Link]("Air Quality: ");
[Link](airQuality);

[Link]();
[Link](" Posting to ThingSpeak...");

if ([Link]() == WL_CONNECTED) {
HTTPClient http;
String url = String(server) + "?api_key=" + apiKey +
"&field1=" + String(t) +
"&field2=" + String(h) +
25
"&field3=" + String(airQuality);

// Print the URL being sent for debugging


[Link]("URL: " + url);

[Link](url);
int httpCode = [Link]();

// Debug HTTP response code


[Link]("HTTP Response code: ");
[Link](httpCode);

if (httpCode > 0) {
[Link](" Data sent!");
} else {
[Link](" Failed to send data.");
}
[Link]();
} else {
[Link](" WiFi not connected.");
}

delay(1000); // Delay to avoid exceeding ThingSpeak rate limit


}

26
5.4.2 Outputs:

fig.5.4.2 Result

fig.[Link] Field1(Temperature)

27
fig.[Link] Filed2(Humidity)

Fig.[Link] Field3(Air Quality)

28
fig.[Link]

fig.[Link]

29
fig.[Link]

30
References
[1] "IoT-Based Air Quality Monitoring and Prediction System," Nature Communications,
2024. [Online]. Available: [Link]

[2] "Real-Time Air Quality Monitoring in Smart Cities," MDPI Processes, 2024. [Online].
Available: [Link]

[3] "IoT-Based Real-Time Air Pollution Monitoring System," IEEE Xplore, 2024. [Online].
Available: [Link]

[4] "An IoT-Based Smart Air Quality Monitoring System," IEEE Access, 2024. [Online].
Available: [Link]

[5] "Design and Development of an IoT-Based Air Quality Monitoring System," Journal of
Environmental Science and Technology, 2024. [Online]. Available:
[Link]

[6] "Low-Cost Air Quality Monitoring Using IoT," Sensors, vol. 25, no. 1, 2025. [Online].
Available: [Link]

[7] "A Survey on IoT-Based Air Pollution Monitoring Systems," Springer Link, 2024.
[Online]. Available: [Link]

[8] "Smart Air Quality Monitoring with IoT for Urban Areas," International Journal of
Computer Applications, vol. 154, no. 4, 2024. [Online]. Available:
[Link]

[9] "Design and Implementation of a Smart Environmental Monitoring System Using IoT,"
Sensors and Actuators A: Physical, 2025. [Online]. Available:
[Link]

[10] "Internet of Things-Based Smart City Monitoring System: A Case Study of Air Quality,"
Journal of Ambient Intelligence and Humanized Computing, 2025. [Online]. Available:
[Link]

31

You might also like