Design of electronic password lock system for safe door based on single chip microcomputer

Publisher:自由思想Latest update time:2011-08-11 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

This paper aims to strengthen the security management of the vault. Aiming at the current management defects of the vault, this paper designs an electronic password lock system for the vault door. This password lock does not require changing the password, but the unlocking password is different each time. It has high confidentiality. It requires entering a set of random numbers and a variable password calculated by a password generator. This design is very suitable for situations where the security factor is very high and requires multiple people to manage and participate in order to unlock. The unlocking password is different each time, which solves the shortcomings of traditional keyboard-type electronic password locks that are easily tested by others on the keyboard or peeped by bystanders, and lack of confidentiality.

1 Design ideas

The whole design consists of two parts: the safe door password lock controller and the password generator. Both parts have LCD display modules and keyboard modules as interfaces and tools for human-computer dialogue. The difference is that the password lock controller also includes a password recognition module and an unlocking control module. The user enters the password information from the keyboard, and the unlocking control module and the alarm system are controlled through the calculation, comparison and judgment of the built-in information. The password generator mainly includes a password generation module, which calculates the password through a certain algorithm based on the information entered by the user, and feeds the password back to the user through the LCD display.

The password generator is managed by an institution head. When a user needs to open the vault door, the vault door password controller first generates a six-digit random code for the user. After the user obtains the random code, he needs to ask the institution head for the password. The institution head enters a 2-digit random serial number and a 6-digit random code informed by the user on the password generator according to the prompts. The password generator calculates a 6-digit password. The responsible person informs the user of the 2-digit random serial number and the 6-digit password. After the user enters the 2-digit serial number and the 6-digit password, the vault door password lock is calculated by the same algorithm. If the password matches correctly, it will be unlocked, otherwise it will not be opened. If the password is entered incorrectly more than 3 times, the buzzer will sound and the alarm system will be activated. Only by entering the correct system built-in password can the buzzer stop sounding and the alarm system be turned off.

The vault door password lock controller and password generator have the same built-in password, which can be reset. When resetting, the original password needs to be verified. If they are the same, they can be changed and the new password is saved in the EEP-ROM of the microcontroller. After shutting down, the saved password is not lost. After resetting the built-in password, the same random code and random serial number will result in a different unlocking password.

2 Introduction to STC12 series MCU and OCM12864

STC12 series MCU is a single clock/machine cycle (1T) MCU produced by Hongjing Technology. Compared with ordinary MCU, it has the advantages of high speed/low power consumption/super strong anti-interference/unable to decrypt. It is a new generation of 8051 MCU, and the instruction code is fully compatible with the traditional 8051, but the speed is 8 to 12 times faster. The working voltage is 3.8 V ~ 2.2 V (3 V MCU) / 5.5 V ~ 3.3 V (5 V MCU), with 6 16-bit timers, compatible with ordinary 8051 timers or 4 external interrupts, with watchdog and EEPROM functions, and internally integrated MAX810 dedicated reset circuit. Based on the above advantages, this design uses STC12 series MCU.

The LCD display part uses the OCM12864 graphic dot matrix LCD module, which has a 128×64 dot matrix, can display various characters and graphics, can be directly interfaced with the CPU, and has an 8-bit standard data bus, 6 control lines and a power line. OCM12864 has its own instruction set. Combined with the interface timing of OCM12864, it can realize the read and write operations of the LCD module. Figures 1 and 2 are the read and write operation timings of OCM12864, respectively. By comparing the read and write operation timings, it can be found that the difference in the read and write operation timings lies in the value of the chip select signal R/W when E is valid. When E is high and R/W is high, the microcontroller performs a read operation; when E is high and R/W is low, the microcontroller performs a write operation. This design uses OCM12864-5 (3 V) and OCM12864-2 (5 V) in OCM12864. According to the read and write operation timing programming provided by Jinpeng Electronics Co., Ltd., the reading and writing of the LCD module can be realized.

3 Hardware Design

The system hardware design consists of two parts: password generator hardware design and password lock controller hardware design.

3.1 Password Generator Hardware Design

With STC12 series single-chip microcomputer STC12LE5410AD (3 V single-chip microcomputer) as the core, the structural block diagram is shown in Figure 3. Its functional module is mainly composed of four parts: power circuit module, keyboard circuit, liquid crystal display module and indication control module.

