Design of Multi-channel Power-off Alarm System Based on Keyboard Scanning Algorithm

With the development of modern communication technology, the application of technical equipment in aviation systems, military, industrial and other fields has become the fundamental guarantee for business operation. Most equipment requires 24 hours of uninterrupted power supply, which requires intelligent detection and real-time power supply. Monitoring, in order to deal with power outages in a timely manner, to ensure the normal operation of equipment. In practical applications, in order to ensure sufficient time to repair the power-off line, multi-channel power supply is usually used in the power supply of the equipment to form a main, second, and third emergency framework. Therefore, real-time detection of power-off lines and alarming in multi-channel power-off lines has become the key to returning to normal power supply in time. This paper proposes an intelligent keyboard scanning algorithm based on the design of the relevant detection hardware circuit and monitoring software to intelligently detect and alarm and remotely monitor the multi-channel power supply system.

1 system structure

The system has been put into use in the beacon station of the civil aviation station of the civil aviation department of Shantou. The following is a brief description of the basic structure of the design.

The hardware part of the system is mainly composed of the detection hardware circuit, AT89C51 single-chip microcomputer and its related components and PC. The software part is the keyboard coding of the power-off signal, the improvement of the keyboard scanning algorithm and the design of the PC monitoring software. The specific implementation is to send a power-off signal to the single-chip microcomputer through the detection circuit, and the single-chip computer obtains the keyboard code corresponding to the power-off line through the keyboard scanning algorithm, and the PC monitoring software sends the different key codes to the relevant alarm processing through the serial port communication, such as Figure 1 shows.

In the beacon station room, there are mains input 1, mains input 2 and oil electromechanical input 3 power supply. Normally, the normal situation is that the two mains are the main standby, and the oil machine does not generate electricity (the two mains are disconnected). When the electricity is on, the oil machine starts the power generation emergency). Therefore, there are four power supply states:

(1) Normal situation, 2-way mains supply, oil machine standby;

(2) Only one mains power supply, the other mains failure, the oil machine standby;

(3) The two-way mains electricity has failed, and the oil machine starts to generate electricity;

(4) The 2-way mains has failed and the oil machine has not started.

For the above four states, the A state can be set to the initial state of the monitoring system, and the rest has four power-off states (two cases of the B state). The keyboard is coded separately, so that each power-off state has a unique key code corresponding to it. The circuit design uses a 2×4 keyboard, and the hardware circuit is shown in Figure 2. Through the key code identification, the monitoring software on the PC can judge the power failure line to raise an alarm in real time.

2 system design

2.1 Hardware Design

As shown in Figure 2, the circuit uses a photocoupler for strong electrical isolation, which acts as a lightning protection and converts the analog signal into a digital signal for A/D conversion. The input 220 V AC is rectified by the rectifier diode D1 and filtered by the capacitor C1 to form a direct current.

The current is divided into two paths, one through the R1 current limiting resistor to make the indicator LED emit light; the other is sent to the photocoupler 4N25 after R2 current limiting, illuminating the internal light emitting diode, so that the phototransistor is turned on, in the photocoupler 4 The foot gets a high level. When the input 220 V AC power is cut off, the voltage at the input of the optocoupler disappears, the LED is extinguished, the phototransistor is turned off, and the 4 pin gets a low level. After the relevant logic circuit processing, the control relay is closed (the relay replaces Keyboard button). Thereby, the power-off signal is simulated into a state in which the keyboard is pressed, which facilitates the next processing.

2.2 MCU improved keyboard scanning algorithm

In the case of multi-channel power supply, it is possible to identify the multi-channel power failure by performing keyboard coding on the line power-off signal. Due to the real-time and accuracy requirements of the circuit, an improved keyboard scanning algorithm was adopted. Experiments show that the algorithm has a good effect in the application of the system. Real-time detection of power-off signals is an important indicator of system accuracy. Since the traditional keyboard scanning algorithm masks interrupts while the jitter algorithm is called, it is necessary to improve the keyboard scanning algorithm.

The algorithm improvement is mainly divided into three steps: first, set the interrupt variable in the interrupt running program, and record the running times. Determine whether the number of interrupt executions meets the delay time, and then judge whether the keyboard is pressed (that is, whether the power-off signal is true). Secondly, each time the keyboard scan analysis program is called, it takes 10 ms to synchronize. When the button is detected for the first time, only one flag is set. When the button is detected for the second time (10 ms after the first detection of the button) Key analysis to achieve alarm accuracy while improving the real-time performance of the system. Finally, the system encodes the signal according to different states. The three-way circuit is composed of four unified independent key codes due to four different states, which reduces the complexity of the key code analysis and improves the real-time performance of the system.

2.3 Design of monitoring software based on VC++6.0

Design monitoring software on VC++6.0 platform. The software is mainly composed of three parts: system setting, running status and status display. The interface is simple and convenient to monitor. The system sets the function of resetting the system status display, selecting the function of the communication serial port, and the function of communication test.

Communication test is mainly used for routine maintenance. For this system, the communication link between the MCU and the PC is very important. The communication test through routine maintenance can reduce the risk of the system not being alarmed. In the health module, the monitoring software provides two mains operation reports and the status report of the oil machine, as shown in Figure 3.

The status display can intelligently display the power-off line, realizing unsupervised and remote monitoring on-site, as shown in Figure 4.

3 Conclusion

This paper proposes a multi-channel power failure alarm system based on improved keyboard scanning algorithm. Using the simple feasibility of the keyboard scanning algorithm, the keyboard encoding is performed on the multi-channel power-off line signal, and the terminal monitoring alarm software passes the corresponding keyboard code of the power-off signal. Identification is performed, and the power-off line raises an alarm. The system simplifies the general power failure alarm system. In practical applications, the system is simple to implement, the identification power-off time is μs level, the alarm is accurate, and it has been put into practical use.

Split Type Solar Street Lights

Split Type Solar Street Lights,Solar Street Light With Pole,Solar Street Light With Camera,Waterproof Solar Street Lighting

Jiangsu Bosiwei Optoelectronics Group Co.,ltd , https://www.bswledled.com