The conflagration of fire is still a serious problem caused by humans, and houses are at a high risk of fire. Recently, people have used smoke alarms which only have one sensor to detect fire. Smoke is emitted in several forms in daily life. A single sensor is not a reliable way to detect fire. With the rapid advancement in Internet technology, people can monitor their houses remotely to determine the current condition of the house. This paper introduces an intelligent smoke alarm system that uses ZigBee transmission technology to build a wireless network, uses random forest to identify smoke, and uses E-charts for data visualization. By combining the real-time dynamic changes of various environmental factors, compared to the traditional smoke alarm, the accuracy and controllability of the fire warning are increased, and the visualization of the data enables users to monitor the room environment more intuitively. The proposed system consists of a smoke detection module, a wireless communication module, and intelligent identification and data visualization module. At present, the collected environmental data can be classified into four statuses, that is, normal air, water mist, kitchen cooking, and fire smoke. Reducing the frequency of miscalculations also means improving the safety of the person and property of the user.

1. Introduction

The wide deployment of sensing technologies in our daily living environments and the pervasive usage of mobile devices bring about great opportunities for the deployment of smoke alarms [1]. At present, most of the traditional smoke alarm systems consist of sensor modules, transmission lines, and monitors, each of which is connected to a sensor module [2]. Therefore, there is a defect in the accuracy and timeliness of the traditional alarm system. The misinformation of the fire alarm caused by water mist or oil smoke causes unnecessary losses to people. People spend a long time in vehicles on roads after homes and offices [3, 4]; they want to get the right fire alarm while they are in the distance. And there are two main reasons for these problems.

(1) The Way to Judge Whether or Not Fire Is Too Simple. The traditional smoke alarm system only detects a single environmental value. If the detection value exceeds the threshold, it is judged to be a fire. There are many uncertainties in the fire scene that will cause the smoke alarm system to be unable to accurately determine the fire, such as temperature, combustible gas concentration, smoke particle concentration, and barometric pressure, which can lead to false positives, omission, delay reporting, and other phenomena which occur frequently [5].

(2) Inadequate Component Connection. The traditional smoke alarm system use copper wires, insulated wires, or cables to connect detectors and alarms. This kind of connection has many disadvantages, such as copper wire’s price, large consumption, and weak anti-interface ability. On the other hand, the copper wire easily wears at high temperatures, resulting in the alarm system maintenance being very complex, reducing the reliability of the traditional smoke alarm system [6].

At present, some new smoke alarms use LoRa to achieve wireless communication, and they do not need to install wires. This solves the problem of difficult installation of traditional smoke alarms and enables people to view the status of the alarm remotely, so as to ensure the timeliness of the alarm. But there was no change in the way the fire was judged, and the accuracy of the alarm was not improved.

For the first question, we believe that using the machine learning classification algorithm and a variety of sensors to monitor the maximum real environment can restore the real scene of the environment approximately and greatly enhance the accuracy of fire warning, while reducing false, omission, and late alarms’ frequency.

When designing the communication system, we want it to be able to support multipoint data transmission with low complexity, low cost, and high reliability. So, we choose to use ZigBee. In addition, we designed and implemented data visualization on the web to ensure that the users can monitor their homes remotely. Experiments show that the intelligent smoke alarm system has a high reliability in data transmission and fire alarm, can monitor multiple scenes at the same time, and has high practicability.

In this paper, the combustion process is analyzed, and a variety of WLAN technologies and ML algorithms are compared. The sensor type of the system is given, and the usability and reliability of the system are tested through simulation experiments. Finally, the conclusion is given and the improvement scheme is put forward.

2.1. Changes in the Indicators in the Process of Conflagration

The conflagration is a disaster that is not controlled by man and caused by combustion [7]. The three basic elements of the fire are combustible, comburent, and ignition source. The combustible material is in the form of gas, solid, and liquid; “comburent” mainly refers to oxygen. For combustible gas combustion, according to the mixture of combustible gas and air, it can be divided into two different ways. If it is in the combustion before the air has been mixed with the gas, it is called premixed combustion; if the air and combustible gas do not enter the combustion state at the same time but are mixed and burned, this is called diffusion combustion. Liquid and solid substances are condensed matter, which is difficult to mix well with air. The basic process of combustion is as follows: when it gets enough energy from the outside, the condensed matter evaporates into steam or decomposes, and the combustible gas molecules, ashes, and unburned matter particles are suspended in the air, called aerosols. Usually, aerosol molecules are relatively small. During the production of aerosols, large molecules of solid or liquid particles are produced at the same time, known as smoke. But when burning, heat will be generated, causing a temperature rise, while generating a lot of smoke; with the temperature, pressure, and smoke dust parameters, it can be determined whether the fire occurred [8].

