3.1. Overall Framework
In the design of this system, the overall architecture includes two main components: the edge device and the cloud, as shown in
Figure 2. The edge device collects environmental data through various sensors, and these data are transmitted to the cloud’s MQTT Broker via NB-IoT or 4G networks. Finally, the data are stored in the cloud database using the MQTT protocol for further analysis and processing.
The edge device architecture consists of a microcontroller mainboard, a sensor board, and various sensor modules, forming the core data collection and processing unit of the system. The microcontroller mainboard acts as the central processing unit, interacting with different types of sensors through various interfaces such as I2C, GPIO, and ADC. It also uploads the collected sensor data to the cloud’s MQTT Broker using NB-IoT or 4G communication modules, enabling remote data transmission and monitoring. The sensor board integrates signals from various sensor modules and transmits them to the microcontroller mainboard for centralized processing. The integrated sensor modules include: limit switches for detecting the physical travel state of the device; vibration sensors for monitoring the device’s vibration; medium pressure (which refers to the pressure inside the gas pipeline) and temperature sensors; environmental pressure and temperature sensors for capturing external pressure and temperature data; a CH4 sensor for detecting methane concentration; and a CO sensor for monitoring carbon monoxide concentration in the environment. These sensor modules work together to provide real-time monitoring of the device’s operating status and surrounding environmental parameters, offering crucial data support for the system’s safety and stability.
In the cloud architecture, the cloud platform receives various sensor data from the edge device via protocols and stores the data according to type. Specifically, structured data are stored in an SQL database for easier querying and analysis, while time-series data related to the device are stored in a time-series database to support in-depth, time-based analysis and processing. This dual-database architecture not only enhances the flexibility of data management but also meets the storage and processing needs of different data types, thereby providing robust support for the overall performance and data analysis capabilities of the system.
Through the collaboration between the edge device and the cloud, this system provides real-time monitoring, data transmission, and cloud storage capabilities, effectively detecting the device’s travel status and various environmental parameters while reliably transmitting this data to the cloud for processing and storage. The cloud platform supports querying and analyzing historical data through a persistent storage mechanism, ensuring long-term monitoring and data traceability. Additionally, the system enables remote management and data analysis through the cloud platform, supporting applications in environmental monitoring and device status monitoring, particularly suitable for long-term, remote monitoring and data processing scenarios, with broad applicability and high reliability.
3.2. Hardware Design
3.2.1. Mainboard Design
In the design of the hazardous gas monitoring system, the low-power design of the motherboard, careful hardware selection, and optimization of power management strategies are key to ensuring the long-term stable operation of the system. The product features a robust metal casing and a protective coating on the PCB surface. All internal gaps are filled and sealed with silicone sealant, which not only prevents the minimal moisture in the gas pipelines (which remain dry and virtually moisture-free) from affecting the circuitry but also improves EMC sensitivity. Additionally, by optimizing the layout in the motherboard design, the length and crossing of signal lines have been effectively reduced, further enhancing EMC sensitivity. As shown in
Figure 3, a modular architecture has been adopted, integrating multiple interfaces to meet the requirements of complex embedded applications.
The power supply utilizes a multi-level voltage conversion circuit, complemented by voltage stabilizing diodes and filters. This design not only ensures a stable voltage supply but also enhances electromagnetic compatibility and anti-interference capabilities. This design effectively reduces noise interference, ensuring that the motherboard remains stable under harsh conditions such as high temperature, high humidity, and strong electromagnetic interference. Additionally, by leveraging hardware sleep mode and on-demand power supply technology, the power consumption of the motherboard is further reduced, providing robust support for the system’s long-term, continuous operation.
3.2.2. Communication Module Configuration
In this system, the communication module is closely integrated with the microcontroller, achieving further reduction in system power consumption through optimized interface design and power management strategies. The low-power characteristics of the communication module are evident not only in its microamp-level current consumption in standby mode, but also in its efficient communication protocol, which allows it to quickly enter a low-power state after data transmission is completed, thereby maximizing battery life. The circuit diagram of the module is shown in
Figure 4.
3.2.3. Sensor Module Design
To achieve optimal performance of the sensors, the system incorporates a dedicated sensor module. The schematic diagram of the module is shown in
Figure 5. The sensor board is connected to the motherboard through a 10-pin socket, adopting a modular design that facilitates installation and maintenance. It is equipped with an efficient preheating circuit and signal output circuit to ensure the sensor quickly reaches its operating temperature upon startup and provides stable output signals during measurements.
In the methane sensor design, a pulse heating mode is employed, in which periodic voltage pulses control the heating temperature of the detection element. This design not only significantly reduces power consumption but also improves the sensor’s response speed and extends its lifespan. For the carbon monoxide sensor, a high-precision signal amplification circuit is designed in combination with its output signal range and high-sensitivity characteristics, ensuring the accuracy and stability of the measurement data.
The sensor module also integrates anti-interference and data filtering technologies, such as hardware filtering circuits and software-based moving average algorithms, which effectively suppress environmental noise and short-term signal fluctuations. Through the careful selection and configuration of the methane and carbon monoxide sensors, combined with an optimized sensor board design, the system achieves high-precision gas detection while further reducing power consumption, laying a solid foundation for long-term and stable gas monitoring.
3.3. Data Collection and Processing
3.3.1. Data Collection Process
The data collection process outlined in this article consists of several steps to ensure the completeness and accuracy of the data, as detailed in
Figure 6.
Upon system startup, the device first initializes various functions, including reading and writing parameters stored in Flash memory, which pertain to system configuration and the initial state of the sensors. Then, the system proceeds based on whether the device has been activated. If the device is not activated, it enters a communication window mode, waiting to receive activation commands. Meanwhile, the NB-IoT state machine checks the network connection status and performs reconnection or restart operations as necessary.
Once the device is activated, the system initiates vibration sensor data processing and manhole cover detection procedures to gather necessary environmental data. It smooths the data from the pressure sensor, calculates absolute values, and completes related calculations for energy density and gauge pressure. After processing the data, the device evaluates whether to upload periodic data and high-frequency pressure data based on preset conditions. If these conditions are met, the data are uploaded and resent in the event of a transmission failure to ensure successful data upload.
Furthermore, the device monitors environmental concentrations of methane and carbon monoxide. If the concentrations exceed predefined alarm thresholds, the system immediately uploads the data and switches to a low-energy deep sleep mode to reduce energy consumption and ensure safety. Finally, the device periodically undertakes high-frequency data collection and phased data processing. After completing a set of data collections, the system reinitializes the function buffer to prepare for the next round of data collection. If a sensor reading error occurs during collection, the device implements corresponding error-handling measures to ensure data accuracy and overall stability.
In the aforementioned process, this system employs techniques such as deep sleep, retry mechanisms, and periodic collection and processing to ensure that it operates only when necessary, significantly reducing the system’s power consumption.
3.3.2. Calibration Process
To ensure the measurement accuracy of the methane sensor under different concentration environments, the system is designed with a strict calibration process. This calibration process is divided into three stages, and the specific procedure is shown in
Figure 7.
The intercalibration environment is a sealed chamber that can be filled with methane, in which a high-precision desktop concentration detector provides accurate reference values. The sensor is first placed in a methane-free environment (i.e., 0 ppm concentration) to begin the initial intercalibration stage. This stage lasts for at least 2.5 min. During this stage, the device’s indicator light alternates flashing every 5 s as a visual prompt. The device reads the sensor’s output voltage during the later part of this stage and processes the data, using the result as the reference voltage corresponding to 0 ppm. At the end of this stage, the indicator light turns off to indicate completion. Next, methane is gradually introduced into the intercalibration environment until the concentration reaches 4000 ppm. When a rise in concentration is detected (indicated by an 80 mV increase in voltage compared to the 0 ppm level), the device enters the medium concentration intercalibration stage. During this stage, the indicator light remains steadily on as a prompt. Once the concentration stabilizes, the device reads and processes the sensor’s output voltage over a period of time, using the result as the reference voltage corresponding to 4000 ppm. This stage ends with the indicator light turning off to indicate completion. Methane continues to be added to the intercalibration environment until the concentration reaches 10,000 ppm. When the device detects a further increase in concentration (a 50 mV increase in voltage compared to the 4000 ppm level), it enters the high concentration intercalibration stage. During this stage, the indicator light alternates between on and off every second as a prompt. Once the concentration stabilizes, the device reads and processes the sensor’s output voltage over a period of time, using the result as the reference voltage corresponding to 10,000 ppm. This stage ends with the indicator light turning off to indicate completion.
This multi-point intercalibration method enables the system to accurately calibrate the sensor response curve under different concentration environments, thereby improving measurement accuracy and stability. This specific approach involves recording the sensor’s output voltage at multiple concentration points, which serve as reference values for subsequent measurements. This method not only ensures real-time performance and accuracy of monitoring in low-power mode but also significantly reduces energy consumption, making the system more efficient and competitive than traditional engineering solutions. It is especially suitable for environments requiring long-term, unattended monitoring, where a low-power, high-precision monitoring system is essential.
3.3.3. Concentration Calculation and Alarm Mechanism
The calculation of methane concentration is based on the calibrated voltage values stored in memory (0 ppm, 4000 ppm, and 10,000 ppm), fitting a function relationship that includes five parameters. The system measures the sensor voltage every 30 s to estimate the current methane concentration. Within the first 5 min after startup, the system calculates the average concentration over the past 3 min every minute and accumulates these data. After storing 240 concentration values, the system calculates and stores the maximum value, which is then uploaded as periodic data to the upper-level system.
Regarding the over-limit alarm mechanism, the system stores the latest 84 maximum values in a circular array, using the maximum value as the alarm threshold. When the methane concentration exceeds the threshold by 2000 ppm for five consecutive readings, the system triggers a “methane concentration over-limit alarm” and uploads the information. If the concentration exceeds 10,000 ppm, a higher-level alarm is triggered, and data collection is paused for 4 h. During the alarm period, if the concentration is below the alarm threshold for five consecutive readings, the system triggers an event to indicate the “methane concentration over-limit alarm cleared”.
For the calculation of carbon monoxide concentration, the system uses stored coefficients to implement it through fitting a single-parameter function relationship. The system collects data every 10 s and calculates the current concentration every 10 min, recording the maximum value for that period. Concentration data is uploaded every 4 h. When the carbon monoxide concentration reaches or exceeds 500 ppm, the system triggers an alarm and uploads the relevant information. For every additional 2000 ppm, the system updates the alarm information accordingly. When the concentration drops below 500 ppm, the system triggers an event signaling “carbon monoxide concentration alarm cleared”.
3.3.4. Data Communication Module
In Internet of Things (IoT) applications, efficient data upload and low-power operation of devices are crucial for ensuring the long-term stability and reliability of the system. The NB-IoT (Narrowband Internet of Things) module, designed specifically for low-power wide-area networks (LPWAN), effectively achieves low power consumption and efficient communication through its refined state machine control and intermittent data upload strategy, as illustrated in the state machine diagram in
Figure 8.
The NB-IoT module utilizes a sophisticated state machine process in device operation management, covering the complete sequence from device startup and network connection to entering a normal standby state. The transitions between different states ensure precise control over each operational phase, especially during data uploads. The system employs a strict communication process in low-power conditions to achieve efficient and accurate data transmission.
The design of the communication protocol fully accounts for low power consumption requirements. This paper adopts the MQTT protocol and encodes the payload directly using HEX byte streams to reduce data traffic and communication time overhead. Additionally, a state machine module is used to centrally manage connection and data transmission. The system enters deep sleep mode when communication is not required and wakes only at key communication points, thereby significantly reducing power consumption. Before each communication, the module performs connection tests and parameter configuration checks via AT commands to ensure data is uploaded in the shortest possible time, avoiding prolonged resource occupancy that leads to additional energy consumption.
Figure 8 details the complete process of the state machine, clearly marking each stage from system startup to the completion of data upload.
Additionally, the NB-IoT module employs an intermittent data upload mechanism that not only effectively reduces device power consumption but also ensures the accuracy and timeliness of data transmission. This low-power communication mode lays a solid technical foundation for the long-term stable operation of IoT devices. Experimental results show that this system reduces power consumption by half compared to traditional solutions, while ensuring data transmission efficiency. This significantly extends device battery life, reduces maintenance costs, and contributes significantly to the energy efficiency and environmental sustainability of IoT devices.