3604 views|0 replies

1782

Posts

0

Resources
The OP
 

Design and implementation of electronic locking system based on RFID [Copy link]

Source: Electronic Design Application Author: Gao Yang Li Zhengqin

Introduction

The current customs supervision of transit goods mainly adopts the traditional one-time lead sealing method, which uses manual operation and visual identification to mechanically seal, verify and unseal the container. The operation cost is high and the safety is low. More importantly, this supervision method has low operation efficiency and is far from meeting the supervision requirements of customs with high density and high intensity business flow. RFID (Radio Frequency Identification) technology is an automatic identification technology that uses induction, radio waves or microwave energy for non-contact two-way communication to achieve the purpose of identifying and exchanging data. It automatically identifies the target object and obtains relevant data through radio frequency signals, and the identification work does not require human intervention. This paper designs an electronic lock system based on active RFID technology, and uses electronic locks instead of traditional lead seals to electronically monitor and manage transit containers.

System architecture and operation mode

This system consists of four parts: monitoring center server, crossing monitoring machine, radio frequency reader (crossing reader, handheld reader), and electronic lock. Its system architecture is shown in Figure 1. The monitoring center server is responsible for background data storage and management; the crossing monitoring machine controls the crossing reader through the serial port to communicate with the lock through radio frequency; the electronic lock, as a wireless terminal, mainly realizes functions such as information storage, wireless communication, mechanism control, and status monitoring.


Figure 1 Network topology of electronic locking system

The bottom hardware structure and design of the system

The bottom part of the electronic lock system consists of a reader and an electronic lock, and the basic components are MCU and RF transceiver circuit. The difference is that the crossing reader has an RS-485 communication interface, the handheld reader has an additional human-computer interaction interface, including a 4×4 membrane keyboard and a 128×64 dot matrix LCD display module, and the electronic lock has expanded the abnormal state monitoring circuit and motor drive circuit. The motor drive circuit is used to drive the motor to achieve the electronic sealing and unsealing of the lock. The

electronic lock requires 10~20 meters of wireless data communication. This paper selects the nRF2401 (hereinafter referred to as 2401) produced by Nordic as the RF transceiver chip. 2401 works in the globally open 2.4GHz frequency band, 125 channels, uses GFKS modulation, and the maximum wireless data transmission rate can reach 1Mbit/s. It has built-in hardware address decoding and CRC encoding and decoding circuits. In the actual design, the single-channel mode is adopted. The MCU needs to be connected to the six pins of 2401, namely DATA, CLK1, DR1, PWR, CE, and CS. Among them, PWR, CE, and CS are used to configure the working mode. DATA and CLK1 form the SPI bus. DR1 is the data preparation pin, which is connected to the interrupt I/O pin of the MCU. Figure 2 is the schematic diagram of the RF transceiver circuit.

Software Design

The software design of this system is divided into three levels: the monitoring center server is the top layer; the crossing monitoring machine is the middle layer; the reader and writer and the electronic lock are the bottom layer. Due to space limitations, the software design of the bottom system is mainly described here.

Analysis of 2401 Communication Mode

2401 has two communication modes, namely direct transmission mode (Dire Mode) and burst transmission mode (Shock Burst). This design adopts the latter.

In this design, the address segment is set to 2 bytes, the data segment is 28 bytes, and the check code is 2 bytes. The address segment is the receiving address configured by the 2401 chip. The electronic lock is set as the called party in the system, and their receiving addresses are the same; accordingly, the receiving addresses set by the calling party, that is, all readers and writers, are also the same. 2401 is a half-duplex mode, and the data transmission and reception mode must be switched by configuring the status word.

The RF data packet defined by the communication protocol research

and design is loaded in the data segment (PAYLOAD), and the data packet is a fixed length of 28 bytes.

Analyzing the application requirements of the system, since there are multiple readers and multiple locks communicating separately on site, the wireless communication protocol formulated must be for multi-point to multi-point. At the beginning of each communication, the caller needs to establish a connection with the responder. The following is the connection establishment process:

1. The reader sends a broadcast call (abbreviated as full call) command, which is a single-packet command. 0xFFFFFF needs to be filled in the responder identifier, and the command code is 'S'. At this time, all electronic locks within the effective communication distance will be awakened, and they will fill in their own ID in the responder identifier and return it to the reader.