In general, combustibles while burning produce the following several forms of expression as shown in Figure 1: for liquid and solid combustible materials, the first produced is combustible gas, followed by smoke; in case of sufficient combustion, gas can only be fully burned, releasing a lot of heat to promote the current ambient temperature. In the process of fire, the initial stage produces a huge amount of smoke, but the temperature is not very high. If the detector at this stage begins to test, you can minimize the loss caused by the fire. After the fire starts, the fire will quickly spread and produce a lot of heat to the current environment, increasing the temperature and burning oxygen, so that the air pressure is reduced. If at this moment the current temperature and pressure can be effectively detected, the fire can be controlled.

2.2. WLAN Technology Comparison

We analyzed the most widely used technologies in the field of intelligent home wireless communication technologies, including Wi-Fi, Bluetooth, Z-Wave, and ZigBee.

Table 1 contains rough comparisons between different wireless technologies. It is conceptual in nature. However, it may be used as a quick tool for making a decision on which technology you will use in your application. It includes data on the range, data rate transmission, possibility of network building, and so on.

2.3. Analysis of ZigBee Network Architecture
2.3.1. Star Network

Star network structure control and synchronization are relatively simple, usually used for a small number of node occasions [10]. The disadvantage of this topology is that there is only one path for data routing between nodes. The coordinator may become the bottleneck of the entire network. Figure 2 shows the star network structure.

2.3.2. Cluster-Tree Network

The cluster-tree network structure can accommodate more nodes than the star network structure and can also expand the network as needed [10]. The disadvantage of this topology is that the information is only a unique routing channel; once the routing node is paralyzed, the subnetwork below it will be completely paralyzed. Figure 3 shows the cluster-tree network structure.

2.3.3. Mesh Network

The advantage of this topology is that it automatically finds the best path, reducing the message delay, and enhances the reliability of the system; the disadvantage is the need for more storage space [10]. Figure 4 shows the mesh network structure.

2.4. Classification Algorithm Analysis

In order to improve the alarm speed of the system, a classification algorithm is needed to ensure the accuracy of the same time with faster processing speed. According to this requirement, we analyzed the algorithm with excellent classification accuracy and processing speed in the case of small data volume, including SVM, decision tree, and random forest [11].

2.4.1. Support Vector Machine

Support vector machine (SVM) was first proposed by Cortes and Vapnik in 1995. Support vector machines show many unique advantages in solving small sample, nonlinear, and high-dimensional pattern recognition and can be extended to function fitting and other machine learning problems, which in many areas has been widely used. SVM is based on the Vapnik-Chervonenkis dimension theory and the structural risk minimization principle of statistical learning theory [12]. Based on the complexity of the model information in the model (i.e., the learning accuracy of the specific training samples) and the learning ability, we accurately predict the ability of any sample to seek the best compromise between them in order to obtain the best promotion ability (i.e., generalization ability). The basic principle of the support vector machine is to find a reliable kernel of high-dimensional space to a high-dimensional space so that these points are linearly separable in the new space. Support vector machine is based on the linear division and the use of linear division of the principle of the final classification of prediction [13].

2.4.2. Decision Tree

Decision tree is a basic classification method, based on the process of feature classification, originally originated from the ID3 algorithm proposed by Quinlan. A decision tree is a method of defining a Boolean function whose input is a set of properties describing the object, and the output is yes or no. Decision trees represent a hypothesis that can be written as a logical formula. The decision-making tree’s ability to express is limited to propositional logic, and any test of any of the properties of the object is a proposition [14].

Within the context of propositional logic, the decision tree’s ability to express is complete. A decision tree can represent a decision process that determines the classification of the training set, and each node of the tree corresponds to an attribute name or a specific test that divides the training set based on the possible outcome of the test. Each part of the division corresponds to a classification subproblem of the corresponding training case subspace, which can be solved by a decision tree. Thus, a decision tree can be seen as a division of the target classification and access strategy [15].

2.4.3. Random Forest

Random forest is a random way to use the decision tree as a base classifier into a forest algorithm, for the prediction of classes, so that each decision tree in the forest is used to make a prediction of the sample. Finally, the results of all the decision trees are combined to obtain high-precision classification results. It is a kind of statistical learning theory, randomized by bootstrap resampling method, from the original training sample set to extract multiple versions of the sample set. The decision tree for each sample set training models the final combination of all decision trees. The final forecast can be established by voting mechanism [16]. The construction of the random forest is shown in Figure 5.

