Abstract

In order to comprehensively improve the sensitivity of fire warning and effectively shorten the warning time, this paper proposes and implements an indoor distributed fire alarm system based on low power wide area network. The system is mainly composed of three parts: a multisensor acquisition node based on LoRa technology, a distributed edge gateway, and a remote user monitoring system. The multisensor collection node obtains environmental parameters such as indoor temperature, smoke concentration, and air quality and then transmits the sensing data to edge gateway by LoRa after preprocessing. The edge gateway is based on an embedded Linux platform and is deployed in distributed state to collect and store data from multiple collection nodes. Besides, edge gateway forwards valid data to the remote user monitoring system by standard MQTT protocol. The user monitoring system displays current deployment area parameters to users in real time and provides early warning prompts based on relevant preset indicators to help the administrator make more accurate decisions on corresponding measures. The system has been deployed and tested in Nanjing Institute of Technology. By sensor calibration experiments, LoRa communication experiments, and system tests in different environments, the experimental results show that the average received signal strength in a small interference space is -104.12 dBm, and the average received signal strength in a noisy signal environment is -57.5 dBm. By setting the optimal transmitting power for each distance, the packet receiving rate can reach more than 95%, and the alarm accuracy can reach 100% under premise of ensuring the lowest power consumption. Finally, this paper conducts a comprehensive performance analysis on the wireless communication performance of environmental collection nodes, multisensor data fusion algorithm, distributed LoRa edge gateway deployment performance, and remote system early warning accuracy.

1. Introduction

Nowadays, fire is a common serious problem faced by countries all over the world. While causing casualties, it will also bring certain property losses and adverse sociopolitical effects. According to statistics from the China Commercial Fire and Safety Association in 2019, a total of 233,000 fires were reported across the country, 1,335 people died, and direct property losses reached 3.612 billion yuan. Compared with 2018, the numbers of fires and property losses have been reduced by 4% and 1.9%, respectively [1]. Among them, the number of fires caused by electrical short-circuit aging and other reasons is majority. Figure 1 shows the situation of serious fires in the past 13 years. It can be seen from the figure that the number of fires is decreasing year by year [2]. In addition, with the continuous growth of population and economy, high-rise buildings are also increasing, and the number of fires has increased by 5.8% compared with the previous year. Therefore, high-rise buildings have become the focus and difficulty of fire prevention. The pressure and difficulty of urban fire prevention and control will continue to increase, and risks must be predicted in advance and preventive measures must be studied in advance. Detecting the occurrence of fire in the first time and monitoring fire in real time can play a vital role in reducing the loss of life and property.

With the development of Internet of Things (IoT) technology, the application of IoT technology to fire alarms can accurately locate the fire point and has the characteristics of real-time monitoring, fire tracking, online upgrades, and convenient maintenance. Many countries have also conducted a lot of research on wireless communication technology applications to indoor fire protection. For example, scholars such as Bo Chang studied the indoor fire monitoring system that used ZigBee wireless network to monitor the temperature, humidity, and smoke concentration of fire site in real time [3]. Liu Yunhong and other scholars studied the use of ZigBee to Wi-Fi communication gateway to collect the data collected by sensor nodes to gateway and upload it to servers to solve the indoor location problems of fire locations and evacuation plans [4]. Scholars such as SwetaBasu adopted Wireless Sensor Network (WSN) to accumulate accurate environmental data by sensor nodes such as temperature, relative humidity, and different gas concentrations and send these data to base stations connected to the ground [5, 6]. In 2019, Zhou et al. [7] used an infrared thermal imager to sense changes in indoor temperature and sent alarm messages by 4G module to remind users by sending text messages. However, the data packets in mobile network need to be uploaded by the base station of operator, [8] which increases a large part of communication cost. ZigBee wireless network technology has the characteristics of low complexity, low power consumption, and low cost [9]. ZigBee technology has its own inapplicability in this field due to its short communication distance [10].

Based on the above problems, this paper chooses LoRa as communication module. The module has long distance and low power consumption characteristics. The system is divided into three parts: node, gateway, and cloud server. The nodes and gateways are deployed in a star network structure. As shown in Figure 2, this system is deployed in urban indoor buildings, large warehouses, or large factories and installed in ventilated and easy-to-detect locations such as walls and ceilings. Compared with other solutions, this solution differs in that terminal nodes are easy to deploy. Moreover, the deployed nodes have a long service life and through sensor filtering and weighted fusion algorithm to judge whether a fire occurs. Each node can remotely monitor the site in real time by remote user monitoring system through the web page.

