3441 views|0 replies

1379

Posts

0

Resources
The OP
 

Design and implementation of embedded fingerprint lock [Copy link]

Abstract : Fingerprint recognition is unique and reliable, and has been widely used in the security field. This paper develops an embedded fingerprint lock based on the fingerprint recognition module, and provides a good set of software and hardware design solutions for the application of fingerprint recognition technology in embedded systems.

With the continuous reduction in the size of the fingerprint automatic recognition system and the continuous improvement of the function and speed of the microprocessor, the complex fingerprint recognition door lock control algorithm can be solidified on a very small embedded microprocessor module. The system composed of this module, fingerprint sensor, and door lock control mechanism is called an embedded fingerprint recognition door lock system. The application field of embedded fingerprint locks is very wide, including safes, laboratories, and identity confirmation in corridors. This paper designs and implements an embedded fingerprint lock based on the fingerprint recognition module, and provides a relatively complete set of software and hardware design solutions.

The hardware structure of the fingerprint recognition door lock system

mainly includes: fingerprint recognition module, microcontroller, read-write module, power management and electric lock mechanism, infrared sensing circuit and LCD display required for the door lock function, etc. The core part is the fingerprint recognition module and microcontroller. The structural block diagram of the fingerprint recognition door lock system is shown in Figure 1, and the fingerprint recognition function module is inside the dotted line.

740)this.width=740" border=undefined>
Figure 1 Structural diagram of fingerprint recognition door lock system


The core structure of the door lock control circuit of the single-chip microcomputer

is the microcontroller P89LPC932A1, which is a single-chip packaged MCU suitable for many occasions requiring high integration and low cost, and can meet many performance requirements. P89LPC932A1 integrates many system-level functions, which can greatly reduce the number of components, circuit board area and system cost.

The MCU communicates with the fingerprint recognition module through the serial port to complete the entry, deletion and identity confirmation of the fingerprint. After verification, the motor control door lock will execute the action of opening and closing the door. The schematic diagram of the door lock control circuit with the single-chip microcomputer P89LPC932A1 as the core is shown in Figure 2. P89LPC932A1 has as many as 26 powerful I/O ports, which can meet the needs of the keyboard, LCD display, indicator light, button, buzzer and other peripherals. The keyboard is used to enter the password, the LCD displays the user's registered information and ID number, and the two-color indicator light and buzzer are used to remind the user whether the operation is successful or to issue an alarm prompt. In addition, there are some remote-controlled key switches for powering on the device or performing operations related to opening and closing the door. The specific design can increase or decrease peripheral devices according to different application scenarios and actual functional requirements, and reduce system power consumption while meeting the functions as much as possible. The motor control part is driven by the microcontroller to issue logical commands to the motor to open and close the lock. In the figure, U1 is the power control chip R1121N, which outputs 3.3V to the microcontroller; U2 is the I2C read-write module E2PROM, in which important information such as the fingerprint lock's door opening and closing records and passwords are stored. R1121N is a CMOS process voltage regulator with high voltage output accuracy and low input current.

740)this.width=740" border=undefined>
Figure 2 Circuit diagram of door lock control system740

)this.width=740" border=undefined>
Figure 3 Schematic diagram of motor drive control



The basic requirements for low -power design of microcontrollers

are as follows: 1) All circuit units in the system have power management functions, that is, the circuit units can be turned off (no power consumption) during non-effective operation. The system has the ability to implement fine power management according to the effective time-space duty cycle, and can achieve reasonable system power consumption allocation.
2) For micro-effective operations that the system cannot reach, the static and dynamic characteristics of the circuit are required to meet the power consumption allocation, that is, the circuit has power consumption in the dynamic process, and no power consumption when the circuit is static.

This embedded door lock system is powered by 4 1.5V batteries, and the useless power consumption is required to be minimized as much as possible, so the working mode of the microcontroller selects the complete power-down mode. The important factors for the low power consumption of the door lock system are power supply voltage, crystal oscillator frequency, setting of functional modules, and setting of I/O ports and external circuits.
In this system, 3.3V is selected as the power supply voltage of the microcontroller; the internal crystal oscillator is selected to save external resources while reducing power consumption. When the MCU enters the complete power-down state, it can be awakened by the watchdog timer (using reset or interrupt), external interrupt INT0/INT1, keyboard interrupt, real-time clock, etc. INT0/INT1 interrupts are valid at falling edge/low level, and keyboard interrupts are valid at low level. Therefore, the corresponding pins must be high before entering the interrupt, otherwise it is difficult to wake up the MCU from a completely power-off state.

