Abnormal fluctuations in coal mine gas concentration are a significant hidden danger leading to safety accidents, especially during deep mining. Gas concentration is often influenced by complex factors such as mining activities and ventilation conditions, exhibiting nonlinear, time-varying, and uncertain characteristics traditional gas monitoring systems primarily use fixed-parameter PID control algorithms to monitor gas concentration and control ventilation [1]. However, due to the complexity and dynamic nature of the coal mine environment, the performance of fixed-parameter PID algorithms is often limited, making it difficult to adapt quickly to complex conditions. This results in regulation delays and insufficient control precision [7].
In recent years, coal mine gas monitoring technology in China has made significant progress. Traditional single-point monitoring has gradually been replaced by multi-point, distributed monitoring systems, which rely on IoT technology to achieve real-time collection of parameters such as gas concentration, temperature, humidity, and wind speed [2]. However, most existing systems still use traditional PID control algorithms, which struggle to adapt to complex working conditions [8].
Developed countries have been conducting research on coal mine gas monitoring technology earlier, leveraging advanced industrial automation and IoT technology [3]. They have built real-time monitoring systems with multi-sensor integration. For example, countries such as the United States and Germany have achieved efficient monitoring and precise control of gas concentration in mines through a combination of distributed monitoring and intelligent control algorithms. While traditional PID algorithms have been widely applied in IoT systems abroad, there are still challenges related to high sensor energy consumption and inadequate real-time performance and stability of control algorithms under complex conditions [4]. Especially for dynamic multi-variable conditions, existing methods still fail to meet practical demands [5].
In recent years, fuzzy control (Fuzzy Control) technology has emerged as an effective solution for controlling complex dynamic systems, thanks to its adaptability and robustness for nonlinear systems [11]. By introducing fuzzy logic, fuzzy control dynamically adjusts the parameters of the PID controller based on real-time monitoring data and system status, ensuring excellent control performance under varying conditions. Applying the Fuzzy-PID algorithm to coal mine gas monitoring systems can effectively overcome the limitations of traditional control methods, enabling precise gas concentration control and efficient management [17].
This study proposes to research and develop the “Intelligent IoT Monitoring System for Coal Mine Gas Based on the Fuzzy-PID Algorithm,” with the following significant implications:
- 1)
Improved Precision and Robustness in Gas Concentration Control: By introducing the Fuzzy-PID algorithm, the PID controller parameters can be dynamically adjusted, allowing the system to adapt to the nonlinear variations in gas concentration. This enables rapid response and stable control, significantly reducing the risk of abnormal gas concentration fluctuations and enhancing mine safety.
- 2)
Deep Integration of IoT Technology: By combining IoT architecture, a multi-source sensor network will be constructed to achieve real-time collection and intelligent fusion of parameters such as gas concentration, temperature, and humidity. Through the integration of edge computing and cloud computing, the system’s data transmission efficiency and overall intelligence will be improved, creating a highly efficient coal mine gas monitoring platform.
- 3)
Promoting Digital Transformation in the Coal Mining Industry: The research outcomes will not only provide new technical solutions for coal mine safety monitoring but also accelerate the industry’s shift toward digitalization and intelligence. The combination of intelligent monitoring and dynamic control technologies will contribute to achieving the dual goals of safe production and green development in coal mining.
- 4)
Addressing Dynamic Control Challenges in Complex Conditions: This study will design optimized Fuzzy-PID control strategies tailored to complex dynamic conditions. By refining algorithms and conducting experimental validation, the system's stability and reliability under extreme conditions will be enhanced, providing technological support for addressing dynamic changes in the coal mining industry.
This research holds both academic and practical value, offering direct technical support for production while ensuring safe operations in coal mines. It will also enhance the level of intelligence in the industry, contributing significantly to the safe and sustainable development of coal mines.
Based on the complexity of the mine environment and the high requirements for real-time performance and safety in gas monitoring, the overall architecture of the intelligent IoT monitoring system for coal mine gas, as shown in Figure 1, has been designed. The system is divided into four layers: the perception and execution layer, the network transmission layer, the control service layer, and the mobile application layer, ensuring modular functionality and efficient collaboration. The perception and execution layer is responsible for accurately collecting environmental data and executing control commands. The network transmission layer ensures stability and real-time performance in data transmission through multi-protocol communication. The control service layer, with the Fuzzy-PID algorithm as its core, achieves intelligent analysis and dynamic regulation. The mobile application layer provides convenient monitoring and remote control interfaces. The layered design clearly defines functionalities, reduces system complexity, and enhances scalability and maintainability. It also ensures real-time and secure data transmission and processing, thereby meeting the requirements for intelligence and reliability in coal mine gas monitoring systems.