2.5. Classification Algorithm Effect Comparison

Using cardiotocography (CTG) data [17] as an example, the data has 2126 observations and 23 variables, including the fatal heart rate (FHR) and the uterine contraction (UC) characteristics classified by experts based on guardianship records. For the comparison of decision tree, bagging, random forest, SVM, and -nearest neighbor method, bagging is a method for generating multiple versions of a predictor and using these to get an aggregated predictor [18], and the -nearest neighbors algorithm is a nonparametric method used for classification and regression [19]. We use R language to fit each method and use 5-fold cross-validation method. To balance the three types of dependent variables, the sample size is randomly divided into 5 substitutions, 5 classification methods’ error rate, and 5-fold cross-validation results.

As can be seen from Table 2, random forest performance is the best of these five classification methods.

3. System Design

3.1. Network Topology and System Composition

On the basis of the traditional smoke alarm, the ZigBee mesh network structure is introduced. It includes several router nodes (router) and a terminal device (end device) connected with the PC and a coordinator node (coordinator). Each router will automatically find the router close to it and will automatically establish connection with these routers. In order to avoid router collisions, it is required that each router can connect to up to three other routers; if the distance exceeds a certain range or the signal strength is lower than a certain range of nodes, connection will be refused [24]. Connected nodes can communicate directly between each other; if two nodes are not connected, the data needs to be forwarded to the target node via the intermediate node.

The improved network structure as shown in Figure 6 has many advantages: the communication range of each node increases; there can be more choices of path; we can choose one of the most stable node forwarding data. When a routing path is damaged, due to the dynamic nature of the entire network, we can reobtain the best routing path in the network and send messages between the various devices, using multihop transmission to increase the coverage of the network which can also transparently transmit data, and can send data to any node as needed.

As shown in Figure 7, the intelligent smoke alarm system consists of a smoke detection module, wireless communication module, and intelligent identification and data visualization module. The smoke detection module is responsible for the environmental data collection of the system. It is composed of a thermometer (temperature sensor), a humidity sensor, air pressure sensor, dust sensor, trophy, and a piece of integrated CC2630 module STM32. The thermometer, humidity sensor, air pressure sensor, and dust sensor are responsible for detecting the current environmental information. STM32 microcontroller is responsible for receiving three types of sensor signals. CC2630 module is responsible for three types of data transmission from the coordinator to end device and then transfers data through the USB serial port to the intelligent identification and data visualization module. Random forest algorithm is implemented for data classification and returns the classification result to the tape end device via USB serial port. When the output value is repeated several times for the set alarm value, that is, when the fire generates smoke, the alarm is pushed.

3.2. Hardware Design
3.2.1. Wireless Communication Module

The wireless data transmission network is based on Texas Instruments’ CC2630 programmable RF chip for development. CC2630 is a high-performance, low-cost, low-power system integration chip that supports Smart Bluetooth, ZigBee, 6LoWPAN, and ZigBeeRF4CE remote control applications development platform. CC2630 dual ARM core 32-bit CPU chip design, with Cortex-M0 core, is responsible for wireless communication processing, and Cortex-M3 core as the main CPU is responsible for ZigBee protocol processing. This architecture allows the CC2630 to build a larger network, a more stable network, and more capacity data when building a ZigBee protocol [25].

CC2630 CPU acts as the whole node subsystem. On the one hand, it is responsible for collecting the sensor in the room to monitor the real-time data and the data along the routing path to the target terminal equipment. On the other hand, it garners the data from surrounding neighbors to establish contact when forwarding the request and data is forwarded to the next node. In addition, the system is set up as a network status indicator; you can use the indicator to determine whether the current node is online or offline or send and receive data status.

The sensors used in this system include temperature and humidity sensors, pressure sensor, and dust sensor. Multiple environmental data including temperature, humidity, barometric pressure, PM2.5 concentration, and PM10 concentration can be monitored in real time. The use of multiple types of sensors avoids the errors of the single indicators in the prior part. And through wireless communication, the environment acquisition module can be placed with the user at random to carry out real-time environmental data collection, which greatly improves its practicability.

The entire system consists of four replaceable ordinary 1.5 V dry batteries, and the supply voltage is 6 V. In addition, the system also uses a low-power optimization program. Running the specified task will trigger the low-power sleep mode, until a wakeup signal is issued.

