Abstract
Aiming at the problems of low fire detection accuracy and high false alarm rate of the current intelligent camera fire accident alarm system, a fire accident alarm system based on fuzzy recognition algorithm is designed. By analyzing the structural principle of the fire detection and alarm system, selecting the CO gas, temperature and smoke sensor selection, designing the corresponding fire signal detection circuit, and designing the single-chip system circuit, including the single-chip clock circuit, reset circuit, power supply circuit and A/D conversion circuit design, on the basis of in-depth study of the Bluetooth communication protocol structure, the hardware design of the serial interface circuit of the single-chip microcomputer, PC and Bluetooth module has been completed. The fuzzy recognition algorithm is used to set the input and output, establish the control rule table and reasoning relationship, generate the input and output rule table, preprocess the sensor signal, and finally output the fire alarm model through the fuzzy inference system, so as to realize the fire accident alarm of the intelligent camera. The experimental results show that the fire detection accuracy of the proposed method is high, and can effectively reduce the false alarm rate and false alarm rate of the system.
Introduction
Fire is a kind of disaster caused by uncontrolled combustion in time and space. At present, due to the high density of population in modern society, the popularity of high-rise buildings, the relative concentration of buildings, property and commerce, and the extensive development and utilization of new energy, new materials and new equipment aggravate the harm caused by fire [1]. According to statistics, in many disasters, the direct economic loss caused by fire is about 5 times of the earthquake, second only to drought and flood. Moreover, a large number of carbon monoxide and toxic substances produced during combustion cause great harm to human beings. The reliability of fire automation system is low, resulting in false alarm and missing report. The attention to fire is not enough, and the fire is found late in the initial stage. Moreover, all kinds of electrical and electronic equipment, instruments and meters are highly concentrated and in long-term operation. There are many fire hazards of overload, overheating and short-circuit of electrical equipment, which aggravates the heavy economic losses and casualties in case of fire [2]. Therefore, the prevention of fire and the reduction of fire losses have become an important topic of human research. In order to avoid the disastrous consequences of fire, the fire accident alarm system is an effective means to prevent fire [3]. The fire accident alarm system can change the smoke, heat, flame and other physical quantities generated by combustion into electrical signals through the fire detector and transmit them to the fire alarm controller at the initial stage of fire, and at the same time notify the whole floor of evacuation in the form of sound or light. The controller records the location and time of the fire, so that people can find the fire in time and take effective measures to put out the initial fire and minimize the loss of life and property caused by the fire.
The fire accident alarm system can accurately judge and forecast the fire alarm in the early stage of fire, so as to ensure the safety of people’s life and property. Fire accident alarm system is related to the life safety of people in buildings. In the whole intelligent building, fire accident alarm system plays a very important role. At present, great progress has been made in the study of fire accident alarm system. In reference [4], a wildfire risk monitoring system was proposed. The web-based drawing system was used to accurately analyze the information about soil moisture balance, drought and wildfire risk provided by neighboring United States. The daily historical, near real-time and 4-day predicted radiation, temperature, humidity and snow water equivalent data with 8 arcsec resolution were developed. The drought and wildfire risk index was calculated by grid. The snow accumulation and melting time on the north slope were delayed by the difference of short wave radiation and surface air temperature with slope direction, and the fuel regulation on shady slope was delayed. This approach supports more proactive management of wildfires and improves the characteristics of mountain droughts in the United States. Reference [5] proposed a new type of alarm system to prevent the technical failure of cryopreservation products. According to a large number of refrigerators, freezers, cryogenic containers and incubators, a centralized alarm system is determined to ensure timely response in case of failure and protect the materials with high scientific relevance. To check the equipment that should be alarmed because it contains critical materials, activate alarms in room equipment and central call center, develop a procedure to describe the function of the alarm system and follow this procedure. The simulation after installing the alarm highlights the effectiveness of the centralized alarm system. However, the above-mentioned system has the problems of low fire detection accuracy, high system false alarm rate and false alarm rate.
In view of the above problems, a fire accident alarm system based on fuzzy recognition algorithm is designed. By analyzing the structure principle of the fire detection and alarm system, the CO gas, temperature and smoke sensors are selected to design the corresponding fire signal detection circuit. On the basis of Bluetooth communication protocol structure, the hardware of serial interface circuit between MCU, PC and Bluetooth module is realized design. The fuzzy recognition algorithm is used to set the input and output, establish the control rule table and reasoning relationship, preprocess the sensor signal, and finally output the fire alarm model through the fuzzy inference system, so as to realize the fire accident alarm of intelligent camera. The fire alarm system of the system has high accuracy of fire detection, which can effectively reduce the rate of false alarm and false alarm.
Hardware design of fire alarm system
System structure principle
The fire accident alarm system is composed of PC and single chip microcomputer. As the lower computer, the single-chip microcomputer constitutes the front-end measuring unit, which is responsible for the collection and preprocessing of the fire signal at the scene [6]. As the upper computer, also known as the terminal, PC is responsible for the parameter setting and monitoring of the whole network system, completing the centralized intelligent processing of data, etc. The communication between upper and lower computers is realized by Bluetooth module. The lower computer system adopts wired and wireless connection mode for information transmission. The hardware structure of the fire alarm system is as Fig. 1.

