Introduction
The access control system is a modern security means used to protect the people's property safety and personal safety. With the development of society and the advancement of science and technology, the access control is developed from mechanical lock to electronic access control. From a separate access control system to the alarm integration, it is developed from a single access control to the network interconnection. At present, the market is mainly mainly based on wired access control systems, but according to market demand analysis and prospect prediction, wireless access control systems are undoubtedly more suitable for an increasing security industry. Compared to wired access control systems, wireless access control systems have simple installation, convenient maintenance and low cost.
This paper studies the wireless access control system based on STC15 single-chip microcomputer and NRF2401, recognizes the host computer system, can detect and identify the identity of the visitor in real time. If the database is included in the database, the access control terminal opens the door lock and displays the visitor information at the LCD; otherwise, the alarm alarm.
1 wireless access control system overall design
The system structure is mainly composed of a PC-side software system, an access control terminal, and an access control, and the overall structure of the system is shown in Figure 1. The PC terminal host software is mainly responsible for identifying the identity information of the visitor and converts information into a corresponding data frame format, transmitted to the access control terminal through the serial port. The access control terminal is mainly responsible for data encryption, initialization of the RF module and the transmission of information. The access control terminal is mainly responsible for data decryption, and performs the corresponding operation according to the information decrypted, thereby achieving the role of the control access control system.
Be
2 system hardware design
2.1 STC15L2K61S2 Introduction
STC15L2K61S2 is a single-clock / machine cycle (1T) produced by STC. It is a new generation of 8051 single-chip microcomputer with high speed / high reliable / low power / super interference. The 8th generation encryption technology, strong encryption, and instruction code Completely compatible with the traditional 8051 single-chip, but the speed is 8 ~ 12 times faster than the traditional 8051 single chip. The STC15 series single-chip interior integrates high precision R / C clock, which can be configured with a range of 5 to 35 MHz, while the STC15 series microcontroller integrates a highly reliable reset circuit, so the STC15L2K61S2 minimum system does not require external crystal oscillator and clock circuit.
STC15L2K61S2 has 3 channels of CCP / PWM / PCA, 8-way 10-bit high-speed A / D converter, built-in 2K large-capacity SRAM, 2 groups of ultra-high-speed asynchronous serial communication ports and 1 set of high-speed synchronous serial communication port SPI, and for 5TC15L2K61S2 For this single, its power supply voltage is only 3.3V, so its power consumption is much lower than the traditional 8051 single-chip microcomputer.
2.2 Power Module
The working voltage of the NRF2401 is between 1.9 and 3.6 V, the power supply voltage of the microcontroller is 3.3 V. In order to make NRF2401 normal stable work, the NRF2401 must be connected to a DC power module. The test NRF2401 is relatively stable at 3.3 V, and the power supply voltage of the STC15L2K61S2 single-chip microcomputer is also 3.3 V. The system is powered, the voltage is approximately 5 V, so the 5 V voltage needs to be converted to 3.3 V voltage. The power module selects a linear regulated power supply to form an analog power supply, by adjusting the sliding varistor to make the output voltage of 3.3 V, 3.3 V power module schematic diagram shown in Figure 2.
Be
2.3 NRF2401 RF Module Interface Circuit Design
NRF2401 is a single-chip wireless transmission and reception chip, which is produced by Nordic, working on a global free application (ISM) frequency of 2.4 to 2.5 GHz. Chip built-in address decoder, first in the post-out stack area, demodulation processor, clock processor, GFSK filter, low noise amplifier, frequency synthesizer, power amplifier, etc., there is a small peripheral component, so it is very Convenient.
NRF2401 has four types: transceiver mode, configuration mode, idle mode, and shutdown mode. The working mode of the NRF2401 is determined by the three pins of PWR_UP, CE, TX_EN. The transmission and receiving mode of the NRF2401 has three kinds of Enhanced ShockbursTTM transceiver mode, ShockBursttTM transceiver mode and direct transceiver mode. For energy saving, the system selects wireless transmission using the Enhanced Shock BurstTM transceiver mode, and the connection circuit of the NRF2401 RF module and the STC15L2K61S2 is shown in Figure 3. The CSN is a chipline of the chip, when the CSN is low, the chip works. SCK is a clock line (SPI clock) controlled by the chip. MISO and MOSI Control data lines are chip. IRQ is an interrupt signal, and the MCU is primarily communicated with NRF24L01 during wireless communication. CE is a mode control line for the chip. In the case where the CSN is low, the CEC register of the CE collaborative NRF24L01 determines the state of the NRF24L01.
Be
2.4 LCD Display Module Interface Circuit Design
NOKIA5110 is a liquid crystal display produced by Nokia. It can display both characters or graphics. When low-voltage supply, the normal display is under 200 μA, and the price is cheap. A NOKIA5110 module with a drive chip is 15 yuan, while the 1602 liquid crystal display is 20 yuan, and the 12864 liquid crystal display is 50 to 70 yuan, and only 8 pins of the NOKIA5110 include backlight, compared to 1602 and 12864. It is more convenient to say that the pin is less, it is also more convenient in hardware design. The 8 pins of the NOKIA5110 are RST, CE, D / C, SDIN, SCLK, VCC, BL, and GND, where RST is a reset pin, CE is the chip enable pin, D / C is the mode selection pin, SDIN is a serial data cable, SCLK is a serial clock, VCC is 3.3 V operating voltage, BL is a backlight pin, GND is a power supply, and the NOKIA5110 interface circuit is shown in Figure 4.
Be
2.5 Step Motor Drive Circuit Design
This paper uses L298N to constitute a motor drive circuit, and L298N is a high voltage produced by ST, a large current motor drive chip. The chip uses a 15-pin package. The main features are: high operating voltage, up to 46V; output current is large, instant peak current can reach 3 A, continuous working current is 2A; rated power 25 W. Using the L298N chip drive motor, the chip can drive a two-phase stepper motor or a four-phase stepper motor, just satisfying the design needs of the system, the stepper motor drive circuit is shown in Figure 5.
3 system software design
3.1 NRF2401 software design
NRF24L01 data transmission or reception is mainly implemented by the SPI interface, using the STC15L2K61S2 single-chip I / O port to simulate the working timing of the SPI interface, SPI read and write timing, as shown in Fig. 6 and FIG.
Be
Be
Be
After completing the basic function of the chip, the chip needs to initialize the chip, ensuring the address width, channel operating frequency, transmitting and reception rate, and power of the transmitting end and the receiving end, and the RF initialization functions are as follows:
Be
3.2 Stepper motor software design
The four-phase stepper motor can be divided into single 4 shots in accordance with the different sequence of power-on, double 4 shots, 8 take three ways of working. Single 4 shots and double 4 shots are equal, but the turn torque of single 4 is small. 8 Take a walking angle of work is half a single 4 shot and double 4 shots. Because 8 shots can maintain both higher rotational moments, it can improve control accuracy, so this article uses a 4-phase 8 shot.
Be
Single 4 shots, double 4 shots and 8 shots work mode power supply timing and waveforms are shown in Figure 8, respectively.
Be
Be
Be
Be
Be
Conclusion
Through multiple experimental tests, the wireless access control system designed herein has better real-time and accuracy. Under the obstacle conditions, data transmission can meet practical requirements and achieve the expected design goals.
Be
Be
Reprinted from-Electronics World
Our other product: