1. Introduction
Air pollution is a big, complex problem arising from the presence of particulate matter, noxious substances, and biological compounds in the Earth’s atmosphere. This pollution has far-reaching consequences, impacting various forms of life, from humans and animals to food crops, and it can also have a terrible effect on both natural and built environments [
1]. Fine particulate matter (PM) has widespread harmful effects, ranging from allergies to severe diseases, including cardiovascular and respiratory conditions, strokes, and lung cancer, which can even lead to death. So, a massive global focus has progressively shifted toward the risk of environmental pollution to the well-being of both ecosystems and humans [
2].
Therefore, the motivation for implementing an IoT weather station in the context of climate change-related sustainable development goals arises from the need for accurate and real-time data on weather conditions and pollution levels. Climate change is one of the most profound challenges confronting our world in this era, and its repercussions extend across a wide spectrum, affecting ecosystems, economies, and human beings. Facing climate change and quality of life on earth are included in the Sustainable Development Goals (SDGs) of the United Nations, specifically in numbers 3, 11, 13, and 15 [
3]. We need to monitor air quality everywhere in cities, especially in crowded and industrial zones, so there is a great need for IoT air monitoring stations of low cost to monitor the quality of the air continuously throughout the day.
To effectively address climate change and work toward sustainable development, it is crucial to have access to reliable and comprehensive information on weather patterns and pollution levels. Monitoring weather conditions through an IoT weather station can provide valuable data that can be utilized by policymakers, researchers, and communities to make informed decisions and implement a comprehensive strategy to take appropriate action and mitigate the far-reaching and long-lasting impacts of climate change.
Furthermore, IoT weather stations can also contribute to other sectors, such as transportation, agriculture, energy, and water resources. High-accuracy and real-time data obtained from IoT weather stations can be used to optimize transportation routes and schedules, ensuring efficient and safe movement of goods and people. Additionally, the data can inform agricultural practices, allowing farmers to make informed decisions regarding irrigation, planting, and pest control services, ultimately leading to higher productivity and sustainable agricultural practices.
The deployment of cost-effective wireless sensor networks empowers these systems to accurately measure levels of harmful gases, temperature, and humidity. The systems rely on application software for cloud-based data analytics and microcontrollers to process sensory inputs.
Blockchain technology, when merged with the Internet of Things (IoT), delivers a wide range of advantages that have the potential to transform many industries and services. This powerful combination enhances data security, transparency, and efficiency in ways that did not exist before. By providing a secured ledger concept for IoT devices to record and share data, blockchain ensures the integrity of information, making it a game-changer in fields such as supply chain management, healthcare, and environmental monitoring. Also, the promising synergy between blockchain and IoT holds great potential for revolutionizing various industries and applications by providing data integrity and security, transparency, decentralization, scalability, energy efficiency, and sustainable systems.
In the case of this research, like environmental monitoring, blockchain, when merged with IoT, can contribute to sustainable practices by ensuring data transparency and accuracy and promoting eco-friendly policies, which have many environmental benefits.
To address this significant gap in our environmental awareness, a system has been devised. This system employs sensors for detecting carbon monoxide, carbon dioxide, temperature, and humidity. The Arduino Uno, with the microcontroller ATmega, a low-power and cost-effective processing solution, is the central hub for data collection and processing. It offers an ideal low-cost and low-power consumption platform.
The Internet of Things (IoT) and cloud computing are two of the most transformative technologies in this context. The IoT introduces a paradigm where devices autonomously sense, identify, process, and communicate with each other without human intervention. The IoT cloud system affords a consolidated perspective for accessing IoT resources and their capacities through well-defined Application Programming Interfaces (APIs), which conduct their functions within the cloud infrastructure [
3]. Information stored within the cloud can be accessed, making it easier to analyze and, ultimately, adding to more effective solutions for managing air pollution to a certain extent.
This paper introduces a solution that provides a low power and relatively low cost way to meet the requirements and needs of many IoT stations covering industrial and crowded wide areas.
2. Literature Review
As a result of the air pollution problem and its dangerous impact on people and human beings, there is much research on air quality and how to detect it with many different methods. One institute conducted an experiment near New Delhi, India, in an industrial zone with a diameter of one kilometer. It found that the parts per million (PPM) was more than 10,000, which is very high and unacceptable because a pollution level exceeding 600 PPM is unsafe for humans [
4]. We found many research papers discussing this topic.
A study introduced an architecture designed for low-power wide-area IoT devices. The system uses sensors to detect the presence of harmful gases, transmitting these data seamlessly to a web-based server through a radio frequency (RF) module and common computer. Then, the data stored in the web-based server are analyzed [
5].
Another study developed a solution for air monitoring. They used temperature and humidity as parameters to assess the quality of air and build a wireless sensing and monitoring platform consisting of sensors and a microcontroller. The data are stored on a personal computer (PC) and can be accessed remotely via an Android phone [
6].
In another study, the authors developed a solution for air quality monitoring using carbon monoxide, carbon dioxide, and smoke as the parameters to evaluate the air quality, measured using the MQ7, MQ135, and MQ6 sensors, respectively. To detect the measurements and process these signals from the sensors, a microcontroller was used, and a liquid crystal display (LCD) screen was used to monitor the data. They added an ESP8266 Wi-Fi module to the system to access it remotely [
7].
Other researchers in the same field of air quality monitoring used an Arduino Uno with the MQ7, MQ135, and DHT11 sensors to detect different gases—carbon monoxide, carbon dioxide, and temperature, respectively. Also, they used a GP2Y1010AU0F dust sensor to detect dust and an ESP8266 to connect to the Arduino via a Wi-Fi network to transmit the data to any related server [
8].
In [
9], the authors used the concept of merging IoT and blockchain technologies to collect air quality measurements by using three sensors, MQ2, MQ7, and MQ135, to collect the parameters of smoke, carbon monoxide, and carbon dioxide, respectively. They measured the gases to indicate the air quality and used the concept of blockchain technology to connect to an Arduino Uno.
Different sensors were used to measure the parameters of monoxide, dioxide, temperature, and humidity, respectively. All of these sensors were connected to an Arduino and then connected to a Raspberry Pi, which sends the data to an online platform and then connects to a cloud service. This results in very high power consumption and a relatively higher cost of this solution [
10].
In the paper by [
11], the research is also related to climate monitoring. The paper presents a solution consisting of a Raspberry Pi, which is a mini computer on a single chip. It is connected to a DHT11 temperature and humidity sensor and a laptop, which uses software to simulate a blockchain platform.
The above paper presented a solution that uses carbon monoxide, carbon dioxide, and temperature as the parameters to evaluate the air quality by an IoT-based system for a smart healthcare solution. It can track a patient’s current room conditions in real time by connecting MQ9, MQ135, and DHT11 sensors to an ESP32 processor and then sending the data to a web server to assess the health environment for healthcare purposes.
The system in [
12] measures variables like humidity, altitude, atmospheric pressure, and the concentrations of dangerous chemicals, like NO
2 and CO
2, in the atmosphere.
In another study, the MQ-135, DHT-11, and BMP280 sensors were used to collect data, which were processed by the ESP32 board. A fuzzy inference system (FIS) model used a reasoning technique to perform parameter classification and the message queuing telemetry transport (MQTT) protocol to send the gathered data over the Internet to a website [
13].
Some other trials have measured air pollution by using different techniques, like hyperspectral imaging (HSI) technology, and combined them with deep learning techniques, such as in [
14,
15].
Table 1 presents a summary of the references in the literature review. A generic view of air monitoring systems is illustrated in
Figure 1.
2.1. Motivations
The motivation for implementing an IoT Air quality monitoring station is to provide an accurate solution that can sense some air quality parameters at a low cost and that is easy to install anywhere. Moreover, we provide a simulation of the Ethereum Blockchain platform to support the concept of decentralization and transparency in the context of the Sustainable Development Goals.
2.2. Contribution
The contribution of this research is providing a reliable air quality monitoring station at a low cost and with low power consumption. Moreover, the ease of use and installment is a very important point. Also, the simulation of blockchain technologies highlights the synergies between blockchain and IoT technologies.
3. Methodology
This paper presents an innovative concept of an IoT Air quality monitoring station with a low cost to detect CO (carbon monoxide), CO
2 (carbon dioxide), temperature, and humidity. This system is designed to detect air quality and send it directly to the cloud-based platform ThingSpeak. Also, we conducted a simulation of the blockchain platform using Ganache v2.7.0 software and Truffle v5.11.4 software. A block diagram of the proposed system is shown in
Figure 2.
3.1. Sensors
3.1.1. MQ-135
The MQ135 sensor is a gas detector, capable of detecting a large spectrum of gases, including ammonia, benzene, nitric oxide, smoke, and carbon dioxide. It can be operated in both indoor and outdoor environments. Moreover, MQ135 has good sensitivity to carbon dioxide. It is also cost-effective and has a long operational lifespan [
16]. The sensor is shown in
Figure 3.
3.1.2. MQ-7
The MQ-7 sensor is harnessed to detect carbon monoxide, a primary culprit behind air pollution and the onset of various life-threatening diseases. The MQ-7 is a semiconductor sensor specifically designed for the identification of carbon monoxide (CO). Its sensitive material, SnO
2, exhibits lower conductivity in clean air. The sensor is incredibly user-friendly and thoughtfully engineered for accurately detecting CO levels in the atmosphere. It is capable of sensing CO concentrations ranging from 20 to 2000 ppm and is also cost-effective [
17]. The sensor is shown in
Figure 4.
3.1.3. DHT11
The DHT11 sensor is used to measure temperature and humidity, which are two very important parameters for assessing air quality. This sensor, known for its low cost and very high accuracy, serves as a digital temperature and humidity sensor [
18]. The sensor is shown in
Figure 5.
3.2. Arduino Uno
The Arduino is a microcontroller board that interfaces with a large number of sensors. It is a simple, very flexible board that can be used in different solutions and in many environments. Combined with expandable peripherals, this board is power-efficient and has a relatively very low cost [
19]. The board is shown in
Figure 6.
3.3. ESP Wi-Fi Module
The Esp01S module with ESP8266 Wi-Fi is a compact module that is compatible with the Arduino. It is used to provide wireless internet connectivity to various devices. It is a cost-effective single-chip system-on-a-chip (SoC) solution that integrates both Wi-Fi capabilities and a microcontroller, all of which make it an excellent choice for the Internet of Things (IoT) and embedded systems. It is always preferred because of its small size, low power consumption, and ease of use [
20]. The module is shown in
Figure 7.
3.4. ThingSpeak
ThingSpeak is a web-based open-source platform designed for Internet of Things (IoT) applications [
21]. It enables users to gather, analyze, and visualize data from different types of IoT devices, sensors, and applications in real time. It provides a great, well-organized platform for management and good tools to analyze data generated by the connected devices. It is also equipped with a great user-friendly graphical user interface (GUI).
3.5. Hardware Setup
The Arduino Uno R3 microcontroller board is based on the ATmega328. A replaceable chip was used as the central execution device. Thanks to its open-source platform, community, and ease of use, we could manage multiple sensors in parallel. The Arduino Uno R3 has general-purpose input/output (GPIO) pins, and numerous peripherals can be connected to them. Its low power consumption and cost made it a suitable controller board for this research, as sensors can be easily connected and used with it, along with Internet connectivity via Wi-Fi using ESP01S, which includes the ESP 8266 Wi FI module. The MQ-135 Gas sensor, the MQ-7 Gas sensor, and the DHT11 temperature and humidity sensor were responsible for the data acquisition of carbon dioxide, carbon monoxide, and temperature and humidity, respectively. This is available in the 3-pin version. This setup was used to collect the measurements of the air quality station and send them via Wi-Fi directly to the cloud solution platform ThingSpeak. The experimental setup is shown in
Figure 8 and
Figure 9. The hardware implementation of the air quality monitoring station is illustrated in
Figure 10.
The data collection environment:
The experimental data were obtained before sunset and sunrise close to the location of the university campus in normal room conditions. The room had fresh air flow and a window overlooking a moderately crowded street. It was connected to a 4 g connection with a download speed of 56.6 Mbps and an uploading speed 15.3 Mbps.
4. Results and Discussion
The following figure shows the measurements on the ThingSpeak cloud platform, which were gathered from the IoT station sensors.
Figure 11 shows the ThingSpeak platform dashboard, which contained the flow of measurements of carbon dioxide, carbon monoxide, the location of the IoT station, and the bad air quality alarm. The first row shows the measurements for carbon dioxide, which came from the MQ135, and the gauge of the last reading.
The second row shows the measurements for carbon monoxide, which came from the MQ7, and the gauge of the last reading. The third row shows the bad air quality alarm, which turns red if the measurements exceed the zone safe limit. On the right, the location of the IoT station can be seen.
Table 2 has a sample of the results gathered by the station.
Figure 11 shows six different graphs (a–f) which provide a good overview of the air quality measurements. The historical and current measurements of the MQ-135 sensor data are shown in graphs (a) and (b), respectively, offering important insights into the patterns and variations in air quality. Similarly, graphs (c) and (d) provide the historical and current measurements of the MQ-7 sensor data, which also help explain the variation in air quality.
Graph (e) shows the alarm that is triggered by low air quality, which is an important signal for possible environmental hazards. Lastly, graph (f) presents the location of the air quality monitoring station. The integration of these graphical representations enhances the understanding of the changes in air quality, which helps with the development of well-informed environmental management and public health strategies.
Table 2 and
Table 3 present a comprehensive set of measurements in Mansoura City in a location near the university campus from the MQ135 and MQ7 sensors for the CO
2 and CO levels, respectively, along with the temperature and humidity readings. These data were obtained during important periods of the day, before sunset and sunrise, in autumn. The timing of these measurements is important because it provides information on how the environment and air quality changed throughout the day. The results show that there was relatively better air quality in the period of time before sunrise.
Additionally, a comparative analysis of the sensor performance under different environmental conditions can provide valuable insights for optimizing sensor-based monitoring strategies in future studies.
Table 4 and
Table 5 present a comprehensive set of measurements in Mansoura City in a location near the university campus from the MQ135 and MQ7 sensors for the CO
2 and CO levels, respectively, along with the temperature and humidity readings. These data were obtained during important periods of the day, before sunset and sunrise, in the spring. The timing of these measurements is important because it provides information on how the environment and air quality changed throughout the day. The results show that there was relatively better air quality in the period of time before sunrise.
Table 6 presents a comprehensive set of measurements in Mansoura City in a location near the university campus from the MQ135 and MQ7 sensors for the CO
2 and CO levels, respectively, along with the temperature and humidity readings. These data were obtained during the afternoon time on a hot day.
In case more accuracy is needed or measurements are being take in a region with severe weather, we suggest another scenario implementing an advanced sensor solution, as follows:
A Raspberry Pi, which is a single-board computer, can be used as the controller. Connectivity can be established using integrated Wi-Fi and Bluetooth modules. An NDIR CO2 sensor, with exceptional accuracy and reliability, can be used for measuring the CO2 levels, an electrochemical CO sensor, with enhanced accuracy, can be used for CO measurements, a particulate matter sensor (PM2.5/PM10) can be used to detect fine particulate matter, and high-precision sensor can be used for temperature and humidity.
An advanced cloud platform, such as the ThingSpeak paid plan or Azure IoT, can be used.
An advanced paid blockchain solution with optimized mechanisms for scalability, such as the Ethereum paid plan or IBM blockchain solutions, can be used. This scenario offers more sensitivity and accuracy and can be established if there is a need for better accuracy. Equipped with enhanced capabilities but at a higher cost, blockchain technology is able to identify a wider range of harmful substances with better accuracy in zones with severe weather.
By showing these two scenarios, we aim to show the ability to adjust our air quality monitoring station solution across different regions and applications.
5. Blockchain Platform Simulation
This section explains the simulation of exchanging data between stations using the Ethereum Blockchain platform, which uses “Ganache” software to run Ethereum Blockchain on a local machine. It is necessary to use the plugin “Truffle Suite Framework” [
22] for initiating, compiling, and migrating smart contracts, all within the “Solidity” programming language.
The simulation tools Ganache and the Truffle Suite operated seamlessly on a personal laptop with the following main specifications: Intel Core i5 processor and 8 GB of RAM. This laptop ran on the Windows 10 operating system, with Ganache version 2.7.0. While we will not delve into a detailed code description, we will provide a brief overview of one of its critical components.
The first line in Algorithm 1 indicates the version of the compiler used by Ganache. This smart contract Solidity code uses “DataExchange,” which allows users to update a string of data associated with their Ethereum addresses using the “ExchangeData” function. The data, which are stored in a public mapping project, are accessible to anyone who needs to read the data associated with specific addresses on the Ethereum Blockchain. The data [Message.Sender] can access the mapping project using the sender’s Ethereum address (Message.Sender) as the key.
Algorithm 1: Data Exchange Algorithm |
pragma solidity 0.8.21; Contract DataExchange // Define a public mapping to store data associated with addresses Mapping (Address => String) Data // Function to exchange data Function ExchangeData(String Memory NewData) // Set the data associated with the sender’s address to the new data Data[Message.Sender] = NewData |
Another important part of the code is testing a smart contract that simulates the data exchange between two IoT stations, which is described as follows in the form of a pseudo-code in Algorithm 2:
Algorithm 2: Contract Testing Algorithm |
1. Define the smart contract: DataExchange 2. Contract Test: DataExchange- -
Setup: - -
Deploy the DataExchange contract. - -
Test: IoT Stations Exchange Data - -
IoT Station 1 deploys DataExchange contract. - -
IoT Station 2 deploys DataExchange contract. - -
IoT Station 1 sends data “Data from IoT Station 1” to DataExchange contract. - -
IoT Station 2 sends data “Data from IoT Station 2” to DataExchange contract. - -
Retrieve data from DataExchange contract for IoT Station 1. - -
Retrieve data from DataExchange contract for IoT Station 2. - -
Assert that data for IoT Station 1 matches “Data from IoT Station 1.” - -
Assert that data for IoT Station 2 matches “Data from IoT Station 2.”
|
This pseudo-code outlines the steps involved in testing a smart contract for the data exchange between two IoT stations, including the setup, simulated data exchange, and verification of the stored data.
6. Conclusions and Future Work
This research paper highlights the importance of affordable IoT-based air quality monitoring stations that use cloud platform technology, which has some advantages, including (1) a low cost, (2) real-time monitoring and easy accessibility, and (3) a simple design, which makes its application easy and scalable. The disadvantages to note are a relatively long latency time when using Ethereum Blockchain to transfer data, the lack of air quality prediction, which could help in making early warnings to the public, and trend analysis, for which artificial intelligence (AI) is used to identify long-term trends in air quality data.
This reliable access to real-time air quality data empowers individuals and organizations to address air pollution effectively. The integration of cloud platforms streamlines data management, while blockchain ensures data integrity and security. These technologies provide a strong framework for decision-making, public engagement, and sustainable urban planning to combat air pollution and its consequences. Continuous research, cost reduction, and collaboration are vital for further progress in this area, promising a cleaner, healthier, and more sustainable future.
Our solution can overcome many challenges, as follows: the lack of availability and stability of internet network connections in remote areas; extreme weather with very high or low ranges of temperature, which may affect sensor measurements and necessitate other sensors with a higher cost, like the NDIR CO
2 sensor with exceptional accuracy and reliability for measuring CO
2 levels [
23]; the electrochemical CO sensor has enhanced accuracy for CO measurements [
24]; the particulate matter sensor (PM2.5/PM10) detects fine particulate matter; the high-precision sensor can be used for temperature and humidity; and the scalability issues of blockchain when applied to wide-range areas with multiple nodes.
These solutions can be further developed in future work. It will be a great benefit to add a real blockchain network transmission and to use AI algorithms to predict the pollution percentage according to the measurement trends. We think this technology can be implemented by adopting the predictive analytics concept using AI models that can forecast future air quality levels based on past data, present readings, and outside variables, like the weather. This might make it easier to notify the public in advance. In addition, carrying out trend analysis and adaptive sampling by applying AI to find long-term trends in data on air quality and modifying the sampling rate in response to changes in the reading variability or the identification of pollution spikes can be important for environmental studies and the development of public policy.