The Overall Architecture Diagram of the Intelligent IoT Monitoring System for Coal Mine Gas
The Perception Layer serves as the foundation of the system, responsible for real-time collection of various physical parameters in the mine environment. These include gas concentrations (CH4, CO2, CO), oxygen concentration (O2), temperature and humidity, pressure, and wind speed. This data is critical for reflecting the real-time status of the mine environment and serves as the core basis for subsequent intelligent control and early warning [6]. The perception layer also performs preliminary processing of sensor data to eliminate interference, improve data quality, and standardize it into a unified data format.
The perception layer is composed of various high-precision sensors. For example, gas sensors utilize electrochemical or infrared detection technology to ensure stability under high-temperature and high-humidity conditions. Oxygen sensors use long-life sensing elements for continuous monitoring, while temperature, humidity, pressure, and wind speed sensors employ fast-response chips to adapt to dynamic changes in the mining environment. All sensors are centrally managed through Data Acquisition Terminals (DAT), which optimize collected data using filtering and calibration algorithms and transmit it via the Modbus protocol.
The perception layer interacts with the network layer through RS485 buses or wireless transmission modules (e.g., WiFi). Sensor data is uploaded to the network layer via the communication interface of the data acquisition terminal, while control commands from the control service layer are received simultaneously. For instance, real-time gas sensor data uploaded to the network transmission layer can trigger the activation or adjustment of ventilation equipment.
The network layer serves as a data transmission bridge between the perception layer and the control service layer, responsible for the efficient transmission of sensor data and the reliable delivery of control commands. By utilizing multiple communication protocols such as 5G, WiFi, and RS485, the network layer ensures real-time uploading of environmental data from the mine and accurate transmission of control strategies generated by the control service layer to execution devices, maintaining the dynamic operation of the system [9].
The network layer supports a multi-protocol, multi-node communication structure. Wired communication (RS485) is used for short-distance transmission, suitable for reliable data delivery between mine sensor nodes. WiFi enables medium-distance data transmission, facilitating mobile device access, while 5G supports high-bandwidth, long-distance data transmission, accommodating the complex topography and large data volumes of the mine. Additionally, the network layer integrates data encryption technologies (e.g., TLS) and firewalls to ensure the security of data transmission.
The network layer interacts with the perception layer and control service layer through standardized protocols such as MQTT and HTTP. The perception layer uploads sensor data to network nodes via RS485 or WiFi, and the network layer transmits the data to the control service layer in JSON format. Simultaneously, the control service layer issues control commands through the network layer, leveraging the low-latency capabilities of the 5G network to meet the real-time control requirements of the mine.
The control service layer is the core of the system, responsible for data analysis, storage, and the generation of control strategies. Utilizing a combination of cloud platforms and local servers, the control service layer runs the Fuzzy-PID algorithm to intelligently regulate gas concentrations and environmental parameters in the mine. Additionally, it stores historical data and performs big data analysis to support forecasting of mine environment trends and the optimization of control strategies.
The control service layer consists of high-performance servers and database systems. Cloud servers execute the Fuzzy-PID algorithm, dynamically adjusting PID parameters through fuzzy logic to achieve precise control of ventilation equipment. The database system combines relational databases (e.g., MySQL) and NoSQL databases (e.g., MongoDB) to store both structured and unstructured data. Furthermore, the control service layer features intelligent early warning capabilities, allowing it to trigger alarms based on real-time data and notify mine management personnel to take action.
The control service layer interacts with the network layer via RESTful APIs, receiving standardized real-time data and returning optimized control instructions. Its interface with the mobile application layer supports real-time monitoring data queries and the pushing of early warning notifications [10]. Through these interfaces, users can access historical data and trend analyses. Additionally, the control service layer includes a command parsing module, which translates control strategies into executable commands for the devices in the perception layer.
The mobile application layer provides users with real-time monitoring, remote control, and anomaly warning functions, serving as the system's front-end interaction interface. Through a user-friendly interface, the mobile application layer allows users to view mine environment data such as gas concentration and temperature/humidity anytime and remotely operate mine ventilation equipment via control interfaces.
The mobile application layer consists of both PC and mobile (Android/iOS) platforms. The PC platform offers advanced data visualization features, including multidimensional trend analysis and comparative charts, while the mobile platform focuses on lightweight design, providing real-time monitoring and quick operation capabilities. Additionally, the mobile application layer integrates push notification services, promptly notifying users of gas concentration anomalies via alerts or SMS and recommending appropriate measures.
The mobile application layer interacts with the control service layer through the HTTPS protocol, retrieving real-time environmental data and alarm information while uploading user-issued remote control commands. Utilizing WebSocket technology, the mobile application layer achieves bidirectional real-time communication with the control service layer, ensuring users receive instant updates on mine environment data and equipment status [12]. Furthermore, the mobile platform features access control through interfaces to restrict user permissions, ensuring the security of the system.
To achieve efficient, precise, and reliable data acquisition and processing in the complex mine environment, the sensor node hardware structure, as shown in Figure 2, has been designed. Through modular design, each functional module (such as sensors, filtering, A/D conversion, processors, communication, and power management) is clearly delineated, ensuring the system's adaptability and scalability. The filtering module eliminates signal noise, the A/D conversion module ensures high-precision signal digitization, the processor handles data integration and analysis, the communication module guarantees reliable long-distance data transmission, and the power management module provides stable power supply support. This architecture not only meets the multi-parameter monitoring requirements of mines but also optimizes system performance through inter-module collaboration, enhancing anti-interference capabilities, adapting to harsh mining environments, and ensuring stable operation and reliable communication of the system.

