Real-Time Monitoring of Indoor Air Quality with Internet of Things-Based E-Nose

: Today, air pollution is the biggest environmental health problem in the world. Air pollution leads to adverse e ﬀ ects on human health, climate and ecosystems. Air is contaminated by toxic gases released by industry, vehicle emissions and the increased concentration of harmful gases and particulate matter in the atmosphere. Air pollution can cause many serious health problems such as respiratory, cardiovascular and skin diseases in humans. Nowadays, where air pollution has become the largest environmental health risk, the interest in monitoring air quality is increasing. Recently, mobile technologies, especially the Internet of Things, data and machine learning technologies have a positive impact on the way we manage our health. With the production of IoT-based portable air quality measuring devices and their widespread use, people can monitor the air quality in their living areas instantly. In this study, e-nose, a real-time mobile air quality monitoring system with various air parameters such as CO 2 , CO, PM 10 , NO 2 temperature and humidity, is proposed. The proposed e-nose is produced with an open source, low cost, easy installation and do-it-yourself approach. The air quality data measured by the GP2Y1010AU, MH-Z14, MICS-4514 and DHT22 sensor array can be monitored via the 32-bit ESP32 Wi-Fi controller and the mobile interface developed by the Blynk IoT platform, and the received data are recorded in a cloud server. Following evaluation of results obtained from the indoor measurements, it was shown that a decrease of indoor air quality was inﬂuenced by the number of people in the house and natural emissions due to activities such as sleeping, cleaning and cooking. However, it is observed that even daily manual natural ventilation has a signiﬁcant improving e ﬀ ect on air quality.


Introduction
In recent years, air pollution has been a major environmental problem and a global concern that has exceeded recommended national limits. Air pollution has negative effects on human health and ecosystems, as well as affecting the world's climate [1]. Air pollution can be classified as internal or external air pollution, depending on where the activities take place [2]. Outdoor air pollution occurs in an open environment, covering the entire atmosphere. Fossil fuels used to meet the energy needs of factories, industries and vehicles are the main activities contributing to agricultural and mining outdoor air pollution. The external air pollutants are mainly composed of nitrogen oxides (NOx), nitrogen dioxide (NO 2 ), sulfur dioxide (SO 2 ), ozone (O 3 ), carbon monoxide (CO), hydrocarbons and particulate matter (PM) of different particle sizes. Indoor air pollution, found in offices, hospitals, schools, libraries, entertainment areas, gymnasiums, public transport vehicles, etc., is classified as the pollution of the air of indoor areas [3]. Major indoor air pollutants include NOx, SO 2 , O 3 , CO, carbon dioxide (CO 2 ), volatile and semi-volatile organic compounds VOCs, PM, radon and microorganisms. The air quality index includes an internationally adopted parameter for assessing air quality.
Wi-Fi module, all measured air quality data are displayed in the mobile app and these data are stored on a cloud server. The mobile interface provides users with numerical and graphical data on contaminating gas concentrations, temperature and humidity. The proposed e-nose measurement system sends a notification to the users via the mobile application if any gas concentration levels reach health-threatening values. In this way, households can take measures to reduce gas concentrations when necessary. The data can be viewed graphically through the mobile interface which allows users to observe the effects of activities such as sleep, cleaning and cooking on the gas concentration. In addition, the IoT-based e-nose air quality measurement system has a low-cost (about $100), easy-to-install and open-source feature produced by a DIY approach.