Hardware structure diagram of fire alarm system.
The upper computer monitors the status of the lower computer, and makes intelligent decision-making for the sensor data collected by the lower computer. When there is a fire alarm, the display screen will immediately display the location and alarm time of the alarm detector in the area where the lower computer is located, store the alarm information, send out the sound and light alarm signal, and send the control information to the lower computer to start the fire fighting device in the fire area.
The lower computer is installed in each area of the site, and its main task is to collect the sensor information and store it in the selected memory unit, and then send the fire signal to the upper computer after preprocessing. When there is a fault or abnormal event in the detector area, the alarm is given, and then the fire information is sent to the upper computer.
The upper and lower computers communicate through the Bluetooth module. The lower computer uses MCS-8051 as the controller to collect and preprocess the on-site temperature, smoke concentration and CO gas signals, and save them in the microcontroller, and then send them to the terminal unit through the Bluetooth module ROK101007 of the front-end unit by wireless communication. The Bluetooth module is finally transmitted to the PC for subsequent processing, so as to realize the information exchange between the single-chip computer and the PC, and vice versa for the information transmission from the PC to the single-chip computer.
The occurrence and development of fire is a comprehensive phenomenon accompanied by smoke, light, temperature rise, diffusion radiation and abnormal smell. Therefore, it is necessary to use various fire sensors to detect these information and conduct comprehensive processing to improve the fire alarm rate [7]. The structure of composite intelligent fire detection system is as Fig. 2.

Structure diagram of composite intelligent fire detection system.
The detection part is composed of a CO gas sensor, a temperature sensor and a smoke sensor. The CO gas sensor adopts the Japanese Fugaro TGS 813 indirectly heated gas sensor, the smoke sensor adopts the domestic model HQ-2 gas sensor, and the temperature sensor adopts DALLAS. The DS18B20 uses three sensors to detect the scene at the same time. After A/D conversion, it is sent to the single-chip microcomputer for pre-processing and initial intelligent processing, and then transmitted back for subsequent processing to further improve the reliability of the fire alarm system.
The gas sensor is a sensitive element that can sense the gas composition and its concentration in the environment. It converts the information related to the gas type and its concentration into electrical signals. According to the strength of these electrical signals, the presence of the gas to be measured in the environment is obtained. Information related to the situation can be detected, monitored, and alarmed, and an automatic detection, control and alarm system can be formed through the interface circuit and the computer. It can be divided into semiconductor and non-semiconductor. Semiconductor gas sensor mainly uses oxide semiconductor as the basic material to make gas adsorbed on the surface of the semiconductor. The composition and concentration of the gas are measured by the change of conductivity. Semiconductor gas sensor has the advantages of high sensitivity and fast response, and its products have developed rapidly. At present, it has become one of the most widely used sensors with the largest output in the world.
(1) Working principle: The sensitive part of the semiconductor gas sensor is the sintered metal oxide semiconductor micro crystalline particles. When the detected gas is adsorbed on its surface, the proportion of conductive electrons at the contact interface of the semiconductor micro crystalline particles changes, so that the resistance value of the gas sensor changes with the concentration of the gas to be measured [8]. The reaction is reversible and can be reused. The change of resistance value is accompanied by the adsorption and release of gas on the surface of metal oxide semiconductor. In order to accelerate the reaction, the gas sensor is usually heated by heater.
When the oxidizing gas is adsorbed to the N-type semiconductor, or the reducing gas is adsorbed to the P-type semiconductor, the semiconductor carriers will be reduced and the resistance value will increase. When the reducing gas is adsorbed to the N-type semiconductor, or the oxidizing gas is adsorbed to the P-type semiconductor, the number of carriers increases and the resistance of the semiconductor decreases. N-type materials include SnO2, Fe2O3, TiO2, etc., and P-type materials mainly include MoO2, Cu2O, etc.
Since the oxygen content in the air is generally constant, the adsorption capacity of oxidation is also constant, and the resistance value of the device is relatively fixed. When the semiconductor gas sensor is electrified and heated to a stable state in clean air, if the gas to be measured contacts the surface of the semiconductor gas sensor and is adsorbed, the adsorbed gas molecules first diffuse physically on the surface of the semiconductor gas sensor, and then lose kinetic energy, part of them are evaporated, and some of them are thermally decomposed and chemically adsorbed. As a result, the resistance value changes with the adsorption of the gas to be measured. The change rule depends on the semiconductor material: the resistance value of the P-type semiconductor gas sensor increases; the resistance value of the N-type semiconductor gas sensor decreases. According to this feature, the type and concentration of the adsorbed gas can be known from the change in resistance, and the response time generally does not exceed 1 min.
(2) Structure and characteristics: semiconductor gas sensors can be divided into resistance type and non-resistance type according to the detection methods of different gas sensitive characteristic quantities. The surface controlled porous sintered gas sensor with SnO2 as gas sensing material is a mature and widely used gas sensor at present. It is composed of SnO2 sintering body, heater, electrode lead, plastic base and stainless steel wire mesh cover. During sintering, SnO2 between heater and measuring electrode is sintered together to make gas sensor. Finally, heater hot wire and measuring electrode are welded on the lead-out line of plastic base and covered with two layers of stainless steel wire mesh. SnO2 gas sensor can detect methane, propane, carbon monoxide, hydrogen, alcohol, hydrogen sulfide and other gases, and has the advantages of high sensitivity and fast response.
(3) Design of CO detection circuit with temperature and humidity compensation: TGS 813 type side heated SnO2 gas sensor is used in the detection circuit, which has high sensitivity to CO, good selectivity and good stability of temperature and humidity. Because SnO2 gas sensor is easy to be affected by ambient temperature and humidity, in order to improve the reliability of instruments and equipment, temperature and humidity compensation should be added in the circuit, and the components with good temperature and humidity performance should be selected. The temperature and humidity compensation circuit is composed of RT and R2-R6. The thermistor RT is connected with the gas sensor at the reverse end of operational amplifier U1, and forms a differential amplifier circuit with VR, R7 and R8, which is input to AD7705 after second-order band-pass filtering [9]. The resistance temperature coefficient of the thermistor RT is required to be the same or close to that of the gas sensor. When the ambient temperature increases, the absolute temperature increases, the resistance value of the gas sensor decreases, and its partial pressure decreases; at this time, when the resistance value of the thermistor decreases, the partial pressure of R3 increases, so as to realize compensation. In this way, the influence of temperature on the output of CO sensor can be reduced and the detection accuracy of the circuit can be improved.
Design of temperature detector
The programmable single bus digital temperature sensor DS18B20 produced by DALLAS Semiconductor Company is used for temperature detection. It has only one data line to receive commands and return the measured temperature data. It is miniaturized, low-power, and can directly output the measured results as serial digital signals. It is easy to connect with the microprocessor and has a long transmission distance. It is very suitable for on-site temperature measurement in harsh environment.
(1) Structure and interface circuit: DS18B20 is mainly composed of temperature sensitive element, temperature alarm trigger TH and TL, data buffer memory, storage controller, 64 bit laser ROM, single line data port and 8-bit CRC generator. Its internal structure is as Fig. 3.