The rest of this article is organized as follows. Section 2 introduces the system architecture and implementation functions, as well as an overview of LoRa applications. Section 3 introduces the software and hardware design of nodes and gateways. Section 4 discusses the architecture and design of the remote user monitoring system. The performance parameters of the system through the test prototype are calculated in Section 5, which explains the conclusion and direction of future improvement. Finally, this paper is concluded in Section 6.

2.1. Monitoring System Structure

The system block diagram described in this paper is shown in Figure 3, which is composed of LoRa node, LoRa gateway, cloud server, and remote user monitoring system.

The sensor on LoRa node collects ambient temperature, smoke concentration, and carbon monoxide content at a certain time interval. The collected data is fused and calculated by fire support weighting algorithm, and weighted fusion result is compared with the set threshold. If the fire alarm threshold is reached, an alarm signal is issued and a data packet with a fire alarm signal is sent to the gateway. When there is no fire, the node periodically checks battery power. If battery power is lower than the preset threshold, node’s red Light Emitting Diode (LED) will flash and upload a data packet with a low battery alarm signal to the gateway. When the node is not working, it enters a low power consumption mode to extend battery life.

The gateway uses embedded processor IMX6 based on ARM Cortex-A7 core introduced by NXP. It is used to receive data sent from the node. After the data is sorted and packaged, it is sent to cloud server by Transmission Control Protocol (TCP).

The cloud server is mainly composed of Message Queuing Telemetry Transport (MQTT) Broker, MySQL, Backend Service, and Tomcat. When gateway receives data sent from the node, it encapsulates the data and publishes it under the corresponding topic of MQTT Broker. Then all remote user monitoring systems (MySQL, RESTful Web Server) subscribed to this topic will receive messages.(1)MQTT Broker is a message forwarding service provided by servers. Client is a remote user monitoring system used to connect to MQTT Broker to subscribe and publish messages. The IMX6 gateway runs TCP-based MQTT protocol software (MQTT Client) and connects to the Broker and creates a theme representing the gateway in MQTT theme. When gateway receives the data, it will publish the data package under this topic. At the same time, by plug-in of MQTT Broker, MySQL database can be subscribed to specific topics on MQTT Broker. When the topic has data released, back up the data to MySQL.(2)Backend Service provides a web page that can manage node information, and users access the server’s address by a browser. Corresponding data can be displayed on web page, and users can also perform corresponding operations. The Web Server subscribes to messages on MQTT Broker and queries data in the database in background. When necessary, the message can also be published for gateway to receive and transmit to the node.

The remote user monitoring system realizes the visual monitoring of data and can observe the fire situation and battery power information at each node. At the same time, the communication parameters of nodes can be set in the remote user monitoring system (transmission frequency, transmission power, spreading factor, etc.). You can choose to set a single target node, or you can choose the broadcast mode to set all nodes in the range.

2.2. LoRa Technology Overview

LoRa communication can effectively fight against Doppler frequency shift, using Chirp Spread Spectrum (CSS) technology to send data [11, 12]. This technology is based on symmetrical bilateral and dual-channel ranging positioning technology, covering a large distance, which can effectively reduce noise and interference. The low-cost feature also makes it one of the reasons why it is so hot. The average cost of a typical low power wide area network (LPWAN) module is $4–18 [13], but the price of LoRa chip is about $1–2, and the price of complete module is about $5–10. This also makes LoRa technology regarded as the future wireless communication standard of IoT in the industrial field [14, 15].

SX1278 transceiver mainly uses LoRa remote modem. The module has good anti-interference ability and can minimize the current consumption during work. Under the condition of ensuring high sensitivity exceeding -148dBm, constant RF power output can be achieved when the voltage changes. This solves the traditional communication scheme, when long-distance communication cannot guarantee a certain degree of sensitivity, anti-interference, and power consumption [16].

3. Materials and Methods of Data Acquisition Device Terminal

3.1. LoRa Node Hardware Implementation

The node hardware block diagram is shown in the figure. The core unit on the main board for subnode is composed of a control unit, a radio frequency unit, a sensor interface, an acoustooptic indicating unit, a data storage unit, a debugging interface, and a power supply unit. The Microprocessor Control Unit (MCU) uses STM32L151C9T6 chip to control data collection, data storage, and manage the communication between data and gateway. The subnode prototype and hardware block diagram are shown in Figure 4. For the abovementioned sensors of different communication types, they can be connected to sensors interfaces reserved at both ends of the board. Each node has its own ID number and communicates with the gateway by different channels.

