An IoT-based handheld environmental and air quality monitoring station

Weather and air quality play an important role in determining environmental pollution. Fluctuation of these parameters not only causes environmental pollution but also causes severe injuries to human health. With the emergence of the Internet of Things (IoT), sensor-based weather devices with easy observation facilities started to develop. In this regard, this study focused on developing an IoT-based portable weather monitoring gadget that can measure weather and air parameters which are more often required in our day-to-day life. The proposed system is capable to measure temperature, pressure, humidity, altitude, PM2.5, PM10 level, VOC, and CO level. It consists of a portable display and a mobile app with a thing speak cloud platform. Further, the system has a Wi-Fi and GSM connection to communicate data. A mobile application was developed to monitor the readings in real-time which are stored in the cloud platform. The developed hardware was carefully calibrated in the national meteorological department to make sure our system is practically usable. Compared to existing models, our prototype is very handholdable,


INTRODUCTION
In the early days, people used larger devices to measure a single weather parameter. They are used to place weather stations in a location to collect and analyse information, and to make predictions on future weather changes. In the past years the devices were large, complex, and analogic type. Then, simpler and less power-consuming digital systems were introduced [1]. The collection and the storage of data with analogic and digital devices is a tedious and time-consuming activity, as manual involvement was significantly needed for that. The need of collecting real-time data and their storage led researchers to pay more attention to obtaining accurate and fast weather parameters in a large area using simple on-set devices [2].
These devices are considered automated devices that measure and record weather information using sensors. With the real-time data monitoring ability of IoT, these devices become more reliable. Hence the IoT is considered as the modern state-of-theart method for measuring the weather and air quality parameters.
Overall, IoT technology provides the capability to monitor, collect and exchange data using a device consisting of sensors or actuators, controllers, etc. The main reason for using IoT in smart weather monitoring is due to the vast range of options that exist in this technology. On the other hand, IoT enables the connection of a larger number of sensors to a cloud network using various connectivity methods based on connection range. To date, an IoT is considered the best way to collect, maintain, and analyse large amount of data [3].
This study aimed to design a small portable weather monitoring device suitable for environments such as schools, laboratories, and industries to monitor real-time parameters. The device can give all the required environmental and air quality parameters at once with a reasonable time range and with the possibility to customize the data acquisition. Hence, this device could be used to create a nationwide network to collect the required weather and air quality parameters accessible at any place.
Overall, the weather station gets seven important parameters at once with easy monitoring methods. The system could be used in agricultural and field monitoring activities, environmental controlling activities in places such as greenhouses, environmental and air pollution monitoring, damage control activities, climate change study, etc. Further, this network would generate big data which could be used for machine learning research. This system could also be usable as a home automation control device in which we can control the home automation sensors and actuators based on the weather and air quality readings that we are obtaining. Additionally, air pollution causes severe health injuries to human health, which ultimately result in death [4]. Hence, this system could be used to monitor the air quality parameters in the close living environment and to accordingly take countermeasures to avoid life-threatening risks.
The rest of the paper is organised as follows. Section 2 describes the previous works, Section 3 provides existing models, Section 4 and 5 explains the hardware and software layouts, Section 6 analyses the results, and finally, Section 7 concludes our work.