DS18B20 internal structure diagram.
Using the special technology of single bus, it can be connected with microprocessor through serial port or other I/O port, and output the measured temperature directly without other conversion circuit. The temperature measurement range is –55 +125 □, and the measurement resolution is 0.0625 □. The chip contains a unique 64 bit read-only memory ROM modified by laser, so that multiple DS18B20 can be connected to one line by bus without confusion, which is convenient for multi-point temperature measurement at the same time. It contains parasitic capacitance and is suitable for various microprocessors. The user can set the upper and lower limit TH and TL of non-volatile temperature alarm. The maximum measuring distance is 150 m.
There are two ways to connect DS18B20 to the single-chip microcomputer, one is the external power supply mode, the pins VDD and GND are connected to the power supply and ground respectively, and the I/O is connected to any I/O line of the single-chip microcomputer; the other is the parasitic power supply mode. At this time, no external power supply is needed, VDD and GND are both grounded, and I/O is connected to any I/O line of the microcontroller. When the bus is high, the supply of stable power is realized by the pull-up resistor on the single wire; when the bus signal is low, it is powered by its internal capacitor. Regardless of the connection method, the I/O interface must be connected to a pull-up resistor of about 5 kΩ. In practical applications, the DS18B20 can be 150 m away from the microcontroller, and multiple DS18B20s can be connected in parallel at the same time.
(2) Software control: DS18B20 processing sequence: initialization; send ROM command; send function command. Initialization includes that the host sends a reset pulse, and then the host waits for DS18B20 to send back the existing pulse. DS18B20 waits for 15l6μs after detecting the rising edge of the reset pulse and then pulls down the single-wire bus for 60240μs to realize the transmission of the presence pulse. After initialization, send ROM commands, including search ROM command, read ROM command, comply with ROM command, skip ROM command and find alarm command [10]. Then send function commands, including temperature conversion command, write register command, read register command and so on. The command transmission is realized by writing sequence, and the host reads DS18B20 and transmits data by reading timing.
The smoke sensor uses the HQ-2 gas sensor, and its structure is as Fig. 4.

