Security and anti-theft have become a social issue. Locks have been the iron generals guarding the door since ancient times. People have high requirements for them. They must be safe and reliable against theft and easy to use. This has also been the theme of lock makers' research for a long time.
The electronic combination lock designed in this article is similar to the AB lock sold on the market, but the main difference is that the owner of this combination lock decides the password for guests to enter, and there is no need to change the lock to prevent people who have used the lock from entering again, and only the owner has the right to modify the password.
1 Design Idea
The multi-user password lock in this article has an administrator user who has the right to modify the password. There are also two guest users who can unlock the lock according to the password provided by the administrator, but they cannot modify the password at will. When changing residents, only the administrator needs to change the password, which avoids the trouble of changing the lock and saves costs.
The design of the password lock is made of a universal board, so it involves the arrangement and routing of components. Since there is an administrator user (master user), he can modify the passwords of himself and two guest users, and the two guest users' right to modify the passwords must be restricted. Therefore, the password modification procedure needs to be carefully handled. There are two conditions when entering the password modification procedure. First, the system is entered by the master user; second, the password modification button is pressed. Special attention should also be paid to the password input procedure to distinguish and confirm which user enters the current system, that is, the user name and password must be matched, which is also the key to the design.
2 System Structure and Principle
2.1 System Structure
The multi-user password lock circuit design is divided into 6 parts: power supply, user display unit, crystal oscillator circuit, keyboard circuit, programming control part, and function display unit. Through typesetting and layout, these 6 parts are combined to form a complete multi-user password lock control circuit, as shown in Figure 1.
2.2 System Principle
First, a crystal oscillator circuit is required to generate a working clock and send it to each component inside the microcontroller to make it work normally. Secondly, the parallel port P1 of AT89C5l is used to connect a 4×4 matrix keyboard, with P1.0~P1.3 as output lines and P1.4~P1.7 as input lines. The row and column lines of the matrix communicate with the CPU through two parallel interfaces respectively. The combination of row and column values obtained by scanning is used to identify the code of the pressed key to complete the input of the password, the input and switching of the user name, as well as the input of the confirmation, cancel command, password modification command, user switching command and lock command. Furthermore, the microcontroller transmits the data signal to be displayed to the digital tube through the P2 port, directly controls the display of the digital tube, thereby lighting up the digital tube and displaying the current user. The entire system realizes the realization of various signal prompt functions.
3 Circuit design of each functional module
3.1 Keyboard Circuit
To enter the password of the password lock, you must use the keyboard. The keyboard is designed to be 4×4. In addition to the 10 numeric keys from 0 to 9, there are also "OK", "Cancel", "Password Modification", "Lock", "User Switch", and "Display Switch". The 4×4 matrix arrangement can effectively save port resources and avoid the use of port expansion modules. When the keyboard is installed, the keys are arranged in a matrix in a 4×4 format. Connect pull-up resistors to the P1.4~P1.7 output lines so that the ports can be accurately set high and low. The other end of the pull-up resistor is connected together to a 5 V power supply. The circuit is shown in Figure 2.
3.2 Display Circuit
The circuit mainly uses seven-segment digital tubes. The single-chip microcomputer transmits the data signal to be displayed to the digital tube through the P2 port, directly controls the display of the digital tube, and thus lights up the digital tube. Since the clock frequency of the single-chip microcomputer reaches 12 MHz, it is not possible to see the data being transmitted one by one. From the perspective of human vision, it is as if all digital tubes are displayed at the same time. The single-chip microcomputer controls the digital tube to display 1 to 3, representing 3 users respectively. The hardware circuit is mainly that the a to g of the 7-segment display decoder is connected to the P2.0 to P2.6 of the single-chip microcomputer, and the value to be displayed is obtained by looking up the table. The circuit is shown in Figure 3.
4 Software Design
4.1 Software Design Concept
The whole system is designed to distinguish the entry of three users. Only the main user can modify his or her own and the guest user's passwords after entering. Other users cannot modify their passwords after entering.
The program design mainly includes the password modification program, password input program, alarm program, key scanning program, numeric key conversion program and function key conversion program. During the operation of the entire program, the key scanning program is placed in the interrupt service subroutine and scans every 150ms. In the design of the password modification program, each user has been marked when entering the system to ensure that when the password is modified, it can be accurately identified which user modified the password and whether the user has the right to modify the password.
4.2 Design of the main program
First determine whether the password is entered. If the password is entered, enter the password into the password input buffer. After the password is entered, perform a password comparison to distinguish which user enters the password lock system. After the comparison is successful, use the flag to distinguish the master user from the guest user. In the password modification program. First, determine whether it is the master user. Secondly, determine whether there is a password modification requirement. If the above two conditions are met, enter the password modification program. If the two new passwords are the same, it means that the password modification is successful. Next is the alarm subroutine, which uses the register to accumulate the number of consecutive incorrect passwords entered. If it reaches 3 times, an alarm signal is generated. Finally, there is a display subroutine to display the current user entering the system. The main program flow chart is shown in Figure 4.
5 Conclusion
The password lock designed in this paper can ensure that the password can be modified by the authorized user, and also restrict the user from modifying his or others' passwords. Taking the AT89C52 single-chip microcomputer chip as the core, the overall system design, hardware module circuit and software design are given.
Previous article:Car temperature control system based on single chip microcomputer and CDMA
Next article:Development of Short Message Terminal Phone Based on 80C31
Recommended ReadingLatest update time:2024-11-16 21:40
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- RIGOL Live Replay | China's "Core" flagship digital oscilloscope is launched
- List of problems in using CC1310
- [GD32L233C-START Review] V. I2C (Hardware I2C Driven OLED)
- How to prevent lithium battery from supplying power to load when charging
- [NXP Rapid IoT Review] + Rapid IOT Kit Review Summary
- Please give me some guidance on the route of analog electronics learning
- Worried about switching from Class AB to Class D? No need to worry
- [ART-Pi Review] 4: Networking to synchronize time and automatically connect to WiFi
- IO port level conversion
- DSP C6000 Architecture