RELATED WORK
In general, smart weather stations are automated systems designed by connecting one or more sensors using a microcontroller. With the ability of IoT to connect devices to a cloud network using wireless communication, the data could be accessed from any place in the world. In [2] an IoT-based system was designed using an LPC1768 microcontroller and four sensors to measure temperature, pressure, relative humidity, and light intensity. The data was collected and sent to a base station using an ESP8266 Wi-Fi module.
In [3], a system was implemented using an Arduino UNO board, DHT11 sensor, ESP8266, and Wi-Fi module which transmit data to open IoT API service thing speak where the data can be stored and analysed. Rather than weather monitoring, air quality measuring devices are also designed using Arduino UNO, MQ135, and MQ7 sensors [5]. Also, there are systems designed [6] using Raspberry Pi to monitor temperature, humidity, PM2.5, and PM10 concentration, and air quality index.
Later projects were using the Arduino UNO based system [7], to measure even gas content and earthquake information with a combination of moisture, temperature, humidity, and rainfall parameters. There were even single sensors such as MQ135 which were able to measure Carbon Dioxide, Sulphur Dioxide, Nitrogen Dioxide, smoke, and LPG gas [8]. There are many challenges related to IoT-based systems such as complex topology design, privacy and security, power backup, and high memory requirements, In [9], the researchers have designed an indoor and outdoor pollution monitoring system using ESP8266 Node MCU controller, SDS021 sensor, and ZE07-CO sensor. The system is a low-cost, simple topology system.
Further the GSM/ GPRS modules could also be used in IoT systems to build a mobile communication systems [10], [11].
Overall, these systems used an LCD to display real-time information, and systems could use wireless modules such as ESP8266 to connect the system to the Internet using a wireless connection. Then the data was transferred to a remote server or IoT platform such as "thing speak" or to a mobile application [12]. Wireless sensor networks have carried out a selfconfiguration and reconfigurations, and can adapt well to mobility as well as to a remote control [13]. Rather than webbased technologies, messaging technologies such as MQTT can be used in IoT systems [14]. This can help to separate system migration complexity and make it easier to build a distributed information system.
In the global market, there are IoT-based weather devices that can measure only a few parameters such as temperature, humidity, pressure, or some on-set devices that can use as domestic or industrial weather stations. Many of them are powered by batteries and they use solar power systems as a backup power supply. In [15], the authors describe an IoT-based microclimate monitoring weather station that can be installed in any place and can be easily modified to suit any environment. The data is transmitted to the cloud at a fixed range using a mobile communication network. A microprocessor, local storage unit, communication module, LCD display, power controller, and sensor panel comprise the system whereas it has only the temperature and the humidity sensor to get only those two parameters.
Further, in [16] there was another work carried out by International Water Management Institute (IWMI) to upgrade the climate monitoring systems in Sri Lanka, with the aim of designing and programming a device using Arduino, using opensource software and hardware. The aim of this equipment was to monitor the variability of rainfall. The system was able to measure parameters such as wind speed, pressure, humidity, water pollutants, wind direction, rainfall, and water level.
The device consists of an Arduino Lakduino board, a weather shield, a GPS receiver, a data logger, an anemometer, and a rain gauge with solar-powered rechargeable battery. Further [17]- [19] are addressing similar devices used in environmental and agricultural monitoring applications.
However, most of the existing devices were developed only for either weather monitoring or air quality monitoring separately. Only recent researches have started to incorporate both types of devices [20]- [29], but there is still a wide combination of parameters to include. Our objective was to measure multiple parameters with a single device, given that they are needed by environmental researchers for machine learningbased forecasting models [30]- [37].
Moreover, most of the existing works did not indicate the calibration procedure and the results after obtaining the calibration report. Hence, this would question the reliability of the hardware for practical use. Most researchers have carried out laboratory tests to show the variations in the readings by suddenly creating some variations in the atmosphere and checking if the device readings were changed or not. Apart from that, the sensor components are being improved and enhanced with the latest technologies, leading to a better performance and a less power consumption.
The majority of the previous works were carried out through Raspberry Pi, a more complicated device if compared to Arduino UNO, because of its programming structure and the nature of the Raspbian operating system [3]. In Table 1 we compare the existing models with the one we propose in this study. Based on the cost of the equipment, we have also categorized if the cost for the development of the setup is low, high, or moderate.
Based on the comparison with the literature, it is evident that our proposed setup enables weather, air quality, and environmental monitoring facilities for a low cost, with cloud, and mobile connection facilities.

SYSTEM REQUISITES
In order to build the hardware and the software platforms we needed to have microcontrollers, weather parameter reading sensors, air pollution monitoring sensors, a 3D printer, a Wi-Fi module, a GSM module, a display unit, a cloud platform for data storage, data visualization, and data analysis, Android application development kit, and finally, a power source for the continuous operation of the system.

SYSTEM HARDWARE
The proposed portable smart weather monitoring station is designed as a weather station that should be able to measure both weather and air quality parameters using an IoT-based system. The system has an Arduino UNO board as the main microcontroller and a node MCU with an ESP8266 Wi-Fi module.
The device can measure temperature, humidity, pressure, PM2.5, PM10, O3, CO, and VOC levels. The data is sent to a thing speak web platform and to a portable display using a Wi-Fi connection. These data can be accessed and analysed in an IoT platform "thing speak" or can be accessed using a mobile application or web server for other activities. The system also has a GSM connection to be used in the absence of wireless connectivity. The next subsections present a brief description of the components of the system.

Microcontroller
Microcontroller consists of an Arduino UNO and a Node MCU board. Arduino UNO is an open-source microcontroller board based on the microchip ATmega328 microcontroller. This will be a 14-pin board powered by a USB cable or by a 9-volt external battery. Arduino UNO board has a voltage range of 7-20 V and can be programmable using Arduino IDE. The Node MCU board is used as a supported microcontroller as well as the ESP8266 WI-FI module enhances to provide the wireless connectivity requirements of the device.