3.1.1. Hardware Materials

In order to detect whether a fire occurs in real time and monitor the fire situation during a fire, subnode development board records the corresponding data by following sensors: temperature (°), humidity (%), carbon dioxide level (CO2 ppm), carbon monoxide level (CO ppm), and smoke concentration. Besides, the remaining power of subnode power supply battery is also monitored, and the node peripherals are shown in Table 1.

The main control unit chip adopts ultra-low power MCU STM32L151 series processor produced by STMicroelectronics. This series of embedded processors uses a high-performance ARM Cortex-M3 32 bit RISC core with a frequency of up to 32 MHz and five different low power modes [17]. In order to reduce costs and the size of subnodes, without wasting hardware resources, various factors are comprehensively considered. This node uses STM32L151C8T6 processor in the series. This model integrates a 12 bit, 14-channel digital-to-analog converter; Three Universals Synchronous/asynchronous serial Receiver/Transmitter (USART) ports, Interintegrated Circuit (I2C) [18];tTwo-way Serial Peripheral Interface (SPI) and 37 General-Purpose Input/Output (GPIO) pins and built-in 64 kBytes Flash and 32 kBytes RAM. Use 1.8 to 3.6 V DC power supply for power supply [19]. The processor is widely used in medical equipment, GPS and sports equipment, and wired and wireless sensors. This module is used to control the data acquisition, processing, storage, and control of radio frequency module to send and receive information.

The SX1278 transceiver adopts Semtech’s LoRa modulation technology, which can carry out ultra-long-distance spread spectrum communication and has good anti-interference performance [20, 21]. At the same time it minimizes current consumption. Through the integrated +20dBm power amplifier, long-distance wireless communication can be carried out under the condition of ensuring sensitivity as low as -148dBm, which solves the contradiction between range, anti-interference, and energy consumption.

Use DHT-11 sensor to measure temperature and humidity and use MQ-2 sensor to measure smoke and combustible gas; MQ-7 sensor can detect the concentration of carbon monoxide (CO) [2224].

3.1.2. Power Module

The power supply unit is composed of a lithium battery and a step-down circuit. The lithium battery provides a DC 5 V working voltage, and 5 V voltage is converted into a suitable working voltage DC 3.3 V for MCU through step-down chip TLV62565. The step-down circuit is shown in Figure 5. Among them, TLV62565 chip cooperates with resistors R23 and R26 to generate a suitable working voltage [25, 26].

In order to ensure low current consumption and a certain degree of noise sensitivity, the feedback current IFB is required to be no less than 5 μA [27]. Noise sensitivity and output voltage accuracy will increase with the increase of IR2 and at the same time will increase the loss of output current. Due to the maximum duty cycle limitation, if input voltage is too low, output voltage will exceed the regulation range. To ensure that the circuit can work normally, VOUT should be less than the product of minimum input voltage VIN_MIN and the maximum duty cycle DMAX, as shown in

3.2. LoRa Gateway Hardware Implementation

The embedded gateway is composed of an industrial control core board and an industrial control backplane. The hardware structure diagram is shown in Figure 6. The industrial control core board is composed of i.MX6Ultrelite embedded processor 256 MB Nand Flash and DDR3 [28]. This series of embedded processors uses a high-performance ARM Cortex-A7 32 bit core architecture with a frequency of up to 792 MHz [29]. The industrial control backplane includes LoRa gateway module and 4G LTE mobile data board, two 100M Ethernet ports, one CAN bus port, and RS485 bus port. Adopt 12 V DC power supply for power supply [30].

The embedded gateway is used to control data reception, processing, storage, and information forwarding. Collect the data uploaded by each node through the LoRa gateway module, check and analyze each data packet, and forward the correct data packet to the cloud server through the 4 G module.

3.3. Software Implementation

The software program in this paper is mainly divided into three parts, as shown in Figure 7. The first is subnode program, which consists of sensor data acquisition, low power software optimization, and LoRa communication. The second is gateway program, which realizes the functions of receiving data from each child node, packaging, and uploading to servers. The third is server program, which realizes data query, real-time data display, and other functions. Besides, users can query real-time data by remote user monitoring system.

3.3.1. LoRa Node Software Design

The embedded software of child node is developed in Keil Embedded Development Tools integrated environment, and it is necessary to develop application layer programs and hardware drivers for peripheral devices. The procedure is divided into three parts. First, STM32 internal ADC collects sensor data into data. The working mode of carbon monoxide sensor, temperature and humidity sensor, and combustible gas sensor is to actively send data to single-chip microcomputer. In order to facilitate management, the single-chip microcomputer enables and disables ADC acquisition pins to control whether data is input. The software flow chart in MCU is shown in Figure 8.