Related Work
Due to the fast advancement in IoT and sensor techniques, interest in air quality measurements continues to grow. In [23] an environmental monitoring system was propose that included the sensors Raspberry Pi and MICS-4514, which enabled the assessment both indoors and outdoors at a university campus of multiple environmental parameters such as temperature, humidity, light, noise level, CO, NO 2 . A proposed system for detecting environmental contamination [24] used various environmental detectors to identify temperature, humidity, ambient light, gas sensors and PM. All data measured by the system using the sensors STM32f4xx and Sharp GP2Y1010 for PM detection, and TGS5342 for CO, are stored in the internal storage and on an Internet server over the Wi-Fi network. Using the ATmega328AVR controller, DHT22 temperature sensor, Sharp GP2Y1010AU0F dust sensor and UVM-30A UV sensors, an Integrated Environmental Monitoring System (IEMS) [25] was proposed to detect the microenvironment. In another study [26], the Nano Environmental Monitoring System (nEMoS) was proposed using an IoT-based indoor environmental quality (IEQ) assessment system created using an Arduino Uno module and low-cost sensors such as DHT22. To determine the quality of packaged products, an IoT-based measuring system was intended, including low-cost pressure, temperature, humidity, gas sensors (BME680, DHT22 and MQ5), Arduino and XBee wireless module [27]. In the study, in which iAQ, an air quality surveillance system based on IoT architecture, was proposed for AAL [28], the wireless sensor nodes (WSN), Gateway and Android user interface provided environmental data such as temperature, humidity and CO 2 to users through the mobile application. In the IoT-based system [29] developed for real-time IAQ surveillance, multiple gases such as CO 2 , NO 2 , ethanol, methane and propane were detected using ESP8266 as the controller and sensors MICS-6814 and MICS-6814 as the detection unit. This system, based on open source technology, has a mobile phone application that transmits real-time notifications to users. The solution is based on the IoT concept and is entirely wireless in a study that presented an IAQ surveillance solution that can measure temperature, humidity, PM 10 , CO 2 and light intensity in real-time [30]. The Arduino UNO emitter utilizes the ESP8266 controller and the "ThingSpeak" open-source IoT platform to record wireless data to enable wireless Internet access. In this study, a real-time surveillance system based on IoT architecture for PM surveillance was presented [31]. The iDust system was created using open source technologies and low-cost sensors. System measurement data, consisting of a WEMOS D1 Wi-Fi controller and PMS 5003 dust sensor, are transferred to users via an IoT-based implementation.

