Design of three-port gateway for intelligent monitoring system of fire indicator lights

Publisher:温馨生活Latest update time:2010-12-28 Source: 微型机与应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Abstract: A fire indicator light intelligent monitoring system with a two-level ring bus network topology and master-slave communication mode is proposed. The overall structure of the communication gateway using a battery to provide emergency power is designed . The dual serial ports of the microcontroller are used to form two independent photoelectrically isolated RS-485 interfaces as the lower ring bus master station to exchange data with the intelligent emergency sign light. The SPI interface function of the microcontroller and another microcontroller are used to expand the third independent photoelectrically isolated RS-485 interface as the slave station of the upper ring bus network to realize the exchange of status and command information with the monitoring host. The system network topology and the communication software structure based on the Modbus protocol are given.

With the development of society, a large number of high-density and large-scale buildings have emerged, making fire escape routes more complicated and increasing the difficulty of escape when a fire occurs. For fire evacuation, how to make escape safer, more accurate and faster when a fire occurs is a new issue raised by the times for building disaster prevention. At present, most fire emergency sign lights exist as single units, and it is impossible to dynamically adjust the escape direction indication according to the changes at the fire scene. In addition, there is also a serious lag in the daily maintenance and inspection of emergency sign lights.

The main function of emergency sign lights is to start in case of fire, and the key to emergency start is whether the battery charging and discharging work properly. It is difficult to find product problems in time by relying on human maintenance and repair, which often brings many blind spots to escape and evacuation instructions in case of fire. Increasingly high public safety requirements have made fire emergency sign lights develop from independent work to intelligent fire emergency lights monitoring system. When a fire comes, the system can quickly and accurately collect information on the fire scene, intelligently select the best escape route, and guide people to escape correctly through hearing, vision and other senses by centrally controlling fire emergency lights in the form of light flow, voice and strobe. The system can also continuously inspect the operating status of intelligent emergency lights, detect lighting failures in time, and improve the reliability and emergency safety of the entire system.

Figure 1 shows the fire emergency lighting intelligent monitoring system with a dual ring bus topology, including upper monitoring computer, relay gateway and intelligent fire emergency lighting, which communicate with each other through a two-level RS-485 ring bus. All control commands are issued by the monitoring computer, transmitted to the relay gateway through the first-level bus loop, and then transmitted to each lamp by the relay gateway through the second-level bus loop network. After the lamp executes the command, it returns the execution result through the second-level and first-level loops in turn. In this system, the monitoring computer obtains fire source information from the fire alarm system (FANS), makes intelligent decisions to select the optimal escape route, transmits the command information to the relay gateway through the bus network, and then the relay gateway sends it to each lamp to indicate a safe and reliable escape route.

Fire emergency lighting system with dual ring bus

Figure 1 Fire emergency lighting system with dual ring bus.

The bus topology is simple, easy to control, and easy to expand, so most fire protection and access control systems currently use this topology. The ring network also has good reliability. If the ring bus is disconnected somewhere, it can be divided into two bus networks, connected to the two interfaces of the master station respectively, and the information exchange between the master station and the slave station can still be guaranteed, which greatly improves the reliability of network transmission. Another advantage of the two-level ring bus structure is that multiple loops can work in parallel, balancing and reducing the communication load on a single bus.

In an emergency, emergency lights and their monitoring systems have two power supply modes: centralized power supply and independent power supply. In an emergency, each lamp and all relay gateways in the centralized power supply system obtain working power from the same dedicated emergency power supply , while the working power of the independent power supply system is provided by the battery of each lamp or gateway. Therefore, it is very important to monitor the energy storage performance of the battery and ensure the availability of the battery. The battery voltage can be checked at any time through the control command, and it can also be checked regularly every month and every year.

1 Three-port gateway design

1.1 Overall structure

In the emergency light intelligent monitoring system shown in Figure 1, the relay gateway serves as the connection between the upper and lower loops and is a transfer station for exchanging data between the monitoring computer and the lamps. Its structure and function design are important contents of the entire system design.

Figure 2 is the overall structure of the independent power supply relay gateway. In the main power state, the working power is obtained through the mains. In the emergency state, the working power is provided by the built-in battery. The gateway has the functions of power conversion and battery charging and discharging control. In the entire fire emergency system, the relay gateway can query the status of the loop lamps through normal sampling and setting lamps. When communicating with the lower computer node, the first node ID and the function code and their data items and the data frame formed by the check code will be sent to the first node through the RS-485 bus, and then it will change to the receiving state, receiving the data frame sent by the first node and parsing it. When the lower computer node sends a fault alarm, the alarm information will be displayed on the LCD screen and the sound and light alarm will be activated. Since there is a timer in the monitoring host program , if the node fails to send back the data frame within a certain period of time, it will prompt an abnormality and remind relevant personnel to check. If no alarm information appears, the next node will be polled.

Independent power supply relay gateway structure diagram

Figure 2 Structure diagram of an independently powered relay gateway.

The system uses the master-slave communication protocol, and both levels of the ring network use the RS-485 bus. In the system network topology, the relay gateway acts as the slave station of the first-level loop bus network, and is also the master station of the second-level loop. The relay gateway requires three serial ports, one of which is responsible for receiving the monitoring computer commands and sorting out the information of the lamps and the gateway itself and then feeding it back. The other two serial ports just form the loop master station, one for sending and one for receiving. If the loop is disconnected, both can be used for sending.