HQ-2 type smoke sensor structure diagram.
The resistance between A-B of HQ-2 gas sensor is tens of thousands of Ohm in smoke-free environment, and can be reduced to several thousand ohm in smoke-free environment. Once the gas sensor detects the presence of smoke in the surrounding environment, the resistance between A-B decreases rapidly. The smoke detection circuit is composed of HQ-2 gas sensor. The detection signal is input to AD7705 and then sent to MCU.
Clock circuit and reset circuit
The MCS-51 clock can be generated in two ways: external and internal. The external clock is generated by connecting the XTAL1 pin to ground and connecting the XTAL2 pin to an external oscillator. The internal clock uses the MCS-51 internal oscillator circuit, and connects the XTAL1 and XTAL2 pins with an external crystal and capacitors CX1 and CX2 to form a parallel resonant circuit to make the internal oscillator generate self-excited oscillation. The crystal oscillator is between 1.2 and 12 MHz. The typical value of the capacitor is between 20 and 100 pF. In this paper, the single-chip clock is generated internally, the crystal oscillator is 6 MHz, and the capacitance is 30 pF.
The design of the reset circuit of the single-chip microcomputer directly affects the reliability of the entire system. The reset methods of MCS-51 usually include: power-on automatic reset, manual button reset, reset method combining the above two, and using reset chip. The reset of this part uses the X5045 chip. X5045 is a programmable circuit that integrates three functions: watchdog, voltage monitoring and serial E2PROM. This combined design reduces the circuit’s demand for board space. The watchdog in X5045 provides protection for the system. When the system fails and exceeds the set time, the watchdog in the circuit will respond to the CPU through the RESET signal [11]. The voltage monitoring function of the circuit can protect the system from low voltage. When the power supply voltage drops below the allowable range, the system resets until the power supply voltage returns to a stable value. The memory of X5045 and the CPU are through serial communication interface, with a total of 4096 bits, and data can be placed in 512×8 bytes.
Power supply circuit
In this design system, there are many types of power supplies. In order to facilitate the design and reduce the components, the 78XX series and 79XX series of series three-terminal fixed voltage integrated voltage regulators are selected, which provide 1.5A rated output current and ±5 V, ±6 V, ±9 V, ±12 V, ±15 V, ±24 V and other stable voltages. The chip is equipped with protection circuits such as short circuit, overheating and adjustment tube, safe working area, etc., which requires few external components, and is convenient and reliable to use. 7805, 7905, 7812 and 7912 are selected in this system. The transformer inputs 220 V industrial frequency power, adopts full bridge rectification and capacitor filtering methods. After the voltage is rectified, a large-capacity electrolytic capacitor C10 is used for filtering, but this cannot suppress the high-frequency interference from the power supply side. The higher the frequency, the greater the inductance, which is why the high-frequency capacitor C12 after the rectification circuit is indispensable. The function of the capacitor at the output of the regulator is to improve the transient response, so that the instantaneous increase or decrease of the load current will not cause a large fluctuation in the voltage.
A/D conversion circuit
This article selects a new type of A/D chip AD7705 recently launched by American AD Company. AD7705 chip is a ¦²-Δ A/D converter with self-tuning function. Its internal is composed of multi-channel analog switch, buffer, programmable gain amplifier (PGA), sigma delta modulator, digital filter, reference voltage input, clock circuit and serial interface. The serial interface includes register group, which is composed of communication register, setting register, clock register, data output register, zero correction register and full range correction register.
AD7705 has 2 channels, can carry on the conversion of two kinds of analog quantities, the interface with the microprocessor is very convenient. In the process of its operation, the pins involved with the microprocessor interface are /CS, SCLK, DOUT, DIN and /DRDY, and AIN1 (+) and AIN2 (+) pins are the signals collected by CO and smoke sensors respectively.
Communication network structure of upper and lower computers
Bluetooth technology
Bluetooth is an alternative cable technology. Through the establishment of an international open standard for universal air wireless signal transmission interface and its control software, different digital devices can have the same operation performance within a certain distance without wires or cables. Bluetooth supports point-to-point and point-to-multipoint connections. The topology of Bluetooth network includes peak network and scatter network.
Peak network: Bluetooth is the most basic network, composed of master and slave devices. The master equipment is responsible for providing clock synchronization signal and frequency hopping sequence, and the slave equipment is controlled to synchronize with the master device. There is only one master device in the peak network, which supports up to seven slave devices to establish communication with the master device [12]. The master device uses different frequency hopping sequences to identify and communicate with each slave device. The ID of the master device determines the frequency hopping sequence, and the system clock determines the phase of the frequency hopping sequence; for the slave device, the system clock plus an offset is synchronized with the master device clock.
(2) Scatternet: Bluetooth allows multiple picknets to coexist in one area. Several picknets in a region form a scatter network. Bluetooth uses a packet-based transmission method connected in a time slot. A device can join multiple picknets. But can only join one Picknet at a certain time, and the Bluetooth device can change its identity when jumping to another Picknet, that is, the master device becomes a slave device. Several picket nets can be connected together, and each peak net can be identified by frequency hopping sequence. All users of the same peak network are synchronized with the frequency hopping sequence, and its topology is described as “multi peak network”. In a “multipeak network” architecture, the full duplex data rate exceeds 6 MB / s in the case of an independent peak network with 10 full loads. In the case of no data transmission, Bluetooth system can adopt low-power mode to keep the connection of piconet devices. There are three low-power modes: hold, breath / listen and sleep.
Bluetooth communication protocol structure
Bluetooth protocol is the rule that Bluetooth devices should abide by when exchanging information. Like the open system interconnection model, the protocol architecture of Bluetooth technology also adopts a hierarchical structure, forming a Bluetooth protocol stack from the bottom to the top. Each layer of protocol specifies the functions completed and the data packet format used, and provides the interface between the upper and lower layers. All Bluetooth equipment manufacturers must strictly abide by the requirements and regulations in the Bluetooth protocol to ensure interoperability between Bluetooth products [13]. The bottom layer of Bluetooth protocol architecture is RF protocol, and the higher layer is baseband and link control protocol, link manager protocol and logical link control and adaptation protocol. There is also a host control interface between the baseband and link control protocol and the logical link control and adaptation protocol. The other higher level protocols include serial cable simulation protocol, service discovery protocol, etc.
Host controller interface HCI is the interface between software and hardware in Bluetooth protocol. It provides a unified command interface to call hardware such as lower baseband, link management, status and control registers. Protocol software entities above HCI protocol run on the host, while functions below HCI are completed by Bluetooth devices, and they interact through the transport layer. Logical link control and adaptation protocol is the basis of other upper layer protocols and the core of Bluetooth protocol stack. Service discovery protocol provides a mechanism for the upper application to discover the available services and their characteristics in the network. According to the ETSI standard TS07.10, RFCOMM serial port simulation protocol simulates the function of 9-pin RS-232 serial port on L2CAP. The telephone control protocol specification provides call control commands for voice and data between Bluetooth devices.
Serial communication interface design
Bluetooth module ROK101007
In this paper, the Bluetooth module ROK101007 produced by Ericsson company is selected to realize the communication between upper and lower computers. The internal structure and external pins of ROK101007 Bluetooth module mainly include the following functional modules: baseband controller, voltage regulator, flash memory, RF module and 13 MHz crystal oscillator. The baseband controller is responsible for the functions of Bluetooth baseband, with UART, USB and PCM interfaces, it provides the physical connection of host control interface transmission layer, and is the communication channel between high-level and physical modules. Its function is realized through a UART or USB hardware module and firmware running in the baseband controller [14]. Baseband controller and RF module provide safe and reliable wireless link for higher level. The voltage regulator is mainly used to filter and adjust the supplied voltage.
Interface circuit between lower computer and Bluetooth module
This system selects its typical value +3.3 V. In view of the operating voltage of the single-chip microcomputer is +5 V, the level conversion chip 74LVTH245 is used for power conversion. The interface circuit of the MCU and the Bluetooth module uses the UART of the Bluetooth chip as the interface for data communication. At this time, the Bluetooth module is used as a digital circuit terminal device, and its serial transmission rate can reach 460 kbit/s. 74LVTH245 is an 8-bit level converter, which converts +5 V signals into +3.3 V that the ROK101007 Bluetooth module can accept. In actual applications, a 16-bit level converter is required, so two 74LVTH245s are connected in parallel to form one.
Bluetooth module and host computer interface circuit
This article uses standard serial port RS-232 to connect, and connects the Bluetooth module to the PC as an additional accessory and card. Since the logic level specified by RS-232 is opposite to the logic level of general microprocessor and single-chip microcomputer signals, negative logic is adopted. Logic 0 is defined as between +5 V and +15 V, and logic 1 is between –15 V and –5. Therefore, in actual applications, in order to match the level of the Bluetooth module, the TTL and CMOS levels must be converted to RS-232 levels, or the two must be inversely converted. These two conversions can be converted by a dedicated level conversion chip achieve. This article uses MAXIM’s MAX232 to complete level conversion, which has a power supply voltage converter inside. MAX 232 chip upper computer interface circuit. The Bluetooth module can be directly connected to the serial ports of the MCU system and the PC system respectively.
Software design of fire alarm system
Software design of area alarm controller
The software of regional alarm controller is written with Delphi programming language. Delphi programming language is a visual object-oriented programming language. This method is different from the usual structured programming, it supports a concept, and then aims to make the solution of computer problems closer to human thinking activities. In addition, Delpih is a visual programming language, which makes it convenient for programmers to develop programs with friendly interface.
The basic function design requirements of the regional alarm controller software, first of all, to be able to manage each fire detector, including querying the relevant information of fire detector, modifying the relevant information of fire detector, adding and deleting fire detector. During the running of the software, the working state of the fire detector can be observed at any time on the interface. Secondly, it should be able to accurately identify the location of the fire detector in case of fire or failure, and display relevant alarm information on the interface to prompt the operator to deal with it. In addition to the alarm, the system will print out the alarm information in addition to the alarm information. Finally, the software should complete the communication between the regional alarm controller and each fire detector. RS485 interface is used to communicate between the area alarm controller and the fire detector. The communication program completes the inspection of fire detectors, receives the data sent by fire detectors, and completes the data exchange with fire detectors.
Fire detector software design
The core control device of fire detector is based on 51 single-chip microcomputer. Considering the efficiency of software execution and the difficulty of programming, the internal software of single-chip microcomputer is written with C5l and assembly language. C language is a general computer programming language. It can be used to write computer programs and general programs. The C5l language used in this system is KeilC5l which is popular now. KeilC51 is a high-efficiency C language compiler specially designed for 8051 single-chip microcomputers developed by Keil Software in Germany. It complies with ANSI standards. The generated program code runs at a very high speed, requires very little memory space, and fully complies with assembly language.
When the software program of fire detector MCU starts to run, it first collects the signal of photoelectric smoke detector and temperature detector. After the signal and processing, it can judge whether the current result can obviously judge whether there is a fire [15]. If the fire can be judged, the fire alarm signal will be output, and the fire alarm will be informed to the regional alarm controller, and the corresponding processing will be done on the regional alarm controller. If it is judged that the temperature rises abnormally or the smoke signal reaches the abnormal value in a short time, the warning signal will be sent out, and the change trend of the temperature and smoke signal will be further concerned. If the trend continues to rise, the alarm will be given and follow-up work will be carried out, otherwise the alarm will be cancelled. If it is not obvious to judge whether there is a fire according to the preprocessed information, such as when the probability of smoldering fire is similar to that of no fire, the signals of the three detectors are input into the neural network with the signals collected by the CO detector.
Communication module design
One of the most important functions of the system software is to realize the communication between the regional alarm controller and the fire detector. The link between the detector and the fire alarm system plays an important role in the fire alarm system. Because RS485 communication interface is selected, MSComm control is chosen in programming. Microsoft communication control is an ActiveX control for serial communication under windows provided by Micorsoft Company. This control has rich properties and events closely related to serial communication, and provides a series of standard communication command interfaces. It can be used to create full duplex, event driven, efficient and practical communication program.
The communication process is that the regional alarm controller sends patrol data packets to each fire detector in turn. After receiving the data packet, the fire detector checks the address code of the fire detector contained in the data package. If it matches its own address code, the data packet is sent to itself. Otherwise, the packet is discarded without any response. In order to ensure the reliability of data packet transmission, the last byte of each packet transmits the check sum receiver calculated by the whole packet. The check of data packet is calculated by the same method, and compared with the check sum in the data package, if consistent, the data packet transmission is considered to be correct. Otherwise, it is considered that the transmission of the packet is wrong and the sender is required to retransmit the packet.
The software implementation process of the fire accident alarm system is: when the fire detector judges that there is a fire, it sends the fire alarm to the regional alarm controller. The regional alarm controller analyzes the detectors around the alarm detector and finally judges whether there is fire. If there is a fire, it sends a signal to start the corresponding linkage device to realize the extinguishing fire. In the whole process, the controller sending the fire alarm is in the waiting state until receiving the signal from the regional alarm controller whether to start the linkage. However, the waiting time is required. If the return information from the area controller is not received within the specified time, the fire detector will try to send it again. If the return signal still cannot be received within the specified time, the fire detector will no longer wait for the return signal, override the level to operate the linkage device, start the linkage device to realize automatic fire extinguishing.
Algorithm design of fire alarm system
Principle of fuzzy recognition
Fuzzy recognition is a kind of recognition technology which does not depend on the mathematical model of the identified object. This technique needs to use the prior knowledge of domain experts to approximate reasoning. The structure of fuzzy recognition system is as Fig. 5.

