Design and Deployment of an IoT-Based Air Quality Monitoring System

Air quality is getting worse worldwide, especially in cities with high population density and many industrial parks. Raising community awareness and applying science and technology are effective ways to mitigate the negative impacts of industrialization and pollution on the natural environment as well as public health. This work presents the design and deployment of an IoT-based air quality monitoring system, named the Environmental Monitoring System (EnMoS). LoRa (Long-Range) wireless communication technology and innovation sensors being used aim to facilitate the development of data communication network over a large area, improving sensing reliability, extending battery life as well as reducing total system costs. The air quality factors such as particulate matter (PM2.5 and PM10), carbon dioxide (CO2), air temperature and humidity, after being read from the sensors were uploaded to a real-time database server for Air Quality Index (AQI) calculation. In addition, for indicating conveniently obtained AQI values a web page is also developed to provide an interactive map along with corresponding charts. A case study on an actual LoRa network consisting of three sensing nodes and a gateway were conducted for validating the feasibility of the system.


I. INTRODUCTION
Climate change has been causing significant impacts on people's living conditions, stability, and socio-economic development status in the Lower Mekong River Basin day by day. Besides, due to population growth, the rapid increase of industrialization, as well as indiscriminate use of chemical fertilizers and pesticides in agriculture, are causing serious impacts on the environment, climate, and public health. Air quality is getting worse noticeably, especially in urban areas where high population density and many industrial parks. World Health Organization (WHO) announced that there are approximately 4.2 million premature deaths globally are linked to ambient air pollution [1]. Air Quality Index is a metric to assess how polluted the air is. Recently, air pollution levels in Hanoi and Ho Chi Minh City have reached alarming levels [2]. According to Vietnam's AQI ranking (see Table I indicating that air quality is harmful to health. In order to mitigate the negative impacts of industrialization and pollution on both the environment and public health, growing community consciousness and applying science and technology is one of the sustainable solutions. Many environmental monitoring applications based on the Internet of Things (IoT) have been applied successfully in many countries. These projects were employed short-range communications, for example, Zigbee, Wi-Fi, for implementing real-time air quality, both indoor and outdoor, monitoring systems [3] [7]. With the rapid development of integrated electronic devices and communication technologies (such as low power long-distance wireless communication technology) which allows deploying the distributed sensing systems on a wide-area and reducing maintenance costs as well [8]. Consequently, the objective of this research is to develop large-scale environmental monitoring by adopting IoT-based systems with the advantages of long-distance wireless communication and innovative sensor technology.
A lot of research on air quality has been conducted to reflect the current state of air quality in Vietnam. The scientists used high-resolution satellite images in combination with ground-based meters to calibrate the values in order to observe a large area [9]. The research also focuses on analyzing the factors that affect air pollution and their harm to public health, particularly vulnerable groups due to environmental change [10], [11]. Apart from monitoring AQI values recognized by governments, the research directions seek to identify areas with a high risk of air pollution or other pollutant compounds [12], [13]. Nevertheless, most of the researchers worked on the existing data collection systems instead of developing air quality index monitoring systems themselves.
In Vietnam, most air quality monitoring systems were located in major cities with a high cost of implementation and operation [14]. For example, until now only Hanoi has an automatic air quality monitoring system managed by the Vietnamese government [15], [16]. The implementation of air quality monitoring systems is essential for areas that are at high risk of air pollution, directly affecting human health such as industrial parks, production complexes, university laboratory complexes, and so on. The goal of this study is to design and implement an affordable air quality monitoring systems in areas with several kilometers radius. The monitoring AQI values are reported on a public website for the purposes of early warning and preventive action.
In Fig. 1, on the right, it is a LoRa star network consisting of a gateway and three sensing nodes. LoRa SX1276 modules manufactured by Modtronix were used in order to Design  establish wireless links for data transmission [17], [18]. In this network, sensing values of nodes from connected sensors and then sends them to the gateway a role of collecting data from sensing. The gateway then uploads obtained data to a cloud server through an Internet connection, for example, Wi-Fi or 3G/4G. As can be seen in Fig. 1, administrators can manage the entire system while end users can approach easily via web services from their various devices such as smartphones, tablets, laptops, and personal computers. For sake of convenience and intuition, we refer to develop a web page for a real-time AQI visual map because it can be accessed from any web browser running on many hardware platforms and operating systems.
The remainder of this paper is organized as follows: after stating various causes, effects, and solutions to air pollution and summarizing the related works in Section I, Section II describes the hardware architecture of the EnMoS system. The system utilizes innovative sensor technologies and Semtech's LoRa to deploy a low-power wide-area wireless network for real-time air quality monitoring. Software programming to manage the LoRa network and also to develop a user interactive web page presents in Section III. In Section IV, experiments were carried out on an actual system for monitoring air quality parameters at three typical laboratories on campus of Can Tho University. Finally, Section V concludes this paper before discussing future works.

A. Hardware System Overview
The objective of the LoRa wireless sensor network is to establish radio links between the gateway and the sensing nodes for gathering air quality factors. For the sake of simplicity and costs, we use either Raspberry Pi Zero W with Wi-Fi or Raspberry Pi Zero for control boards at a gateway and sensing nodes respectively. We designed and implemented a printed circuit board stacked on both control boards. It helps to wire a radio transceiver and sensors up to the control board for reducing attenuation and interference. For radio communication, Modtronix inAir4 module, a compact LoRa transceiver, offers low power consumption and long-distance radio link for sensing applications [18]. Fig.  2 presents the block diagram of the proposed system.

B. Sensor Used
Utilizing the advances of Micro Electro Mechanical Systems (MEMS), light scattering, non-dispersive infrared (NDIR), and proven sensing principles, we use various state-of-the-art sensors for better measurement of major air pollutants [20]- [23]. They must be appropriate for the application requirements, taking into account quality, responsiveness, reliability, and long service life. The specifics of the list of sensors used can be found in Table II. The sensors used in this work are carefully selected with a view to balancing quality and device costs aimed at calculating the AQI level. Adopting the principle of laser scattering, the SDS011 sensor can sense the particle concentration from 0.3 to 10 μm in the air and send these data to the uP using UART protocol [20]. The MH-Z19B sensor based on the non-dispersive infrared principle can detect the existence of carbon dioxide (CO 2 ) in the air with good selectivity and transfer this information to the controller in form of PWM signal [21]. The BME280 sensor provides I 2 C digital signal for humidity, pressure, and temperature with fast response, high accuracy, high resolution, and low noise [22]. CJMCU-4541 sensor is a robust analog MEMS sensor with two fully independent sensing elements such as carbon monoxide (CO) and nitrogen dioxide (NO 2 ) on a small footprint [23].

C. LoRa Transceiver
Semtech's long-range (LoRa) has been one of the well-known long-range technologies used in large-scale remote sensing systems. It provides accommodation between low data rates and long-distance radio links with different configurations of major parameters: Carrier Frequency (CF), Bandwidth (Bw), Spreading Factor (SF), and Coding Rate (CR). Using the LoRa chip, communication links can reach up to several kilometers in urban areas and tens of kilometers in rural areas [6], [17]. Modtronix LoRa inAir4 is a compact wireless module that uses a Semtech SX1276 chip with a standard SMA external antenna connector, operating at a frequency from 430 MHz to 435 MHz, as shown in Fig. 3. This radio transceiver module can be interfaced with a microprocessor or a microcontroller via the SPI bus. All parameters of the chip are configured conveniently in the program for efficient operation [17].

D. Hardware Design and Implementation
An adaptor Printed Circuit Board (PCB) is designed to connect electrical or electronic devices using conductive tracks in order to improve the stability of the system as well as reduce interference. LoRa inAir4 module and sensors are soldered onto the PCB to wire them together. The adaptor interfaces with Raspberry Pi via GPIOs header conveniently. A PCB computer-aided-design (CAD) tool is employed to ensure the proper layout of components and validate operations of circuitry. After that, a computer numerical control (CNC) machine prototyping can produce the PCB quickly, as shown in Fig. 4.  Apart from this, a plastic box was fabricated by a 3D printer machine for protecting electronic components from broken or damage the system. On the front and back of the case, ventilation slots were designed to facilitate the measurement of the air quality sensor. Additionally, as can be seen in Fig. 5, a battery for power supply is also placed inside this box. The complete system of a sensing node is shown in Fig. 6.  Designing and implementing a low-cost system is the objective of this research. The price of a gateway is approximately 54 dollars, while a sensor node is 130.39 dollars, respectively. It is consisting of the costs of raw materials, components, and manufacturing, details can be found in Table III and Table IV.

A. Data Collection
A LoRa star network is deployed to collect environmental data to a gateway from many sensing nodes distributed in a wide area (see Fig. 1). Sensing data at sensor nodes, with data formation as illustrated in Fig. 7, needs to be sent to the gateway reliably so that a trick scheduling communication must be programmed. The LoRa chip operation has to be controlled by a Python program running on an ARM processor equipped on Raspberry Pi. It is critical to executing interrupt routines to control data exchange within the network effectively. At the gateway, air quality factor values collected from sensing nodes are uploaded to a cloud server either through Wi-Fi or the Internet. The obtained data are inserted into a Firebase real-time database and the calculation are executed for AQI values. Fig. 7 depicts the payload structure of a LoRa frame for gathering data in the EnMoS system. The sensors record parameters of air quality and send them to the ARM microprocessor for data processing. For instance, Fig. 8 illustrates a flow chart of the routine in Python programming language for reading and then calculating PM2.5 and PM10 values. Air Quality Index (AQI) is widely used to communicate the public how polluted the air currently. It is necessary to convert the concentrations of pollutants (such as PM2.5, PM10, etc.) into the AQI scale. The numerical value of AQI can be calculated by equation (1) and a breakpoint table. Further details can be found in [24]. (1) where  C Input : input concentration of pollutant  C High : the concentration breakpoint value that is greater than or equal to C Input  C Low : the concentration breakpoint value that is less than or equal to C Input  AQI High : the AQI value corresponding to C Input  AQI Low : the AQI value corresponding to C Input

B. Web Application
The web page at address https://enmos-ctu.web.app/ is built in order to provide an interactive map along with the corresponding graphs for air quality parameters. It is convenient for people to access the information from any web browser running on a variety of hardware platforms and operating systems. The level of pollutants in the air, such as PM2.5, PM10, and CO 2 are presented on separate graphs to observe easily. For instance, PM2.5 values (in µg/m 3 ) measured by the SDS011 sensor were depicted in a graph (see Fig. 9). Such graphs are automatically refreshed whenever the Firebase database is updated in real time. It not only allows governors to observe, analyze, and assess the variation of air pollution level but also raises public awareness about environmental pollution.   The EnMoS system has been implemented to monitor the air quality of three typical laboratories, Organic Engineering Lab, Construction Materials Lab, and CAD/CAM/CNC Lab, on Campus II of Can Tho University (CTU). Fig. 10 depicts the LoRa network deployment, in reality, locations showing on the map with a gateway (red maker) and sensing nodes (blue makers). Although the radius from the gateway to the furthest sensing node is just around 200 meters, the transmission paths were obstructed by various obstacles such as walls, big trees. To overcome this issue, LoRa technology was chosen for data communication within the sensing network. An air quality sensing node was placed at Organic Engineering Lab, as shown in Fig. 11. The gateway was located in the main building of the College of Engineering Technology. During the time, the remote sensing node is in sleep mode to consume as little power as possible. During regular wake-up and transmission 6 times per hour when the gateway requests, it can draw short bursts of current up to 370mA. Its average power consumption must be managed so that it does not exceed 87mA. Using two lithium-ion batteries for power supply, each of them has a 2200mAh capacity, which supports its runtime requirement is more than 2 days (4400mAh / (87mA × 24h/d)  2.1 days). End users, for example, staff and students, can access the web page from everywhere using PC, smart devices with a web browser to notice the level of air pollution in their workplace. They can switch between the laboratories and then choose a graph to observe the corresponding measured data in real time. Typical graphs displaying CO 2 , air pressure, PM2.5, PM10, temperature, and humidity are shown in Fig.  12. The air quality of every laboratory is also indicated by color-coded AQI labels on the map (see Fig. 13). According to Vietnam AQI rankings, an AQI level above 100 is considered to be contaminated or unsanitary to humans as can be seen in Table I. For these cases, people should improve air quality by opening the doors and powering on the ventilation system.

V. CONCLUSION AND FUTURE WORK
In this paper, we presented the implementation of an IoT-based air quality monitoring system, namely the Environmental Monitoring System (EnMoS) system. The system allows AQI monitoring for a wide area in real time with a visual web map application in light of long-distance wireless technology and cloud database service. We deployed a LoRa star network consisting of a gateway for data collection, then uploading to cloud server and three wireless sensing nodes at three typical laboratories on campus. Each sensing node equips sensors for measuring environmental factors for AQI calculation such as particulate matter (PM2.5 and PM10), CO 2 , air pressure, temperature, and humidity. Experimental results show that node deployment strategies and methods have a significant impact on the efficiency of air quality sensing. For future work, it is critical to carry the calibration phase with a reference or standard of known and high accuracy for evaluation and validation of the values of all sensors in the proposed system. We also plan to extend the system for air quality monitoring in an area of few tens of square kilometers, for example, all labs on Campus II of Can Tho University. Moreover, based on the positive results of this research, the EnMoS may be applicable for various surveillance applications, for example, saltwater intrusion monitoring, structural health monitoring, and so on.

CONFLICT OF INTEREST
The authors declare no conflict of interest.

AUTHOR CONTRIBUTIONS
Tuyen Phong Truong, Duy Thanh Nguyen, and Phong Vu