For the general design of the module, please see Figure 8.

3.2.2. Smoke Detection Module

At present, the smoke detectors on the market are mainly infrared detectors. The principle is in the smokeless state, the photosensitive element cannot receive the infrared light, and the smoke particles will refract and reflect to the infrared light, so that the photosensitive element receives the infrared light. When the photosensitive elements receive enough optical signals, the electrode distortion is generated to trigger the alarm signal [26]. But its shortcomings are also very obvious: water mist from kitchen, cooking fumes, and even the haze in winter are likely to trigger the smoke sensor, resulting in frequent false positives.

In order to distinguish between the above-mentioned several different situations, it is necessary to collect different types of environmental data, such as the temperature, humidity, air pressure, and smoke concentration which are the environmental variables that play a decisive role. Therefore, we need to select the sensor as accurately as possible for these four environmental parameters, and the sensor is required to have good enough sensitivity to react very quickly to the environment [27].

For the barometric pressure data, we use the barometric pressure sensor GY-68 BMP180, which can be used for GPS precise navigation (dead reckoning, upper and lower bridge detection, etc.), indoor and outdoor navigation, leisure, sports and medical health monitoring, weather forecast, vertical speed indicating (rising/sinking speed), fan power control, and other fields. The sensor is LCC8 package, whose size is 3.6 mm × 3.8 × 0.93 mm. In low-power mode, the measured air pressure can be accurate up to 0.06 hPa (0.5 m). In high linear mode, the measured air pressure can be accurate up to 0.03 hPa (0.25 m), and the I2C interface is used, the control is simple, and the communication is regular. Compatibility can be used for a variety of processing equipment [28].

For environmental humidity and temperature data, we use the temperature and humidity sensor DHT11; the sensor can be used in laboratories, industrial production, warehouse storage, indoor environmental monitoring, air conditioning devices, intelligent monitoring equipment, and other fields. The sensor humidity measurement ranges from 20% to 95%, the temperature measurement ranges from 0 degrees to 50 degrees, and the use of digital output form is simple and convenient and is easy to control [29].

For the particulate matter in the ambient air, we use the GP2Y1051AU00F dust sensor, which can be used in the field of PM2.5 detector, purifying new fan, filtration system, and so on. The sensor outputs an analog voltage proportional to the measured dust concentration, with sensitivity of 0.5 V/0.1 mg/m3, the smallest particle detection value being 0.8 microns in the range of −10 degrees to 65 degrees, which can detect small particles.

Figures 9, 10, and 11, respectively, correspond to the pressure sensor, the temperature and humidity sensor, and the dust sensor.

3.3. Algorithm
3.3.1. Random Forest

The random forest algorithm makes good use of randomness (including randomly generated subsample sets, random selection of subfeatures), minimizes the relevance of the trees, and improves the overall classification performance, and because the time of each tree is very short and the forest can be parallelized, the random forest classification is very fast.

Assume a random forest classifier ; the class label of the classification result is obtained by each decision tree and probability averaging for the test instance . The environmental information (barometric pressure, humidity, temperature, and particulate matter) is collected by the system; the prediction class tag includes normal air, water mist, kitchen cooking, and fire smoke. The classification process is shown below: where argmax denotes the parameter with the highest score, denotes the number of decision trees in the random forest, denotes the exponential function, denotes the classification result of the decision tree for the class , represents the number of leaf nodes of the decision tree , and represents the weight of the tree in the random forest [30].

3.3.2. Data Visualization

Data visualization is based on the open-source project E-charts implementation. E-charts is a pure JavaScript graphical library, relying on the lightweight Canvas Library Z-Render, providing intuitive, vivid, interactive, highly personalized data visualization chart. Innovative drag-and-drop recalculation, data view, range roaming, and other features greatly enhance the user experience, giving the user data mining and integration capabilities [31].

In this system, taking into account the diversity of data, and in order to create a more intuitive viewing experience, we choose to use the line graph which shows the various types of data over time numerical changes. First, in the front page script tags are used to introduce E-charts master files and JQuery. Then, we use PHP for data processing, including extracting the data from the database and converting it into a JSON format. Finally, in the front, the page uses the $.get JSON method to implement asynchronous loading of data, which is initialized by the echarts.init method.

In order to prevent the last data volume caused by excessive display or display error, due to the data storage time interval, we set to show only nearly half of the data.

4. Experimental Design and Verification

4.1. Power Consumption Comparison

