Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 14, No. 1, 2025 304 Design of A Coal Mine Gas Pipeline Detection System Fanghua Lian* College of Safety Science and Engineering, Henan Polytechnic University, Jiaozuo, China *Corresponding author Abstract: Safety monitoring of coal mine gas pipelines is crucial for ensuring the safety of mine operations, especially in preventing pipeline leaks. Therefore, timely and accurate monitoring of pipeline status has become crucial. This article designs a pressure and leakage detection system for low-pressure gas pipelines in coal mines. The system is based on single-chip technology and integrates sound wave detection and wireless communication technology. The article elaborates on the design concept of the overall plan, including the main design of hardware circuits and software programs, aiming to achieve real-time monitoring of coal mine gas pipeline pressure and rapid identification of potential leakage points. Keywords: Coal mine gas pipeline, pipeline leakage, acoustic detection, wireless communication, microcontroller. 1. Introduction Coal mine gas pipelines are mainly used to discharge gas generated underground in coal mines[1]. Gas is a flammable and explosive gas. If not discharged in a timely manner, it will accumulate underground in coal mines.[2] Once exposed to sources of fire such as open flames or electric sparks, it may cause gas explosion accidents[3][4][5], seriously threatening the safety of coal miners. Therefore, the role of coal mine gas pipelines is crucial, as it can effectively ensure the safety production of coal mines. Once a gas pipeline in a coal mine leaks, its hazards are multifaceted. Gas leakage can lead to a decrease in oxygen content in the air, and in enclosed or relatively enclosed spaces, people may suffocate or even die due to lack of oxygen. Gas mixed with oxygen in the air can form flammable and explosive gases. If exposed to sources of fire such as open flames, electric sparks, or electrostatic discharge, it can cause violent explosions and fires[6]. After entering the human body, gas will bind with hemoglobin, hindering the delivery of oxygen and causing poisoning symptoms such as dizziness, nausea, vomiting, loss of consciousness, and even death in severe cases[7]. Coal mine gas pipelines can be classified into high pressure[8], sub high pressure, medium pressure, and low pressure pipelines based on their pressure levels, and the commonly used conveying pipelines in coal mines are mostly specific types designed to adapt to complex underground environments[9]. It is crucial to timely and accurately grasp the internal status of pipelines to ensure the safety and efficiency of coal mine gas transportation. Therefore, this article designs a single-chip based acoustic detection system specifically for monitoring low-pressure gas pipelines in coal mines[10][11]. The following will elaborate on the overall design concept of the system, list the hardware circuit components and their functions required for implementing sound wave detection[12][13], provide hardware circuit design diagrams, and explain the main functions of software program programming[14], aiming to achieve real-time monitoring and early warning of the internal status of coal mine gas pipelines through sound wave detection technology. The system uses a microcontroller as the core controller and captures the acoustic signals generated by gas flow or abnormal leakage in the pipeline through high-precision acoustic sensors[15]. These sound wave signals are amplified and filtered by a signal conditioning circuit, and then collected and processed by a microcontroller for analysis. The system can identify and distinguish between normal flow sound waves and abnormal leakage sound waves. Once abnormal sound waves are detected, an alarm mechanism is immediately triggered to notify relevant personnel to take corresponding measures, effectively preventing gas leakage accidents and ensuring the safety and stability of coal mine production[16]. 2. Overall Design The overall purpose of this system is to achieve real-time monitoring and remote transmission of mid sound wave signals in the surrounding environment of gas pipelines. The core of the system consists of acoustic sensors, microcontroller control units, LoRa wireless communication modules, and monitoring terminals. The sound wave sensor is responsible for capturing environmental sound waves and converting them into electrical signals, which are then sent to the microcontroller for preprocessing such as filtering, amplification, and A/D conversion. As a data processing center, the microcontroller not only controls the acquisition process of acoustic signals, but also packages the preprocessed data and sends it to the LoRa wireless communication module through the SPI interface. The LoRa module utilizes spread spectrum modulation technology to efficiently and stably transmit data packets wirelessly to remote monitoring terminals. Monitoring terminals can be smart devices such as PCs and smartphones. They receive data sent by LoRa modules, parse it, and display it to users for real-time monitoring of changes in sound wave signals. The entire system was designed with full consideration for the requirements of low power consumption, long-distance communication, and high anti-interference, ensuring stable and reliable operation in various application scenarios. 305 Figure 1. Overall Architecture Diagram 3. Software and Hardware Design In terms of hardware circuit design, in addition to microcontrollers and acoustic sensors, key components such as power management modules, signal conditioning circuits (including amplifiers and filters), A/D converters (used to convert analog acoustic signals into digital signals for microcontroller processing), and communication interfaces (such as RS-485 or wireless modules) are also required. These components work together to ensure accurate acquisition, transmission, and processing of acoustic signals. In terms of software program design, the main functions implemented include real-time acquisition of sound wave signals, signal preprocessing (such as filtering and denoising), feature extraction (identifying abnormal sound wave features), threshold judgment (setting alarm thresholds), and alarm output and recording. By optimizing algorithms and logic control, the system can achieve continuous monitoring of gas pipeline status, providing strong technical support for coal mine safety production management. 3.1. WM8960 Audio Encoding and Decoding Chip WM8960 is a low-power, high-quality stereo audio frequency codec chip produced by Cirrus Logic (formerly Wolfson)[17]. Its performance parameters are excellent, with both the internally integrated ADC and DAC being 24 bits. The signal-to-noise ratio of the DAC is as high as 98dB, and the signal-to-noise ratio of the ADC is also up to 94dB, ensuring the purity and clarity of the audio signal. It supports multiple sampling rates, including 8K, 11.025K, 12K, 16K, 22.05K, 24K, 32K, 44.1K, and 48K, which can meet the needs of different application scenarios. In addition, the WM8960 is equipped with a D-class speaker amplifier, which can drive a 1W 8 Ω speaker per channel. It also integrates headphone and microphone interfaces, supporting stereo, 3D surround sound output, and other sound effects. This chip is equipped with I2S and I2C interfaces, which are widely compatible with various microcontroller and processor platforms, making it convenient for developers to develop audio projects on different platforms. Figure 2. WM8960 Block Diagram 3.2. STM32 microcontroller The minimal system is the core operating unit based on the STM32 microcontroller[18], which integrates the microcontroller itself, necessary power circuits, clock circuits, reset circuits, and program download interfaces (such as JTAG/SWD). The system has high performance, a wide operating voltage range (usually 1.8V to 3.6V), supports multiple clock source configurations to meet different application requirements, and is equipped with high-speed 306 embedded flash memory and SRAM to ensure efficient program operation and data storage. The STM32 minimal system provides developers with a basic platform for building various embedded applications with its low power consumption, powerful peripheral interfaces (such as USART, I2C, SPI, etc.), and flexible interrupt and timing functions. Figure 3. STM32C8T6 schematic diagram 3.3. SX1276 Wireless Lora Module The Semtech SX1276 chip is a long-distance, low-power transceiver chip based on LoRa technology. It supports a wide frequency range from 137MHz to 1020MHz (some versions such as SX1276IMLTRT support up to 1050MHz), and adopts Semtech's patented LoRa modulation technology to achieve ultra long distance spread spectrum communication and high anti-interference capability[19]. This chip has a maximum data rate of 300kbps and a programmable output power range (-20dBm to+17dBm, some sources recommend using+20dBm for optimal performance, but it should be noted that+20dBm is a higher value for output power, which may need to be adjusted according to specific situations during actual use). Under ideal conditions, the communication distance can reach 5 kilometers. In addition, the SX1276 chip also has a high-sensitivity receiver (-148dBm), supports multiple modulation methods (such as GFSK, FSK, OOK, GMSK, etc.), and provides flexible bandwidth options. Its ultra-low power design, internal voltage regulation scheme, and crystal oscillator reference clock ensure stable performance, making it suitable for various application scenarios such as the Internet of Things (IoT), remote monitoring, intelligent sensing, building automation, wireless alarm and security systems, industrial monitoring and control. Figure 4. SemtechSX1276 3.4. Design and Implementation of Various Software Modules (1) SX1276 Wireless Lora Driver Module. This module is responsible for driving the SX1276 wireless Lora module to achieve long-distance wireless transmission of data. It is responsible for configuring the working parameters of the Lora module, such as frequency, spreading factor, bandwidth, etc., as well as sending and receiving wireless data packets. After powering on the system, first initialize the SX1276 wireless Lora module, including setting parameters such as working mode, frequency, and power. Design functions to build and send wireless data packets. The data packet contains collected voltage data or other important information. Before sending, it is necessary to ensure that the data packet format is correct and complies with the Lora communication protocol. Design interrupt or polling mechanisms for receiving wireless data packets from remote nodes. After receiving the data packet, perform checksum decoding to extract useful information for use by the main program or other modules. (2) WM8960 audio codec driver module. This module is responsible for driving the WM8960 audio codec chip to achieve audio signal acquisition and processing. It is responsible for configuring the working mode of the audio chip, such as sampling rate, gain, etc., as well as reading audio data. After the system is powered on, initialize the WM8960 audio codec chip and set parameters such as sampling rate, audio format, input/output gain, etc. Design functions to initiate the audio acquisition process, read analog audio signals from the WM8960 chip, and convert them into digital audio data. During the collection process, it is necessary to ensure the continuity and real-time performance of the audio data. Process the collected audio data as needed, such as filtering, denoising, etc., to improve audio quality. The processed audio data can be used for subsequent analysis, storage, or transmission. (3) Main program module (combined with STM32 microcontroller). The main program module serves as the central hub of the system, coordinating various hardware modules. After power on, first initialize STM32 and its peripherals (clock, interrupt, GPIO), then initialize 307 SX1276Lora module and WM8960 audio chip (expansion backup). Collect pipeline pressure analog signals and convert them into digital signals by combining pressure sensors and TLC2543 chips that are not explicitly mentioned but have logical existence. The main program processes these signals, calculates the actual pressure values, and displays them through assumed display devices. At the same time, use the SX1276Lora module to send data to remote monitoring. Design a comparison module to monitor pressure in real-time, triggering a warning (red light flashing) when the set peak is exceeded. The main program also includes error handling and exception recovery mechanisms to ensure system stability and reliability. Although this example mainly focuses on voltage and pressure data, the WM8960 audio acquisition function can also be enabled as needed, providing the possibility for system expansion. 4. Four Element Cross Sound Source Localization Algorithm The system uses 4 microphones to form a four element cross array to estimate the position of the sound source. The specific algorithm will be derived in the next section. After the microphone collects the analog sound signal[20], it is sent to the WM8960 audio codec chip for encoding. The encoded digital signal is sent to STM32 for processing, and the sound source position is calculated using a localization algorithm This article adopts the four element cross array sound source localization algorithm. Establish a four element cross array consisting of microphones M1, M2, M3, and M4, with an element spacing of L. Using the center position of the array as the origin O, establish a Cartesian coordinate system as shown in Figure 2. Figure 5. Four element cross array structure diagram Based on the geometric positions of the sound source and microphone array, the following equation system can be formulated: 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 3 2 2 2 2 4 ( ) ( ) ( ) ( ) x y z r x d y z r x y d z r x d y z r x y d z r                         (1) 3 1 13 2 1 12 4 1 14 r r C r r C r r C            (2) sin cos sin cos cos x r x r z r           (3) Among them, r1, r2, r3, and r4 are the distances between the sound source P and the microphones S1, S2, S3, and S4, respectively. Organize the system of equations as follows: 4 2 4 2 3 1 3 1 ( )( ) tan ( )( ) r r r rx y r r r r        (4) Since the system is a far-field model ,so 4 2 3 1 1 r r r r    available, 14 12 13 tan      (5)  22 13 14 12sin 2 C d        (6) By performing algorithm processing, the coordinates, azimuth, and elevation angles of the sound source can be obtained, thereby obtaining the specific location of the target sound source. The four element cross array can improve the accuracy of estimating azimuth, but it may produce certain estimation errors when estimating distance. Therefore, the selection of time delay estimation algorithm is very important. Time delay estimation is the process of first estimating the time difference between the arrival of a sound source at different microphones, and then using the obtained time delay, combined with the structure of the microphone array, to determine the location of the sound source. In the theory and methods of delay estimation based on correlation analysis, improving the accuracy of correlation delay estimation and delay detection capability is always the direction and focus of research. Therefore, when the structure of the microphone array is determined, the accuracy of time delay estimation directly determines the position accuracy and azimuth accuracy of the sound source. This article selects the generalized cross- correlation method (GCC) for time delay estimation. In order to validate the algorithm, a sound source localization testing system was built in the plane and 5 experiments were conducted. The delay between microphones was calculated using the generalized cross- correlation method, and the distance between the sound source and the microphone was calculated using the algorithm based on the obtained delay. The specific experimental data can be clearly seen from Table 1. 308 Table 1. Experimental Data Number of experiments Time Delay Estimation/s Sound source distance/m Actual distance/m Deviation percentage/% 1 0.00078125 0.53 0.54 1.89 2 0.0003631 0.28 0.29 3.5 3 0.00040814 0.37 0.38 2.7 4 0.00055691 0.18 0.19 5.5 5 0.00032813 0.62 0.64 3.2 According to Table 1, the error between the experimentally obtained sound source distance and the actual sound source distance is between 0.01 and 0.02 meters, with a deviation percentage within 5.5%. The error accuracy is small and within an acceptable range, indicating that the algorithm can be stably applied in sound source localization systems. 5. Conclusion This article designs a coal mine gas pipeline acoustic detection system based on STM32 microcontroller, WM8960 audio encoding and decoding chip, and SX1276 wireless Lora module. The system adopts a four element cross array microphone layout to achieve real-time monitoring and remote transmission of gas leakage sound waves. By optimizing hardware configuration and software algorithms, the system has advantages such as low power consumption, long-distance communication, and high anti-interference ability, and can operate stably and reliably. The successful development of this system provides new technological means for the safe production of coal mines and has broad application prospects. References [1] Shi Y, Zheng J, Wang C, et al. A safety management system for natural gas pipeline in subsidence area of coal mine[J]. Energy Sources, Part A: Recovery, Utilization, and Environmental Effects, 2022, 44(3): 5766-5783. [2] Li Y, Zhou P, Zhuang Y, et al. An improved gas leakage model and research on the leakage field strength characteristics of R290 in limited space[J]. Applied Sciences, 2022, 12(11): 5657. [3] Li X, Wang X, Fang Y. Cause-chain analysis of coal-mine gas explosion accident based on Bayesian network model[J]. Cluster Computing, 2019, 22: 1549-1557. [4] Guo H, Li S, Cheng L. Research on the causes of gas explosion accidents based on safety information transmission[J]. International journal of environmental research and public health, 2022, 19(16): 10126. [5] RH H. Explosions that may occur in surgical services, excluding accidents caused by compressed gas[J]. Concours Medical, 1959, 81(3): 247-248. [6] Jänig G R, Ruckpaul K, Jung F, et al. Interaction of haemoglobin with ions binding of inositol hexaphosphate to human haemoglobin A[J]. FEBS letters, 1971, 17(2): 173-176. [7] Rosset P M, iacute n Sosa B M. Cuba: The Campesino-to- Campesino agroecology movement: sustainable peasant agriculture and food sovereignty[J]. [8] Liang X, Liang W, Zhang L, et al. Risk assessment for long- distance gas pipelines in coal mine gobs based on structure entropy weight method and multi-step backward cloud transformation algorithm based on sampling with replacement[J]. Journal of Cleaner Production, 2019, 227: 218- 228. [9] Fodstad M, Midthun K T, Tomasgard A. Adding flexibility in a natural gas transportation network using interruptible transportation services[J]. European Journal of Operational Research, 2015, 243(2): 647-657. [10] Tian X, Jiao W, Liu T. Intelligent leak detection method for low-pressure gas pipeline inside buildings based on pressure fluctuation identification[J]. Journal of Civil Structural Health Monitoring, 2022, 12(5): 1191-1208. [11] da Cruz R P, da Silva F V, Fileti A M F. Machine learning and acoustic method applied to leak detection and location in low- pressure gas pipelines[J]. Clean Technologies and Environmental Policy, 2020, 22: 627-638. [12] Koinov Z, Mendoza R. Speed of Sound of a Spin-Balanced Fermi Gas with s-and d-Wave Pairings Across the BCS–BEC Evolution[J]. Journal of Low Temperature Physics, 2016, 184: 1042-1053. [13] Freeman S, Sohmer H. The influence of sound stimulus parameters on the acoustic reflex waveform[J]. European Archives of Oto-Rhino-Laryngology, 1990, 247: 104-108. [14] Wang Y. Magnetic-Flux-Flow Diagrams for Design and Analysis of Josephson Junction Circuits[J]. IEEE Transactions on Applied Superconductivity, 2023. [15] Młotkowski W. Probability measures corresponding to Aval numbers [C]// Colloquium Mathematicum. Instytut Matematyczny Polskiej Akademii Nauk, 2012, 129: 189-202. [16] Moriyama E, Terada H, Ishikawa S. Spinal Cerebrospinal Fluid Leakage After Motor Vehicle Accident—Two Case Reports— [J]. Neurologia medico-chirurgica, 2009, 49(7): 306-309. [17] Xu X, Tu W, Yang Y. Efficient audio–visual information fusion using encoding pace synchronization for Audio–Visual Speech Separation[J]. Information Fusion, 2025, 115: 102749. [18] Liu L, Wang M, Hussain S, et al. Design of a multi-channel gas sensor detection system based on stm32 microcontroller and labview[J]. Journal of Nanoelectronics and Optoelectronics, 2023, 18(1): 17-24. [19] Azhar Muzafar M I Z, Mohd Ali A, Zulkifli S. A study on LoRa SX1276 performance in IoT health monitoring[J]. Wireless Communications and Mobile Computing, 2022, 2022(1): 6066354. [20] **ng H, Yang X, Ji X, et al. A fusion algorithm of passive sound source localization based on the two-plane four-element cross array[J]. Review of Scientific Instruments, 2020, 91(3).