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

Publisher:一条属马的龙Latest update time:2015-10-15 Source: eechina Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The intelligent monitoring system of fire indicator lights with two-level ring bus network topology and master-slave communication mode is proposed. The overall structure of the communication gateway with battery to provide emergency power supply 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 realize data exchange with the intelligent emergency sign lights. 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 Modbus protocol are given. 

With the development of society, a large number of high-density super-large buildings have emerged, resulting in more complex fire escape channels 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 for building disaster prevention in the era. 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 in the fire scene. In addition, there is a serious lag in the routine maintenance and inspection of emergency sign lights.

The main function of emergency sign lights is to start in an emergency in the event of a fire, and the key to emergency start-up lies in whether the battery charging and discharging work properly. Relying on manual maintenance and inspection, it is difficult to find product problems in time, and often brings many blind spots to escape and evacuation instructions in the event of a fire. The increasingly high public safety requirements have led to the development of fire emergency sign lights from independent work to intelligent fire emergency light monitoring systems. When a fire comes, the system can quickly and accurately collect information on the fire scene, intelligently select the best escape route, and centrally control fire emergency lights to guide people to escape correctly in the form of light flow, voice, and strobe from the senses of hearing and vision. 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 a fire emergency lighting intelligent monitoring system using a dual ring bus topology, including a host monitoring computer, a relay gateway, and intelligent fire emergency lights, 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 the 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.






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 ways of 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 detected at any time through control commands, and regular inspections can also be performed every month or 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 a 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 diagram of the independent power supply relay gateway. In the main power state, the working power is obtained through the mains. In an emergency, the working power is provided by the built-in battery. The gateway has power conversion and battery charging and discharging control functions. In the entire fire emergency system, the relay gateway can query the status of the loop lamps through the usual sampling and setting lamps. When communicating with the lower computer node, it will send the first node ID and the data frame formed by the function code and their data items and the check code to the first node through the RS-485 bus, and then change to the receiving state, receive the data frame sent by the first node and parse it. When the lower computer node sends a fault alarm, the alarm information is displayed on the LCD screen and the sound and light alarm is 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 the relevant personnel to check. If no alarm information appears, the next node will be polled.






Figure 2 Structure diagram of the independent power supply relay gateway.

The system uses the master-slave communication protocol, and the two-level ring network uses the RS-485 bus. In the system network topology, the relay gateway is the slave station of the first-level ring bus network and the master station of the second-level loop. The relay gateway needs three serial ports, one of which is responsible for receiving the monitoring computer command 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 single-chip microcomputer STC12C5A32S2 (hereinafter referred to as STC12) with two serial ports is selected as the main control chip. It has two asynchronous serial interfaces (UART), one synchronous serial interface (SPI), and the same 256 B internal RAM as ordinary single-chip microcomputers, 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. The two serial ports of the STC12 single-chip microcomputer are designed as 1# and 2# RS-485 interfaces as the master station of the second-level loop. Another serial port needs to be extended to form 0# RS-485 interface 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 chips on the market that expand the serial port (SP2338DP, GM8123 series).

The frame format is not programmable here. (2) Software simulation. According to the transmission format of serial communication, the timer and the I/O port of the host can be used to simulate the timing of serial communication 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 STC11F04E (hereinafter referred to as STC11) with a serial port to expand the serial port. The principle is shown in Figure 3. TX and RX are the data transmission signal and data receiving pin of the serial port respectively. RE is used to control the receiving or transmitting status of MAX485. The

lower part of the figure shows the principle of the photoelectric isolation type 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 informs 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. [page]




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

Figure 4 is a program flow chart of the microcontroller using the query mode. RI and TI are the serial port receiving flag and sending flag respectively. TX_FLG = 0 indicates that STC11 is in the receiving state, and TX_FLG = 1 indicates the sending state. The subroutine SPI_BYTE implements the simulated SPI master function.





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

1.3 Software structure of the ring bus master

In the second-level loop communication, the relay gateway acts as the loop master, which is implemented by two RS-485 ports consisting of serial port 1 and serial port 2 of the STC12 microcontroller. The three communication ports are respectively equipped with independent receiving (RX) buffers, transmitting (TX) buffers and dedicated flag registers.

The software structure of the loop communication master is shown in Figure 5. During normal operation, one of the two serial ports acts as a sender and the other as a receiver. Compare the receiving data of the receiver with the sending 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 ring bus is intact, the online lamps are always connected to both serial port 1 and serial port 2. When the loop is disconnected, send commands from serial port 2 (or serial port 1) to each lamp. If the correct response data is received, record that the lamp is connected to the port, and use the flag ON_COM2 = 1 (or ON_COM1 = 1) to indicate; 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, and ON_COM2 = 0 (or ON_COM1 = 0) is used to indicate. In this way, according to the different serial ports connected to each lamp, the location of the loop disconnection can be determined.

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 the reliability of network transmission.

Based on the two-level RS485 bus ring communication network, the emergency light intelligent monitoring system is designed with a three-port communication gateway to realize the exchange of command 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 also 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:Design of dynamic adjustment system of traffic signal lights based on CAN bus
Next article:Scanning control and data acquisition of microwave imaging using MSP430

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号