Monitoring the spontaneous combustion of coal stack based on ZigBee and LabView

The spontaneous combustion of coal piles is a great threat to all coal storage sites. In order to avoid the occurrence of spontaneous combustion of coal piles and reduce economic losses and casualties, a set of system is designed to monitor the internal temperature of coal piles and predict the temperature value and combustible gas concentration. The system has the advantages of monitoring and warning, short-term prediction and low power consumption.


Introduction
According to the statistics of "Basic Law and Development Trend of Geological Disasters in China" in 2006, in recent decades, there have been more than 10,000 spontaneous fires in nearly 300 coal mines with spontaneous combustion risk in China, with an average of 15 fires per million tons. Fifty-six fire areas are still burning, with a total burning area of 720 km 2 . More than 2 million tons of coal are directly lost every year, and the direct economic loss is more than 20 billion yuan [1]. Because of the high harmfulness of coal spontaneous combustion, scholars at home and abroad have paid great attention to it, and they have also made unremitting efforts to find solutions.
At present, the prediction methods of coal spontaneous combustion mainly include temperature measurement, gas analysis, magnetic prospecting, resistivity and radon measurement. Each method has its own application occasions. For example, the monitoring point of gas analysis is usually in the pre-buried pipeline of coal plant. This method can monitor whether coal spontaneous combustion occurs, but it is affected by the gas flow in the pipeline. It is impossible to determine the specific location of the fire source; resistivity method and magnetic method are suitable for detecting the high temperature and closed fire area; radon measurement method is to use radioactive elements released from the top of the fire without burning process, and these elements have a long half-life, radon elements will be produced in the decay process. Measuring the variation of radon concentration to determine the degree of coal spontaneous combustion development and the range of fire sources, but there are many reasons for the abnormal occurrence of radon. The specific distribution law of radon in rocks is not very clear at present. The technology is still in the research stage, and has less application in coal mines at home and abroad [2].
Temperature measurement method is one of the most effective methods to measure coal seam temperature by directly collecting coal seam temperature. The existing coal field monitoring system uses sensors to collect environmental parameters and then send the data parameters to the upper computer on the ground by wired transmission. Because of its complicated wiring and strong line dependence, it can not meet the requirements of coal mine safety production very well [3]. Therefore, wireless sensor technology has been widely used in practical applications. Compared with other A temperature sensor is inserted from the outside of the coal heap. The sensor has a wireless transmitting module, which transmits the data to the wireless module of the receiving end in real time. The received data is sent to the upper computer through the serial port. The upper computer communicates through the LabView program design, using VISA serial port to complete the display and alarm function, and uses the MATLAB foot. The function of this document is to complete the display and to predict the spontaneous combustion temperature and smoke concentration of coal in a short term.
As for the distributed wireless temperature measuring device developed in this paper, it can be divided into two parts, namely software and hardware.The hardware part is to design the temperature sensor node of the lower computer. Through the design of high precision temperature acquisition circuit, the accuracy of real-time temperature can be guaranteed.In terms of software, it involves the upper and lower computer data wireless transmission program. In the device, many temperature acquisition terminal devices arranged in the monitoring point position, namely the hardware part, are mainly used to collect the temperature information of the point to be measured, and use wireless mode to send such information to the coordination terminal node.The existence of coordinator node is to receive such temperature data, print such data to serial port and send it to PC.With the application of ZigBee wireless transmission technology, the temperature information can be transmitted to the coordinator node from collection. The coordinator node then sends the received temperature information to the host computer by combining RS-232 serial port.The system written by LabView can display the multi-point temperature information in real time and then transmit it to users. Moreover, this kind of system also has the following functions, such as alarming, saving data and so on.

