How to design and implement electronic code lock based on RFID technology

Publisher:温馨小屋Latest update time:2023-09-12 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

With the development of information technology and the enhancement of people's security awareness, electronic lock technology has developed rapidly. The electronic lock system has long gone beyond simple doorway and key management, and has gradually developed into a complete access management system. The development of electronic lock systems has gone through single password keyboard electronic lock systems, IC card electronic lock systems, non-contact IC card electronic lock systems, and now the latest biometric identification system. Among them, the non-contact IC card electronic lock system has been widely used due to its mature technology, low price, easy to use and other superior properties. Based on the research on RS485 and TCP/IP communication protocols, this paper proposes a non-contact IC card electronic password lock system based on radio frequency identification technology.


2. System structure

The system adopts a hierarchical distributed centralized control scheme to form a distributed network of all electronic code locks. Its overall structure is shown in Figure 1. The entire system includes a three-layer structure of the management center server, user building PCs, and electronic password locks.

How to design and implement electronic code lock based on RFID technology

Figure 1 System structure diagram

The management center server is the management and control center of the entire electronic password lock system, and also runs the electronic password lock management system program and database. The database adopts a database structure that supports network communication to facilitate function expansion. In order to achieve unified security management of all electronic code locks, users open the electronic code lock by using a non-contact IC card and entering the password, and the user's IC card information, security time, etc. are stored in the database. Administrators can clearly query the usage status, entry and exit records, etc. of each electronic code lock through the electronic code lock management system program.

The user building PC uses an RS485-TCP/IP communication converter, which is responsible for the information interaction between the electronic password lock and the management center server, realizes the function of data forwarding, and realizes the conversion of RS485 and TCP/IP communication protocols. It does not directly control the electronic password itself. lock action. Its main function is to convert the RS485 signal of the electronic code lock into a TCP/IP signal, thereby directly connecting to the LAN and realizing communication between the management center server and the electronic code lock.

3. Electronic code lock design

3.1 Working principle

The non-contact IC card electronic password lock system is based on radio frequency identification technology and mainly uses a Mifare card-specific read and write processing chip MFRC530. It is a small Mifare card radio frequency base station with a maximum operating distance of 10 cm. Its functions include modulation, demodulation, radio frequency signal generation, security management and anti-collision mechanism. It is the core module for wireless communication with non-contact IC cards. , is also a key interface for reading and writing contactless IC cards. In this system, when a card enters the radio frequency antenna induction area, the electronic password lock reads the card number of the contactless IC card, stores the read card number and user password in the memory, and at the same time sends the user card number and card swiping time to the user building. build the PC and display the user information on the LCD display. When no card enters the RF antenna sensing area, the MCU reads the time in the real-time clock chip and displays the current time and date on the LCD display.

3.2 Hardware composition

Each electronic code lock can independently complete a series of operations such as monitoring the door status and lock status, identifying whether the card is valid, monitoring card swiping actions in real time, controlling the electronic code lock and alarm, and reading keyboard information. The hardware part of the electronic password lock system mainly includes RF base station MFRC530, keyboard input module, LCD liquid crystal display, monitoring control module, RS485 communication interface, clock DS1305, information storage unit and buzzer alarm. The hardware block diagram of the circuit is shown in Figure 2:

How to design and implement electronic code lock based on RFID technology

(1) The system uses the microcontroller STC89C58RD+ as the control chip, which is the control core of the electronic code lock system and is used to control and coordinate the processing of data information of the electronic code lock system. STC89C58RD+ has built-in 32K Flash memory and 1280 bytes of RAM, has three 16-bit counters and a standard serial communication port, and has a P4 port, strong encryption, super anti-interference, ultra-low power consumption, and online system. Programmable and remotely upgradeable.

