Enhancement of real-time IoT-based air quality monitoring system

Received Aug 19, 2019 Revised Oct 28, 2019 Accepted Dec 1, 2019 Air pollution is one of the biggest threat for the environment and the human’s health. The monitoring of air pollution based on several atmospheric pollutants is becoming critical in most countries including Malaysia. This paper presents a development and enhancement features of real-time Internet of Things (IoT)-based environmental monitoring system for air quality. The proposed system will be beneficial to monitor the real-time data for a specific set of air quality parameters such as temperature, humidity and concentration of carbon monoxide, liquified petroleum gas (LPG) and smoke. An alarm system will be triggered if the concentration of carbon monoxide exceeds 50 ppm. Users can use their smartphone to view these data via Wi-Fi by installing an application called “AirProp”. Based on the collected data, this paper also analyses other contributing factors such as time and traffic condition on the temperature, humidity and concentration of pollutant gases at different locations. The advantage of the real-time system is it serves as the data base platform to store data up to certain duration of time. The data can be further analysed and leveraged by governments and researchers to mitigate air pollution.


INTRODUCTION
Nowadays, crisis related to air pollution is getting serious which lead to alarming problems to human health and environment. Some of the common air pollutants are carbon monoxide, nitrogen dioxide, ozone and sulfur dioxide. In terms of human health, these pollutants cause higher risk for asthma, respiratory diseases, circulatory system diseases, high incidents of heart problem, damage of immune system and others [1][2][3][4]. The significant increment in number of vehicles such as cars and motorcycles on major roads in most developing and developed cities has worsened the air pollution problem [5][6][7]. Proactive actions must be taken to reduce and prevent the air pollution from getting more serious. The air quality is determined based on the estimation of some essential and indicative parameters such as air temperature, radiation, activity level, air flow, humidity and presence of atmospheric particles and including for example: carbon monoxide (CO), nitrogen dioxide (NO2), ozone (O3), volatile organic compound (VOC), and black carbon [8][9][10][11][12]. The air quality monitoring process is critical to curb the escalating air pollution issues.
A survey on various air pollution monitoring systems has been carried recently [13]. Some of the monitoring systems are IoT (Internet of Things), Kernel Models Technique [14] which described the architecture of a product unit network and evolutionary learning algorithm and mobile system which is a Int J Pow Elec & Dri Syst ISSN: 2088-8694  Enhancement of real-time IoT-based air quality monitoring system (Wei Jian Ng) 391 reliable measurement system. Besides, there are also an air pollution monitoring system using LabVIEW that display real time data acquisition and monitoring system on LabVIEW interface [15]. These monitoring systems have their own advantages and issues. IoT technology has emerged as a key role in Industry 4.0 in many applications to improve human's life [16,17]. With the advanced progress of IoT (Internet of Things) application, all the network of the devices can be connected to the same cloud server for collecting and sharing the data [18]. In 2016, a research on multi-sensor system for environment regarding air and water quality monitoring is carried out by M. Simić et al. [19]. A low-cost, low-power and portable sensor system which powered by battery with solar panel-based charger unit is developed to monitor the air quality and water quality of the environment. Users can view the real-time graph of parameter and sensor reading through the webpage of IBM Watson IoT platform. Arunava Mukhopadhyay and his research group has conducted a project on air quality meter and air pollution detector in 2017 [20]. They developed an IoT technology via Bluetooth to monitor the environment. The data from the sensors is then sent to a computer or smartphone for real-time monitoring. However, this work has some limitations such as only one device can be connected to the system to view the data through the display device because Bluetooth is used as the communication channel. Another research on air monitoring system based on space-borne terahertz radiometer was conducted by R. You, Z. Lu, Q. Hou and T. Jiang [21]. By observing the absorption peak, the identity of the pollution gases such as carbon monoxide, particulate matter, sulfur dioxide, ammonia and hydrogen sulfide can be defined because different pollution gases have different absorption peak. However, this monitoring system does not have a systematic networking monitoring which can view the real-time data by using mobile application via Wi-Fi. Saha and his group proposed a research on a Raspberry Pi controlled cloud-based air and sound pollution monitoring system with temperature and humidity sensing [22]. This work used an IoTbased method to monitor the AQI and Noise Density of an area. It also used Anomaly Notification Module to alerts the user by sending an email and SMS when the condition of environment is unhealthy. However, there may be some people failed to check the SMS and email due to the reasons that they do not have electronic devices or the device is not available. In short, this system does not have an alarm such as buzzer to be activated to give warning to the people around the area.
The advances in sensors, IoT platforms and mobile communications technologies have led to the development of smaller, portable, low cost, mobile-enabled sensors that can measure and report air quality in near real time. "Big Data" capabilities can be applied to this data together with other contributing factors such as weather and traffic can be further analysed for air quality monitoring purposes [23][24][25].
This paper presents an enhancement of a real-time IoT-based monitoring system for air quality. This can be achieved by designing an integrated air quality monitoring system. The hardware part of the air quality sensing system consists of sensors, alarm and warning indicator. An Android application which can monitor the real-time measurements of temperature, humidity and concentration of pollutant gases via Wi-Fi is developed. Most importantly is the development of database to monitor the pattern of air pollution for a certain specified time, date and period. The effect of several factors such as time and traffic condition on the temperature, humidity and concentration of pollutant gases are also investigated.
The outline of the paper is presented as the following. First, the methodology to develop the environmental monitoring system for air quality is described. Then, the results obtained are analyzed and discussed. Finally, some conclusions are drawn at the end of the paper. Figure 1 shows the project methodology. Initially, a gas sensor MQ2 and a humidity and temperature sensor, DHT11 were chosen to determine the concentration of carbon monoxide, smoke and LPG as well as the humidity and temperature of environment,. These sensors were connected to Raspberry Pi to develop the prototype of the project. The algorithm of the project was developed to initiate the communication of hardware and software.