Temperature measuring terminal design
Before explaining the terminal sensor, it is necessary to understand the spontaneous combustion mechanism of coal heap [4]: Figure 2 is the profile of the coal pile. We can see that the coal pile mainly forms three hierarchical structures: (1) Cooling layer: that is, the surface layer, thickness of 0.5 to 1.5 meters, coal particles are relatively loose, can fully contact the air, although there will be oxidation reaction, but with good heat dissipation conditions, so spontaneous combustion will not occur; (2) Oxide layer: below the surface, the thickness is about 1 to 4 meters, with all the conditions of spontaneous combustion, once the ignition period is reached, spontaneous combustion will occur.
(3) Asphyxiated layer: under the oxide layer, the inner layer is compact, there is not enough oxygen supply, and has a high moisture content, making the degree of oxidation is relatively low, the probability of spontaneous combustion is low. Therefore, according to the analysis, the most prone to spontaneous combustion is the oxide layer.
According to the mechanism of spontaneous combustion of coal heap, the sensor terminal is designed as a rod temperature sensor shown in Figure 3, which is convenient for deep insertion into the oxide layer to obtain the effective data needed for the experiment.
The sensor in the figure is in the head position, which can ensure accurate contact with the oxide layer data. After receiving the data, the sensor passes through the circuit conversion module, and then transmits the data through the data transmission line to the rear ZigBee module for transmission.
In the aspect of temperature acquisition, the temperature acquisition node of the temperature measuring rod is used as the terminal device, which involves wireless module, temperature sensor, microprocessor and so on. It can also complete the wireless transmission operation while collecting data.
The overall layout of the system is shown in Figure 4 Figure 4. Overall system layout. Through the cooperation of coordinator and terminal temperature acquisition node, the system enables wireless communication of information, including microcontroller chip, wireless receiving module and so on. The coordinator manages all terminal temperature acquisition nodes and receives the collected data wirelessly. Finally, the data is transmitted to PC monitoring platform through serial port [5].

MQ_2 smoke sensor
MQ-2 smoke sensor belongs to tin dioxide semiconductor gas sensing material and surface ionic Ntype semiconductor. At 200-300 degrees Celsius, tin dioxide adsorbs oxygen in the air and forms negative ion adsorption of oxygen, which reduces the electron density in semiconductors and increases their resistance value. When contacting with smoke, if the barrier at the grain boundary is adjusted by smoke, the surface conductivity will change. This information can be used to obtain the existence of the smoke. The higher the smoke concentration, the higher the conductivity and the lower the output resistance, the larger the output analog signal [6].
The measuring circuit is shown in Figure 5. The AOUT pin of port J4 is connected to the P07 pin of CC2530 chip.

Design of PT100 temperature measurement module
Pt100 temperature sensor belongs to positive temperature coefficient thermistor. It has high accuracy, good stability, and can withstand high voltage. The platinum thermal resistor has good linearity. If it varies from 0 to 100 C, the maximum non-linear deviation is not more than 0.5 C. In its circuit design, the three-wire connection method can eliminate the resistance of the conductor and ensure more accurate measurement [7]. The temperature measuring circuit is shown in Figure 6. Among them, port J2 is used to connect Pt100, port J3 is the external common port, port J1's pin 2 is the output pin, which can be directly connected to the ADC built-in CC2530 chip through the general interface of ZigBee device. Figure 7 is the PCB layout of the circuit. The circuit schematic diagram and PCB layout are all made by Protel-99SE software. Finally, the simulation welding diagram of the circuit board is made, as shown in Figure 8.  . Pt100-platinum resistance three-wire temperature measurement Circuit simulation welding diagram. Figure 9 shows the external pins of the main chip CC2530: The port J2 is the interface of Pt100 sensor and the pin 2 of port J1 is the output pin of temperature measuring circuit. The main chip CC2530 from pin P_0 to pin P_2 is the external pin of the main chip. The seven pins of the P0 port can be used as the ADC input interface of the CC2530 chip.In this system, we set the P_6 pin as the access pin of PT100 resistance conversion circuit, the P_7 pin as the gas sensor access pin, and the P_6 pin and the P_7 pin are set as the direct connection ADC analog-todigital converter in the main chip. The main chip CC2530 can also provide stable 3.3V input voltage and 5V input voltage. The circuit of Pt100-Pt resistance sensor uses 5V voltage, and the gas sensor uses 5V voltage, so both of them can be supplied by the main chip.J4 port is the interface of gas sensor. We adopt analog data acquisition, so we need to connect the 3 pin of J4 port to the P07 pin of the main chip.