Structure diagram of fuzzy recognition system.
(1) Input and output of fuzzy calibration:
Taking the smoke concentration signal of one of the input variables as an example, the upper and lower limits of the concentration signal should be determined as the error universe, and then the fuzzy level of the concentration signal should be given, and then the membership functions of these fuzzy sets should be established. The temperature signal and fire alarm probability can also be similarly processed respectively, so that three sets of fuzzy sets {A i }, {B i } and {C i } are constructed, which respectively represent the fuzzy quantization levels of the smoke concentration signal, temperature signal and fire alarm probability.
(2) Establish control rule table:
Establishing control rules is the core of designing fuzzy identification systems, and they always appear in the form of “if...then...”. Taking the identification system of temperature signal T, smoke concentration signal S and fire probability P as an example, the rule can generally be expressed as: “If T is A i and S is B i ; then P is C i ”, or abbreviated as: “If A i and B i then C i .
(3) Establish control reasoning relationship
Each identification rule is a fuzzy sentence, and all the rules are exactly a set of multiple compound fuzzy implications. According to the provisions of fuzzy reasoning, the i rule corresponding to the reasoning relationship R
i
can be expressed as:
All n rules corresponding to the inference relationship R
i
can be expressed as:
The relationship R is a summary of all fuzzy identification rules, which determines the performance of the fuzzy identification system.
(4) Generate input and output rule table:
If the temperature signal T is A* and the smoke concentration signal S is B*, this can be obtained by fuzzy inference from the fuzzy relationship R:
The C* thus obtained is a fuzzy set in the domain of identification. C * (u) gives the degree of membership of each probability, and the fuzzy identification output must be unfuzzified, that is, fuzzy decision.
The system first performs a series of processing on the output analog signals of the CO gas sensor and the smoke sensor, including shaping filtering, amplification, and A/D conversion, and then normalizes the signals so that they can be used by the system. In the control system, the actual variation range of the input is called the basic domain of these variables, which are denoted as [- x, x] respectively. Suppose the domain of the input is:
In the formula (4), x represents the precise quantity that characterizes the input quantity, and the value of m depends on the actual data. The universe of discourse is transformed by the so-called quantization factor. The quantization factor k is defined as:
Suppose the output of the middle layer is O
m
and the output of the output layer is O
p
, then:
In formula (6), IN represents the input signal vector, w1, w2 represents the weight vector of the input layer and the middle layer, the middle layer and the output layer, θ1, θ2 represents the threshold vector of the input layer and the middle layer, the middle layer and the output layer, and f represents Sigmoid function. The network learning algorithm uses the BP algorithm, and the network error function is defined as:
In formula (7), O T is the expected output of the system, and O P is the actual output of the system. Based on a step-descent method, the network weights and node thresholds are adjusted to minimize the network error function. In order to further improve the accuracy of the system fire detection, the output of the neural network is fuzzified, and finally the fire alarm model is output through the fuzzy inference system. Because the fire signal is a kind of gradual change signal, even if the interference noise can cause large output, it is generally only a short time. Therefore, taking the duration of fire probability as the input variable of fuzzy reasoning system can further reduce the system false alarm. Through the above steps, the fuzzy recognition algorithm is used to set the input and output, establish the control rule table and reasoning relationship, generate the input and output rule table, preprocess the sensor signal, and finally output the fire alarm model through the fuzzy inference system, so as to realize the design of the fire accident alarm system based on the fuzzy recognition algorithm.
Setting up the experimental environment
In order to verify the effectiveness of the fire alarm system of the smart camera based on the fuzzy recognition algorithm, the experiment uses a computer configured with: Inter Core i5-3470 processor, 6.00 G memory, 800 G hard disk, and 32-bit Windows7 operating system. In the Matlab environment, the C++ language was used to develop a smart camera fire alarm system based on fuzzy recognition algorithm to realize and verify its performance.
Comparison results of system fire detection accuracy
The fire alarm system is established in fuzzy logic. The reference [4] method, the reference [5] method and the proposed method are used to collect field data, and 800 groups of effective data are obtained. The collected data are normalized. The expected output is no fire probability, open fire probability, smoldering fire probability and fire probability. Compare the fire detection accuracy of different methods as Fig. 6.