Materials and Methods
Low air quality poses a significant health threat for individuals who spend most of their time indoors. Some pollutants such as tobacco smoke, CO, NO 2 , formaldehyde, asbestos fibres, microorganisms and allergens are known to be closely related to health problems. Temperature and humidity monitoring are part of everyday life, but in the vast majority of buildings, real-time air quality monitoring is not performed. In this study, air quality measurement system with an IoT-based e-nose has been proposed for real-time, low-cost and easy-to-install air quality monitoring. With the proposed e-nose system the ambient temperature and humidity values are measured in real-time in addition to the polluting gases such as CO 2 , CO, PM 10 and NO 2 . Information on the presence of these monitored gases in excessive quantities is transmitted to users via the mobile application as a notification. This is a completely wireless solution developed using the ESP32 module, which integrates the IEEE 802.11 b/g/n network protocol into the IoT architecture.
The architecture of the proposed e-nose system is given in Figure 1. A real-time air quality monitoring system provides information about the concentration of pollutants in the environment. It provides precise and detailed information about the air quality of the living environment and helps to plan interventions that lead to improved air quality. The e-nose air quality monitoring system in Figure 1 consists of two parts: The first part is the detection and communication unit consisting of an ESP32 microcontroller-based sensor array with built-in Wi-Fi; and the second is the Android/iOS-based mobile user interface. The ESP32 module with a built-in Wi-Fi module is used in the e-nose system created for monitoring air quality. The low-cost and high-performance 32-bit controller is frequently preferred in IoT applications. An ESP32 has a dual-core structure and has many internal modules such as Wi-Fi, Bluetooth, RF, IR, CAN, Ethernet module, temperature sensor, hall effect sensor and touch sensor needed for smart home applications. In the ESP32 module structure, the Harvard Tensilica Xtensa LX6 32-bit Dual Core features a processor capable of operating at up to 240 MHz. The detection unit includes the sensors GP2Y1010AU, MH-Z14, MICS-4514 and DHT22, which measure air quality parameters such as CO 2 , CO, PM 10 , NO 2 , temperature and humidity.
The GP2Y1010AU is a dust sensor with an analogue output system. An infrared light-emitting diode (IRED) and a phototransistor are arranged across from each other. The IR beams reflected from dust entering the air chamber of the sensor is detected by the phototransistor and generates a corresponding voltage [32].
The MH-Z14A CO 2 sensor module uses the non-dispersive infrared (NDIR) principle. It measures between 0-5000 ppm, 5 ppm resolution with an accuracy of ±50 ppm. The sensor module sends the CO 2 concentration in three different output modes: Serial output (RS-232), analogue output and pulse width modulation (PWM) [33].
The MICS-4514 is mainly used for measuring emissions from automobile exhausts but is also used for measuring concentrations of gases such as NO 2 , CO and hydrocarbons. The sensor has a built-in heating element and a micro-sensing diaphragm on the upper side. The MICS-4514 includes two sensor chips with independent heaters and delicate layers. One sensor chip detects oxidizing gases (OX) and the other sensor detects reducing gases (RED) [34].
The DHT22 consists of two parts: A thermistor temperature sensor and a capacitive humidity sensor. The DHT22 is an advanced sensor unit that provides a calibrated digital signal output. It is equipped with an 8-bit microcontroller and has a short response time. It has a relative error of ±0.5 • C in temperature measurement and ±2% rH in humidity measurement [35]. The electronic features of the sensors used in the IoT-based e-nose system are given in Table 1. The images of the IoT-based e-nose system used in air quality measurements and formed from different sensors are displayed in Figure 2. The sensors used in the system are mounted in a 17 × 12 × 8 cm size sealed box per the measurement specifications. In addition to the sensors used for measurement, the box includes a printed circuit board, a fan for airflow to the dust sensor, and a power supply for the energy of the system. The measurement system can work with a 12 V DC adapter, and additionally has a mobile use feature when paired with a power bank that can be connected to the 5 V DC USB port. This feature provides a great advantage for short-term measurements. When supplied from a 5 V power supply, the measuring device draws a current of 160 mA. With a 5000 mAh power bank, it has a measuring time of approximately 30 h. Using a wireless internet connection, it provides the opportunity to measure air quality from many common living areas such as parks, gardens, highways, industrial areas, sports fields, public transportation, cafes, restaurants, schools, hospitals.
The climate parameters and gas concentrations are a median of 12 measurements taken at 5 s intervals. This minimizes the effect of erroneous measurements brought about by faulty sensors. Users are notified by exceeding the designated gas concentration and climate parameter thresholds. Five-minute averages are calculated and delivered to users as notifications, preventing false warnings that may mislead users. In this e-nose system which measures air quality, no memory element is used for data recording. The received data are recorded directly to the Blynk cloud server via the mobile interface. The data are sent to the registered e-mail address of the user when requested. The status of the internet connection is checked before each data transmission. When not connected, data packets that cannot be temporarily transmitted are stored to ensure data integrity, and then, when the internet connection is re-established, these packets are sent to the cloud server using past time tags. In this way, data loss can be prevented by providing continuity in the data flow.
The front panel images of the developed Android-based mobile user interface are given in Figure 3. Control over mobile devices in IoT applications has become very common. There are many free options available for Android and iOS devices. Blynk is one of these applications and it is an IoT platform developed for iOS and Android applications that enables management of different controllers such as Raspberry Pi, ESP8266, ESP32, chipKIT, Intel, LeMarker, Onion Omega, SparkFun and STM32. Using the Blynk cloud server service, digital data such as temperature, humidity, current, voltage measurements and control systems are stored and can be easily accessed at any time. The Blynk graphical components (widgets) allow real-time clock and calendar (RTCC) features to be used.  Table 2 shows the cost table of the IoT-based e-nose measurement system. The total cost of the software and hardware components required to install the system is approximately $100. Compared to most commercially accessible non-IoT-based home air quality meters, this cost is very economical and convenient.