Functional Block Diagram of the Hardware Composition of IoT Sensor Nodes for Coal Mine Gas Monitoring
The sensor module is the core of the IoT sensor node for coal mine gas monitoring, responsible for collecting key parameters in the mine, such as gas concentrations (e.g., CH4, CO2, CO), oxygen concentration (O2), temperature and humidity, pressure, and wind speed. These sensors convert physical signals into electrical signals, providing reliable environmental data for subsequent modules. For example, the CH4 sensor can use the Figaro TGS2611, which employs non-dispersive infrared (NDIR) technology and can accurately measure methane concentrations in high-humidity and dusty mine environments, with features like low power consumption and long lifespan. For CO2 monitoring, the Senseair S8-0048 is recommended for its high accuracy and suitability for applications with a wide concentration range. For CO detection, the Alphasense CO-B4 sensor, based on electrochemical principles, offers high sensitivity and resistance to interference from other gases. The DHT22 is a suitable choice for temperature and humidity monitoring, featuring fast response and high accuracy, making it ideal for dynamic environments. These sensors output different electrical signals, such as voltage or current signals, based on the environmental parameters they collect, providing input for subsequent signal processing modules.
The analog filtering module is a critical component of signal processing, primarily responsible for removing noise and interference from sensor signals to ensure that the subsequent A/D conversion module receives more stable and accurate signals. Due to the high levels of electromagnetic interference and vibration noise in mining environments, the filtering module requires specialized design. Typically, the analog filtering module employs low-pass filters to suppress high-frequency interference signals. For example, an RC low-pass filter can be used to filter out high-frequency noise with a simple resistor-capacitor combination, or an active filter circuit built with an operational amplifier like the LM741 can enhance signal processing precision. For higher performance requirements, the OPA134 from TI, featuring low noise and a wide bandwidth, is suitable for high-precision sensor filtering needs. Filtered signals have a higher signal-to-noise ratio, providing a reliable data foundation for subsequent A/D conversion. Additionally, the filtering module can customize filtering parameters based on the sensor type, such as adjusting the cutoff frequency to suit the response characteristics of gas or temperature and humidity sensors, further optimizing system performance.
The A/D conversion module converts analog signals from sensors into digital signals for data analysis and processing by the node processor. This module must ensure sufficient resolution and sampling rate to meet the multi-parameter monitoring needs in the complex mine environment. For instance, TI's ADS1115 is recommended—a 16-bit high-precision ADC chip with four-channel input and low power consumption, suitable for the energy-constrained mining environment. The ADS1115 achieves a sampling rate of up to 860 SPS (samples per second), which meets the monitoring requirements for rapidly changing parameters such as gas concentration and temperature/humidity. Additionally, the ADS1115 supports the I2C communication protocol, offering strong compatibility with node processors and ease of integration. For scenarios requiring higher precision, a 24-bit ADC chip such as the AD7190 from Analog Devices can be used, ideal for converting sensor signals that demand higher resolution. The selection of the A/D conversion module should consider factors like the dynamic range of sensor output signals, system real-time requirements, and energy constraints to achieve optimal performance.
The node processor module is the "brain" of the entire sensor node, responsible for integrating, processing, and analyzing sensor data, as well as interacting with upper-layer systems via the communication module. ARM Cortex-M series processors, such as the STM32F103, are recommended for their low power consumption, high performance, and rich peripheral interfaces, making them well-suited for data processing tasks in complex mining environments. The STM32F103 supports various communication protocols (e.g., I2C, SPI, and UART), enabling seamless integration with A/D conversion and communication modules. Additionally, this processor can run simple data correction algorithms, such as linearization or temperature and humidity compensation, to enhance sensor data accuracy. For scenarios requiring higher processing capabilities, the ESP32 processor is a suitable option, as it integrates WiFi and Bluetooth modules, supporting complex network communication and real-time data processing. The node processor also requires a low-power mode design to extend battery life in unmanned mining scenarios.
The RS485 communication module serves as the data transmission channel between sensor nodes and upper-layer systems. It is characterized by strong anti-interference capability and long transmission distances, making it highly suitable for the complex communication environments of mines. For instance, the MAX485 chip is recommended, a low-power, high-reliability RS485 transceiver capable of stable communication over distances up to 1200 meters. RS485 communication modules transmit data using differential signals, effectively resisting electromagnetic interference in mines. Additionally, RS485 modules support multi-node communication, allowing up to 32 devices to connect to a single bus, facilitating large-scale sensor node network deployment. This module is typically connected to the processor via a UART interface, responsible for uploading sensor data to the control service layer and receiving control commands from the upper layer. For example, the MAX485 can efficiently transmit gas concentration data, providing critical support for controlling ventilation fan operations.
The power management module provides stable power supply to all parts of the sensor node, ensuring reliable operation in harsh environments. The AMS1117 voltage regulator chip is recommended to step down the commonly used 12V or 24V DC voltage in mines to 3.3V or 5V to meet the power supply needs of sensors and processors. To handle power outages or interruptions, backup batteries such as lithium battery packs can be included, with a charging management module (e.g., TP4056) for battery charging and management. The power management module should also include a voltage monitoring circuit to warn the processor when the power supply voltage is insufficient, ensuring that critical data is saved, and the system shuts down safely. This design extends the node's battery life, making it particularly valuable in unmanned mining environments.
The microcontroller program design of the sensor node is shown in Figure 3. It adopts a modular design, where multiple independent subprograms collaborate to perform functions such as the collection, processing, storage, and communication of coal mine gas data. After powering on, the program first initializes parameters and then controls the sensors to collect real-time gas concentration data from the environment. The collected data undergoes filtering and noise reduction before being stored to ensure its accuracy and continuity. The entire process is efficient and stable, meeting the stringent real-time requirements of coal mine gas monitoring.