The power module is designed with dual power switching, that is, it can be powered by the USB interface or by the battery. The voltage drawn from the USB or the battery is 5 V, and then it is stabilized by the 1117-33 voltage regulator to provide 3.3V voltage for the CPU. The P1 port of STC12LE5410AD is connected to the keyboard circuit, and P3.6 is connected to the LED light as the indicator light of the system. P3.0 is connected to the data/instruction pin RS of OCM12864 to realize data/instruction selection. When RW=1, data DB0-DB7 will be sent to the display RAM; when RW=0, data DB0-DB7 will be sent to the instruction register for execution. The read/write selection R/W of the data is controlled by P3.4. E is the read/write enable terminal of the LCD screen of OCM12864, and the left and right half screens of OCM12864 are selected through P3.2 and P3.3 of STC12LE5410AD. In addition, V0 is the adjustment voltage of the LCD and must be connected to a 10 k potentiometer together with VEE to adjust the contrast of the LCD screen. [page]

3.2 Hardware Design of Safe Door Password Lock Controller

Taking STC12C5410AD (5V single-chip microcomputer) of STC12 series as the core, the structural block diagram is shown in Figure 4, which mainly includes power circuit module, LCD display driver module, keyboard circuit module, alarm output module, serial communication module for communicating with STC12C2052AD, and unlocking control circuit.

In this system, the power circuit module is mainly composed of a 12 V transformer and a LM7805 voltage regulator circuit to provide voltage for the CPU. Since STC12C5410AD is a 5 V single-chip microcomputer, the LCD display module also uses a 5 V OCM12864-2 LCD module. The 8-bit standard data bus is connected to the P2 port of the single-chip microcomputer STC12C5410AD; the read/write selection pin R/W is connected to P3.3; the read/write enable pins CS1 and CS2 are connected to P3.7 and P3.5 respectively; RS is connected to P3.4 to control the selection of data/instructions. The system includes an alarm output circuit. When the wrong password is entered three times in a row, the buzzer alarms as a warning and the alarm system is activated. No operation can be performed until the correct built-in password is entered to turn off the alarm system. In this system, the input and display parts are separated from the unlocking control circuit. The PCB is made into two boards, and serial communication is used to realize communication between the two boards, so that the results of password comparison can be transmitted to STC12C2052AD to realize the control of the mechanical lock.

4 Software Design

4.1 Implementation of Cryptographic Algorithms

The password algorithm is one of the most important parts of this design. When the user uses the password lock to unlock, the password entered each time is different. The password is mainly calculated by a random code, a built-in password and a random sequence number through a certain algorithm.

The random code implemented directly using the mad(); statement of the C51 language has a certain random order. The random code sequence obtained after each startup is basically the same, which is a pseudo-random code. Therefore, for confidentiality products, using the rand(); statement has defects. This design uses a timer to implement a random sequence. The timer is set to mode 2, which is an 8-bit counter that can be automatically reloaded, with an initial value of 100. After the password lock controller is turned on, the timer starts timing. The user generates an interrupt by pressing the key three times, reads the value of the lower eight bits of the timer, converts it to decimal, and takes the lower two bits to store in two elements of a predefined 6-bit array. The three key presses generate a total of three 2-digit random codes, forming a 6-bit random code. The probability of repetition of this random code is very small, which is 1/1 000 000. Therefore, sampling the timer can achieve a true random code.

The user generates a 2-digit random number, which is combined with the random code and the built-in password of the password generator through a certain algorithm to generate a password. The password lock controller calculates the password based on the random number and password entered by the user, the random code, and the built-in password using the same algorithm as the password generator to generate the password, and compares it with the password entered by the user for verification.

The STC microcontroller has its own EEPROM, which is used to store passwords. The passwords are not lost after the power is turned off, and the passwords can be changed at will. The passwords are different each time they are unlocked, which can effectively prevent malicious snooping and clearly identify the people entering and leaving the vault. There is no need to change the passwords frequently, which is convenient for management.

4.2 Password lock controller program flow chart

5 Conclusion

The electronic password lock system for the vault door designed in this paper solves the management and separation of passwords in the "one password, two keys and three separations" of the vault door management. The power-on password is different each time, which effectively prevents password leakage and enhances the security of vault management. This electronic password lock system can not only be used for vault doors, but also for other products or places that require high confidentiality. Moreover, one password generator can be equipped with several password lock controllers for easy management.

Reference address:Design of electronic password lock system for safe door based on single chip microcomputer

Previous article:Solar controller based on PICl6F676
Next article:Design of hip force tester based on SPCE061A single chip microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号