Comparison of fire detection accuracy of different methods.
It can be seen from Fig. 6 that the expected output position of the fire alarm system based on the reference [4] method and the reference [5] method has deviated greatly from the actual output, while the expected output of the fire alarm system using the proposed method is basically consistent with the actual output, that is, the training of the fuzzy neural network model is successful. When the network input deviates from the sample data, the actual output curve is basically consistent with the expected output curve, that is, after the fuzzy neural network operation, the system can early judge the occurrence of fire and achieve satisfactory results. It can be seen that the fire detection accuracy of the proposed fire alarm system is high, because the proposed method fuzzizes the output of the neural network, and finally outputs the fire alarm model through the fuzzy inference system, thus improving the fire detection accuracy of the fire alarm system.
In order to further verify the false alarm rate and false alarm rate of the intelligent camera fire alarm system based on fuzzy recognition algorithm, the reference [4] method, the reference [5] method and the proposed method are used to compare the false alarm rate and false alarm rate of different methods as Table 1.
Comparison of false positive rate and false positive rate of different methods
Comparison of false positive rate and false positive rate of different methods
According to the data in Table 1, when the effective data amount is 800, the system missing report rate of reference [4] method is 1.8%, the system false positive rate is 2.0%, the system missing report rate of reference [5] method is 3.6%, the system false positive rate is 2.2%, while the system missing report rate of proposed method is only 0.3%, and the system false positive rate is 0.2%. Therefore, compared with the reference [4] method and the reference [5] method, the system false positive rate and missing report rate of the proposed method are lower. Because the fuzzy recognition algorithm is used in the fire alarm system, the smoke, temperature and photoelectric signals after data fusion are taken as the input signals of the fuzzy algorithm, and the membership function is trained. On this basis, fuzzification, fuzzy reasoning and defuzzification are carried out to obtain the probability of fire. The system combines the advantages of fuzzy system and improves the sensitivity and sensitivity of the system the intelligent degree effectively solves the contradiction between accuracy and false alarm rate.
The intelligent camera fire alarm system based on fuzzy recognition algorithm is designed in this paper, which gives full play to the advantages of fuzzy recognition algorithm. The fire alarm system has high accuracy of fire detection, and can effectively reduce the rate of false alarm and false alarm. However, in the process of fire detection of fire accident alarm system, the authenticity of experimental environment conditions is low when network training samples are collected by simulation experiment. Therefore, in the next step of research, we will establish the approximate real environment conditions to obtain more representative data.
Footnotes
Acknowledgments
This project is supported by the National Natural Science Foundation of China (No.: 51479159).