2. The reader will select a target lock from the returned lock identification and send a single-point call instruction (referred to as point call) to it. For the crossing reader, a directional antenna is used to ensure that only one lock is called each time the full call is made, and the lock is directly called; for the handheld reader, it is possible to get multiple locks to respond, and the keyboard can be used to select and then call. When calling, the ID of the target lock needs to be filled in the responder identification.

3. After receiving the instruction, the electronic lock will parse the data packet, and after authenticating the host identity and confirming that the responder identification is its own ID, it will return a response confirmation instruction to the host. After receiving the confirmation instruction, the host believes that the connection has been established.


Figure 2 RF transceiver circuit

Design of the main program of the electronic lock

In general, the electronic lock is in a dormant listening state. After 2401 receives the RF data frame, it generates a DR1 interrupt to wake up the MCU. After the MCU performs data parsing and identity authentication according to the RF protocol data packet format, it processes according to the command code and finally packages and sends the response data. The abnormal state detection after electronic sealing adopts timed interrupt processing. The main program flow of the electronic lock is shown in Figure 3.
  
Analysis of key issues

Low power design

The electronic lock is powered by a battery, so low power consumption is the focus of the design. Reasonable setting of the working mode in the software design can greatly reduce power consumption. The electronic lock does not need to communicate most of the time, but it must maintain a wireless listening state to ensure that it can answer the host's call at any time. The current consumption of 2401 in the receiving mode is 18mA, which is relatively large and does not meet the system requirements. The design adopts the time window listening mode. The electronic lock only turns on the 2401 wireless listening for 1ms per second. After receiving the wake-up command, it enters the long-term listening mode. The actual test shows that the power consumption in the time window listening state is only 0.68mA, which is significantly reduced. For the host, i.e. the reader, a wake-up process needs to be added before each connection to the lock, and the wake-up command is continuously sent within 1 second to ensure that its duration covers the lock monitoring time window.

Avoid adjacent lane interference

. There are generally multiple lanes at the customs checkpoint, and there may be co-frequency interference in the adjacent lanes. In the system design, two methods are combined to avoid this interference: one is that the crossing reader uses a directional antenna, so that the RF signal emitted by the reader is directed to a single lane, which can avoid the impact of the reader's RF signal on the adjacent lane. However, it is impossible for the electronic lock to use a directional antenna, so a frequency hopping communication working mode is added. The working base frequency of each lane is set to the same. However, once the reader establishes a communication connection with the electronic lock, both parties jump to the fixed frequency specified by the host, i.e. the reader, so that different lanes can effectively avoid adjacent channel interference due to different frequency hopping settings. It is very convenient to set the frequency hopping of 2401. You only need to set the channel status word in the configuration mode.


Figure 3 Electronic locking main program flow chart

The application environment of the time-sharing answering

handheld reader is different from that of the road crossing reader. It uses a wide-directional antenna, and there may be multiple locks within the effective communication range. Due to the same frequency, the synchronous answering of the electronic lock during the broadcast call will cause signal conflict. To avoid conflicts, time-sharing answering is adopted in the software design. After receiving the broadcast call command, the lock will first randomly delay for a period of time before returning the answering command. It should be noted that the random delay is not arbitrary, but segmented to ensure that the host processes different answering signals within the time gap.

Here, the time-sharing answering design is analyzed. Let the communication time after the reader sends the broadcast command be Tc, and Tc is divided into n time gaps, each of which is sufficient to complete the reading and storage of the identification of a certain lock. After receiving the broadcast call, the lock randomly assigns the answering time point to a certain time gap and returns the answering command. If there are x locks within the communication range, when n>>x, the conflict probability of the return signal will be very low. In actual applications, the number of locks on site generally does not exceed 10, usually 3~4, so when n is set to 100, a low conflict probability can be guaranteed. At the same time, since the response time is very short (large-scale data interaction occurs after the connection is confirmed), setting n larger will not significantly reduce the response time.

Conclusion

Actual tests show that the electronic lock system has high reliability, strong anti-interference ability and good scalability. This system is a new application of active RFID technology in the field of logistics monitoring, which significantly improves the operating efficiency of customs transit business.



This post is from RF/Wirelessly
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

快速回复 返回顶部 Return list