Flowchart of the Microcontroller Software Design for Sensor Nodes
During the data processing phase, the program uses built-in algorithms to generate control instructions, which are executed via I/O or D/A interfaces to precisely control external devices (e.g., alarms). Additionally, the node provides LCD display and keypad functions, enabling on-site operators to view data or adjust operating parameters in real-time. The RS485 communication module ensures reliable data upload and inter-node communication, significantly enhancing the system's overall connectivity and resistance to interference.
The pseudocode for the algorithm implementation of this program is as follows:
int main() { // Step 1: Power on and initialization Power_On(); Initialize_Parameters(); while (1) { // Step 2: Data acquisition float gas_data = Acquire_Data(); if (gas_data == -1) { // Error handling for failed acquisition Log_Abnormal_Condition(gas_data); Trigger_Alarm(); Communicate_Emergency(); Recover_System(); continue; // Restart loop after error handling } // Step 3: Data filtering and storage float filtered_data = Filter_Data(gas_data); Store_Data(filtered_data); // Step 4: Algorithm control int control_signal = Algorithm_Control(filtered_data); Output_Control(control_signal); // Step 5: Key input handling if (Key_Pressed()) { Process_Key_Input(); } // Step 6: RS485 communication if (RS485_Available()) { Send_Data(filtered_data); Receive_Commands(); } // Step 7: LCD display update Update_LCD_Display(filtered_data); // Step 8: Exception detection if (Check_Abnormal(filtered_data)) { Log_Abnormal_Condition(filtered_data); Trigger_Alarm(); Communicate_Emergency(); Recover_System(); continue; // Restart loop after handling abnormal conditions } } return 0; }
The greatest advantage of the program lies in its robustness and safety. With built-in anomaly detection and handling modules, it can promptly identify and respond to abnormal gas concentration situations, triggering alarms or recording fault data. This design not only ensures the reliability and scalability of the coal mine monitoring system but also provides strong technical support for safe coal mine production.
Based on the principles of modularity and layered design, the software functions of the control service layer are divided into the following modules: system user management module, RS485 communication interface module, data recording and storage module, process screen display module, dynamic curve display module, system logic control module, and Fuzzy-PID algorithm control module, as shown in Figure 4. These modules are responsible for core functionalities such as user access management, data transmission, historical record storage, monitoring interface display, data trend analysis, system operation logic processing, and dynamic parameter regulation.

Function Module Diagram of the Control Service Layer in the IoT Monitoring System
Through the collaborative division of labor among these modules, the system can efficiently monitor coal mine gas concentration, perform real-time regulation, and respond to anomalies. The modular design ensures low coupling and high reusability between functional modules, enhancing system flexibility while facilitating future feature expansion and system maintenance.
The system user management module is responsible for creating, managing, and assigning permissions to user accounts. Its main functions include user authentication, account creation and deletion, password management, and permission level control (e.g., administrators, regular users, maintenance personnel). The module uses encryption algorithms such as SHA-256 to securely store user passwords, ensuring data security. By defining user roles, it restricts access to sensitive data and high-privilege operations, enhancing overall system security. Additionally, the module supports logging features to track user operation history, providing data support for audits and troubleshooting. Technical specifications include the maximum number of supported users (e.g., 1,000), the number of permission levels (e.g., 5 levels), and the storage capacity for operation logs (e.g., 10GB).
The RS485 communication interface module facilitates communication between the control service layer and sensor nodes. Its core functions include real-time data transmission, communication status detection, data verification (e.g., CRC checks), and fault recovery mechanisms. The module supports a maximum communication distance of 1,200 meters and a maximum data transfer rate of 10 Mbps, meeting the data transmission requirements of complex coal mine environments. Utilizing a master-slave communication model ensures reliability and stability in data transfer. Additionally, the module supports concurrent connections with up to 32 slave nodes, making it suitable for large-scale sensor deployment scenarios. The module also integrates a communication interruption detection mechanism, enabling quick retries or alerts in case of communication failure.
The data recording and storage module is responsible for real-time data logging and storage. It supports data types such as gas concentration, equipment operating status, and alarm information, using relational databases like MySQL for storage. Its functions include real-time data writing, periodic backups, historical data retrieval, and report generation. The module supports a data recording frequency of 10 times per second, with scalable storage capacity up to terabyte levels. Data compression technology optimizes storage space utilization. Additionally, the module supports data backup and recovery, enabling rapid restoration in case of data loss.
The process screen display module provides a visual interface for dynamically presenting system operation status and monitoring data. Interface elements include gas concentration trend charts, equipment status icons, and alarm notifications. The module supports a resolution of 1920×1080 and a refresh rate of 60 Hz, ensuring clear and smooth visuals. Users can adjust display content through touch operations, with features such as multi-language support and customizable interface layouts. Developed using HTML5 and JavaScript, the module supports remote access and cross-platform display, providing operators with an intuitive monitoring tool.
The dynamic curve display module is primarily used for trend analysis and historical playback of monitoring data. Its functions include real-time curve plotting, historical data playback, curve zooming and panning, and comparative analysis. The module supports up to 10 curves displayed simultaneously with an update frequency of 1 Hz. By employing efficient data caching algorithms, it ensures responsive performance even when processing large datasets. Users can customize display parameters (e.g., time range and data source) through the interactive interface, facilitating personalized analysis. This module is particularly useful for evaluating equipment performance and tracing anomalous data.
The system logic control module handles the core logic processing of system operations, including comprehensive analysis of sensor node data, status monitoring, and the generation of control commands. Its functions include receiving and parsing sensor data, generating action instructions based on control strategies (e.g., starting fans or closing valves), distributing control signals, and coordinating the overall system operating status. The module supports flexible logic configuration, allowing control strategies to be adjusted according to specific needs (e.g., switching between automatic and manual modes). Technical parameters include a response time of less than 10 ms and support for up to 100 logic control rules, ensuring stable and efficient operation of complex systems.
The Fuzzy-PID algorithm control module dynamically regulates critical system parameters. By incorporating fuzzy control algorithms, it achieves precise control in nonlinear and complex environments where traditional PID control falls short [20]. Its functions include fan speed control during gas concentration exceedance and system stability optimization. The module supports online adaptive parameter adjustment, with a sampling frequency of 50 times per second and control precision up to 0.1%. By optimizing the fuzzy rule base, the module can automatically adjust PID parameters based on real-time data, enhancing control effectiveness, especially in dynamic coal mine environments.
Together, these modules form the core framework of the control service layer, each performing its designated role while collaborating to deliver efficient, secure, and precise solutions for coal mine gas monitoring. The system logic control module, in particular, serves as the foundation of efficient system operation by handling data analysis, command generation, and status coordination.
The IoT system’s mobile application layer software design emphasizes real-time performance, convenience, interactivity, and security. Seamlessly integrated with the control service layer, it provides users with functionalities such as gas concentration monitoring, alarm notifications, historical data queries, and remote operations. The mobile application supports multi-platform compatibility, featuring an intuitive and user-friendly interface, and ensures system security through identity authentication, data encryption, and access control. Real-time alarm notifications and intelligent notification mechanisms keep users informed of system status anytime and anywhere, making it an efficient mobile solution for coal mine gas monitoring. The mobile application layer software design shares similarities with the control service layer’s functional modules, which are not reiterated here for brevity.
The design philosophy of this system centers on intelligence, real-time performance, and adaptability. By integrating fuzzy control with traditional PID control, it overcomes the nonlinear and dynamic characteristics of complex coal mine environments, achieving precise gas concentration regulation. The core controller collects sensor data in real-time, dynamically adjusts PID parameters through fuzzy reasoning, optimizes control accuracy and response speed, and seamlessly integrates with the IoT system. It supports data analysis, alarm linkage, and remote monitoring, ensuring the safety and efficiency of coal mine operations.
Traditional PID control (Proportional-Integral-Derivative Control) is a classical automatic control algorithm widely used in industrial control systems. Its fundamental principle involves the coordinated action of three components: proportional (P), integral (I), and derivative (D) [17]. By analyzing the error between the control target and the actual output, it dynamically adjusts the control variable to gradually bring the system output closer to the desired value, achieving precise automatic control.
In coal mine gas IoT systems, variable frequency drives (VFDs) controlling ventilation fans often employ continuous control methods. The output current signal typically ranges from 4 to 20mA, and the general process of traditional PID control is illustrated in Figure 5.

Traditional PID Control Process for Ventilation Variable Frequency Drives in Coal Mine Gas IoT
The control principle is shown in equation (1).
Where Kp is the proportional coefficient; TI is the integral time constant; TD is the derivative time constant; e(t) is the error; and u(t) is the control variable.
After discretization, the discrete algorithm for positional PID is obtained, as shown in equation (2).
The output u(k)u(k) of the PID controller is related to all past error signals, requiring the system to accumulate e(i), which leads to significant computational workload. Additionally, delays in external signal acquisition or interference faults may cause u(k) to oscillate significantly. Such scenarios often result in unsatisfactory control performance and, in some cases, can lead to serious accidents. Furthermore, the output u(k) of the controller corresponds to the actual position of the actuator; when the system experiences significant delays in signal acquisition, large changes in u(k) can cause drastic position changes in the actuator.
In practical control systems, an incremental PID algorithm can be used to mitigate these issues. Based on the previous formulas, it calculates the difference between two consecutive time points. The formula is shown as equation (3):
Where e(k) is the error value at the k-th sampling; e(k-1)e(k-1) is the error value at the (k-1)-th sampling; u(k) is the output of the regulator at the k-th sampling; Kp is the proportional coefficient; KI is the integral coefficient; and KD is the derivative coefficient. These coefficients can be expressed using the following formulas, as shown in equation (4):
Based on the algorithm's structure, it is evident that the incremental PID algorithm has the following advantages over the positional PID algorithm:
The incremental algorithm only depends on e(k)e(k), e(k–1)e(k-1), and e(k–2)e(k-2), eliminating the need for accumulation. This characteristic prevents integral saturation, enabling better control performance.
In positional control algorithms, transitioning from manual to automatic mode requires ensuring the computer's output matches the valve's original opening position to guarantee a disturbance-free switch, which complicates program design. In contrast, the incremental design only depends on the current error value and is independent of the valve's previous position, making it easier to achieve seamless manual-to-automatic transitions.
In the incremental algorithm, the computer only outputs the incremental value, minimizing the impact of faulty operations. Additionally, logical protection mechanisms can be implemented as needed to limit or block outputs during faults.
This flowchart illustrates the working principle of traditional PID control in coal mine gas IoT ventilation systems. The system calculates the error e(t)=x(t)–y(t) between the target value and the actual output. It then processes this error through proportional, integral, and derivative operations to generate a control signal u(t).
The control signal is input into the ventilation variable frequency drive (VFD), which adjusts the operating frequency of the fan, thereby changing the ventilation volume v(t) to regulate the state of the controlled object (e.g., gas concentration). Through closed-loop feedback control, the system continuously adjusts fan operations, ultimately making the actual output y(t) approach the target value x(t). This ensures precise and efficient gas concentration control while optimizing energy usage.
In practical applications of coal mine gas intelligent IoT monitoring systems, traditional PID algorithms face several challenges, including poor adaptability to nonlinear and dynamic environments, fixed parameters that struggle to accommodate environmental changes, sensitivity to noise and interference, and insufficient capability to handle multivariable coupling.
Moreover, in the complex coal mine environment, gas concentration often fluctuates drastically and is influenced by multiple factors. Traditional PID control struggles to achieve precise regulation and may experience response delays on devices with limited computational power. These shortcomings limit its control effectiveness in complex coal mine scenarios, necessitating optimization and improvement through the integration of fuzzy control or intelligent algorithms.
The Fuzzy Algorithm (Fuzzy Control Algorithm) is an intelligent control method based on fuzzy logic, widely applied in control scenarios involving nonlinear, uncertain, and complex systems. Its core concept is to use "fuzzy sets" and "fuzzy rules" to address problems that traditional control methods struggle to solve. By fuzzifying the system's input variables, applying a set of fuzzy rules for reasoning, and then defuzzifying the reasoning results into outputs, the algorithm achieves system control.
In coal mine gas intelligent IoT monitoring systems, the fuzzy algorithm can be utilized. Its core component is the Fuzzy Controller, and the basic control principle diagram is shown in Figure 6.

Fuzzy Control System Block Diagram
Based on the fuzzy control system framework shown in Figure 7, the working principle of fuzzy control can be described as follows:
The core of fuzzy control lies in error feedback. It begins by calculating the error e(t) and its rate of change Δe(t) between the set value SV(t) and the actual output PV(t), which reflects the system's deviation. These input parameters undergo fuzzification, converting them into linguistic variables (e.g., "positive large,""negative small") and describing their degree of fuzziness using membership functions. This step effectively handles nonlinear systems and uncertain environments.
During the fuzzy reasoning phase, the fuzzy controller applies a predefined fuzzy rule base (e.g., "If the error is large and the rate of change is small, then the control output should be small adjustments"). Combining the fuzzified inputs, it uses logical reasoning to generate fuzzy outputs. These rules, often derived from expert experience or system analysis, adapt flexibly to the dynamic changes of complex systems. The fuzzy reasoning output is a set of fuzzy values representing the membership degree of the control variable under different linguistic variables.
Finally, the fuzzy controller employs a defuzzification method to convert the fuzzy outputs into specific control signals MV(t), which are used to adjust the controlled object. After applying the control signal to the system, the closed-loop feedback continuously optimizes the control effect, gradually aligning the system output PV(t) with the desired value SV(t).
Fuzzy control does not require precise mathematical models and demonstrates excellent adaptability and robustness in environments with nonlinearity, multivariable coupling, and significant uncertainties, making it an effective complement to traditional control methods.
The Fuzzy Controller adopts a dual-input single-output control method, using temperature error e and error rate of change ec as input variables and UF as the output variable.
The fuzzy subsets are E=EC=UF={NB,NM,NS,ZE,PS,PM,PB}={NegativeBig,NegativeMedium,NegativeSmall,Zero,PositiveSmall,PositiveMedium,PositiveBig}. The domains are defined as e=ec=UF= {-3,-2,-1,0,1,2,3}, or written as e:[-Xe,Xe], ec:[-Xec,Xec], uF:[-UF,UF].
The membership functions use triangular distribution functions. Based on practical experience, a set of reasoning rules is summarized and expressed in the form of if—then statements, resulting in a Fuzzy control rule table for the control variable UF, as shown in Table 1 [13].
- (1)
if E is NB and EC is NB then UF is PB
- (2)
if E is NB and EC is NM then UF is PB
……
- (49)
if E is PB and EC is PB then UF is NB
F
| UF | E | |||||||
|---|---|---|---|---|---|---|---|---|
| NB | NM | NS | ZE | PS | PM | PB | ||
| EC | NB | PB | PB | PM | PM | PS | ZE | ZE |
| NM | PB | PB | PM | PS | PS | ZE | NS | |
| NS | PM | PM | PM | PS | ZE | NS | NS | |
| ZE | PM | PM | PS | ZE | NS | NM | NM | |
| PS | PS | PS | ZE | NS | NS | NM | NM | |
| PM | PS | ZE | NS | NM | NM | NM | NB | |
| PB | ZE | ZE | NM | NM | NM | NB | NB | |
Based on the fuzzy rules, the fuzzy relationship is summarized. By applying Mamdani's fuzzy reasoning and composition operations, the membership degree μUF (E,EC) for the elements in the UF domain is obtained.
The defuzzification process uses the weighted average method to calculate the precise control value UF from the fuzzy controller. This control value adjusts the output voltage of the power regulator and regulates the temperature, effectively suppressing disturbances and enhancing the system's response speed and stability [14].
The design of a fuzzy controller can be carried out in the following steps [15]:
- Step 1:
Clearly define the input variables (Input Variable) and output variables (Output Variable) of the fuzzy controller (Fuzzy Controller).
- Step 2:
Design the control rule table (Control Rule Table) of the fuzzy controller based on the characteristics of the system.
- Step 3:
Determine the method for fuzzification and defuzzification (also called clarification) according to the fuzzy rule table (Rule Table).
- Step 4:
Select the domains of the input variables (Input Variable) and output variables (Output Variable) for the fuzzy controller, and determine parameters such as quantization factors and scaling factors for the Fuzzy Controller.
- Step 5:
Choose an appropriate sampling time (Sample Time) for the fuzzy control algorithm based on the system's application requirements, and obtain the discretized input data.
- Step 6:
Use the input data to run the fuzzy control algorithm module and obtain the output control data.
Theoretically, the more variables selected for the fuzzy controller, the higher the control precision of the system. However, when the number of variables is too large or the trends in input-output errors are unclear, the fuzzy control rules become overly complex, making control algorithms based on fuzzy reasoning and composition more challenging [16].
Furthermore, fuzzy control is a multivariable nonlinear disturbance control method. It inherently has uncertain static errors and may exhibit poor convergence, making stable control difficult to achieve.
In coal mine gas intelligent IoT monitoring systems, traditional PID algorithms are widely used due to their simplicity and ease of implementation. However, they show insufficient adaptability when dealing with nonlinear, multivariable coupling, and dynamic changes in complex coal mine environments. Fuzzy algorithms excel at handling uncertainty and nonlinearity but require high system response speeds.
Combining the two into a Fuzzy-PID algorithm leverages their respective strengths: The Fuzzy algorithm dynamically adjusts PID parameters, enabling the system to optimize control performance under different operating conditions, while the PID algorithm provides high-precision execution control, ensuring rapid and stable system responses [17].
The Fuzzy-PID algorithm not only enhances the intelligence level of control but also improves the system's adaptability and robustness. Especially in complex gas environments, it effectively reduces overshoot and oscillation issues, delivering a more efficient and precise control solution for coal mine safety.
This system adopts a combination of Fuzzy control and PID control, retaining the advantages of PID control while incorporating the features of Fuzzy control [18]. The structural block diagram is shown in Figure 7.

Coal Mine Gas Intelligent IoT Fuzzy-PID Control Schematic
When the system error e(t,k) is large, the focus is on Fuzzy control to improve system responsiveness. Conversely, when the system error e(t,k)is small, the emphasis shifts to PID regulation.
The working process can be described as follows:
- 1)
Error Calculation
The system receives the input signal PV(t) (CH4 or O2 content) and the setpoint SV(t) It calculates the error e(t)=AVER(PV(t)–SV(t)) and the rate of change of the error de/dtto obtain the core control parameters that reflect the system's state. These parameters serve as the input for the subsequent fuzzy control and traditional PID control.
- 2)
Parallel Operation of Fuzzy Control and Traditional PID Control
- Fuzzy Control:
The fuzzy controller receives the error e(t) and the rate of change of the error de/dtas inputs. Based on the fuzzy rule base, it performs reasoning and generates the fuzzy control output MV(f). Fuzzy control is primarily responsible for dynamic adjustment and precise control under nonlinear operating conditions [19].
- Traditional PID Control:
The PID controller receives the error ΔE(t) as input and generates the traditional PID control signal MV(pid) based on proportional, integral, and derivative algorithms. PID control focuses on stable control and rapid response under linear operating conditions.
The fuzzy control output MV(f) and the traditional PID output MV(pid) are sent to the weight control selection function f(t,r), which is calculated at time t as shown in Equation (5). This function dynamically adjusts the weight ratio between fuzzy control and PID control based on the system's real-time operating conditions (e.g., degree of environmental change, error magnitude, etc.) [20]. By merging the control signals from both methods, the final integrated control output MV(Out) is generated.
5
Where r is the weight coefficient. Based on this formula, it can be seen that r is actually a coordination factor that varies over time. The system can dynamically adjust the value of the coordination factor rr according to the real-time control deviation. This allows for the weighting of PID control and fuzzy control to be modified, fully leveraging the advantages of both fuzzy control and PID control while avoiding their respective shortcomings.
- Fuzzy Control:
- 3)
Control Execution and Feedback
The integrated control signal MVis sent to the coal mine ventilation variable frequency drive (VFD) control unit, which adjusts the fan speed and ventilation volume, thereby controlling the CH4 or O2 concentration. Meanwhile, the system continuously monitors the actual output PV(t) via closed-loop feedback, compares it with the setpoint SV(t), and enters the next control cycle.
The core algorithm pseudocode is as follows:
int main() { // Parameters double PV, SV, error, prev_error = 0, error_rate; double MV_fuzzy, MV_pid, MV; double kp = 1.0, ki = 0.5, kd = 0.1; // PID parameters double fuzzy_weight = 0.7, pid_weight = 0.3; while (1) { // Step 1: Read inputs PV = get_sensor_input(); SV = get_setpoint(); // Step 2: Calculate error and error rate error = SV - PV; error_rate = error - prev_error; // Step 3: Compute outputs MV_fuzzy = fuzzy_control(error, error_rate); MV_pid = pid_control(error, kp, ki, kd); // Step 4: Combine outputs with dynamic weights double state = fabs(error); // Example state calculation double weight = calculate_weight(state, fuzzy_weight, pid_weight); MV = weight * MV_fuzzy + (1 - weight) * MV_pid; // Step 5: Output control signal set_actuator_output(MV); // Step 6: Update error prev_error = error; // Delay for the next control cycle delay(100); } return 0; }
To evaluate the performance of the PID, Fuzzy, and Fuzzy-PID algorithms for oxygen (O2) monitoring in coal mine environments, a comprehensive two-stage experimental setup was designed to simulate realistic working conditions. The first stage involved a controlled laboratory simulation, where a sealed test chamber was constructed to replicate underground coal mine conditions. The chamber was equipped with industrial-grade O2 sensors, a ventilation system, and a microcontroller-based real-time control platform to implement the three algorithms. A variable frequency drive (VFD) was integrated to adjust airflow dynamically, simulating oxygen concentration fluctuations caused by operational variations. The system was programmed to generate multiple test scenarios, including sudden O2 drops (e.g., 15%) due to ventilation system failures and gradual concentration changes due to environmental instability. Performance metrics such as response time, steady-state error, and control stability were recorded to assess the adaptability of each algorithm under dynamic conditions.
In the second stage, the system was deployed in an active coal mining site to evaluate its effectiveness in real-world applications. Ten O2 sensors were strategically installed in key ventilation zones to collect real-time data, which was transmitted via the IoT-based monitoring system to the control center. The industrial validation test was conducted over a 30-day period, during which the system automatically adjusted ventilation in response to varying O2 levels. The experimental data originated from two main sources: first, calibrated industrial sensors
continuously recorded O2 concentrations to ensure high-resolution performance evaluation; second, historical datasets from coal mine safety organizations were integrated to create real-world disturbance scenarios, including rapid O2 depletion events, long-term atmospheric trends, and sensor noise interference. The collected data was analyzed to compare the efficiency, reliability, and adaptability of the three algorithms, confirming the superiority of the Fuzzy-PID approach in ensuring stable and precise O2 regulation within coal mine environments.
The experiment aims to compare the three algorithms in terms of response time, stability, and ability to handle disturbances. PID is expected to show fast initial response but with oscillations, Fuzzy should perform better in non-linear scenarios with smoother results, and Fuzzy-PID is anticipated to combine the advantages of both, delivering optimal performance. By systematically analyzing their effectiveness, the experiment will validate which algorithm is best suited for intelligent O2 monitoring in coal mine safety systems. The experimental control effect curve of the traditional PID algorithm is shown in Figure 8.

Experimental Control Effect Curve of the Traditional PID
The PID control algorithm demonstrates a fast initial response, reaching approximately 80% of the setpoint within 2 seconds, as seen from its curve. However, its oscillatory behavior around the setpoint, with variations of about ±0.1 concentration units, indicates a lack of stability in dynamic environments. This sensitivity to system disturbances or noise highlights its limitation in handling the complex, nonlinear nature of coal mine environments, where robust and adaptive control is required. The experimental control effect curve of the Fuzzy algorithm is shown in Figure 9.

Experimental Control Effect Curve of the Fuzzy Algorithm
The Fuzzy control algorithm provides a smooth and stable response, with no significant oscillations after reaching the setpoint. It stabilizes within 4 seconds, slower than PID, but exhibits less than ±0.05 concentration unit deviation, demonstrating its robustness. However, the slower convergence rate suggests that Fuzzy control alone may not be suitable for scenarios requiring rapid corrective actions, such as sudden O2 level drops in coal mines. The experimental control effect curve of the Fuzzy-PID algorithm is shown in Figure 10.

Experimental Control Effect Curve of the Fuzzy-PID Algorithm
The Fuzzy-PID algorithm exhibits a fast response, reaching 90% of the setpoint within approximately 2.5 seconds, demonstrating its efficiency in quickly adjusting to the desired oxygen level. Additionally, it stabilizes near the setpoint with minimal deviation of less than ±0.03 concentration units, ensuring precise and steady control. This combination of rapid response and stability makes the Fuzzy-PID algorithm particularly suitable for dynamic and complex environments like coal mine O2 monitoring, where both timely adjustments and robust performance are critical for maintaining safety and operational efficiency. The comparative experimental control effect curve of the three algorithms is shown in Figure 11.

Comparative Experimental Control Effect Curve of the Three Algorithms.
The Fuzzy-PID algorithm addresses the shortcomings of both by combining the fast response of PID with the stability of Fuzzy control. It reaches 90% of the setpoint within 2.5 seconds and stabilizes with deviations of less than ±0.03 concentration units, outperforming both individual algorithms. This balance between speed and precision is essential in coal mine O2 monitoring, where timely and stable adjustments are critical to ensure safety and efficiency in dynamic and uncertain conditions.
The author used the theoretical framework of the coal mine gas intelligent IoT monitoring system based on the Fuzzy-PID algorithm proposed in this paper, which has been successfully developed and tested in a gas concentration monitoring and early warning project at a coal mine enterprise. The gas monitoring main screen of the system is shown in Figure 12. The system can monitor changes in gas concentration in real-time and can interlock and control multiple ventilation system variable frequency drives to dynamically adjust the gas concentration.

The Main Screen of the Intelligent IoT Monitoring System for Coal Mine Gas Using the Fuzzy-PID Algorithm.
The IoT control service software of the system was developed using the object-oriented integrated development tool Embarcadero RAD Studio XE, and the database system uses the lightweight and efficient SQLite. The mobile terminal part was developed using Android Studio to create the coal mine gas monitoring app. Considering the special needs for coal mine production safety, the mobile terminal only provides real-time browsing of operational parameters and data such as gas concentration, air volume, and air pressure, with no remote control operations allowed.
Since the system began its trial operation for more than half a year, it has shown significant advantages compared to traditional manual gas monitoring methods: it is more convenient to operate and has a higher degree of intelligence; the equipment operation alerts are accurate and the response is timely. This system provides strong technical support for intelligent gas concentration monitoring and safe production in coal mines, effectively reducing the risk of safety accidents and improving the level of automated management in coal mine operations.
The coal mine gas intelligent IoT monitoring system based on the Fuzzy-PID algorithm is an important component of smart mine construction. This system can collect and monitor various environmental parameters such as gas concentration, temperature, humidity, pressure, and air volume in real-time underground. Through IoT technology, it enables efficient data transmission and processing, ultimately achieving remote real-time control and early warning functions. By dynamically adjusting the operating status of the ventilation system (e.g., variable frequency drive fan control), the system can accurately control the underground gas concentration within a safe range, significantly improving the safety and intelligence of coal mine production.
In addition, the system uses the Fuzzy-PID algorithm, which can adaptively adjust control parameters based on changes in environmental conditions, improving control accuracy and response speed while reducing the need for manual intervention. At the same time, the IoT platform enables cross-regional collaborative monitoring and management of the coal mine, closely integrating gas monitoring with other mine operations such as ventilation, drainage, and more, further optimizing the overall efficiency and management level of the coal mine production process.
In summary, the coal mine gas intelligent IoT monitoring system based on the Fuzzy-PID algorithm has significant advantages in reducing underground operation risks, enhancing production safety, reducing labor intensity, and improving equipment reliability. It provides strong technical support for the intelligent production and safety management of coal mines.