After packaging the sensor data, the kernel and various peripherals are initialized by MCU. After the initialization is successful, the node sends a handshake signal to gateway, asking the gateway whether to send configuration data, waiting for gateway to send data, or waiting for timeout to enter the low power consumption mode. If the gateway sends data, SX1278 clears interrupt and enters the receiving mode. In the receiving mode, MCU parses the message sent by the gateway according to a certain protocol and judges the correctness for data frame format of messages. The protocol frame format is shown in Table 2. After receiving the data and enabling new parameters, enter STOP mode. If the wait times out, it directly enters STOP mode.

In STOP mode, MCU detects the current smoke concentration by sensors. If the sensor detects a fire, it immediately sends a pulse signal to MCU interrupt IO port and uses an external interrupt to wake up MCU and set the SX1278 chip to send mode, continuously send alarm signals to gateway, and send out audible and visual alarm signals. If there is no fire, MCU maintains STOP mode state. The node wakes up every 24 h to detect the current system battery voltage. When the system detects that the current voltage is less than a certain value, it sends a low battery alarm signal to the gateway to remind staff to replace battery to ensure the normal operation of nodes.

3.3.2. Gateway Software Design

According to the flowchart shown in Figure 9, the gateway is in a passive receiving state in this system. When LoRa gateway receives the data packet of LoRa node, it parses the data packet. The analysis content includes CRC check bit, the node ID that sends data packet, the destination address of data packet, the data collected by sensor, and RSSI value of data packet.

After the gateway receives data packet sent from nodes, it stores data in an array with a length of 16 bytes. For the data packets stored in array, CRC check is performed first, if CRC check succeeds. Then analyze the data packet according to self-defined protocol, and discard the data packet if CRC check fails.

3.4. Application Layer Monitoring System

The application layer monitoring system mainly completes the real-time monitoring of measured data, alarm management, and viewing historical data. Equipment monitoring mainly monitors the status and data information of equipment as shown in Figure 10. The platform can monitor real-time data collected by sensors under each node and can display the historical data curve in current period of time. It can be searched according to provided conditions. Alarm information management is mainly to summarize and display the alarm information generated by system. The generation of alarm information is currently mainly realized by the trigger of system. When the trigger detects that real-time data of sensing point exceeds threshold set by administrator, it will start the trigger and send out an alarm message. The ID number, geographic location, and data name of alarm node are provided in alarm details, so that users can quickly locate the source of alarm. According to the state of alarm information, it is divided into three states: unprocessed, processed, and marked. The system administrator or user handles the alarm according to specific conditions of alarm. The historical data mainly records the historical data of equipment. The user can query historical data based on node ID number and sensor name under the node in combination with time.

4. Experimental Results and Analysis

Based on the abovementioned hardware and software platform, the system is tested for alarm response and monitoring. Before deploying system, the performance of system operation and different interference environments was tested. At the same time, the optimal transmission power of each node is selected to ensure that the node can stably receive data packets while operating with the lowest power consumption, thereby prolonging the service life of nodes.

4.1. Sensor Correction Experiment

When the concentration of carbon monoxide in air reaches 50 ppm, it is the maximum content allowed for an adult to be in it. When it exceeds 200 ppm, the human body will have symptoms such as headaches and nausea. Therefore, when the carbon monoxide concentration is set to 50 ppm, it is alarm threshold. However, since Message Queue (MQ) series sensors use analog voltage output, it is necessary to refer to the sensitivity characteristic curve to convert analog voltage value into a value in ppm. Certain errors will occur during the conversion process. In order to improve the accuracy of value as much as possible, the carbon monoxide concentration was measured several times, and the experimental results are shown in Figure 11. The x-axis is analog voltage, and y-axis corresponds to ppm value of CO. It can be obtained by curve fitting that, in a ventilated room, the carbon monoxide concentration is 9.5 ppm and smoke concentration is 59.7 ppm.

4.2. Impact of Environment on the LoRa Communication Quality

The quality of communication environment will affect the quality of link transmission. When working in an environment full of irrelevant electromagnetic waves, the accuracy of receiving correct data packets will decrease accordingly. Thus, it is necessary to analyze the influence of indoor electromagnetic wave strength on communication quality. The communication quality of LoRa can be evaluated by received signal strength RSSI. Select two representative locations for testing in order to more realistically reflect the test results and study how different environments will affect the test results. The first experimental site is Numerical Control workshop of Nanjing Institute of Technology. This is a 12338 m processing workshop as shown in Figure 12(a)). Since electromagnetic harmonics are generated during the operation of machine tools, they are the main source of communication interference, making it a very noisy experimental environment. The second experimental environment is school library, as shown in Figure 12(b)).