Results and Discussion
For air quality analysis with IoT-based e-nose, data were collected in a residence for 4 days at one-minute intervals. The housing area where air quality measurements were taken is 150 m 2 . The room in which the measurements were made is 25 m 2 and the measurements were taken from a height of 1.5 m. The five-person house is heated by a central heating system. Although there were changes in the number of inhabitants during the day, there were always at least two people in the household. There was no air cleaning system in the house and the ventilation of the environment was done by manually opening the windows.
The doors in the household were not closed during the measurement and thus the air was homogeneous throughout the house. Ventilation was carried out once a day for a duration of one hour. Ventilation started at 11:30 on the first day and at 07:30 on the other days. Figure 4 displays 4-day measurement graphs showing the relationships between humidity-CO 2 , CO-CO 2 , CO 2 -NO 2 , CO-NO 2 , PM 10 -CO and PM 10 -NO 2 .  Figure 5 displays PM 10 , CO 2 , CO and NO 2 measurements over 4 days. When the graph is examined, it shows that the indoor PM 10 , CO, NO 2 and CO 2 PM and gas concentrations vary depending on the number of household inhabitants and individual activities. It is seen that natural ventilation in the morning hours caused a decrease in CO, NO 2 and CO 2 gas concentrations. In addition, an increase in PM 10 is observed in the morning as a result of increased activity in the household. These increased rates at the PM 10 level are 27.1%, 32.2%, 14.4% and 12.5%, respectively. Figure 6 displays the daily changes of temperature, humidity, PM 10 , CO, CO 2 and NO 2 values. One-day time, period 1 (00:00-07:30), period 2 (07: 30-16:30) and period 3 (16:30-00:00) are divided into three parts; period 1 sleeping of household inhabitants, period 2 during which the daily activities (cooking, cleaning, etc.) of the individuals in the household are performed, and the period 3 of eating and resting of the household inhabitants. The PM 10 value seen in Figure 6a is in the order of 28.18 µg m −3 , 29.93 µg m −3 and 28.40 µg m −3 for periods 1-3, respectively. It can be seen that PM 10 has the lowest value in period 1 when the household is asleep. The CO 2 values in the periods are as follows: period 1, 565 µg m −3 ; period 2, 317 µg m −3 ; and period 3 has a mean value of 297 µg m −3 . The value of CO 2 reaches the highest value in period 1 when the household inhabitants are asleep.  When Figure 6b is examined, it is seen that NO 2 concentration has average values of 53.15 µg m −3 for period 1, 41.59 µg m −3 for period 2 and 42.22 µg m −3 for period 3. It is seen that the NO 2 concentration value reached the highest value in the period 1, similar to CO 2 . The CO concentration has an average of 5.48 mg m −3 in the period 1, 1.38 mg m −3 in the period 2 and 1.09 mg m −3 in the period 3. The CO value, and also CO 2 and NO 2 values, are observed to be highest in the period 1 while the household is asleep. Also, natural ventilation by opening the windows in the morning results in a significant reduction of CO, CO 2 and NO 2 concentrations.
As a result of natural ventilation, the indoor concentration of CO is seen to fall from 6.51 mg m −3 to 0.4 mg m −3 , NO 2 concentration from 54.7 µg m −3 to 38.6 µg m −3 and CO 2 concentration from 608 µg m −3 to 282 µg m −3 .
As a result of one hour of natural ventilation, the increased gas concentrations in the closed and unventilated environment resulted in a significant decrease of 93.8% in CO, 29.4% in NO 2 and 53.6% in CO 2 . Figure 7 shows the minimum, maximum and average values of daily gas concentrations. When the values given in Figure 7 are examined, it is seen that the largest variance is observed in the CO concentration. The CO values increased by nine times on day 1 and 16 times on day 3. Similarly, CO 2 concentration increased by 1.36 times on day 2. NO 2 , with a lower change, increased by half on day 4 and PM 10 concentration increased by half on day 2. The correlation relationships between air quality dates have been estimated by the Konstanz Information Miner (KNIME) "Linear Correlation" algorithms. Figure 8 shows the linear correlation workflow of KNIME.  Table 3 demonstrates the period 1 linear correlation matrix. There was a positive correlation between CO-CO 2 , NO 2 -humidity and NO 2 -temperature at values of 0.943, 0.871, 0.755, respectively, during the period when the household was asleep. In addition, there were 0.979, 0.911 positive and 0.941 negative correlations between time-CO, time-CO 2 and time-NO 2 , respectively. There was a strong negative correlation between climate parameters and values of CO and CO 2 and a strong positive correlation between climate parameters and values of NO 2 . On the other hand, the correlation between PM10 and gas concentrations and climate parameters were minuscule. The findings indicate that in period 1 there was an elevated positive and negative correlation between gas concentrations and climatic parameters, which represents sleep hours.  10 1 −1 Table 4 demonstrates the period 2 linear correlation matrix. There was a positive correlation between CO-CO 2 . CO-NO 2 and NO 2 -CO 2 at values of 0.966, 0.881, 0.861, respectively, and a negative correlation of 0.915 for temperature-humidity during this period, in which households are undertaking domestic activities (cooking, cleaning, washing, etc.). There were strong negative correlations between time, CO, CO 2 , humidity and NO 2 at −0.844, −0.752, −0.735 and −0.669 during this period. In addition, this period's correlations between PM 10 value and gas levels and climate parameters were very low. The linear correlation matrix provided in Table 5 belongs to period 3, in which families carry out activities such as eating and resting. There was a positive correlation between CO-NO 2 and CO-CO 2 at 0.833, 0.671, respectively, during this period. Furthermore, there was also a positive correlation between time-CO, time-NO 2 , time-CO 2 and time-PM 10 at 0.968, 0.846, 0.622 and 0.407, respectively. We can conclude that the cost of the proposed e-nose measurement system is very low compared to commercial products sold on the market. Moreover, the majority of domestic air quality meters available for commercial use measure only a restricted amount of air quality and climate parameters. In this system, CO, CO 2 , NO 2 , PM 10 , and six parameters of temperature and humidity can be evaluated. Another significant advantage is that our measuring system is IoT-based and provides users with real-time data transfer through its mobile interface. The major drawback of the proposed e-nose system is that no comparison and calibration is conducted with any conventional measuring system. The measuring precision of the system is equivalent to the measuring precision indicated by manufacturers. To rectify this, in our future studies the measuring system will be calibrated first, then the sensor node created and longer-term readings made. Thus, the change in IAQ through individual activities will be disclosed more obviously.