RESEARCH METHOD
A preliminary experiment was carried out to determine the functionality of each sensor. MQ2 in condition with and without the presence of carbon monoxide. Another preliminary experiment was also conducted to determine the functionality of DHT11 on temperature in outdoor and indoor and functionality of DHT11 on humidity in bathroom and kitchen. Then, a performance testing of the environmental monitoring system for air quality was carried out under different conditions such as venue and time. A database was created to store all the collected data from sensors. In addition, an Android application was developed to view the real-time data of the sensors which retrieved from the database. Finally, the collected data was retrieved and analyzed.

Development of prototype
The proposed prototype consists of several electronic components such as gas sensor MQ2, humidity and temperature sensor, DHT11, analog to digital converter MCP3008, buzzer, LCD and potentiometer. These components are connected to the I/O ports of the microcontroller, Raspberry Pi 3 Model B. Gas sensor MQ2 and humidity and temperature sensor DHT11 are used as the input to microcontroller while buzzer and LCD display are used as the output of microcontroller. Figure 2 shows the overall block diagram of the real-time IoT-based environmental monitoring system. Figure 3 shows the circuit connection of the components with Raspberry Pi 3 Model B.
An Android application is developed to observe the real-time measurement of the humidity and temperature of environment, concentration of carbon monoxide, smoke and LPG. The concentration of carbon monoxide is compared with a threshold value of 50 ppm. A buzzer is triggered and a warning message is displayed on LCD screen if the concentration of carbon monoxide exceeds 50 ppm. The concentration of carbon monoxide, the humidity and temperature of environment are stored into the cloud database.

Preliminary experiments
Three preliminary experiments were carried out to verify the performance of sensing system of gas sensor MQ2 and humidity and temperature sensor, DHT11. In the first preliminary experiment, the gas sensor MQ2 which can detect various pollutant gases such as carbon monoxide, smoke and LPG was placed under different condition. The performance of MQ2 with and without the presence of carbon monoxide were compared. Table 1 shows the concentration of carbon monoxide, smoke and LPG, alarm condition and LCD display of the system under these two different conditions. Based on Table 1, the concentration of carbon monoxide, smoke and LPG increased rapidly when the gas sensor MQ2 was exposed to smoke from exhaust pipe of a motorcycle. The smart alerting system was triggered by activating the alarm and displaying the air condition with the word of "dangerous" on the LCD screen when the concentration of carbon monoxide was larger than 50 ppm. However, once all the smoke from the exhaust pipe of motorcycle was gone or the air of surrounding was clean, then only low concentration of carbon monoxide, smoke and LPG were detected. As a result, the alarm was deactivated.
The changes in the concentration value in two situations verified the performance of the gas sensor MQ2. In the second preliminary experiment, the humidity and temperature sensor, DHT11 was placed in air-conditioned room and under sunlight respectively. The measurement of DHT11 on temperature in these two different places were compared. The differences of temperature in these two places proved the functionality of the DHT11 sensor on temperature.
In the third preliminary experiment, the humidity and temperature sensor, DHT11 was placed in the kitchen and bathroom. The performance of DHT11 on humidity in these different places were compared. Table 2 shows the humidity in these different places. In the next stage, a real test has been carried out to observe the changes of these measurements under different conditions, which are locations, traffic condition and time.

Data collection in database
Firebase is chosen as the cloud database because the NoSQL database can manage the unstructured big data efficiently by providing high velocity in storing and retrieving the data. A project named "AirPollutionData" has been created in the Firebase Console. The Firebase Python Library is installed in the Raspberry Pi 3. The http address of Firebase is defined in the Python Script. The sensed data is then received by Raspberry Pi 3 and send to the Firebase database.