Sensors
We have selected the sensors according to three main features, necessary to address our main objective: i) less power consumption, ii) small dimension, and iii) low cost. AHT10 was selected to get temperature and humidity measurements. It has a small volume, a less power consumption, and a better antiinterference capability. The maximum voltage requirement for its operation is 3.6V dc. MQ-7 is having more sensitivity to the carbon monoxide gas. It can detect up to 10-500 ppm range of CO gas. It also complies with our three major concerns and provides suitable digital outputs. MQ-7 was interfaced with the Arduino-UNO controller. Furthermore, it produces low conductance with clean air. BMP280 was selected for the pressure sensor due to its robustness, high reliability, and digital outputs along with the above three primary concerns. It can be interfaced with mobile devices, GPS modules, and even with watches. BMP280 was connected to the Node MCU controller since Arduino UNO is fully loaded with the previous sensors. ZP07-MP503 is a volatile organic components detection sensor that is sensitive to formaldehyde, alcohol, cigarette smoke, ammonia, benzene, hydrogen, essence, etc. It is also very costeffective, has a long life, and pre-shipment calibrated sensor. This sensor was connected to our main Arduino UNO controller and can be operated with 5vdc power. Conversely, it is not suggested to expose the module to a high concentration of organic gases for an extended period.
The laser scattering principle is utilized here, namely, the induction of scattering by using a laser to radiate suspended particles in the air, then collect scattering light to a specific degree, and lastly acquire the dispersion of light changes throughout the time. Finally, using MIE theory [38], a microprocessor can calculate the equivalent particle diameter as well as the number of particles of different sizes per unit volume. This sensor is linked to the Node MCU since the connections are full in the Arduino UNO. This sensor also requires around 5vdc power for its continuous operation. After the complete connection of all the sensors and configurations, two outer cases were printed using the 3D printer. One is for the main equipment and the other one is for the digital display unit. Table 2 illustrates the details of the sensors that were used. AHT10, PMS 5003, and BMP280 sensors are described by an uncertainty value which indicates the maximum deviation values from the actual readings. They can be considered as the worstcase uncertainties (Maximum errors). But for the other sensors, MQ-07 and ZP07-MP503 are described by a sensitive value that defines the smallest physical parameter input required to produce a discernible output change or it can be interpreted as the input parameter change needed to form a standardized output change. Consequently, Figure 1 depicts the block diagram for the hardware implementation. Figure 2 shows the internal and external physical organization of the device. A detailed wiring and schematic diagram have been depicted in Figure 3

Wireless connectivity
A wireless connection was established using ESP 8266 Wi-Fi module. This connection is used to send data to the ThingSpeak channel and portable display unit. This Wi-Fi module uses the full stack of TCP/IP. When this Wi-Fi module is connected to the Internet it will get the IP address automatically or dynamically. After establishing the Wi-Fi connection, it would be possible to transmit the equipment readings to the ThingSpeak cloud in which real-time monitoring, data visualizations, and data analysis are possible in one place. It requires only 3.3 VDC power for its function and it is also an inexpensive device. This works under the 2.4GHz (802.11 b/g/n) regular Wi-Fi standard. This Wi-Fi module was also connected to the Node MCU controller.

Portable Display Unit
A display unit with Wi-Fi connectivity was designed along with the prototype to display the sensors' data using Wi-Fi connectivity. A Node MCU with ESP 8266 Wi-Fi module and an OLED 0.96' display is used in the portable display. A lithium battery powered up the device. The required power supply for this unit is provided by the Arduino UNO in the system.

SYSTEM SOFTWARE
Software is critical to the integration and operation of our hardware design. There are two software components in our design. The first component is driving the operation of the hardware components including the sensors. It was completed by microcontroller programming using Arduino IDE. The second component is the android-based Graphical User Interface (GUI) which can be used by multiple mobile devices to get the weather and air quality readings.

ThingSpeak Channel
A ThingSpeak channel was created using a commercial license which contains 8 channels to display temperature, humidity, pressure, relative altitude, VOC, CO and PM2.5, and PM10 levels. Table 3 describes the channel information of the obtained account. ThingSpeak uses traditional HTTP/HTTPS connectivity via the Internet. This cloud-based analytics platform is used to gather, view, and analyse live data streams. Figure 4 shows the dashboard visualization layout of the real-time data values.

Mobile Application
An Android app with Graphical User Interface (GUI) was designed using the Android studio to enable users to retrieve the data from the ThingSpeak platform easily. The application is more flexible and efficient to use, and the user authentication features help users to log in using their username and password. MySQL has been used to store the required details. Android    Studio uses Java Script Object Notation (JSON) parser to enable sending GET requests to the ThingSpeak channel to collect the necessary data by using the REST API request methods. Figure 5 illustrates the login page and the selection of parameter options menu page of the developed mobile application.

