With the development of science and technology, security issues are becoming more and more concerned by people. Various security products have been launched one after another, such as fingerprint anti-theft, infrared anti-theft, etc. Although these products have high security, their cost is also high. It is not convenient to carry and install, which also limits their development. This paper uses ATMega 16 microcontroller, 4×3 keyboard and seven-segment digital tube display, in addition to realizing the basic functions of password verification, reset and input error alarm of the password lock, it also innovatively redefines the keyboard. By redefining the keyboard, it can effectively prevent the password from being stolen, and at the same time reduce the cost and facilitate carrying and installation.
1. Design purpose, use, function
1. Design purpose
With the advancement of science and technology, security issues are becoming more and more concerned by people, and many products have appeared on the market accordingly, such as fingerprint anti-theft, infrared anti-theft, etc. Although its security performance is very high, its cost is also relatively high, and it is not convenient to carry and install. The purpose of this design is to reduce costs and facilitate carrying and installation under the premise of ensuring high security.
2. Design purpose
Since this design has low cost and stable and excellent safety performance, it can be applied to some products with low safety performance requirements and portability, such as home anti-theft, luggage, and car luggage. Its safety performance is far better than the safety of the same cost. The idea of keyboard definition in this design can be transplanted to ATMs, cash withdrawal devices in public places, etc., which can prevent others from peeping and stealing when users enter passwords, and increase the safety of users when withdrawing money.
3. Implementation function
1) Password setting function: By default, the default password is "6666", and the keyboard defaults to
"1 2 3
4 5 6
7 8 9
# 0 *".
When the keyboard is pressed, it is the password input. For each input, the seven-segment digital tube displays "8" and moves one position to the left. If the input is correct, it will display "PASS"; if the input is wrong, it will display "ErOr". If the input error reaches three times, the keyboard will automatically lock and cannot be entered again, and the buzzer will sound an alarm. During the input process, press "*" to delete the wrong number entered, and the display will also move one position to the right.
2) Keyboard redefinition function: When the password is entered correctly, press "#" again to enter the selection and modification function. Enter "#" again to enter the keyboard redefinition function. Press each key in turn, starting from 0, until 9, when the definition ends (the "*" and "#" keys cannot be redefined). During the input process, the buzzer sounds once for each digit entered until the "0~9" are completely redefined. At this time, the digital tube displays "PASS", and the keyboard is the redefined keyboard. When entering the password again, you must enter it according to the redefined keyboard. Similarly, during the input process, press the "*" key to delete the last digit entered.
3) Function reset: When someone enters three wrong digits to trigger the buzzer, the buzzer will keep ringing and sound an alarm until its owner presses the "reset" key to restore all to default.
2. Hardware Design
1. Hardware design ideas
1) Keyboard input: 4×3 matrix keyboard input is used. The three columns correspond to PB0, PB1, and PB2 from left to right, and the four rows correspond to PB4, PB5, PB6, and PB7 from top to bottom.
2) Display: The display uses a common anode seven-segment digital tube display. The four digits correspond to PD0, PD1, PD2, and PD3 from right to left. The abcdefg of the seven-segment digital tube corresponds to ports PA0, PA1, PA2, PA3, PA4.PA5, and PA6.
3) Alarm: When the password is entered incorrectly for three times, the keyboard is locked and a high level is output at port PC0, driving the buzzer to sound continuously.
2. Circuit schematic diagram
3. Software Design
1. Programming Ideas
1) Keyboard Scanning:
The keyboard scanning program learned in the AVR class uses software de-bouncing to eliminate jitter, "delay_ms(10); //delay de-bouncing". Because the "delay function" is called on the CPU, the CPU cannot perform other tasks within 10ms, thus wasting the CPU and reducing the CPU efficiency. In view of the above defects, we have made great improvements to the keyboard scanning program. By combining the timer interrupt with the comparison interrupt, the CPU can continue to perform other tasks between the two confirmations of whether the key is pressed, thereby improving the CPU efficiency.
2) Display of the seven-segment digital tube
In view of the actual situation of this experiment: when the password passes and the keyboard is redefined, the seven-segment digital tube displays "PASS", and when an error occurs, it displays "ErOr". Therefore, in order to improve the efficiency of the program operation, the pointer variable output method is used, that is, the display of "PASS" and "ErOr" is pre-stored in the memory. When needed, the pointer variable points to the corresponding memory display. For the display of each input bit shifted left, the dynamic scanning method is used.
3) Buzzer alarm:
Output high level to PC7 port to drive the buzzer to sound an alarm.
Previous article:Application of SD card in circuit breaker offline tester
Next article:Design based on Atmega128 embedded controller
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Three steps to govern hybrid multicloud environments
- Three steps to govern hybrid multicloud environments
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- SensorTile.Box becomes bricked after firmware upgrade
- Window Comparator
- [GD32L233C-START Review] Part 2 Compilation, Software Development Environment Review
- Stuck inexplicably
- Realization of Chinese Characters and Graphics Overlay Based on DSP
- Please recommend, is there any domestic dual-channel H-bridge that can drive motors with an operating voltage of 12V or above?
- How to install and use pressure transmitter
- The flashing prompt cannot recognize the device. What's going on?
- Model-Based Design and Its Embedded Implementation
- Q&A on Connectivity: Why Wi-Fi 6 Could Be Your Competitive Advantage