Realtime Air Quality Evaluator Using Iot and Machine Learning

DOI : 10.17577/IJERTV13IS020035

Download Full-Text PDF Cite this Publication

  • Open Access
  • Authors : Mrs.K.V.Lalitha Assistant Professor, Adabala Venkata Naveen, Alapaty Sai Venkata Supriya, Pilli Satya Rama Nagalakshmi, Pallala Surya Kantham
  • Paper ID : IJERTV13IS020035
  • Volume & Issue : Volume 13, Issue 02 (February 2024)
  • Published (First Online): 21-02-2024
  • ISSN (Online) : 2278-0181
  • Publisher Name : IJERT
  • License: Creative Commons License This work is licensed under a Creative Commons Attribution 4.0 International License

Text Only Version

Realtime Air Quality Evaluator Using Iot and Machine Learning

Mrs.K.V.Lalitha, Assistant Professor, Adabala Venkata Naveen,

Alapaty Sai Venkata Supriya, Pilli Satya Rama Nagalakshmi, Pallala Surya Kantham

Department of Electronics and Communication Engineering,

Godavari Institute of Engineering and Technology(A), Rajahmundry, AP, INDIA.

ABSTRACT: The primary objective of an air quality evaluator is to install a security system that will detect gas leaks in enclosed spaces. The system of interconnected, internet-connected objects used for data collection and transfer is called the "internet of things." An Internet of Things (IoT)-based air pollution monitoring system uses a web server to monitor air quality. Companies and homes can benefit from the installation of this alarm system, which could save lives. In this project, a GSM modem interfaces with a dust sensor, LCD display, buzzer, DHT11, Arduino Mega2560, PM2.5, and gas sensors (MQ2, MQ135) to accomplish the selected task. We will locate leaks for various gases by utilizing different kinds of gas sensors.

Keywords: Arduino Mega 2560, Machine Learning , Sensors, GSM modem, Linear regression ,ThingSpeak.


One of the most crucial things in the modern world is poor Air quality. Air pollution is a critical global issue that endangers human health, the environment, and the quality of life. The increasing amounts of pollutants in the atmosphere, caused by industry, urbanization, and automobile emissions, have had a negative impact on respiratory health, cardiovascular illness, and even climate change. Timely and precise prediction of air pollution levels is critical for effective mitigation techniques, urban planning, and public awareness campaigns.Continuous, high-precision monitoring of air qualityis crucial for prompt implementation of effective solutions. This study presents an independent, real-time approach for assessing air quality. We use the Internet of Things (IoT) to monitor air quality, a technology widely used in various industries. This IoT project allows remote monitoring of pollution levels using a PC or mobile device. The "Internet of Things" (IoT) refers to a network of interconnected items, including electronics, software, and other technologies, that communicate and exchange data online.Appliances can range from common to very specialized. The Internet of Things (IoT) has become an effective tool for monitoring and evaluating air quality. The project will use an IoT sensor network to monitor air quality metrics as PM, CO2, NO2, and O3 levels. IoT sensors enable real-time air quality data collection and analysis, allowing authorities to make educated decisions on environmental rules, public health policy, and emergency response.Embedded system,An embedded system is a type of computer system that is primarily designed to handle several activities such as data access, processing, and storage as well as

data control in various electronics-based systems. Embedded activities such as data access, processing, and storage as well as data control in various electronics-based systems. Embedded systems are a combination of hardware and software, with the software, known as firmware, embedded within the hardware. One of the most important features of these systems is that they provide o/p within time constraints. Embedded technologies help to make work more precise and convenient. So, embedded systems are commonly used in both basic and complex products. Embedded systems are used in a variety of products in our daily lives, including microwaves, calculators, TV remote controls, home security systems, and neighborhood traffic control systems, among others.


In recent years, society and the government have paid careful attention to the degradation of air quality, frequent instances of air pollution, and the resulting health consequences. As a result, there is an urgent demand for relevant and useful forecasting tools in scientific research.

[1] Hui Liu, Guangxi Yan, Zhu Duan, and Chao Chen discuss the basic forecasting methodologies, which include shallow and deep learning predictors. They discuss their foundations, uses, advantages, and disadvantages. The goal of this study for Support Vector Machine, Artificial Neural Network, Forest, and Adaptive Boosting (AdaBoost) is to give a comprehensive literature evaluation of complex modeling techniques used in air quality forecasting, which may be useful for future investigations.