RESULTS AND DISCUSSION
It is very important to have higher precision or lower uncertainty values when building measurement equipment. The accuracy value is defined by the combination of the resolution and precision of that sensor. Resolution is the measurable incremental variation and precision is the nature of giving the same output the for same input values [39]. In weather monitoring gadgets, uncertainty is the most important feature which should be given much priority as well.
Calibration could be done in many ways such as by Homogenous mutual test, Heterogenous mutual test, combined mutual test, and by using standard sensors [40]. We have used the fourth method for calibration which is using standard sensors. After designing and configuring the device, data collection was carried out through a calibrated device available at the Sri Lanka meteorology department headquarters to check the uncertainty of device readings and to calculate error percentages. For that purpose, a mounted ambient weather station is used. According to those data, the error calculation and plotting are done for a selected time interval using the obtained data. Data was recorded from morning 10.00 am until afternoon 4.00 pm at 30-minute intervals. Figure 6 shows the Humidity variation, Figure 7 shows the Pressure variation, and Figure 8 shows the     Table 4. Figure 9 and Figure 10 are showing similar graphs for PM2.5, and PM10 reading values. CO level readings are very close to the standard reading values with less than a 5 % error percentage.
PM10 sensor also indicates the lower uncertainty values close to the standard reading with less than 7 % of error values. PM2.5 sensor is also showing a lesser deviation from the actual reading values. In many instances error percentage is 0 %, but in a few instances, they are reaching 10 % to 11 % with a little higher deviation. In any way, the overall accuracy values are good in comparison with the standard values. Table 5 shows the final summary of the sensor accuracy values in the Mean Absolute Percentage Error (MAPE) metric. It is obvious from the summary table that the pressure sensor, CO sensor, PM2.5, and PM10 sensor are having reliable reading values. But the temperature sensor and pressure sensor should be replaced or rechecked. These variations might have occurred due to various reasons such as there is always a fluctuation range provided in any type of sensor as indicated in Table 2. Manufacturing variation, Environmental effects over time, the presence of signal-to-noise ratio, improper installation practices while using very thin and sensitive cables, discontinuity in reading the values (temporary malfunction) or non-responsiveness, sporadic events, and some human planned attacks such as malicious attacks, and tampering are some of the potential reasons for getting the error values [40], [41]. Calibration is helpful in removing the structure errors of the sensors. By using the error values which are shown in Figure 6, Figure 7, Figure 8, and Table 3, the characteristic curves could be obtained for correcting the reading values. This curve would be linear in the ideal situation only, most of the time, it will be non-linear. Singlepoint, two-point, and multi-point adjustments are done for nonlinear cases [40].

CONCLUSION
This paper describes an IoT-based environmental and air quality monitoring station that could be a part of a larger weather data acquisition network. This platform could be used to collect and analyze the readings of various parameters in multiple geographical locations and this could help us to get the smaller variations of the environmental and air quality parameters among the various villages and cities. The designed prototype is consisting of 5 sensors and a Wi-Fi connection. We connected BMP280, AHT10, MQ7, PM2.5, and VOC sensors which give us a total of 8 parameters as temperature, humidity, pressure, CO level, altitude, PM2.5, PM10 level, and VOC level.
Also, we expected to design a very smaller and handholdable size equipment with very low cost and successfully made it. If we want to use the market products, we need to use multiple devices and some of them are very larger and need trained technicians for installation. This is the main novelty of our research study.
The Wi-Fi connection is set up using ESP8266 in the Node MCU board. The parameters can be successfully updated using the thing speak platform with an interval of 30 seconds.
The data could be also observed using a portable handheld display unit or the mobile app as well. The display unit is updated every 1 minute using Wi-Fi connectivity. This system paves the way for a crucial step in understanding the creation and execution of IoT applications and serves as a basis for several   Our main contribution to the existing literature is proposing a handheld weather station with air quality measurements which could be helpful in building a larger network. Moreover, most of the previous researchers did not provide the calibration details which might question the reliability of their research work. On the other hand, this system could help the authorities to take necessary actions to control environmental and air pollution which ultimately protects humans from severe life-threatening health injuries. Our calibration results have shown a good indication of the practical working ability of our equipment. Continuous power supply to the equipment is another crucial factor for such kinds of IoT devices.
Since the main goal of this research was to build handheldsize equipment, it is not preferable to allow for carrying bigger size power resources along with the gadget. Hence, we have used a power bank with a rechargeable battery. 24 hours of continuous operation is not possible with our equipment since the equipment should be switched off while recharging the battery. This is one of the limitations of our work. There could be much research carried out to design very efficient and handheld power supplies for such systems. This could be explored in the future. Moreover, somehow the temperature-humidity sensor which is AH10 has produced unreliable results with more than 5 % of MAPE value. This should be checked and rectified. We can test this by using different types of the latest IoT sensor models and should compare the results. It is a real challenge to get guidance from the previous studies since majority of the previous researchers have not produced their calibration and comparison results. Further, we should be sure that there are no noise effects and signal interferences are generated in the environment. On the other hand, other sensors have produced extremely better results.

ACKNOWLEDGMENT
We acknowledge the contribution of the Sri Lanka Meteorological Department in helping us to get the calibration of our equipment. Their support in this work should be highly appreciated.