Abstract : This article introduces the design of a multi-functional security system that, in addition to basic video monitoring and automatic alarm functions, also features alarm information SMS mass sending, multi-alarm multi-task buffering, USB read/write, remote image transmission via a dedicated processing board, and remote operation. The system consists of a main control chip, a secondary control chip, and peripheral circuitry. Data exchange between the main and secondary control chips occurs via a parallel port. The main control chip handles alarm signal processing, control panel operation, and communication with the dedicated processing board. The secondary chip controls PTZ camera movements, sends alarm SMS messages, and performs USB read/write operations. The system's powerful functions and intelligent design offer significant advantages over similar products on the market and can be widely applied in demanding remote unattended security monitoring applications.
Keywords : Video surveillance system; automatic alarm; bulk SMS messaging; USB
Chinese Library Classification Number: TP273 Document Identification Code: A
① Chengdu University of Information Technology, Chengdu 610066, Yang Mingxin, Wang Jianbo, Menfan ② Sichuan Shuining Meteorological Institute, Liu Ping
Abstract : This article introduces a kind of multi-functional auto-alarm system, which not only have the basic video frequency function and switch quantity auto-alarm function, but also can implement short alarm message group-sending, multi-task and multi-alarm buffer processing, USB read-write, image transmission and remote operation of the special processing board. The system consists of main chip, vice chip and peripheral circuit. The data exchanges between the main chip and the vice chip by parallel interface. The function of the main chip includes alarm signals, processing the control panel operation and the communication with the special processing board. The function of the vice-chip includes tripod motion control, short alarm message service, USB read-write, etc. Compared to the similar products in the present market, this system has obvious superiority in strong function and intellectualized design, it can be broadly applied in high-quality remote unattended auto-alarm surveillance.
Key words : Video supervisory system; Auto-alarm; Multi-SMS sending; USB
I. System Design Overview and Hardware Module Design
With technological advancements, simple camera-to-monitor monitoring methods are no longer sufficient for high-level surveillance requirements. This article introduces a video security control system that not only possesses the basic video monitoring and automatic alarm functions of ordinary video security products (compatible with both open-circuit and closed-circuit alarm signal input methods), but also features alarm SMS mass messaging, automatic alarm information storage, multi-channel alarm buffering, alarm data USB access, remote image transmission to a host computer, and remote monitoring. This system overcomes the shortcomings of traditional products, offering powerful functionality and excellent performance, meeting the high-standard application requirements of military applications, unattended automatic weather stations, and other similar settings.
Figure 1 shows the hardware structure block diagram of the field unit of the security control system. The system consists of four main parts: video signal selection and processing, control panel, system control, and signal alarm processing. Two STC89C58RD+ microcontrollers serve as the control core, responsible for implementing various system functions. These microcontrollers not only have a large program storage capacity (32k) and 1K of RAM, but also can download programs via serial port, facilitating future online upgrades.
The main control chip is responsible for the following functions: detecting the working status of the secondary control chip and the dedicated processing board, and coordinating the work of the management system; detecting alarm inputs and realizing alarm control outputs and alarm information processing; managing the DS1302 clock chip, acquiring the time and displaying the time on the digital tube of the control panel, and automatically correcting the time; managing mobile phone numbers and processing the human-machine interface of the control panel; transmitting and receiving alarm information with the dedicated processing board and the secondary control chip; using EEPROM to store alarm data to realize automatic storage of alarm information (up to 6,000 records), multi-task multi-alarm buffering; and handling functions such as power-on self-test.
The secondary control chip is primarily responsible for USB detection and read/write functions, executing commands from the main control chip and receiving data, sending mass SMS messages using the GSM module, and parsing and sending instructions according to the Percol protocol to control the pan-tilt-zoom (PTZ) mechanism. In addition, the secondary control chip is responsible for automatically obtaining SMS center numbers for different regions upon power-on to determine the GSM module's operating status and communication network status, adapting to application requirements in different regions. When an alarm occurs, if the SMS sending function is enabled, the main control chip sends alarm information to the secondary control chip, which then integrates the alarm information data into a data packet conforming to the SMS format and sends it to the GSM module. After the on-duty personnel clear the alarm, the secondary control chip can also choose to send an SMS to the remote monitoring center to indicate that the on-site alarm has been cleared.
The video security control section can monitor eight input video signals. After anti-interference processing and impedance matching by the MAX4090, four video outputs are generated for security personnel to view images of on-site security activities. The other outputs are transmitted to the system's video signal selection circuit. An eight-to-one multiplexer automatically selects one video signal, outputting it at the common video terminal. This signal is then digitally compressed and stored by a dedicated video processing board (with a built-in external hard drive) and transmitted over the network as required. The video processing circuit uses an AC-coupled output method. The receiving circuit establishes a common-mode level at the input, independent of the DC level of the input video signal. A 75Ω series resistor is placed as close as possible to the output to isolate downlink parasitic interference generated at the output, providing optimal signal quality.
The dedicated video signal processing board enables on-site digital processing of video signals, remote network transmission, reception and response to commands from remote monitoring computers, and data exchange processing with the security control system. This processing board is a purchased finished product. Due to space limitations, the design of the remote host computer software and the application development of the dedicated processing board involved in the design will not be introduced here. This article focuses on the design of the security control system body based on a microcontroller.
Figure 1 System hardware structure block diagram
The system receives and processes video signals in real time during operation. The alarm input circuit monitors front-end alarm information in real time. When a switch alarm is triggered, the main control chip responds and sends a short message to the GSM module via the secondary control chip to notify security personnel on duty. Security personnel can configure the system's operating environment, such as setting mobile phone numbers, default video source settings, and alarm output control settings, on the system display panel and in the host computer monitoring center. In security control systems operating unattended for extended periods, it is necessary to record certain data of special significance and the time of their occurrence. Therefore, the DS1302 was selected as the system's operating clock chip in this design.
II. Handling Several Key Issues in Hardware Design
2.1 Design of Alarm Detection Circuit
The design of the alarm signal input circuit is one of the key aspects of this system. It requires opto-isolation to effectively remove interference signals and improve the system's lightning protection level and reliability; it must be compatible with both open-circuit and closed-circuit alarm modes; and it should have a self-test function, automatically triggering an alarm when the alarm input signal line is cut or short-circuited. The front-end alarm detection circuit in this design is ingeniously designed and flexible in structure, meeting the above requirements. Its simultaneous compatibility with both open-circuit and closed-circuit alarms eliminates the need for differentiating alarm modes and adjusting installation settings in similar devices; thus, it possesses high promotional value and advanced features.
Figure 2 shows the front-end circuit diagram. Point A is the signal test terminal, point B is the external alarm line input terminal, and point C is the digital input terminal for the alarm signal to the microcontroller, connected to the P2 port of the main control chip. The TLP421-2 is a dual optocoupler. The positive terminals of the upper half of the photodiodes and the negative terminals of the lower half of the photodiodes of the two optocoupler inputs are connected to 6V to accommodate different input methods. The open-circuit gates of the dual optocouplers are connected in parallel. As long as either group is conducting, a low level will appear at terminal C, sending an alarm signal to the microcontroller. The diodes D2 and D3 are used to raise the conduction threshold of the dual optocoupler input terminals, improve the anti-interference capability of the input circuit, and avoid false alarms caused by differences in components. The following describes the four modes of circuit design compatibility: self-test, normally open, normally closed, and anti-tampering (only the single-input circuit is described).
Figure 2 Alarm Detection Principle Diagram
A. Self-test circuit
When there is a +12V voltage at test point A, the lower half of the TLP421 dual optocoupler conducts, causing a low level at terminal C. In practical application, the system performs a self-test every time it is powered on, testing the input and output circuits of each alarm point. The test first provides 12V power to terminal A through a programmable transistor switch circuit to simulate an external alarm input, in order to check whether each alarm detection circuit and signal processing is normal. As shown in Figure 2, when there is a higher voltage (12V) at test point A than the negative input voltage of the lower half optocoupler (+6V), diodes D1 and D2 conduct, generating current through the lower half optocoupler; at this time, the lower half input photodiode of the dual optocoupler conducts and emits light, corresponding to the lower half optocoupler output OC gate conducting, and terminal C connected to the I/O port presents a low level. The microcontroller considers that an alarm has occurred at this point and processes it, indicating normal detection; otherwise, the self-test fails, and the system issues a self-test fault alarm.
B. Normally open circuit
With the alarm contact normally open (as shown in Figure 3), the alarm detection switch is connected in parallel with R3 and then connected to terminal B during installation. When the switch is open, resistors R1 and R3 divide the voltage (R1 = R3), and the voltage at point B is approximately 6V. Since one end of the dual optocoupler is connected to +6V, the voltages at the two optocoupler input photodiodes are similar, the optocoupler does not conduct, and terminal C outputs a high level, so the system has no alarm signal. When the alarm occurs and the switch is closed, R3 is short-circuited, and terminal B shows a low level of 0V. The 6V voltage then conducts to ground through the upper half of the dual optocoupler, diode D3, and R2, resulting in a low level at terminal C, and the system issues an alarm signal.
Figure 3 Normally open circuit
C. Normally closed circuit
With the alarm contact normally closed (as shown in Figure 4), during installation, the alarm detection switch is connected in series with R3 to terminal B. Under normal conditions, terminal B forms a circuit to ground through R3 and the external alarm detection point. R1 and R3 divide the voltage (R1 = R3), and the voltage at terminal B is approximately +6V. The voltage at terminal B is close to the voltage at one end of the two input photodiodes, so the dual optocouplers are in the off state and do not function. Terminal C is at a high level, and the system has no alarm signal. When an alarm occurs, the alarm switch opens, and a high level greater than +6V appears at terminal B. The negative terminal of the lower half of the input optocoupler is connected to the +6V voltage. The 12V voltage forms a current loop to the 6V power supply through resistors R1 and R2, diode D2, and the lower half of the dual optocouplers. The lower half of the dual optocouplers conducts, and a low level appears at terminal C, triggering an alarm signal from the system.
Figure 4 Normally closed circuit
D. Line damage monitoring
As can be seen from the alarm input circuit described above, under normal no-alarm conditions, the voltage at terminal B is approximately +6V (regardless of whether it is a normally open or normally closed circuit). When external equipment is stolen, cut, or damaged by an open circuit, terminal B becomes open to ground, and the voltage at terminal B is greater than the +6V voltage at the negative terminal of the lower half of the optocoupler. At this time, 12V is connected to ground through R1, R2, D2, and the lower half of the dual optocoupler, forming a circuit. The lower half of the optocoupler is turned on, and terminal C shows a low level. The microcontroller interprets this as an alarm and issues a corresponding alarm prompt.
When an external device is short-circuited to ground (R3, which is installed inside the switch, is also short-circuited), the voltage at terminal B is zero. The voltage at terminal B is less than the positive terminal voltage of the upper optocoupler +6V. At this time, current flows through the upper optocoupler through D3 and R2 to ground to form a loop. The upper optocoupler is working, and terminal C presents a low level. The microcontroller interprets this as an alarm and issues a corresponding alarm prompt.
2.2 Sharing and multiplexing of memory and serial port and design of system human-machine interface
In Figure 5, the system design incorporates two AT24C256 EEPROM chips with a storage capacity of 32K. The memory contents are electrically erasable and reusable, enabling system data storage and power-down protection. The main and secondary control chips share the EEPROM, reducing data transfer volume, improving efficiency, and indirectly resolving the issue of excessive data exchange buffering between them. Two microcontrollers connect to the two AT24C256 chips via simulated I2C buses through I/O ports, allowing both to read and write to the EEPROM chips. The EEPROM chips are reused to share system operation and historical alarm information. However, if both chips simultaneously read or write to the EEPROM, the microcontrollers may crash. Therefore, the main control chip needs to coordinate with handshake signals to ensure that neither microcontroller reads or writes to the EEPROM simultaneously.
Figure 5 EEPROM multiplexing block diagram
To address the insufficient I/O ports for the CPU during system design, a dedicated ZLG7290 keyboard and LED driver chip was selected for the control panel. This chip can drive an 8-digit common-cathode LED display (or 64 independent LEDs) and 64 buttons. As shown in Figure 6, the ZLG7290 connects to the main control chip via four I/O ports. As the main control chip for the human-machine interface, it features dynamic display of the LED display, real-time button monitoring and interrupt triggering, enabling manual control of the system on-site. It displays the current time, system operating status, alarm point status, SMS module status, USB interface status information, and human-machine interaction information. During system operation, the system's operating environment can be configured and video equipment controlled via a dedicated processing board. Similar operations can be performed using the lower-level machine's button panel, such as setting alarm video sources, alarm timeout settings, mobile phone number settings, and PTZ control.
Figure 6 Control Panel Function Diagram
The system design utilizes multiple serial ports. To address the insufficient number of serial ports, two time-division multiplexing methods are employed: manual jumper multiplexing and automatic switching multiplexing using a CD4052. The two CPUs not only need to provide download interfaces for future product upgrades but also provide serial ports for related peripheral circuits. The main control chip needs to communicate with a dedicated processing board; the secondary control chip not only sends AT commands and data to the GSM module via RS232 serial port but also sends PTZ control commands via serial port converted to MAX485. Manual jumper multiplexing is used because during program updates, the system control CPU is essentially in a bare-metal state, making program switching via the 4052 impossible. Both CPUs use manual jumpers to solve the serial port download conversion problem (only required during product shipment and field upgrades). During program execution, since data transmission is time-division multiplexed by the internal program, both CPUs use a CD4052 to automatically switch to the appropriate port as needed, achieving time-division multiplexing of the serial ports.
2.3 USB Interface Design
Devices with USB interfaces are convenient to use and cost-effective. In this system, they are used to download important historical alarm record data (stored in EEPROM) for easy review and analysis by security personnel. The design uses the CH375B chip as the USB interface control chip (see Figure 7). The CH375B is a general-purpose USB bus interface chip that supports both USB-HOST and USB-DEVICE/SLAVE modes. Locally, the CH375 has an 8-bit data bus, read, write, chip select control lines, and interrupt outputs, allowing for easy connection to the microcontroller's system bus. In USB host mode, the CH375 also provides serial communication, connecting to the microcontroller via serial input, serial output, and interrupt output. In this system, the CH375 chip is connected to the secondary control chip in parallel. The CH375's TXD pin is grounded through a 1KΩ resistor, enabling the CH375 to operate in parallel mode. This connection method significantly improves data transmission rate and reliability.
Figure 7. Block diagram of USB interface circuit
2.4 Communication between the secondary control chip and the primary control chip
This system uses two microcontrollers to address real-time requirements and insufficient I/O port resources. Since the serial ports of the master and slave control chips are occupied by peripheral devices, communication between them utilizes parallel connections of ordinary I/O ports. Specifically, the P0 port of the master control chip is connected to the P2 port of the slave control chip. Additionally, the INT1 interrupt port of the master control chip is connected to the INT1 port of the slave control chip as a data transmission handshake signal, thus improving the data transmission rate.
The main data transmitted between the secondary control chip and the primary control chip consists of alarm information, PTZ operation commands, and communication signals between the two. The primary control chip controls the operation and coordination of the entire system. When an alarm occurs, the primary control chip automatically records the alarm information, executes the set alarm outputs, and sends the alarm information to the secondary control chip so that it can be integrated into an SMS format and sent to a designated mobile phone number. When the PTZ is operated from a control panel or via remote network commands (received and forwarded by a dedicated processing board), the primary control chip sends the received commands to the secondary control chip. The secondary control chip then parses the received data to extract the Percol instruction and controls the PTZ movement.
When a portable storage device (USB flash drive) is connected, a large amount of data will be sent to the USB portable storage device. If the main control chip operates on the EEPROM at this time, it will affect the USB copying process. Considering that the time required to copy all alarm information to the USB flash drive is very short, the main control chip is not allowed to operate on the EEPROM while the secondary controller is performing USB copying, until the USB copying is completed.
2.5 Design of On-site Alarm Control Circuit
The circuit is designed with three sets of switch contact signal outputs consisting of switching transistors and relays, controlled by the I/O ports of the main control microcontroller. The corresponding functions are achieved through operational settings. The three control contacts function as follows: one connects to the panel buzzer; when an alarm signal is generated or panel operation requires a prompt, the buzzer on the control panel emits an alarm sound under the control of the main control chip, alerting the operator; another connects to external sirens and warning lights; in case of an alarm, the sirens and warning lights are activated; and the last connects to external lighting, controlling the lighting in the security area to facilitate better camera operation and security personnel patrolling the area. It can also be set to turn on the lighting in case of an alarm.
III. System Software Design
3.1 Main Control Chip Software Design
The main control chip is the control core of the entire system, responsible for the operation of the entire system and the coordination between various modules. The secondary control chip is the executor of the entire system, responsible for parsing and executing the commands issued by the main control chip. The program flowchart of the main control chip is shown in Figure 8. The software functions are roughly divided into three aspects:
For alarm information processing, the main chip must continuously monitor the alarm input ports for alarm signals. If an alarm signal is detected, it immediately executes the set alarm output and automatically stores the alarm information after integrating it according to the prescribed format. In addition, the main control chip also sends the integrated alarm information to the dedicated processing board (forwarded to the host computer via the network) and the slave control chip in real time. It also needs to receive remote operation commands from the dedicated processing board.
The control panel is processed by the main chip, which receives key values captured by the ZLG7290 on the control panel via interrupts and performs corresponding processing based on the key values. In addition, the control panel has a 4-digit LED display showing the current time, specific operation response information, and 8-channel alarm status indicator lights; the displayed data is refreshed in real time.
The main chip interacts with the secondary control chip, primarily transmitting alarm information and PTZ operation commands, as well as handshake protocols. The main chip communicates with the secondary control chip in three situations: First, when the control panel or host computer operates the PTZ, the main chip sends the received data (i.e., PTZ operation commands) to the secondary control chip, which then parses the instructions and executes them. Second, when an alarm occurs and SMS functionality is enabled, the main chip sends the integrated alarm information to the secondary control chip, which then integrates the alarm information into a suitable SMS format string and sends it to the mobile phone via GSM. Third, when a USB connection is available, relevant data is read from the EEPROM and written to the USB drive. If the main control chip operates on the EEPROM during this time, it will affect the USB operation. Furthermore, even copying all alarm information to the USB drive takes less than one second; therefore, during the USB copy operation, the secondary control chip exclusively uses the EEPROM chip until the copy is complete. During this period, the main control chip must check the busy status of the secondary control chip.
Figure 8. Main Flowchart of the Main Control Chip Program
In addition, the main program must also be able to implement multi-task caching, automatically retrieve and process unexecuted tasks, handle timeouts for various operations, and automatically correct time. Multi-task caching and retrieval involve many variables. When an alarm occurs, the main control chip automatically records the alarm information and executes the set alarm output. For the GSM module, sending a single SMS message takes a certain amount of time; sending multiple SMS messages requires even more time. If another alarm occurs during this period, the main chip sends the new alarm information to the secondary control chip, overwriting the previous alarm information and causing alarm information loss or misalignment. When the secondary control chip is busy, the main control chip should promptly detect its busy state, understand its status, and queue the data to avoid loss. Furthermore, when the secondary control chip is idle, the main control chip should automatically identify unprocessed alarm information and send it to the secondary control chip—this is the task retrieval function. Therefore, a complete and accurate alarm information processing program should be integrated with multi-task caching and retrieval into a cohesive process.
3.2 Software Design of the Secondary Control Chip
The program flow of the secondary control chip is shown in Figure 9. The secondary control chip is responsible for obtaining the SMS center number (different numbers for different user regions) upon power-on, determining the GSM module's operating status, and monitoring the communication network status. After completing the power-on self-test, it periodically monitors the GSM module's operating status and is responsible for sending and receiving data with the SMS center. Simultaneously, the secondary control chip receives data from the main control chip in real time, executes corresponding actions based on commands from the main control chip, sends its own operating status information to the main control chip, uses the GSM module to send mass SMS messages, parses and reassembles PTZ operation commands, and sends control actions for the PTZ according to the Percol protocol. It also detects the USB insertion status, manages the external USB device file system, sends historical alarm storage information to the USB device, and sends busy/idle information to the main control CPU.
Figure 9. Flowchart of the secondary control chip
IV. Conclusion
The security video control system introduced in this article boasts advantages such as powerful functionality, high stability, convenient operation, easy upgrades, stable system operation, and moderate cost. It has significant practical value in the field of video security control and has already been applied in unattended meteorological stations networked by the Guizhou Meteorological Bureau and the Suining Meteorological Bureau in Sichuan Province, with excellent results. The innovative design lies in the ingenious and rational design of the alarm signal input circuit, achieving photoelectric isolation, compatibility with open-circuit and closed-circuit alarm modes, and automatic detection of input signal line damage. Simultaneously, it supports network transmission of monitoring images and remote network monitoring. Other outstanding advantages include wireless SMS mass transmission of alarm information, multi-task caching of historical data, and support for USB mobile storage devices. This design can meet the requirements of high-level security applications such as military and meteorological applications.
References
[1] Wang Furui. Complete Guide to Single-Chip Microcomputer Measurement and Control System Design [M], Beihang University Press, 2001.
[2] Deng, Lujuan. Design and Implementation of Remote Network Video Surveillance System [J]. Security Technology, 2007, 8
[3] Krishnamachari B, Estrin D, Wicker S. Impact of data aggregation in wireless sensor networks[J]. In: Proc 22nd Int'l Conf on Distributed Computing Systems, Vienna, Austria,July 2002.
Author Resume
Yang Mingxin (1963-), male, Master's degree, Associate Professor, mainly engaged in research on automation measurement and control and instrumentation, microcontroller and embedded technology and application, and computer control.
Biography: Yang Mingxin (1963-), Man, Born in Xianyou of Fujian province, The associate of professor of Chengdu university of information technology, Master degree, The main researching field is automation meter and computer control.
Contact information is as follows: Telephone: 028-81965317 (Mobile phone, PHS)
028-85966238 (Office)
028-84317918 (Home)
Email: [email protected]
Mailing Address: Postcode: 610066
Addressee: Yang Mingxin, Unit 2, Building 296, Juleyuan, No. 199 Shuangqiao Road, Chengdu, Sichuan Province