Secret Password Lock Using Arduino, OLED Display and Push Buttons
by DESHBOT in Circuits > Arduino
8 Views, 0 Favorites, 0 Comments
Secret Password Lock Using Arduino, OLED Display and Push Buttons
The Secret Password Lock is an Arduino-based security project that allows the user to enter a password using two push buttons.
A 128×64 OLED display is used to show the password entry screen. The password consists of a sequence of button presses.
In this project:
- D10 = Button 1
- D12 = Button 2
The programmed password is:
1 → 2 → 1 → 1
The password is hidden on the OLED using asterisks. If the correct sequence is entered, the display shows ACCESS GRANTED. If an incorrect button is pressed, the display shows WRONG! TRY AGAIN.
Supplies
Components Required
ComponentQuantity
Deshbot shield
Arduino Uno/Nano
128×64 OLED Display
Push Buttons
Pin Connections
OLED Display
OLED PinArduino
VCC - 5V
GND - GND
SDA - A4
SCL - A5
Push Buttons
ButtonArduino
Button 1 - D10
Button 2 - D12
The other terminal of each button is connected to GND.
The program uses:
so the button reads HIGH when released and LOW when pressed.
Working Principle
The system works as follows:
- The OLED displays the SECRET LOCK screen.
- The user presses either Button 1 or Button 2.
- The Arduino checks the pressed button against the next password value.
- If it is correct, the password position advances.
- A * appears on the OLED for each correct input.
- If all four inputs are correct, access is granted.
- If an incorrect button is pressed, the password entry is reset.
- The user can try the password again.
Password Position
The variable:
keeps track of which password character the user needs to enter.
For example:
After pressing Button 1:
The process continues until the complete password is entered.
OLED Display
The initial display shows:
After a correct button press, the corresponding position is hidden using *.
Example:
The actual password is not displayed.
Access Granted
When the complete password is entered correctly, the OLED displays:
The message remains on the screen for approximately 3 seconds.
After that, the system returns to the password entry screen.
Wrong Password
If the user presses the wrong button, the OLED displays:
After approximately 1.5 seconds, the password position is reset to zero and the user can try again.
Button Debouncing
The program uses a small delay to reduce accidental multiple readings from a button press.
It also waits until the button is released:
This helps make each physical button press count as one password input.
Main Features
- OLED password interface
- Two-button password input
- Four-digit button sequence
- Hidden password entry
- Correct password detection
- Wrong password detection
- Access-granted message
- Automatic password reset
- Button debouncing
- No external RTC or sensor required
Downloads
Conclusion
The Secret Password Lock project demonstrates how an Arduino can create a simple password-based access-control system using two push buttons and an OLED display.
The project combines button input, password arrays, conditional statements, OLED graphics and input validation to create an interactive security system. It provides a good foundation for developing more advanced electronic locking and access-control projects.