The real-time power management capability of the embedded system is reflected in the ability to ensure that the system can achieve the maximum static operation of the system time and space according to the effective operation time and space duty cycle. The core technology is the control and scheduling of the clock and signal flow in the system. At the time and area of invalid operation of the system, the clock operation or entry is terminated, and the switch and pulse signal are prohibited from entering. After reasonable task allocation, the static power consumption of the system can be greatly reduced, and some adjustments can be made in the selection of hardware resources. Experiments show that after reasonable task allocation, the static power consumption of the system can be reduced to 10mA, and the current is less than 100mA during normal operation. Compared with similar products, this system has good low power consumption performance.

740)this.width=740" border=undefined>
Figure 4 System initialization steps740

)this.width=740" border=undefined>
Figure 5 Communication format with array

The mechanical

drive part of the motor drive circuit is driven by a small DC motor. Since the driving ability of the single-chip microcomputer is extremely limited, it is necessary to drive and amplify the output of the single-chip microcomputer. Here, the BA6289 logic control chip is used. It can receive TTL logic levels and is used to drive inductive loads. It performs logical control according to different operations on the door lock, drives the forward and reverse rotation of the motor, and pushes the lock tongue on the door lock in and out. The motor rotates forward, the lock tongue retreats, and the door opening action is realized; the motor reverses, the lock tongue advances, and the door closing action is realized. The schematic diagram of the motor forward and reverse control circuit is shown in Figure 3.

System encryption design

Single-chip microcomputer systems generally use MCU+EPROM mode. Usually EPROM is transparent. Although many MCUs have encryption bits, most of them can now be cracked. In order to protect the fingerprint recognition door lock algorithm developed by the self-developed, system encryption is a key. Common single-chip microcomputer encryption technologies are hardware encryption and software encryption. Software encryption cannot prevent others from copying, but can only increase the difficulty of dissection and analysis, and the security is insufficient.

Now many MCUs have encryption bits, and the most successful encryption method used in single-chip microcomputers is the bus burning method. That is, the specific I/O of the microcontroller data bus is permanently destroyed. Even if the decryptor erases the encryption bit, he cannot read the correct code of the program on the chip. In addition, there is a method of destroying the EA pin. This method is relatively successful in encrypting small programs, but because the bus has been destroyed, it can no longer be used to expand the interface chip and memory. At the same time, the on-chip memory no longer has the reprogramming feature.

System software design

The fingerprint recognition door lock system is a completely independently developed software with independent intellectual property rights. Its complete system management protocol enhances the robustness and portability of the software. The complete fingerprint recognition command set enables it to automatically register, identify and output fingerprint data. The system software overall program includes the monitoring and control part and the communication part. The monitoring and control part includes door lock control software such as door opening and closing, emergency password door opening, fingerprint entry, fingerprint deletion and other programs, as well as fingerprint recognition management, power management, timer interrupt management, watchdog, external command processing and I2C bus memory and other programs. The communication part mainly includes communication protocols and drivers, among which the communication protocol includes data reception, data transmission, verification, data packet processing and other programs; the device driver includes register configuration and system status control programs.

740)this.width=740" border=undefined>|
Table 1 Performance indicators of fingerprint lock

System Initialization

After the embedded fingerprint lock system is started or reset, the system hardware and software operating environment need to be initialized. These tasks are completed by the startup program, which is usually written in assembly language. Writing a good startup program is the key to designing a good embedded program. The operations performed by the system startup program are related to the specific target system and development system. The process is shown in Figure 4. The system management protocol of
the fingerprint recognition software protocol command set