[2] Yun-Chia Liang*, Josue Rodolfo Cuevas Juarez, Angela Hsiang-Ling Chen, and YonaMaimury presented their research, which focuses on developing AQI prediction models for severe air pollution occurrences 1, 8, and 24 hours in advance. The following machine learning (ML) techniques are investigated: support vector machines, artificial neural networks, random forests, and stacking ensemble approaches [3] The recommended work by Madhuri VM, SamyamaGunjal GH, and Savitha Kamalapurkar employed the supervised learning method. Several algorithms, including Naive Bayes, Linear Regression, SVM, Kernel SVM, Nearest Neighbor, and Random Forest, are considered supervised learning methods. Because Random Forest surpasses all other algorithms in terms of outcomes, we utilize it to reliably forecast air pollution .

[4] Riteeka Nayak, Malaya Ranjan Panigrahy, Vivek Kumar Rai, and T Appa Rao presented a project in which they created an IOT Based Air Pollution Monitoring System that monitors air quality over a web server via the internet and will sound an

alarm when the air quality falls below a certain level, indicating that there are enough harmful gases in the air such as CO2, smoke, alcohol, benzene, and NH3. It will display the air quality in PPM on the LCD as well as the webpage, allowing us to conveniently monitor it. The MQ135 sensor is ideal for monitoring air quality due to its ability to identify and accuratelyquantify hazardous gases.

[5] Mustapha Si Tayeb , Mohamed Anis Benallal, Mohammed Salim Benabadji, Amine Houari presented IoT monitoring system for air quality assessment and collecting data. This work proposes a hardware and software solution for a low- costdeployable device to collect environmental data related to AP such as CO, CO2, NH3, and NO2 , as well as temperature and humidity,and shows that the device can efficiently collect real- timedata [6]Mahalakshmi.B.S,B.R.VarshithaChandra,Pooja.G.Nair,Rish a Irshad Khan presented their Air Quality Monitoring System Using Machine Learning and IOT .The goal of this project is tocreate an air quality monitoring system that uses machinelearning and the Internet of Things (IoT), which is an Internet server network made up of physical nodes. This system isdivided into three sections: an air pollution detection model written in Python and built with machine learning algorithms such as random forest and support vector machine, a low-cost air monitoring device made up of a hardware unit that detects various pollutants such as CO, NOx, and PM2.5, and an IoT Cloud, ThingSpeak, that acts as a middleman between the hardware component and the algorithm for air pollutionclassification.


Currently, we only have buzzer notifications for gas leaking systems. As a result, people can be alerted and evacuate the house, but there is no way to automatically remove the gas from the area. This implementation has only been done for gas leaks; if a fire occurs, no alarms will be issued.


  • The process is time-consuming;

  • It may loose connections under certain circumstances;


The proposed system uses two controllers: an Arduino Mega as the main controller and a NodeMCU. We're using Arduino to check the air quality by connecting sensors to the board. We used gas sensors such as MQ2, MQ135, and PM2.5, as well as dust sensors, to detect gases. We used a DHT11 Sensor for temperature and humidity measurements. Sensor readings will be transmitted to the cloud using NodeMCU,because NodeMCU already contains a WIFI module.we are using ThingSpeak cloud as it enables us to aggregate, view, and analyze live data streams in the cloud and also allows us to send data from our devices, create real-time visualizations, and send warnings. The goal of this framework is to create a dependable and efficient system for real-time data collection, analysis, and visualization of air quality

Fig.1.1 Proposed Block Diagram

Fig.2.1.Circuit Diagram