Conclusions
Although many people spend most of their lives indoors, they have very limited information about the air quality in their environment. IAQ, which plays an especially important role in the health of children and the elderly, should be measured and necessary ventilation measures should be taken. In recent years, individual air quality measuring devices have been produced owing to the developing information communication technologies, Wi-Fi based microcontrollers and low-cost sensors.
In this study, an IoT-based personalized air quality measurement and monitoring system was proposed by using air quality sensors and DIY approach. The developed e-nose measurement system made data measurements at one-minute intervals and recorded these data to the cloud server. The measurement data can be monitored instantaneously via the Blynk mobile interface, and if the limit values are exceeded, the application sends a notification to the user to take the necessary measures.
According to the four-day measurement results, the following inferences have been obtained: • IAQ is directly related to the number of people in the household and the activities carried out in the household.

•
Activities such as cooking, sleeping, cleaning have a significant effect on CO, NO 2 and CO 2 gas concentrations. A rapid decrease in CO, NO 2 , CO 2 gas concentrations was observed from the moment of natural ventilation, while a concurrent increase in PM 10 was observed.

•
In period 1, the highest positive correlations occurred between time-CO and CO-CO 2 ; the lowest negative correlations occurred between CO-humidity and time-humidity.

•
In period 2, the largest positive correlations occurred between CO-CO 2 and CO-NO 2 , whereas the smallest negative correlations occurred between temp-humidity and time-CO. • The highest positive correlations between time-CO, time-NO 2 and CO-NO 2 occurred in period 3. There was no negative correlation between the weather parameters and gas concentrations during this period.
IAQ has been observed to change depending on the daily activities of the inhabitants. Low air quality is undoubtedly an important parameter that directly affects our health. Even simple measures such as opening only windows to reduce the concentration of harmful gases in the environment can significantly improve IAQ. The numerical data obtained show that the e-nose system is a feature that can contribute to a healthier living environment. In future studies, it is planned to model the effects of individual activities on IAQ by using the e-nose air quality measurement system used in this study.

Conflicts of Interest:
The authors declare no conflict of interest.