We use MATLAB to build a virtual system for testing the power consumption of the three WLAN (ZigBee, Bluetooth, and Wi-Fi) technologies during sleep interval [32]; the results are shown in Figure 12. According to the experimental results, ZigBee power consumption is lower than Wi-Fi in all sleep intervals, and in the case of long sleep interval, ZigBee and Bluetooth are close to 0.

4.2. System Effectiveness Testing

In order to verify the performance of the system, this study selected a house with a living area of about 110 square meters as a test site (located in Shuangliu District, Chengdu, Sichuan Province). The house includes one bedroom, one bathroom, one family room, one kitchen, one store room, one living room, one balcony, and a study. The layout of these rooms is shown in Figure 13.

In order to better test the classification of random forest in each case, we produced four smoke detection modules, ensuring that the data transmission is stable and the packet acceptance success rate is higher than 90% of the case [33]. The four smoke detection modules are placed next to the bedroom door, bathroom ceiling, kitchen ceiling, and living room sofa. Then, we started to set the simulation. Scene 1: at the same time, in the bedroom, we lit a bunch of clothes to simulate a fire smoke and cooking in the kitchen to produce fumes, closed the bathroom door, opened hot water to produce water mist, and in the living room did nothing to ensure that the air status is normal. After a number of simulations, we started to set up the simulation. Scene 2: at the same time, in the living room, we lit a bunch of clothes to simulate a fire smoke, boil water in the kitchen to produce water mist, and in the bedroom and the bathroom we did nothing to maintain the normal air state, and we carried out the same number of simulations. These two types of simulation scenarios are the settings that we think are most close to the life scene. Table 3 is a summary of these two simulated scenarios.

A total of 2,5006 observations and 5 variables were collected from April and May 2017, including the normal environment, fire smoke, fumes, and water mist. The random forest algorithm was used to classify these data. After analyzing the classification results, the error rate was found to be 0. Figure 14 shows the results of random forest identification. It can be seen from the figure that the air conditions have obvious characteristics under these four indicators.

4.3. Visualization of Experimental Data

Figure 15 shows the visualization of smoke concentration (unit: mg/m3) in the living room at 09:54 to 10:40 on April 13. Since the collected data is updated every second, in order to prevent the data from being displayed too fast, the mechanism of automatic updating every two minutes is adopted to ensure the timeliness of the data and the normal display function.

5. Discussion

Accor ding to the simulation scenario testing, we can see that the system performed well in the indoor smoke classification and can meet the needs of users for remote monitoring and has certain practical significance for realizing the intelligent home environment monitoring. But the whole system can also be improved in function.

First of all, the current system can only identify four types of circumstances: the normal environment, fire smoke, fumes, and water mist environment; in fact, smoke is generated in several forms, such as secondary smoke generated from primary smoke and construction site smoke.

Second, in the data visualization, the current visualization page can only provide a simple browsing function and cannot perform complex operation such as data extraction.

Moreover, the system is currently vulnerable to network communications and external intrusion. For the whole system, we must have a noise security mechanism; this is an important future research direction.

Finally, when the number of routers in the system keeps increasing, the amount of data will multiply, making it easy for data to overflow, generating some unpredictable errors in the stored procedure. The test only used four smoke detectors and has not yet met the problem of excessive data volume. In order to prevent the possibility of simultaneous storage errors, our current solution is to set up a separate data storage cycle for each smoke detection module. But later, we need to optimize these two issues.

6. Conclusion

In this paper, we introduced an implementation method of intelligent smoke alarm system, including sensor network, classification algorithm, and visual interface. Then, the problem of low precision and weak timeliness of traditional smoke alarms is given. The solution of smoke information classification and display and component wireless sensor network is put forward. Smoke information classification solves the problem of low accuracy of traditional smoke alarms. Smoke information visualization can help users understand the air situation more intuitively. Wireless sensor networks can improve the timeliness of the alarm. The experimental results show that, based on the proposed intelligent smoke alarm system, the air condition can be more accurately distinguished, and the probability of false alarms is greatly reduced, so that the air information can be viewed in real time and the alarm information can be received in a timely manner. In addition, we have discussed some of the shortcomings of the current system. In the future, we will try to identify more types of smog in the same sensor system. And the visual function is extended to add more user customization options and enhance the security of the system to ensure the stability of data transmission and storage. Finally, consider the system’s requirements for the communication environment; the intelligent smoke alarm system should be used in the weak electromagnetic environment such as the family.

Conflicts of Interest

The authors declare that they have no conflicts of interest.