For the apartment security problem, the apartment security controller is designed by using the FPGA. Real-time perception and monitoring of the room’s security status are carried out by using a variety of sensors. By receiving and analyzing the data of different sensors, the security controller realizes the functions of false alarm, fire alarm, anti-theft alarm and alarm of high-power electrical appliances. ICL7135 is used for A/D conversion of power supply current to judge whether high-power electrical appliances are used or not; ID card information sent by access card reader is received by serial communication mode and is compared with the correct card number bit by bit. The time series simulation experiment shows that the system can monitor and alarm the safety state of student apartments. Safety accidents in student apartments occur from time to time and show an upward trend in recent years, which have caused great economic losses and adverse social impacts to both students and schools. The safety of student apartments has become the focus of attention of society, especially the parents of students and the educational circles. Many scholars have made progress in monitoring and controlling the safety of student apartments. A lot of research work has been done [1-3]. Field Programmable Gate Array (FPGA) device is a new type of high density programmable logic device, which is manufactured by CMOS-SRAM process.
It not only has high speed and reliability, but also has the characteristics of repeatable programming. Therefore, the field programmable gate array makes the design of digital circuit system very flexible, and has been widely used in signal acquisition and processing, complex logic control, etc. [4-11]. This paper uses EP4CE6E22C8 chip of ALTERA company as control chip to construct apartment security controller, and uses VERILOG language to design each module circuit of FPGA. The block diagram of the apartment security controller system is shown in Figure 1. The system consists of the main control chip of the FPGA, ID card identification circuit, fire detection circuit, infrared anti-theft circuit, high-power electrical equipment detection circuit and power supply control circuit.
The control chip adopts EP4CE6E22C8, which contains 6272 logic units and 276480 memory units. The fire detection circuit is responsible for collecting smoke data and transmitting information to the FPGA to determine whether there is a fire or not. If a fire occurs, thermostatic element the power supply is cut off immediately by the power supply control circuit. Infrared anti-theft circuit is responsible for detecting whether strangers enter the room, once found, immediately send out sound and light alarm. The detection circuit of high-power electrical appliances is responsible for detecting whether high-power electrical appliances are in use. Once found, the power supply is cut off by the power supply control circuit and sound warning is issued. The power supply is automatically restored after a certain time interval. ID card recognition circuit is used to identify the user’s swipe information and transmit the user card number to the FPGA for identification. If the card number is correct, it opens the door and closes the infrared anti-theft function to avoid false alarm. If the card number is wrong, it gives a sound warning. ICL7135 is a 4-bit semi-CMOS Dual-Integral A/D converter with high precision.
It has the functions of bipolar high impedance differential input, automatic zero-setting, automatic polarity and over-range discrimination. It has ( 20000 counting resolution) and serial digital codes after A/D conversion. Line output and time-sharing parallel output are two kinds of output modes, which are very convenient to interface with microprocessor. The interface circuit between the FPGA and ICL7135 is shown in Figure 2. Current transformer is connected in series in 220 V AC circuit. The output current signal is obtained by signal conditioning circuit, and the peak voltage signal Um which is linearly related to the current is obtained. Um input to A/D conversion ICL7135 conversion to the corresponding digital quantity and through the calculation of the FPGA, the room power supply can be obtained.
Setting the RH pin of the FPGA to a high level, starting ICL7135 for A/D conversion, the BUSY pin of ICL7135 appears rising edge. When the bus pin of the FPGA detects the rising edge, it starts the internal counter to count the pulse input by the CLKIN pin (i.e. the clock pulse CLOCK of ICL7135). At the end of A/D conversion, the BUSY pin of ICL7135 has a falling edge. When the bus pin of FPGA detects the falling edge, the internal counter is stopped. The counting result S of the counter is the number of clock pulses needed to complete A/D conversion. Once it is found that the current increment exceeds the threshold set by the program, it is judged to be used by high-power electrical appliances. The power supply is cut off by the power supply control circuit in order to prevent electric fire. At the same time, a sound warning is issued, and the power supply is automatically restored after a certain time interval. The timing simulation diagram of A/D control module is shown in Fig. 3. The RH pin appears positive pulse to start A/D conversion. Busy pin is high level during the whole conversion period. The operation and operation of busy signal and CLKIN signal make clkout the CLKIN pulse passing through busy high level period. The counter counts the clkout pulse, and the counting result is placed in the clkcnt register. If the IAC threshold in formula (1) is given, the counting threshold of the counter is determined. If the counting value S of clkcnt exceeds the counting threshold, the alarm output signal power_alert outputs a high level.
In Figure 3 (a), the counting value does not reach the counting threshold, the power_alert output low level does not alarm; in Figure 3 (b), the counting value reaches the counting threshold, and the power_alert output high level alarms. The serial communication module of FPGA is used to receive the output signal of ID card recognition circuit. The serial communication format is 9600 BPS baud rate, parity-free check, 8-bit data bit and 1-bit stop bit. The ID card number received by the serial port is checked one by one with all the correct card numbers stored in advance. If the user information is correct, the door is locked by relay control, and if the user information is wrong, the alarm prompt is given. The sequence simulation diagram of serial communication module is shown in Figure 4. rx232_rx is the input pin of serial data, rx_data_r is the receiving register of serial data, and alert_out is the output signal of reading card error alarm. The ID card number consists of 10 digits, that is, the card number sent by the reader is 10 bytes each time, and the data received by the rx232_rx pin is stored in the rx_data_r register in byte form and compared bit by bit with the correct card number. If the card number is correct alert_out pin output low level does not alarm, as shown in Figure (a), otherwise if the card number is wrong alert_out pin output high level alarm, as shown in Figure (b). The edge detection module of the FPGA is responsible for receiving the output signal of the anti-fire and anti-theft circuit. Infrared anti-theft circuit uses infrared pyroelectric sensor to detect whether strangers enter the room, and sends out sound and light alarm as soon as they are found. Infrared pyroelectric sensor is an instrument that senses infrared radiation in a non-contact form and converts it into electrical signals. The principle of thermoelectric effect is used to complete the infrared radiation sensing of moving objects. It has the characteristics of low power consumption, low cost, good concealment and high sensitivity. When the pyroelectric sensor does not detect the movement of human body, it outputs low level. On the contrary, when the pyroelectric sensor detects the movement of human body, it outputs high level, that is, the rising edge signal from low to high will appear at the output. Fire detection circuit uses smoke sensor to detect CO smoke concentration to judge whether a fire occurs. Smoke sensor belongs to gas sensor. It converts the content of combustible gas in the air (i.e. concentration) into voltage or current signal. The sensitivity of detection can be set by comparing circuit, and the output of comparing circuit is digital.
No CO smoke comparison circuit output low level was detected. If CO smoke was detected and exceeded the reference value, the comparison circuit output high level, that is, the output output will appear from low to high rising edge signal. The edge detection module of the FPGA has two input pins to detect the rising edge of the infrared anti-theft circuit output and the rising edge of the fire detection circuit output respectively. If the rising edge signal is detected, theft or fire situation will be determined, and an alarm prompt will be given immediately. The timing simulation diagram of the edge detection module is shown in Figure 5. The fire pin receives the output of the fire detection circuit, the FT pin receives the output of the infrared anti-theft circuit, and the safe_alert [1.0] pin is the alarm output pin. If fire pin rising edge is detected, fire occurs. Safe_alert t [1.0] pin output binary 01, as shown in Figure (a). If the FT pin rising edge is detected, theft occurs. Safe_alert t [1.0] pin output binary 10, as shown in Figure (b). This paper designs an apartment security monitoring and control system based on FPGA, uses QUARTUSII software to write the program of each module circuit based on VERILOG language, and carries out timing simulation through the simulation environment of QUARTUSII software. The simulation experiments show that the system can realize ID card identification and error information alarm, infrared anti-theft alarm, and so on.
High-power electrical appliances use alarm and fire alarm functions, which provide comprehensive protection for apartment safety.