(2) The radio frequency base station module uses Philips' MFRC530 chip. MFRC530 is the core module for wireless communication with the radio frequency card. It modulates the data in the sending buffer according to the setting of the register to obtain the sent signal, which is sent out in the form of electromagnetic waves through the antenna driven by the TX1 and TX2 pins. The non-contact IC card responds using load modulation of the RF field. The antenna picks up the response signal of the non-contact IC card and sends it to the RX pin through the antenna matching circuit. The MFRC530 internal receiving buffer detects and demodulates the signal and processes it according to the register settings. The processed data is sent to the data bus and waits for MCU to read. MCU and MFRC530 use SPI bus to communicate, which can realize wireless transmission of data with non-contact IC cards.

(3) The information storage unit is mainly used to store user interaction information and prevent network failures from affecting the normal use of the electronic code lock, thereby achieving the isolation of the electronic code lock. The user information of the storage unit must be consistent with the server database information. The information storage unit uses a ferroelectric memory (FRAM) FM38081 produced by Ramtrom Company. The new FRAM has a storage capacity of 32k×8bits. It has the characteristics of high-speed reading and writing, ultra-low power consumption and unlimited reading and writing. It is especially suitable for those who Occasions that have high requirements on data collection and writing time. Since the MCU does not have an IIC bus interface, FM38081 needs to use the industrial standard IIC bus for external interfaces, so this system uses P2.3 and P2.4 port lines to simulate the IIC bus.

(4) The system needs to record the time when the card is swiped, and provides an accurate and reliable clock by using the low-power serial communication interface dedicated chip DS1305 launched by the American DALLAS company. DS1305 supports time correction and data reading through the SPI serial data port or standard three-wire interface, and can perform single-byte continuous reading byte beam access. In this system, SERMODE is grounded and three-wire serial mode is used for data communication with the microcontroller: SCLK is used as the clock input, SDA is used as the serial data input and output, and RST is used as the communication permission signal.

(5) The detection control module mainly monitors door, lock status and communication status in real time, and executes various control information of the controller, such as executing commands, executing alarms, etc.; the LCD display part uses 128× with ST7920 as the controller. 64 LCD module with Chinese character library, used to display time, date and various status information, as an interface for human-computer interaction; the keyboard input module uses 4*4 keyboard input, mainly providing user input information for the MCU; buzzer alarm part It will sound an alarm for the error status of the electronic code lock.

4.Software design

The programs of the electronic password lock system include: MFRC530 operation program for non-contact IC cards, MCU and MFRC530 communication interruption processing program, read and write clock chip DS1305 and LCD liquid crystal display program, door and lock status detection program and memory read and write program, etc. . The main program flow chart of the electronic password lock is shown in Figure 3.

How to design and implement electronic code lock based on RFID technology

Figure 3 Main program flow chart of electronic password lock

5.Existing problems and solutions

5.1 Combination of distributed structure and centralized unified management

A key technology for establishing a distributed electronic code lock management system is the data transmission method between electronic code locks distributed in different places and the management center server. If the electronic lock directly exchanges information with the server through RS485 signals, it will lead to problems such as short transmission distance, slow information exchange speed, and poor anti-interference ability. The TCP/IP protocol has the advantages of fast transmission speed, infinite transmission distance, stable communication quality, and is not susceptible to external interference. Therefore, during the implementation process, the RS485-TCP/IP communication converter is used to realize the conversion of RS485 and TCP/IP communication protocols and realize the forwarding of information.

5.2 Isolation of electronic code lock

In the electronic code lock system, the user information (such as card number and password) of each electronic code lock is stored in the information storage unit of the corresponding electronic lock. The electronic lock controller reads the corresponding user information in the information storage unit and passes Compare with the user input information to determine the legitimacy of the current user, ensuring that when the management center server or communication network fails, it will not affect the use of the electronic lock and achieve the isolation of the electronic password lock.

[1] [2]
Reference address:How to design and implement electronic code lock based on RFID technology

Previous article:Control the buzzer through a microcontroller
Next article:Comparative analysis of two methods of CAN bus and Ethernet embedded gateway circuit design

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号