Wireless data transmission
The software of temperature measuring device includes two parts: the program of wireless transmission information and the program of collecting temperature information. Through collecting program, we use main control chip CC2530 to process information such as temperature and voltage. The transmission process requires the use of end nodes to achieve the wireless transmission of information collection.
CC2530 storage device is the core part of temperature acquisition program, and in wireless transmission, ZigBee protocol stack is the key [8]. Next, we will focus on the implementation plan of the above contents. Figure 10. ZigBee coordinator workflow. Figure 11. ZigBee endpoint node workflow.

ZigBee Coordinator Application Layer Workflow.
As far as the complete ZigBee network is concerned, the core of it is the coordinator. It can be used to build coordination network, manage nodes and store node information. At the same time, it is necessary to store the node equipment data, device association table and other information in the coordination node. After initializing the hardware, it is necessary to initialize the MAC layer, define the IEEE64 address and initialize the operating system. This system constructs the LAN, which involves the selection of network identification, channel scanning and so on. After the network is successfully constructed, the request can be sent through the terminal node [9]. Figure 10 is the corresponding workflow of the coordinator node.
After the network is set up, the receiving terminal device, i.e. the request for short address detection, is made. At this time, it can check whether the sub-node is restricted or not. If the device is not allowed to access in the network terminal, and the node assigns a new access to the network address, it will send the received data to the host computer. If the coordinator has a complete short address, then no new sub-nodes will be added [10].

ZigBee Terminal Equipment Application Layer Workflow.
For a ZigBee network, the coordinator is only one, but it can include many terminals. The existence of a terminal for collecting and transmitting information. At the same time, information from other devices is not received. If it sends information, it first needs to apply for access to the network, and at the same time it agrees to join, it can send the information [11]. Figure 11 is the specific workflow of the terminal device.
The process of initializing the terminal device is equivalent to that of the coordinator node. When the initialization operation of the protocol stack is completed, it searches for the existence of an accessible network. If it exists, it submits an application for accessing the network. If this request has been passed, you can join the network. If not, you will fail to join. Then search for other complete access network. After successfully joining the network, through the drive of Pt100-platinum resistance, the temperature data acquisition is completed, and corresponding processing is carried out to realize the conversion of input voltage to temperature signal, and the address information is packaged. Send to the coordinator jointly [12].

Programming of wireless information transmission
In the protocol, many protocols have been developed, using encapsulation function to write statements, using programming, understanding the implementation, transmission and acquisition steps of application layer information, and using protocol stack function to complete the program design.
Stack is executed by the main () function. The main () function does two things altogether: first, system initialization, and the other is to start executing the rotary query operating system. As far as the operating system is concerned, it is a priority-based rotary query operating system. Its flow chart is shown in Figure 12.
The next step is to initialize the application program. When Coordinator and end device devices are powered on, initialization is the primary task. Whether it is a clock, serial port, or task, many other projects need to be initialized. Among them, serial initialization is the most critical. In the "hal_uart.h" file of the protocol stack, we can find the configuration parameters of the serial port. We can configure the baud rate, stop bit, check bit, data bit and serial port flow control bit according to the need.

Data transmission and reception.
(1)Data transmission. In the protocol stack, AF_DataRequest () is called to send data. Specific examples are as follows: af status_tAF_DataRequest (afAddrType_t*dsAddr, endPoint Desc_t*srcEP, Uint16 cID, Uint16 len Uint8 *buf, Uint8 *transID, Uint8 options, Uint8 options Uint8 radius) Specific description of function parameters: * dstAddr denotes destination address, endpoint address and delivery mode, * srcE P denotes source endpoint, cID denotes cluster ID, len denotes data length, * buf denotes data, * transID denotes serial number, options denotes sending options, and Radius denotes hops. * dstAddr determines which device and endpoint the message is sent to, and cluster ID (cID) determines how the device receives the information. Cluster can be understood as a convention, which stipulates how to deal with information. Data transmission mode: In the protocol stack, there are four modes of data transmission: unicast, multicast, broadcast and bind transmission. In this paper, we adopt the binding sending mode. The binding sending mode is as follows: The target device can be one, one or more, which can be defined by binding information. When sending bindings, you need to set DstAddr -> addrMode is AddrNotPresent Set dstAddr -> addr -> shortAddr to invalid address 0xFFFE. The following is the corresponding code: 0xFFFE; = ortAddr dr.addr.sh ZDAppNwkAd sent; AddrNotPre = e dr.addrMod ZDAppNwkAd Combining with the above configuration, the function is used to complete the binding sending operation.
Data reception. In Zstack, if OTA information has been received, the event under the event will be triggered. It only needs to be processed. The AF_DataRequest () function is called by void sampleApp_SendperiodicMessage (void) function to send data. SampleApp_Periodic_DstAddr is used as the sending address, i.e. SampleApp periodic information address, which is 0xFFFF.
For cluster ID, SAMPLEAPP_PERIODIC_CLUSTERID.When the AF_INCOMING_MSG_CMD event of the target device is triggered at the receiver, the event handler SampleApp_ProcessEvent() function is then called.When processing the event AF_INCOMING_MSG_CMD, Zstack calls the function SampleAPP_MessageMSGCB (MSGPKT).In the function SampleAPP_MessageMSGCB, it is often processed according to the different cluster IDs of received information, that is, clusters are equivalent to conventions, which are conventions on how to deal with information. As far as the Zstack protocol stack is concerned, the function of zb_SendDataRequest () is invoked with AF_DataRequest () as the data sending function in order to send data easily. In fact, when invoking this, AF_DataRequest () is also invoked to send data eventually.