Fig.3.1 Flow Chart



  1. ARDUINO MEGA 2560:

    The Arduino Mega 2560 is a microcontroller board built around the ATmega2560 (datasheet). It includes 54 digital input/output pins (14 of which can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It includes everything necessary to support the microcontroller; simply connect it to a computer via USB cable or power it with an AC-to-DC adapter or battery to get started.

    Fig.4.1 Diagram of Arduino Mega 2560


    A GSM modem is a gadget that can be used as a modem or a mobile phone to enable network communication between computers and other processors. In order to function, a GSM modem needs a SIM card and can connect to a network within the range that the network operator has subscribed to. It can be linked via Bluetooth, USB, or serial connection to a computer. If you have the right cable and software driver, you can use a regular GSM phone as a GSM modem by connecting it to your computer's USB or serial interface. There are several uses for the GSM modem in supply chain management, weather stations, and security applications

    Fig.5.1 Diagram of GSM Modem

  3. NODE MCU :

Node MCU is an open-source firmware and development kit that helps you construct your own IoT product with just a few Lua script lines.The board features many GPIO pins for connecting with peripherals and supporting PWM, I2C, SPI, and UART serial communications. The module'sinterface is broken into two parts: firmware and hardware, with the former running on the ESP8266 Wi-Fi SoC and the latter based on the ESP12 module.

ammonia that may be created from methane. When a gas interacts with this sensor, it is first ionized, then adsorbed by the sensing element. This adsorption generates a potential difference on the element, which is transmitted to the processor unit via output pins in form of current.


Fig.6.1 Diagram of Node MCU

Fig.8.1 Diagram of MQ2 Sensor


A sensor is a transducer used to identify an attribute in the surrounding environment.It generates an output in response to events or changes in quantity, usually in the form of an electrical or optical signal;for example, in our project we are using Gas sensor (MQ135),Smoke Sensor(MQ2) and PM2.5 Sensor which sense the air quality, particulate matter , dust particles, and gas Leakagesocccured in the home .It can be detected and send the SMS alert and buzzer sound.

  1. MQ-135 GAS SENSOR:

    The MQ-135 gas sensor is a useful tool for identifying hazardous gases such as smoke. It can identify a variety of dangerous gases, such as CO2, NH3, NOx, alcohol, benzene, smoking, and so on. The MQ135 gas sensor is extremely sensitive to fumes and other dangerous gases, as well as to ammonia, sulfur, and benzoene steam. The MQ- 135

    Fig.7.1 Diagram of MQ135 Gas Sensor

  2. MQ2 SENSOR :

    In current technology scenario, monitoring of gases produced is very important. Monitoring of gases is critical in a variety of applications, including residential equipment like air conditioners, electric chimneys, and industrial safety systems. Gas sensors come in a variety of specifications depending on the sensitivity level, type of gas to be felt, physical dimensions, and a number of other criteria. This Insight focuses on a methane gas sensor that can detect gases such as

    The DHT11 is a basic, inexpensive digital temperature and

    humidity sensor. It measures the surrounding air with a capacitive humidity sensor and a thermistor and outputs a digital signal via the data pin (no analog input pins are required). It's quite simple to operate, however capturing data requires precise timing. The only significant disadvantage of this sensor is that you can only collect new data from it every two seconds.

    Fig.9.1 Diagram of DHT11 Sensor

    1. PM2.5 (PMS7003) SENSOR :

      The PMS7003 is a digital and universal particle concentration sensor that measures the quantity of suspended particles in the air and outputs them through a digital interface.The PM2.5 sensor module, also known as an optical particle counter (OPC), operates on the physical concept of light scattering and measures dust particles lit by laser light at a 90° angle. A mirror collects the light scattered by each particle at around 90 degrees and detects it with a photodiode.

      Fig.10.1 Diagram of PM2.5(PMS7003) Sensor


      1. PYTHON IDLE:

        Python's built-in integrated development environment is known as Python IDLE, or Integrated Development and Learning Environment. This feature-rich integrated development environment (IDE) simplifies Python program creation, execution, and debugging. Developers may run Python commands in an interactive shell inside IDLE, making it simple to test and explore. To enhance the scripting experience, IDLE includes a script editor with capabilities such as code completion and syntax highlighting. The inbuilt debugger aids in the discovery and resolution of issues by providing tools such as breakpoint setup and variable inspection during runtime. IDLE accommodates both novices and specialists by providing a built-in help system and file explorer for easy project navigation and quick access to Python documentation. While excellent for minor projects, more advanced IDEs such as PyCharm or Visual Studio Code may be preferred by some developers for more ambitious and challenging jobs.


      2. ARDUINO IDE :

        Arduino IDE (Integrated Development Environment) is an official program developed by for creating, compiling, and uploading code to Arduino devices. Almost all Arduino modules are compatible with this open-source software, which can be installed and used to compile code while on the go.

      3. THINGSPEAK :

ThingSpeak is an IoT analytics platform that allows you to collect, display, and analyze real-time data streams in the cloud. ThingSpeak enables you to send data from your devices, generate real-time graphs, and issue alerts. ThingSpeak is an open-source Ruby app that enables users to speak with internet-connected gadgets. It makes it easier to access, retrieve, and log data by giving an API to both devices and social networking websites.


The air quality assessor in this project is completely operational and can assess the quality of air in closed spaces in real-time. The built-in system uses hardware components such as an Arduino Mega 2560, a Node MCU, a GSM modem, and sensors to measure air quality. Users can monitor the quality of air in real time.Linear Regression is a machine learning algorithm used to predict and forecast air quality. Thanks to the software built with Python IDLE, Arduino IDE, and enables for smooth communication between hardware components. Through rigorous testing, the project demonstrates the air quality evaluator's competency and dependability in a range of scenarios, showing its ability to detect gases in the air and deliver data immediately. Overall, the project is effective in meeting its objectives of building and deploying a comprehensive monitoring system using easily available and moderately cost technologies.

Fig.11.1 Final hardware implementation

Fig.12.1 High Amount of CO detected and Displayed on LCD

Fig.13.1 Text Alert Received

Fig.14.1 Air quality

Fig.15.1 CO level in atmosphere

Fig.16.1 Temperature FUTURESCOPE

An IoT-based air pollution monitoring system is an excellent solution for providing real-time data and insights into the air quality in a specific location. The suggested system design enables real-time analysis of air quality in specific areas, providing authorities with reliable data for action.In the future, devices could be made more compact by reducing their size. Modifications could include measuring car pollution levels.In the future, the range can be expanded based on the bandwidth for high-range frequencies. Further research can be conducted.


An Effective Prediction of Air Quality Using a Machine Learning Model" advances the field of air quality management by demonstrating machine learning's potential in precise pollution prediction. The study's findings highlight the need of interdisciplinary collaboration among environmental scientists, data analysts, and policymakers in leveraging technology to achieve positive environmental and public healthoutcomes. As we strive for a more sustainable future, incorporating machine learning into environmental management techniques holds enormous promise for reducing quality-related negative consequences and boosting general well-being.


[1] Cho, J., Choi, Y. J., Sohn, J., Suh, M., Cho, S. K., Ha, K. H.,

& Shin, D. C. (2015). Ambient ozone concentration and emergency department visits for panic attacks. Journal of Psychiatric Research, 62, 130-135.

[2] Power, M. C., Kioumourtzoglou, M. A., Hart, J. E., Okereke,

O. I., Laden, F., & Weisskopf, M. G. (2015). The relation between past exposure to fine particulate air pollution and prevalent anxiety: observational cohort study. bmj, 350.

[3] Rotko, T., Oglesby, L., Künzli, N., Carrer, P.,Nieuwenhuijsen, M. J., & Jantunen, M. (2002). Determinantsof perceived air pollution annoyance and association betweenannoyance scores and air pollution (PM2. 5, NO2) concentrations in the European EXPOLIS study. Atmospheric Environment, 36(29), 4593-4602.

[4] Llop, S., Ballester, F., Estarlich, M., Esplugues, A., Fernández-Patier, R., Ramón, R., & Iñiguez, C. (2008). Ambient air pollution and annoyance responses from pregnant women. Atmospheric Environment, 42(13), 2982-2992.

[5] Dr. Gulshan Taj Mohammed Navi Anwar., Hari poornima Gunasekar., Joyce Krishnan., Ramya Sekar .(2020). Air quality monitoring and assessment using IoT. IOP Conf. Series: Materials Science and Engineering 955 , &Technology, Vol.9,

[6] Sass, V., Kravitz-Wirtz, N., Karceski, S. M., Hajat, A., Crowder, K., & Takeuchi, D. (2017). The effects of air pollution on inividual psychological distress. Health & place, 48, 72-79.

[7] Mohd Azrol Bin Azahar , Mohd Shamian Zainal, Nor Shahidah Mohd Shah , Danial Md Nor , Shipun Anuar Hamzah, Masnani Mohamed.,(2020) . IoT-Based Air Quality Device for Smart Pollution Monitoring., Azahar et al., Progress in EngineeringApplication and Technology Vol. 1 No. 1 (2020) p. 284-295.

[8] Okokpujie, K., Noma-Osaghae, E., Modupe, O., John, S., & Oluwatosin, O. (2018). A Smart Air Pollution Monitoring System. International Journal of Civil Engineering and Technology (IJCIET, 9(9), pp. 799809.

[9] Siti Azira Jamrus ., and Aizan Ubin ., (2020). Air Quality Monitoring System using Internet of Things (IoT). Evolution of Information, Communication and Computing Systems(EICCS),By UTHM Publisher .

[10] Wei Jian Ng., Zuraini Dahari.,(2020). Enhancement of real- time IoT-based air quality monitoring system . International Journal of Power Electronics and Drive System (IJPEDS) ,2020.

[11] Dr. Manoj Prabu , Boomika., Jeya Sree Bala. , Prisha.(2023)., Digital Air Quality Monitoring System., International Journal of Research Publication and Reviews, Vol 4, no 5, pp 413-419 May 2023.