In this design, the STC12C5A32S2 (hereinafter referred to as STC12) microcontroller with two serial ports is selected as the main control chip. It has two asynchronous serial interfaces (UART), one synchronous serial port (SPI), and the same 256 B internal RAM as ordinary microcontrollers, as well as an extended 1 024 B external RAM, and 28 KB EEPROM . The large storage space facilitates the connection of lamps and the storage of large amounts of data [5]. The two serial ports of the STC12 microcontroller are designed as 1# and 2# RS-485 interfaces, which serve as the master station of the second-level loop. Another serial port needs to be extended to form 0# RS-485 interface, which serves as the slave station of the first-level loop.

1.2 Serial port expansion

There are two ways to expand the serial port: (1) Hardware expansion. Use the serial port expansion chip on the market (SP2338DP, GM8123 series).

Here, the frame format is not programmable [6]. (2) Software simulation method. According to the transmission format of serial communication, the timing of serial communication can be simulated by using the timer and the I/O port of the host to achieve the purpose of expanding the serial port. The start bit needs to be detected during the reception process, which can be processed using the query method or the interrupt method. During the reception and transmission process, the timing can be processed using either the query method or the timer interrupt method. However, this method requires a lot of CPU time and can only be used in applications with simple functions. It is not suitable for complex devices such as relay gateways.

Considering factors such as cost and performance, this design uses the synchronous serial port (SPI) of the STC12 microcontroller and another microcontroller with a serial port, STC11F04E (hereinafter referred to as STC11), to expand the serial port. The principle is shown in Figure 3. TX and RX are the data transmission signal and data receiving pins of the serial port respectively. RE is used to control the receiving or transmitting state of MAX485 .

The lower part of the figure shows the principle of the photoelectric isolation RS-485 interface. The three RS-485 interfaces use the same principle, but the working power supply of the MAX485 chip in the three interfaces is independent.

In Figure 3, SCK, MISO, and MOSI are the clock signal, master input signal, and master output signal of the SPI interface, respectively. The SPI interface of STC12 is defined to work in slave mode, and STC11 is used as the SPI master. Since the STC11 microcontroller does not have SPI function, the SPI master function must be simulated by software. Here, STC11 is only used as a transit station for byte data transmission, and no information frame verification, storage, or conversion is performed. The monitoring computer sends instructions, which are received by the serial port of STC11 and sent to STC12 through SPI for processing. STC11 then receives the return information through SPI, and then sends it to the monitoring computer through the serial port. In the design, STC12 tells STC11 to start the simulated SPI master function through the output falling edge of the SPI_TX pin, and reads a byte of data from the SPI interface register of STC12.


Figure 3 Circuit structure of using SPI to expand the serial port .

[page]

Figure 4 is a program flow chart of the MCU using the query method. RI and TI are the serial port receiving flag and sending flag respectively. TX_FLG = 0 means STC11 is in the receiving state, and TX_FLG = 1 means the sending state. The subroutine SPI_BYTE realizes the simulation of the SPI master station function.

STC11 MCU flow chart of extended serial port

Figure 4 Flowchart of the STC11 microcontroller with extended serial port.

1.3 Ring bus master station software structure

In the second-level loop communication, the relay gateway acts as the loop master, which is realized by two RS-485 ports consisting of serial port 1 and serial port 2 of the STC12 microcontroller. The three communication ports are equipped with independent receive (RX) buffer, transmit (TX) buffer and dedicated flag register.

The software structure of the master station for loop communication is shown in Figure 5. In normal operation, one of the two serial ports is used as a sender and the other as a receiver. The received data of the receiver is compared with the sent data of the sender. If they are equal, the loop bus is connected; otherwise, the bus has a circuit breaker fault, which is indicated by the flag bit LP_BRK=1.

Note: The serial port working cycle includes three parts: the serial port sending process, the waiting process for the lower computer to receive, and the serial port receiving process.


Figure 5 Ring bus master station communication flow chart.

When the loop bus is intact, the online lamps are always connected to both serial port 1 and serial port 2. When the loop is disconnected, send a command from serial port 2 (or serial port 1) to each lamp. If the correct response data is received, the lamp is recorded as being connected to the port, indicated by the flag ON_COM2 = 1 (or ON_COM1 = 1); if the response information times out or the returned information is incorrect, resend the same command data up to 3 times. If the correct response signal is still not received, it is determined that the lamp is not connected to the sending port, indicated by ON_COM2 = 0 (or ON_COM1 = 0). In this way, the location of the loop disconnection can be determined according to the different serial ports to which each lamp is connected.

When the loop is disconnected, both serial ports act as command senders, and the entire loop is divided into two single bus structures, which improves network transmission reliability.

The intelligent monitoring system of emergency lights is based on a two-level RS485 bus ring communication network. A three-port communication gateway is designed to realize the exchange of commands and status information between the monitoring computer and a large number of intelligent emergency lights. The monitoring computer manages the entire system, and the gateway is responsible for transmitting information sent to the intelligent emergency lights, and also feeds back the information received from the lamps to the monitoring computer.

In addition, the intelligent emergency sign lights in the loop can be directly controlled without the monitoring computer. After debugging, the preset functions are fully realized.

Reference address:Design of three-port gateway for intelligent monitoring system of fire indicator lights

Previous article:Cortex-M3-based STM32 microcontroller handles advanced motor control methods
Next article:Design of shadow detection and removal method in pedestrian video detection

Latest Security Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号