Data retrieval analysis
A project has been created in Android Studio which is named as "AirProp" (Air Properties). "AirProp" is used to monitor the real-time data of the environment including the concentration of carbon monoxide, smoke and LPG as well as the humidity and temperature. The Firebase API has been imported in the app project so that the application able to retrieve data from the "AirPollutionData" database in Firebase. There are five GUI in the project which have their own functions. Table 3 shows the details of each GUI activity. The data collected from the sensors are then stored in the real-time Firebase database in JSON format. The database is exported out in JSON format and converted into CSV file via online JSON to CSV converter. The results are tabulated and analyzed. To monitor the real-time data on temperature and humidity of the environment.

Air Quality Pollutants
To monitor the real-time data on concentration of carbon monoxide, smoke and LPG.
To view the information about pollutants gases such as carbon monoxide, smoke and LPG.

History
To check the average of temperature, humidity and concentration of the carbon monoxide, smoke and LPG of a chosen date. Report To make report to the authorities regarding any issues related to environment.

RESULTS AND DISCUSSION
The test has been carried out at two different locations, which are USM EE school parking lot and at Kulim Hi-Tech Park. These two locations have been selected based on the traffic conditions. Kulim Hi-Tech Park is an industry area which has moderate traffic during weekday while USM Electronic and Electrical (EE) School parking lot is an area which has light traffic during weekday. The data were collected in the morning (7:00-8:00am), afternoon (12:00-1:00pm), evening (5:00-6:00pm) and night (9:00-10:00pm) in the time interval of 1 minute at these two different venues. The concentration of carbon monoxide, LPG and smoke as well as the temperature and humidity of the environment at different time in time interval of 1 minute in different traffic condition area has been recorded in this test.
The average temperature, humidity and concentration of carbon monoxide, LPG and smoke are calculated. In order to compare the average concentration of carbon monoxide, LPG and smoke, three line charts are plotted as shown in Figure 4(a)-(c) show the comparison between average concentration of carbon monoxide, LPG and smoke in USM EE school parking. As expected, Figure 4 shows that the overall average concentration of carbon monoxide, LPG and smoke in the Kulim Hi-Tech Park is higher than that of at USM EE school parking lot. There is a large difference in the average concentration of carbon monoxide and smoke between USM EE school parking lot and Kulim Hi-Tech Park.
Based on Figure 4(a), the highest average concentration of carbon monoxide and smoke are shown at morning and evening have in Kulim Hi-Tech Park due to the peak hour of traffic.
Air Quality Index (AQI) is the standard measurement of the air cleanness in the environment which is commonly used in monitoring the air quality. A low AQI value shows the air quality is good. The highest average concentration of carbon monoxide obtained from the performance testing is 4.429 ppm at Kulim Hi-Tech Park during evening. From this value, the AQI for carbon monoxide can be calculated as in (1).

51 50
( 1 ) Where I is the index for carbon monoxide, Cp is the concentration of carbon monoxide.The AQI obtained is 50. The AQI value is in the range of good level on air quality. Therefore, the air quality is satisfactory and causes no risk on health of human. On the other hand, there is no obvious difference in average concentration of carbon monoxide, LPG and smoke in the morning, afternoon, evening and night time in USM EE school parking lot.
The collected data are stored in the "AirPollutionData" database in Firebase console. Figure 5(a) shows the examples of data that collected from sensors in database. The mobile application "AirProp" has been created to observe the real-time data of temperature and humidity of environment, concentration of  Figure 5(b) shows the weather page in "AirProp" with the measurement of temperature, humidity, carbon monoxide, smoke and LPG. The mobile application "AirProp" is also capable to review the average temperature and humidity as well as the concentration of carbon monoxide, LPG and smoke on a chosen date. Users can also view the more detail information on the chosen date by using date picker. A more detailed temperature and humidity as well as the concentration fo carbon monoxide, LPG and smoke of the whole day can be reviewed in a list view. Figure 6(a) shows the date picker in Android application, Figure 6 In addition, "AirProp" has another feature in which a notification will be pushed to the notification bar of the Android mobile phone. This notification is purposely created to remind users to check the air quality of the environment frequently. Furthermore, a warning message will be displayed on the screen of the mobile phone when the concentration of carbon monoxide exceeds 50 ppm.

CONCLUSION
The real-time IoT-based environmental monitoring system for air quality has been successfully developed and met the outlined objectives. The environmental air quality sensing system with alarm and warning indicator which can determine the temperature, humidity and concentration of the pollutant gases has been designed. The developed application is capable to monitor real-time measurement of temperature, humidity and concentration of pollutant gases has been successfully developed. Besides a webpage or iOS application is also developed to monitor the real-time data and view the previous data of the environmental air quality. The main contribution in this paper is the availability of the database for further analysis and monitoring purpose.