Set the communication parameters to SF = 7, BW = 125 kHz, Freq_tx = 470.7 MHz, so that the transmit power is slowly increased from −4. When defining the interval dm between nodes and gateway, the minimum transmit power when the rate of packet reception of data packet received by the gateway within 10 minutes is higher than 95% is optimal transmit power. In order to ensure accuracy and authenticity of experiment, each test environment selects 8 locations for testing. Each test point is separated by a certain distance, and the optimal transmit power of each distance is measured. In both environments, the gateway is placed in the center of room, and the node is fixed on a wall at a certain distance from the ground. At the same time, if the gateway receives correct data packet, it measures its RSSI.

The experimental results of environment one and environment two are shown in Figures 13(a) and 13(b)). The best transmission power selection model is established by MATLAB curve fitting. It can be clearly seen from the figure that, in a noisy environment, it is necessary to greatly increase the transmission power to ensure normal channel communication. As shown in Figures 14(a) and 14(b)), the received signal strength is also significantly related to the excellence of environment. In a space with less interference, when the node is 40 m away from the gateway, only the transmit power needs to be set to -3, and the average received signal strength is maintained at about -104.12 dBm. In a space with large interference, when the node is at the same distance from the gateway, the transmit power needs to be set to 20 to ensure that the packet reception rate is higher than 95%, and the average received signal strength is only about −57.5 dBm.

5. Distributed Fire Monitoring System Test

8 LoRa nodes and 1 gateway are deployed in a star network, and the node transmitting power is set to the optimal transmitting power of corresponding distance. Perform comprehensive tests of sensor collection data, node-gateway communication, gateway-server communication, and remote user monitoring system display. Through human intervention, the release of carbon monoxide and smoke and increasing the temperature simulate occurrence of a fire, further testing the feasibility of the system. When the index is not detected to exceed standard, the remote user monitoring system will not issue an alarm. In the event of a fire, node immediately sends out an audible and visual alarm signal, and the remote user monitoring system sends out an alarm message at the same time. In order to obtain the accuracy of experimental data, 8 nodes were tested.

It can be seen from Table 3 that after sensor verification and selection of appropriate transmitting power, under normal conditions, the temperature measured at node 8 is 19.4°C, the carbon monoxide content is 11.6 ppm, and the smoke is 102.4 ppm. Then randomly increase the temperature, carbon monoxide, and smoke concentration values, and record the alarm information. Node 7 first improves the carbon monoxide. Judging from the data displayed by the monitoring platform, all three values have increased. After data fitting calculations, an alarm will be given. It was observed from the monitoring platform that the accuracy of alarm reached 100%, and the system was operating stably. This realizes the collection of real-time data, the distributed wireless communication function, and the alarm function after threshold is exceeded, meeting the needs of fire alarm.

In summary, the quality of LoRa wireless communication is greatly affected by the environment, and the transmission power should be reasonably increased in a large electromagnetic interference environment. In practical applications, in order to prolong the service life of the node as much as possible, it was found in the test that when the node is close to the gateway, too high transmission power will cause data packet reception errors, so you should choose the appropriate one according to different transmission distances. The transmission power can also ensure good alarm accuracy.

6. Conclusion

This paper proposes an indoor distributed fire alarm system based on LoRa for IoT. The system realizes the deployment of distributed nodes and gateways in a star network structure by LoRa communication technology. The node collects environmental data and synchronizes data to remote monitoring system in real time. In the event of a fire, the node monitoring system can issue an alarm in real time. The system has the characteristics of easy deployment and long service life. The sensor filtering and weighted fusion algorithm can accurately determine whether a fire has occurred, and the remote user monitoring system can monitor the system status of each node in real time. At the same time, the node implements regular data transmission and low power sleep and energy-saving modes to facilitate the long-term use of devices.

Data Availability

The data included in this paper are available without any restriction.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

Acknowledgments

This work was supported by the Postgraduate Research & Practice Innovation Program of Jiangsu Province (No. SJCX21_0921), School-level Scientific Research Fund of Nanjing Institute of Technology (No. QKJ201808), and 2020 Jiangsu Province Industry-University-Research Cooperation Project (No. BY2020040).