Neural network
In this paper, BP neural network is used to create cascaded forward BP neural network using newcf () function. Learngd () is the network learning function, trainbfg () is the training function. After a lot of data training, the network fitting effect is good [13]. The trained network will be called in LabView.

Data analysis
The experimental data are obtained from the actual measurement of the coal yard. The measured data contain decimals, because the amount of data obtained is very large. In view of the convenience, we adopt a rounding method to simplify the data, which is presented by the daily average data, and the effective digits of the data are 3 digits. Because the temperature inside the coal pile changes very slowly during the latent period of spontaneous combustion, we train the neural network with the data of one day interval. Because the temperature inside the coal pile rises very quickly after reaching 70 degrees Celsius, we set the warning temperature to 70 degrees Celsius. So we only intercepted data before 70 degrees Celsius. Some of the data collected are shown in Table 1.

Construction of Neural Network
The temperature and concentration data in Table 1 are trained by BP neural network. The process is shown in Figure 13.

Forecast results
The difference between the actual output and the predicted output, i.e. the prediction error, is obtained by using the trained neural network to predict, so as to judge the accuracy of the prediction. The temperature prediction error is shown in Figure 14 and the gas concentration prediction error is shown in Figure 15.   Figure 15. Gas Concentration Prediction Error Diagram. According to the error graph, we can see that the network prediction error is between +0.2 and -0.2, and the error is relatively accurate, which can be applied to the actual prediction model.

LabView display alarm implementation
The LabView program contains functions of analyzing data, saving, and communicating to users. Read data through VISA serial port and display data in real time in graphics control. Users can also set the alarm threshold, when the threshold is exceeded, the alarm lights continue to flicker. And the data can also be saved to facilitate the viewing of historical data. This system can not only display the 12 multi-point temperature information in real time, but also save the temperature and time collected from different places in the way of Excel table, and store it in the computer [14].
The local interface of LabView programming is shown in Figure 16. By using the trained neural network, the temperature and gas concentration in the next 24 hours are predicted. In LabView, the neural network trained by MATLAB is called [15]. The MATLAB script file box is shown in Figure 17.  Figure 17. MATLAB script file box. Data input is variable a, data output is A, A is the temperature value that will be reached 24 hours after using the trained neural network prediction.
After the LabView program is edited, it can pack the components and drivers of the upper computer program, form the installation file, and then transplant it to the user computer. Just install the program directly on the computer without the need to re download the driver. And after installation, users can not modify the program, which can make the program more secure and transplantable, and make it easy for users to use the host computer system [16].

Conclusions
The core parts of the system are ZigBee wireless transmission technology, BP neural network data prediction and LabView host computer design. Sensors in the acquisition device use high-precision temperature sensors and gas sensors. According to the characteristics of the sensor, this paper designs a relevant driving circuit to drive the sensor to work. ZigBee wireless data transmission design guarantees the high efficiency and reliability of data transmission. The data prediction of neural network can give the data value after 24 hours. The upper computer interface written by LabView software has intuitive function, convenient operation and stronger portability.