scieee AI-readable full text Open interactive document viewer

Smart and Portable Air-Quality Monitoring IoT Low-Cost Devices in Ibarra City, Ecuador

Alvear Puertas, Vanessa E.,Marcillo, Fabricio

Abstract

Novo Nordisk Foundation NNF20OC0064411

Full text

Citation: Alvear-Puertas, V.E.; Burbano-Prado, Y.A.; Rosero-Montalvo, P.D.; Tözün, P.; Marcillo, F.; Hernandez, W. Smart and Portable Air-Quality Monitoring IoT Low-Cost Devices in Ibarra City, Ecuador. Sensors 2022,22, 7015. https://doi.org/10.3390/s22187015 Academic Editor: James Covington Received: 18 August 2022 Accepted: 13 September 2022 Published: 16 September 2022 Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. Copyright: © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/). sensors Article Smart and Portable Air-Quality Monitoring IoT Low-Cost Devices in Ibarra City, Ecuador Vanessa E. Alvear-Puertas 1,† , Yadira A. Burbano-Prado 2,†, Paul D. Rosero-Montalvo 3,† , Pınar Tözün 3,† , Fabricio Marcillo 4,† and Wilmar Hernandez 5,*,† 1Computer Science Department, University of Salamanca, 37008 Salamanca, Spain 2Electronic Department, Instituto Superior Tecnológico 17 de Julio, Ibarra 100102, Ecuador 3Computer Science Department, IT University of Copenhagen, 2300 Copenhagen, Denmark 4 Department of Computer Architecture and Technology/CITIC, University of Granada, 18071 Granada, Spain 5Facultad de Ingenieria y Ciencias Aplicadas, Universidad de Las Americas, Quito 170513, Ecuador *Correspondence: wilmar[email protected] † These authors contributed equally to this work. Abstract: Nowadays, increasing air-pollution levels are a public health concern that affects all living beings, with the most polluting gases being present in urban environments. For this reason, this research presents portable Internet of Things (IoT) environmental monitoring devices that can be installed in vehicles and that send message queuing telemetry transport (MQTT) messages to a server, with a time series database allocated in edge computing. The visualization stage is performed in cloud computing to determine the city air-pollution concentration using three different labels: low, normal, and high. To determine the environmental conditions in Ibarra, Ecuador, a data analysis scheme is used with outlier detection and supervised classification stages. In terms of relevant results, the performance percentage of the IoT nodes used to infer air quality was greater than 90%. In addition, the memory consumption was 14 Kbytes in a flash and 3 Kbytes in a RAM, reducing the power consumption and bandwidth needed in traditional air-pollution measuring stations. Keywords: internet of things; environmental monitoring; air-quality measurement; machine learning application; data analysis 1. Introduction Environmental pollution is an issue that has undeniably attracted our full attention. The problem of air pollution affects people’s physical and mental health, and long-term exposure increases the risk of cardiovascular and respiratory diseases [ 1 ]. In addition, the World Health Organization (WHO) forecasts that 4.2 million people die every year because of exposure to air pollutants. This concern is more evident in urban sectors with high population density, since their air-pollution levels have increased [ 2 ]. Indeed, cities represent only about 2% of the geographic area and accommodate over 50% of the world’s population [ 3 ]. Therefore, it is necessary to describe human behavior to detect where and when traffic increases and people are at greater risk of air-pollution exposure [ 4 ]. Thus, governments can receive relevant information to propose new transport policies/alternatives that are adjusted to the specific characteristics of each city [5]. Following this environmental concern, several initiatives from worldwide organizations have proposed limiting the emission of harmful gases that come from the combustion of fuels, especially petroleum [ 6 ]. For this reason, one of the most relevant proposals in this field is the Paris Agreement , because it had several countries commit to reducing the production of polluting gases [ 7 ]. Its main objective in environmental terms is to limit the increase in global temperature to below two degrees Celsius per year. In fact, if the global temperature exceeds this value, this could have an irreversible impact on the environment and could affect all ecosystems on the planet [8]. Sensors 2022,22, 7015. https://doi.org/10.3390/s22187015 https://www.mdpi.com/journal/sensors Sensors 2022,22, 7015 2 of 17 Therefore, from a traditional point of view, environmental protection agencies have started to set up fixed-site air-quality monitoring stations in many regions to collect data on air-quality conditions. Additionally, nonprofit organizations, such as waqi.org (https: //waqi.info/ accessed on 17 August 2022), provide information on current air pollution using more than 30,000 monitoring stations installed in 2000 cities around the world. However, in Latin America [ 9 ], several cities do not have air-quality monitoring stations. For example, in Ecuador, there is currently only one air-quality measurement node located in Cuenca, and nine in Quito [ 10 ]. For this reason, the commitment made by some countries to limit their emissions of polluting gases has become a challenging task. This is because of the following two reasons: (a) traditional air-quality stations do not have the necessary infrastructure to acquire data on environmental pollution [ 11 ], and (b) these stations are rigid and, consequently, fixed installation points can only represent approximations of the phenomenon [ 12 ]. For these reasons, low-cost sensors are a suitable solution to deploy data acquisition systems and, combined with conventional equipment, allow air quality to be monitored more effectively [ 13 ]. In addition, low-cost sensors are part of an embedded system (i.e., sensors, microcontroller, and battery) and are capable of sending data by means of different communication protocols. In this way, they become Internet of Things (IoT) devices [14]. The main characteristics of low-cost sensors can be summarized as follows: ease of deployment, fast integration of several sensors with low power consumption, and their flexibility to be installed in remote locations [ 9 ]. However, due to their interaction with the environment, IoT low-cost devices can suffer from malfunctions caused by environmental conditions or deterioration of their materials [ 15 ]. On the other hand, due to the exponential use of IoT devices, their development in recent years has improved their data processing capability, power consumption, and various long-range wireless technologies for sending data. Consequently, today, these devices have enough computational resources to implement machine learning (ML) model inference aimed at local decision making [ 16 ]. Therefore, some trends, such as federated learning, allow complex algorithms to be compiled based on their input data on end devices such as tablets, phones, and, specifically in this case, electronic devices [ 17 ]. It also ensures that data are processed locally and avoids the risk of being intercepted. In addition, it reduces the processing load on servers due to massive data sending [ 8 ]. Nevertheless, it is necessary to determine the random-access memory (RAM) needed to compile a robust application that enables secure processing and avoids remote attestation [18]. Taking into account everything stated above, this research proposes the development of low-cost smart, portable IoT devices for air-quality monitoring. These devices will be installed in public and private vehicles in Ibarra, Ecuador, to collect the required information to describe the air-pollution phenomenon. To do so, first, we design an electronic system that collects data while having the ability to detect outliers [ 5 ]. Then, with the data sent to an external server, we will train several supervised learning models to determine which one best describes the studied phenomenon. Later, the algorithm with the highest classification performance and lowest computational cost will run on the IoT device to infer the class of new incoming data. The implementation of classification algorithms helps provide relevant information for decision making. In this paper, through labels, a heat map of the city is represented in accordance with the pollution indexes and the areas of high vehicular traffic. This is carried out together with the concentration of gases. With this information, we can validate whether the policies of government entities meet the objective of reducing emissions of polluting gases. In addition, citizens can choose to take alternative routes so as not to be exposed to areas with a high concentration of air pollutants. When mentioning that the system infers the class of the new data, it means that the nodes have the ability to make decisions locally, freeing up computational cost on the server and avoiding latencies. Additionally, once the classification is implemented in its memory, the system can determine and classify the Sensors 2022,22, 7015 3 of 17 pollution indexes at any time of day. Established classes are shown in upcoming sections of the paper. In short, the classification benefits citizens, because they can now access the required information and observe the heat map of the city, with respect to the concentration of polluting gases. Likewise, the classification allows researchers in the field of polluting gases analysis to compare the results obtained with a system that detects local patterns—that is, in the place where the measurement is carried out. In other words, the device’s decision means it is not necessary to constantly perform analyses from the server, which consumes much more energy and computational power. Finally, a user interface (GUI) is available on a cloud server in order to store relevant data to improve the model and display the environmental pollution of the city in a heat map. As a result, One-Class Support Vector Machine (One-Class SVM) is defined as an anomaly detection algorithm used to eliminate outliers. In terms of classification algorithms, we had similar results with the Decision Tree algorithm and Neural Networks, with consumption of 12 Kbytes of flash and 3 Kbytes in RAM, with a processing time of approximately 1 s. In short, the novelty of this research is the presentation of an IoT architecture used to deploy ML models locally, using low-cost sensors to reduce the power consumption and bandwidth needed to process large datasets in the Cloud. Therefore, the main contributions of this paper are as follows: • We present an extensive literature review to select the suitable low-cost sensors available to collect air-pollution data properly. • We design an IoT architecture showing characteristics of the transmission channel, the type of database used, and the corresponding data analysis tasks needed to run ML models close to the end-user. • Robust data analysis based on ML techniques is presented with stages of data acquisition and data preprocessing, such as: (a) outlier detection, (b) classification model building, and (c) tests that are necessary to work in natural environments. Here, this analysis has been applied to contribute to the solution of current concerns such as environmental pollution. • A computational cost analysis is performed to define suitable ML algorithms for IoT devices and the new challenges of implementing them in devices with limited processing capabilities. This paper has been organized as follows. Section 2presents a background on airquality indexes and related works. Section 3shows the design of the IoT device. The proposed architecture is shown in Section 4. The data analysis is conducted in Section 5. Section 6presents the results. Finally, the conclusions are given in Section 7. 2. Background This section shows relevant information on air-quality indexes of gases that affect the health of people, and related works. 2.1. Air-Quality Indexes The Air-Quality Index (AQI) is a quantitative measure that defines the air-quality condition in a specific site. Therefore, there are established levels defined by the risk of gas concentration and how they affect human health [ 17 ]. AQI consists of measurements from 0 to 500, with the highest value of more significant concern for the level of air pollution and greater health risk. Traditionally, countries obtain air-pollution data daily and create a relationship between the maximum and minimum concentration to establish the AQI between good, moderate, unhealthy for sensitive groups, unhealthy, very unhealthy, and hazardous. The gases taken into account are Sulfur Dioxide (SO 2 ), Nitrogen Dioxide (NO x ), Ozone (O 3 ), and Carbon Monoxide (CO) [ 1 , 10 , 19 – 21 ]. However, as has been witnessed in several papers [ 14 , 22 , 23 ], there is no metric of ambient air pollution that includes related factors such as temperature, relative humidity, and ultraviolet (UV) exposure. In addition, having daily samples of the above-mentioned variables allows government entities to find Sensors 2022,22, 7015 4 of 17 similarities within human activities. For this reason, we have defined a pollution traffic light (red, yellow, and green) that includes the previously cited variables that specifically describe the environmental conditions of the city of Ibarra, Ecuador. Consequently, we start by generalizing a model for the AQI levels to a specific solution for Ibarra. This is carried out based on the population and vehicle density of this city. 2.2. Related Works In recent years, electronic devices have increasingly developed the number of airquality monitoring systems placed in cities. Novel IoT solutions, such as the one shown in [ 4 , 24 , 25 ], presented works where electronic systems send data to cloud computing to measure the air-quality index. In [ 14 , 26 ], the authors implemented classification algorithms such as the Decision Tree algorithm and data clustering on external servers, once wireless sensor networks acquired the dataset. Subsequently, ref. [ 5 ] focuses on sensor calibration techniques in different wireless sensor network nodes for a correct data acquisition process. In addition, in [ 2 , 9 , 22 ] the authors focused on the design of electronic systems that are part of IoT architectures, and can send data using edge computing platforms for data preprocessing (cleaning) stages. Furthermore, these electronic systems have interfaces to cloud servers for constant data monitoring and sending messages in the event of unexpected events. In a work related to wireless protocols and sending data over long distances, Firdaus et al. [27] presented an indoor air-quality monitoring system using IoT and LPWAN LoRa as communication systems. This proposal uses temperature, humidity, CO and CO 2 sensors. Then, the information is sent to a server in the cloud using the LPWAN LoRa communication protocol to be visualized in an Android application. Additionally, Ali et al. [12], show a proposal for low-cost sensors based on LoRaWAN networks for air-quality measurement. This work proposes implementing three nodes, each with five sensors and the ability to connect over the long-range network using the LoRaWAN communication protocol. The sensing parameters are as follows: NO x (i.e., NO + NO 2 ), CO, particulate matter, temperature, humidity, and gases. The system also consists of solarcharged lipo batteries. As a result, air-pollution forecasting models were developed during data acquisition using ML techniques. Recently, works such as [ 23 , 28 , 29 ] focused on reducing the amount of data by optimizing and calibrating low-cost sensors correctly, to collect rich data used to train ML models. Lastly, Andrade et al. [ 30 ] present a novel alternative to developing tiny ML models to forecast values of CO2emissions over time. The above-mentioned works show that there is a trend to improve IoT low-cost devices by means of data preprocessing techniques and light ML models. However, there are still open problems in developing an IoT architecture, where IoT devices can make decisions locally and reduce both bandwidth and power consumption. Moreover, determining the RAM/Flash needed to create ML models is a relevant aspect to take into consideration, because it provides the new functionalities that emerging microcontrollers must have. 3. IoT Device Design This section presents the design of the IoT device, starting with the selection of sensors. Then, the calibration of sensors is shown and, finally, the voltage supply and rain protection are described. To select the correct air-pollution gases, Alit et al. [ 12 ] presented an electronic system by selecting several sensors from many brands and different signal conditioning stages. They demonstrated the necessity of comparing works to define the suitable sensors that are needed to deploy an IoT device. On the other hand, Refs. [ 11 , 15 ] presented solutions by implementing ML algorithms using external databases that were obtained in the United States and Europe. As a result, they presented a comparison of several ML classification algorithms that fit an air-pollution analysis. Therefore, we used this information to design the IoT device by comparing sensors and ML algorithms. Sensors 2022,22, 7015 5 of 17 3.1. Sensor Selection Table 1presents some relevant works, their technology, and the summary of the sensors they used. These works provide a comparative evaluation of sensors, microcontrollers, and communication protocols. Consequently, the sensors for CO, NO x and CO 2 gases derived from the poor combustion of fossil fuels are established (respectively, NO x for diesel, and CO 2 gases for gasoline [ 19 ]). In addition, temperature and humidity data are used to describe human behavior, which is very relevant to this study. Furthermore, to achieve higher coverage and mobility of IoT devices, and considering that in Ecuador, there is no backbone of the LoRa network that IoT devices can connect to to send data, a GPS/GPRS communication is defined due to its extended coverage. Table 1. Gases and sensors that were used in relevant related works. Author uC Prot. Comm. Sensed Parameters Sensors CO NOxTemp. Hum. CO2SO2O3Others [2] Wasp-mote ZigBee x x x x x x x Gasense Pro Libelium [9] Atmega 328p ZigBee x x x x x x CI2GP2Y1, DSM501, MQ-7 [22] ESP8266 WiFi x x CH4MQ-7, MQ-4, MQ-135 [27] LoRa-Arduino LoRa WAN x x x x MQ-7, MQ-4, MQ-135, DTH22 [17] ESP32 WiFi x x x x x x MH-Z14, MICS-4514, DHT22 [12] Murata LoRa WAN x x x x x Alphasense CO-B4, NO2-B43F [16] Arduino Mega LTE x x x x No mention [28] – – x x PM1 PM2.5 PM10 AirBeam2, DustTrak [29] STM32 – x x x x x x x T6615-5KF, SHT21, HPM 115S0-XXX [3]Arduino Mega 2560 LTE x x x x x PM1 PM2.5 MiCS-2714, MiCS-4514, MQ131, SPS30, BME280, DGS-O3/NOx/CO Several brand new sensors are available to deploy air-quality stations. Precision and accuracy are relevant in selecting a suitable sensor, especially for gas concentration. However, there are other requirements to consider, such as size and communication protocols. Therefore, sensors such as Envio+ (https://www.switch-science.com/catalog/6119/ accessed on 17 August 2022), SDS011 (https://aqicn.org/sensor/sds011/ accessed on 17 August 2022), and OPC-R1 (https://www.isweek.com/product/pm2-5-particle-sensor-opc-r1_2315.html accessed on 17 August 2022), related to the IoT device proposed are not a good alternative, even when some functionalities are superior to the MQ series and Alphasense sensors, which are selected to deploy them into the IoT device. Unfortunately, Alphasense sensors were unavailable at the time to acquire the hardware needed. Furthermore, Kurenshi et al. [ 31 ], mention that any low-cost sensor could improve its robustness via regression and ML algorithms using a reference-grade or research-grade instrument. Consequently, even when MQ sensors do not have the highest precision, their performance might be improved significantly, as demonstrated in the following sections [32]. Sensors 2022,22, 7015 6 of 17 Therefore, the selected sensors are as follows: MQ-135 for NO x analysis, MQ-7 for CO, SCD30 for temperature, humidity and CO 2 data collection, and VLM6075 for UV detection. Moreover, the SIM 808 module is used to send data by GPS/GPRS protocol. These sensors were selected based on functionality, features, and usability requirements. An Arduino nano BLE sense is used as the electronic board. This board uses an nRF52840 Harvard architecture microcontroller from the ARM cortex M4 family. The IoT device is programmed in the Arduino environment (i.e., C language). 3.2. Calibration of Sensors As part of the sensor calibration process, it is necessary to analyze the different sensitivity curves provided in the corresponding data sheets. In addition, within the process, a review of the state of the art was carried out to determine the most effective methods for an adequate calibration and reading of the sensors. In this work, we have proceeded as follows. Due to the fact that MQ sensors have been built with sensitive materials used to detect different concentrations and types of gases, their data sheets specify the calibration process by using the load ( RL ) and target gas ( RS ) resistors, and the ratio of the sensor resistance in clean air over the resistance of the sensor in various gases ( RO ). Therefore, to obtain RS , it is necessary to use the voltage supply ( VC ) and the voltage that the sensor receives ( VRL ). The equation used is (1). RS=Vc−VRL VRL ·RL(1) Each MQ sensor has a sensitivity curve where the x-axis is the detected concentration of the gas in parts per million (ppm), while the y-axis is the RS/RO ratio. The MQ7 sensor was selected to measure the concentration of CO. According to the manufacturer’s data sheet, this sensor can detect concentrations from 20 ppm to 2000 ppm. From the sensitivity curve, the following parameters are considered for the sensor reading: (1) temperature: 20 ◦ C; (2) humidity: 65%; (3) O 2 concentration: 21%; and (4) a value of RL= 10 k Ω . R0 is the resistance value at 100 ppm of CO in clean air, and RSis the resistance to different gas concentrations. To obtain the ppm value, we worked with (2). CO(ppm) =10 ·log(17.5)−log(RS R0) 0.63 (2) To detect NO x , the chosen sensor was MQ135, with parameters as follows: temperature: 20 ◦ C; humidity: 65%; O 2 concentration: 21%; and a value of RL= 20 k Ω , where R0 is the resistance value at 100 ppm of NO x in clean air, and R S is the resistance to different gas concentrations. To obtain the ppm value, we worked with (3). NOx(ppm) = 156 −133 ·RS R0(3) The VLM6075 UV sensor has a photodiode that measures ultraviolet (UV) radiation levels, A (320–400 nm) and B (280–320 nm), allowing the calculation of the UV index with a variation of ± 10 nm, and that sends information using I 2 C communication, with a resolution of 16 bits. On the other hand, for the measurement of CO 2 , the accuracy of the SCD30 sensor is ± 30 ppm ± 3% (25 ◦ C, 400–10,000 ppm). The humidity has a variability of 3% on a scale from 0 to 95%, and the temperature has a variability of 0.5 ◦ C, with measurements up to 70 ◦ C. Those sensor are digital and have auto-calibration techniques in their libraries. Finally, samples were taken by exposing each sensor to its magnitude to observe its errors and define the correct sampling time. Kowalski et al. [ 33 ] mentioned that the most relevant signal smoothing filters (with variable frequency) are as follows: Average, Median, Gaussian, and Savitsky–Golay filters. For this reason, in this research, samples were taken from each sensor to apply these filters. In addition, using the signal-to-noise ratio (SNR) Sensors 2022,22, 7015 7 of 17 metric, here it is shown which of them eliminates the erroneous components inserted in the signal [ 34 ]. Furthermore, it was observed that the average filter is adequate to be implemented by taking n samples with a window of size k= 25. Figure 1shows the signal smoothing obtained by applying the above filters. (a) (b) (—) Original samples (—) Medium filter (—) Average filter (—) Gaussian filter (—) Savi-Golay filter Figure 1. Signal smoothing analysis. ( a ) CO 2 measurement by using the SCD30 sensor. The y-axis is the sensor output in ppm, and the x-axis is the number of samples. ( b ) NO x measurement by using the MQ-135 sensor. The y-axis is the sensor output given by a 10-bit analog-to-digital (ADC) converter (1024 discrete levels). The x-axis is the number of samples. 3.3. Voltage Supply and Rain Protection The system is placed on the roof of the vehicle and is magnetically fastened. When the key of the vehicle is turned, this action closes the starting circuit, the motor engine starts, and the alternator comes on to supply power to the vehicle and power the system with 12 V, which requires rectification to 5 V. Next, the IoT device turns on and leaves its rain protection case to begin data collection. If the system detects rain or the vehicle turns off, it returns to its initial position inside its case. 4. IoT Architecture IoT devices have limited computational resources. Therefore, it is necessary to work with lightweight network protocols and services, which are also oriented to the type of information being sent [ 18 ]. For this reason, the message sending protocol is the Message Queuing Telemetry Transport (MQTT), because it has a variable light payload messaging service with a publisher/subscriber model [ 22 ]. Consequently, Mosquitto (https://mosquitto.org/ accessed on 17 August 2022) is used as the server. Furthermore, following the lightweight computational footprint, the database should not be relational because the information is not concatenated with other information sources. Thus, a time-series database called InfluxDB (https://www.influxdata.com/ accessed on 17 August 2022) is used. The data will be stored for each node and topic (named for each variable in MQTT). In summary, the functionality of each block of the proposed IoT architecture is described as follows: Sensors 2022,22, 7015 8 of 17 •IoT node: Collect sensor data and send messages via MQTT to the edge server. •Edge: Has the MQTT broker, which receives data from IoT nodes. Then, it stores data in a time series database identifying each node. •Cloud: We use a public data viewer called Grafana (monitoring stack) to securely connect to the database allocated in the edge and make querying from the cloud side. Figure 2shows the IoT architecture. Users are considered vehicles and people who can observe and obtain reports. Figure 2. Proposed IoT architecture. 5. Data Analysis This section presents the data analysis scheme used to locally implement the ML algorithm. It is essential to consider that, in Ibarra, it is known from previous studies that the air quality is acceptable [ 1 , 4 , 10 ]. However, it shows punctual peaks that generate risk for people. 5.1. Original Data The data are collected once the IoT device is built with the appropriate sensor calibration. In addition, high-level systems are used to ensure that the data are reliable, such as Air Quality Station in conjunction with MaxiMet weather stations GMX-240 from Libelium (https://www.libelium.com/iot-solutions/smart-cities/ accessed on 17 August 2022), and mobile applications that receive information from the different satellites that surround the globe. To describe the air-pollution phenomenon, seven specific data collection schedules (information obtained from government agencies) were established according to vehicle density and the hours of highest traffic flow (8h00, 13h00, and 17h00), normal traffic flow (10h00, 13h00 and 20h00), and reduced traffic flow (2h00). The data acquisition process starts taking 50 samples every two minutes in the above-mentioned schedules, while the vehicle is driven around the city for approximately two months. Additionally, due to the warming-up condition of low-cost sensors, the system waits 5 min to start taking samples. Furthermore, the smoothing algorithms and outlier detection techniques prune incorrect data, improving the quality of the dataset. After that, the data are sent to the InfluxDB database. In this case, the number of samples sent to InfluxDB is equal to 140,000. Moreover, each obtained datum has been classified according to the defined schedule. At this point, it is important to mention that in this paper, the data set was divided according to the similarity of the values of the different variables into subsets. Therefore, we call classes to these subsets of data, as is carried out in machine learning. For us, a class is a set of data that have the same characteristics. Thus, once the classes were defined, algorithms were trained to generate rules that associate new data with the corresponding Sensors 2022,22, 7015 9 of 17 class. That said, in the event that there are values close to two classes, the algorithm makes its decision based on the variable that has the greatest weight or significance. In this way, the data are classified by criteria or functions defined by the algorithm itself. Taking into account everything said above, the measurements of each variable are now categorized within different air-pollution levels (i.e., classes), which are established by government air-quality measurement networks (e.g., see Quito Metropolitan Network of Atmospheric Monitoring reports (QMNAM) at http://www.quitoambiente.gob.ec/index. php/informes accessed on 17 August 2022). In this paper, following QMNAM reports, the abovementioned classes were defined as follows: •Class A : High levels of pollution with increased incidence of UV rays and high temperatures. •Class B: Acceptable levels of pollution and moderate temperature. •Class C: Low levels of gas concentration and suitable environmental conditions. It is important to mention that the National Transit Agency of Ecuador imposes the maximum speed in cities at 50 km/h. In addition, the IoT application is focused on collecting data in city zones with high vehicle density, which reduces the chance that the IoT device has inaccurate measures by medium/high vehicle speeds. Furthermore, smoothing algorithms eliminate those errors by comparing samples taken with the same sample rate. 5.2. Outlier Detection Due to the nonlinearity of the electronic elements and sensor wear, errors appear in the data that may not follow the same distribution and do not have the same trend as the important information. For this reason, they can impair the data acquisition process [ 35 ]. Therefore, descriptive unsupervised learning techniques allow elimination of these data in order to find a refined training set. Consequently, the most relevant techniques found in the literature review are as follows: Standard Deviation, Local Outlier Factor, Isolation Forest, Elliptic Envelope, and One-Class SVM [ 36 ]. However, it is necessary to know which of the above-mentioned methods suitably fits the data type of the proposed system. Therefore, knowing the statistical distribution of the original samples allows detection of outliers based on quartiles. Figure 3shows the box plot of the original data set (OD) of the CO variable, and how unsupervised learning techniques prune data that have different distributions. As a result, it can be observed that the anomaly detection algorithms allow the data to be concentrated towards a central tendency while eliminating the distant ones (Gaussian bell). Therefore, it is observed that the Standard Deviation (STD) and Local Outlier Factor (LOCAL) algorithms have similar results. Furthermore, Isolation Forest (ISO) and Elliptic Envelope (ELLIP) algorithms maintain outliers in their corresponding dataset. Finally, One-Class SVM (OSVM) shows the lowest data variability and has no outliers. Figure 3. Box plot of data from the outlier detection methods. 5.3. Supervised Classification There are several methods of supervised learning that use different mathematical approaches. These approaches define the model complexity and determine the memory Sensors 2022,22, 7015 16 of 17 Institutional Review Board Statement: Not applicable. Informed Consent Statement: Not applicable. Data Availability Statement: Not applicable. Conflicts of Interest: The authors declare no conflict of interest. References 1. Hernandez, W.; Mendez, A.; González-Posadas, V.; Jiménez-Martín, J.L.; Camejo, I.M. Robust Inferential Techniques Applied to the Analysis of the Tropospheric Ozone Concentration in an Urban Area. Sensors 2021,21, 277. [CrossRef] 2. Benammar, M.; Abdaoui, A.; Ahmad, S.H.; Touati, F.; Kadri, A. A Modular IoT Platform for Real-Time Indoor Air Quality Monitoring. Sensors 2018,18, 581. [CrossRef] [PubMed] 3. Gäbel, P.; Koller, C.; Hertig, E. Development of Air Quality Boxes Based on Low-Cost Sensor Technology for Ambient Air Quality Monitoring. Sensors 2022,22, 3830. [CrossRef] [PubMed] 4. Alvear-Puertas, V.; Rosero-Montalvo, P.D.; Michilena-Calderón, J.R.; Arciniega-Rocha, R.P.; Erazo-Chamorro, V.C. Urban Air Pollution Monitoring by Neural Networks and Wireless Sensor Networks Based on LoRa. In Proceedings of the Future Technologies Conference (FTC) 2020, Vancouver, BC, Canada, 5–6 November 2020; Arai, K., Kapoor, S., Bhatia, R., Eds.; Springer International Publishing: Cham, Switzerland, 2021; Volume 2, pp. 907–919. 5. Maag, B.; Zhou, Z.; Thiele, L. A Survey on Sensor Calibration in Air Pollution Monitoring Deployments. IEEE Internet Things J. 2018,5, 4857–4870. [CrossRef] 6. Hernandez, W.; Mendez, A.; Diaz-Marquez, A.M.; Zalakeviciute, R. PM 2.5 Concentration Measurement Analysis by Using Non-Parametric Statistical Inference. IEEE Sens. J. 2020,20, 1084–1094. [CrossRef] 7. Mazon-Olivo, B.; Pan, A. Internet of Things: State-of-the-art, Computing Paradigms and Reference Architectures. IEEE Lat. Am. Trans. 2022,20, 49–63. [CrossRef] 8. Chase, O.; Carvalho, A.; Andrade, E.; Almeida, J.; Costa, C. Environmental Measurement Technology: An Approach to the Amazonian Environment. IEEE Lat. Am. Trans. 2018,16, 1036–1041. [CrossRef] 9. Idrees, Z.; Zou, Z.; Zheng, L. Edge Computing Based IoT Architecture for Low Cost Air Pollution Monitoring Systems: A Comprehensive System Analysis, Design Considerations & Development. Sensors 2018,18, 3021. [CrossRef] 10. Hernandez, W.; Mendez, A. Robust Estimation of Carbon Monoxide Measurements. Sensors 2020,20, 4958. [CrossRef] 11. Kök, ˙ I.; ¸Sim¸sek, M.U.; Özdemir, S. A deep learning model for air quality prediction in smart cities. In Proceedings of the 2017 IEEE International Conference on Big Data (Big Data), Boston, MA, USA, 11–14 December 2017; pp. 1983–1990. [CrossRef] 12. Ali, S.; Glass, T.; Parr, B.; Potgieter, J.; Alam, F. Low Cost Sensor With IoT LoRaWAN Connectivity and Machine Learning-Based Calibration for Air Pollution Monitoring. IEEE Trans. Instrum. Meas. 2021,70, 1–11. [CrossRef] 13. Lai, W.I.; Chen, Y.Y.; Sun, J.H. Ensemble Machine Learning Model for Accurate Air Pollution Detection Using Commercial Gas Sensors. Sensors 2022,22, 4393. [CrossRef] [PubMed] 14. Sugiarto, B.; Sustika, R. Data classification for air quality on wireless sensor network monitoring system using decision tree algorithm. In Proceedings of the 2016 2nd International Conference on Science and Technology-Computer (ICST), Yogyakarta, Indonesia, 27–28 October 2016; pp. 172–176. [CrossRef] 15. Dairi, A.; Harrou, F.; Khadraoui, S.; Sun, Y. Integrated Multiple Directed Attention-Based Deep Learning for Improved Air Pollution Forecasting. IEEE Trans. Instrum. Meas. 2021,70, 3520815. [CrossRef] 16. Zhang, D.; Woo, S.S. Real Time Localized Air Quality Monitoring and Prediction Through Mobile and Fixed IoT Sensing Network. IEEE Access 2020,8, 89584–89594. [CrossRef] 17. Ta¸stan, M.; Gökozan, H. Real-Time Monitoring of Indoor Air Quality with Internet of Things-Based E-Nose. Appl. Sci. 2019 ,9, 3435. [CrossRef] 18. Yang, Q.; Liu, Y.; Chen, T.; Tong, Y. Federated Machine Learning: Concept and Applications. ACM Trans. Intell. Syst. Technol. 2019,10, 1–19. [CrossRef] 19. Rosero-Montalvo, P.D.; López-Batista, V.F.; Arciniega-Rocha, R.; Peluffo-Ordóñez, D.H. Air Pollution Monitoring Using WSN Nodes with Machine Learning Techniques: A Case Study. Log. J. IGPL 2021,30, 599–610. [CrossRef] 20. Hernandez, W.; Mendez, A. Twelve-Year Analysis of NO 2 Concentration Measurements at Belisario Station (Quito, Ecuador) Using Statistical Inference Techniques. Sensors 2020,20, 5831. [CrossRef] 21. Hernandez, W.; Mendez, A.; Zalakeviciute, R.; Diaz-Marquez, A.M. Robust Confidence Intervals for PM 2.5 Concentration Measurements in the Ecuadorian Park La Carolina. Sensors 2020,20, 654. [CrossRef] 22. Dhingra, S.; Madda, R.B.; Gandomi, A.H.; Patan, R.; Daneshmand, M. Internet of Things Mobile–Air Pollution Monitoring System (IoT-Mobair). IEEE Internet Things J. 2019,6, 5577–5584. [CrossRef] 23. Shakhov, V.; Materukhin, A.; Sokolova, O.; Koo, I. Optimizing Urban Air Pollution Detection Systems. Sensors 2022 ,22, 4767. [CrossRef] 24. Zheng, Y.; Chen, X.; Jin, Q.; Chen, Y.; Qu, X.; Liu, X.; Chang, E.; Ma, W.Y.; Rui, Y.; Sun, W. A Cloud-Based Knowledge Discovery System for Monitoring Fine-Grained Air Quality; MSR-TR-2014–40. Tech. Rep.; Microsoft Research: Redmond, WA, USA, 2014. Sensors 2022,22, 7015 17 of 17 25. Melgarejo, M.; Parra, C.; Obregon, N. Applying Computational Intelligence To The Classification Of Pollution Events. IEEE Lat. Am. Trans. 2015,13, 2071–2077. [CrossRef] 26. Dawei, Y.; Qiang, R.; Sijie, C.; Shujuan, Y. Blind detection algorithm based on WSN air quality monitoring system. In Proceedings of the 2016 IEEE International Conference on Ubiquitous Wireless Broadband (ICUWB), Nanjing, China, 16–19 October 2016; pp. 1–4. [CrossRef] 27. Firdaus, R.; Murti, M.A.; Alinursafa, I. Air Quality Monitoring System Based Internet of Things (IoT) Using LPWAN LoRa. In Proceedings of the 2019 IEEE International Conference on Internet of Things and Intelligence System (IoTaIS), Bali, Indonesia, 5–7 November 2019; pp. 195–200. [CrossRef] 28. Huang, J.; Kwan, M.P.; Cai, J.; Song, W.; Yu, C.; Kan, Z.; Yim, S.H.L. Field Evaluation and Calibration of Low-Cost Air Pollution Sensors for Environmental Exposure Research. Sensors 2022,22, 2381. [CrossRef] [PubMed] 29. Liu, Y.; Chen, L.; Fan, S.; Zhang, Y. Design of Gas Monitoring Terminal Based on Quadrotor UAV. Sensors 2022 ,22, 5350. [CrossRef] [PubMed] 30. Andrade, P.; Silva, I.; Silva, M.; Flores, T.; Cassiano, J.; Costa, D.G. A TinyML Soft-Sensor Approach for Low-Cost Detection and Monitoring of Vehicular Emissions. Sensors 2022,22, 3838. [CrossRef] [PubMed] 31. Kureshi, R.R.; Mishra, B.K.; Thakker, D.; John, R.; Walker, A.; Simpson, S.; Thakkar, N.; Wante, A.K. Data-Driven Techniques for Low-Cost Sensor Selection and Calibration for the Use Case of Air Quality Monitoring. Sensors 2022 ,22, 1093. [CrossRef] [PubMed] 32. Sales-Lérida, D.; Bello, A.J.; Sánchez-Alzola, A.; Martínez-Jiménez, P.M. An Approximation for Metal-Oxide Sensor Calibration for Air Quality Monitoring Using Multivariable Statistical Analysis. Sensors 2021,21, 4781. [CrossRef] [PubMed] 33. Kowalski, P.; Smyk, R. Review and comparison of smoothing algorithms for one-dimensional data noise reduction. In Proceedings of the 2018 International Interdisciplinary PhD Workshop (IIPhDW), ´ Swinou´scie, Poland, 9–12 May 2018; pp. 277–281 . [CrossRef] 34. Rosero-Montalvo, P.D.; López-Batista, V.F.; Peluffo-Ordóñez, D.H. A New Data-Preprocessing-Related Taxonomy of Sensors for IoT Applications. Information 2022,13, 241. [CrossRef] 35. Seo, S.; Chung, J.M. Outlier Detection Technique for IoT Sensor-Driven Big Data Systems. In Proceedings of the 2019 International Conference on Electronics, Information, and Communication (ICEIC), Auckland, New Zealand, 22–25 January 2019; pp. 1–2. [CrossRef] 36. Zhang, M.; Li, X.; Wang, L. An Adaptive Outlier Detection and Processing Approach Towards Time Series Sensor Data. IEEE Access 2019,7, 175192–175212. [CrossRef] 37. Badura, M.; Batog, P.; Drzeniecka-Osiadacz, A.; Modzel, P. Regression methods in the calibration of low-cost sensors for ambient particulate matter measurements. SN Appl. Sci. 2019,1, 622. [CrossRef]