includes function component update download, device reset, component error handling, detection of the number of registered users, detection of memory information, detection of security level, setting of security level, detection of the number of fingerprints registered by each user, setting of the number of fingerprints entered by each user, and setting of baud rate. The fingerprint recognition command set includes automatic ID registration of users, given ID registration of users, deletion of given ID users, matching and deletion of users, deletion of all users, given ID user identification, automatic ID user identification, extraction of feature information, feature information matching, acquisition of feature information from the module, and storage of feature information in the module. The following is a design description of the automatic user registration part of the software fingerprint recognition protocol command set.

Automatic user registration means that the system uses the automatically selected ID number to register the user, as follows:
STI_USER_REGISTRATION: Start registration
 0x1b - 0x5e - 0x50 - Start ID NumberH- Start ID NumberL
STI_USER_REGISTRATION _SUCCESS: Registration success
 0x1b - 0x5e - 0x51 - Start ID NumberH- Start ID NumberL
 Where Start ID NumberH/ Start ID NumberL is the ID value at the beginning of registration
STI_USER_REGISTRATION_ERROR: Registration failed
 0x1b - 0x5e - 0x52 - 0x00- ID Number

Communication protocol between microcontroller and fingerprint module

The working core of the system is the fingerprint module, which includes almost all operations for fingerprint processing. The fingerprint recognition module interfaces with the user through the RS232 serial port. The user uses this interface to command the module to complete a series of operations such as fingerprint collection and fingerprint comparison. The communication between the microcontroller and the fingerprint module is half-duplex asynchronous communication, and the default baud rate of the RS232 interface is 9600bps.

The communication between the microcontroller and the fingerprint module uses frames to receive and send commands, data, and results. The communication format includes packet identification, address code reserved words, packet length, packet content, and checksum.

Because of the serial port communication, one or two bytes are sometimes lost at the beginning of data reception, so when receiving data packets, the program may fall into an infinite loop due to incomplete received bytes. Here, if no data is received within the specified time, the receiving program is forced to exit, and then the data is received again. Since the working frequency of the fingerprint module and the microcontroller is very fast, it will not affect the work of the system at all.

Similarly, the microcontroller and the module transmit commands through a string of message frames. When writing the program, an array is used to store the data received from the module by Receive [Max], as shown in Figure 5. When the microcontroller sends a command to the module through the serial port and then waits to receive the command, one or two bytes are often lost or incorrect, which causes the data in the array Receive [Max] to lose one or two bytes. Referring to the communication protocol of the fingerprint module, we know that most of the data in the message frame are the same, with only one or two different keywords in the middle of the data frame. Therefore, according to the possible situations of the module action, search for the corresponding one or two keywords in the array Receive[Max] of the received data, so that the module action can be correctly judged.

System test

The test plan is designed according to the security performance index of the door lock. The system test is mainly carried out from the following aspects:
1) Use fingerprints of different qualities: use about 500 different fingerprints for unlocking, registration and other tests;
2) The same fingerprint is tested under different conditions: such as dry and wet, damaged, different pressure and temperature, different position angles, and oil pollution;
3) Uninterrupted working mode: long-term fatigue test, frequent unlocking and locking, test the stability of the system;
4) Artificially create emergency conditions: insufficient power, malicious unlocking, forgetting to close the door after unlocking, ordinary users' fingers cannot open the door, canceling illegal user permissions, etc.

The performance indicators of the core part of the fingerprint lock after testing are shown in Table 1.
  
Conclusion

After a lot of testing work, the performance of this door lock system is in good condition and meets the requirements of security and ease of use. The door lock system has the functions of authorizing fingerprint entry, deleting fingerprints by ID number or level, and recording the latest 10 door opening records. 150 fingerprints can be entered. This system adopts an embedded system structure, as well as peripheral devices with high precision, fast response, low power consumption and small size, with mature fingerprint recognition algorithm and perfect functional design, as well as emergency door opening scheme, encryption design and low power consumption design. The false recognition rate of this embedded fingerprint lock is 0.001%~0.01%, the rejection rate is 0.1%~1%, and the processing speed is less than 0.3s, which fully meets the requirements of fingerprint recognition products. A small sample of embedded fingerprint locks made with this system as the core has been supplied to the overseas market at the end of 2005.

This post is from MCU
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list