Day 01

Begineer

Day 29 :- Password Door Lock

Sept 16, 2026

Completed

Wiring Schematic

Arduino Code

ARDUINO / C++

Day 29 Core Training Documentation

Project Overview

The Password Door Lock project teaches you how to build a secure access control system that requires correct password entry for access authorization. This project creates an electronic lock with advanced security features.

In this project, a 4×4 matrix keypad allows users to enter a password securely. Arduino compares the entered password with a stored secure password in memory. If the password matches, the Servo Motor unlocks the door. If wrong, the system displays an error and denies access.

When the temperature or humidity changes, the When a user approaches the lock, the system prompts for password entry on an OLED display. The user presses number keys on the keypad. Each keystroke displays as an asterisk for security. When correct password is entered, the door unlocks for a set time.

This project teaches Keypad Input Handling, Password Validation Logic, Secure Access Control, User Feedback Systems, and Security Application Development.

By finishing this project, you’ll know how electronic locks work in secure facilities, residential smart locks, and professional access control systems.

Components Required

To build this circuit, collect these specific items from your kit:

Arduino Uno × 1, Breadboard × 1, 4×4 Matrix Keypad × 1, Servo Motor × 1, OLED Display 128×64 × 1, Buzzer × 1, LED (Red and Green) × 2, 220Ω Resistor × 2, Keypad Library, Jumper Wires × 12, USB Cable × 1

Circuit Connections

Step 1: Connect Ground Rail

Connect the Arduino GND pin to the negative rail of the breadboard. This creates a shared ground connection for all door lock system components.

Step 2: Connect Keypad Rows

Connect the keypad row 1 pin to Arduino Pin 2. Connect row 2 to Pin 3. Connect row 3 to Pin 4. Connect row 4 to Pin 5 for row signal input.

Step 3: Connect Keypad Columns

Connect the keypad column 1 pin to Arduino Pin 6. Connect column 2 to Pin 7. Connect column 3 to Pin 8. Connect column 4 to Pin 9 for column signal input.

Step 4: Connect OLED Display

Connect OLED VCC to Arduino 5V. Connect OLED GND to breadboard GND. Connect OLED SDA to Arduino Pin A4 and SCL to Pin A5 for I2C communication.

Step 5: Connect Servo Motor

Connect servo VCC to Arduino 5V. Connect servo GND to breadboard GND. Connect servo signal to Arduino Pin 10 for lock positioning control.

Step 6: Connect Red LED

Connect the red LED anode to Arduino Pin 11 through a 220Ω resistor. Connect the cathode to ground. This LED indicates when access is denied.

Step 7: Connect Green LED

Connect the green LED anode to Arduino Pin 12 through a 220Ω resistor. Connect the cathode to ground. This LED indicates when access is granted.

Step 8: Connect Buzzer

Connect the buzzer positive terminal to Arduino Pin 13. Connect the negative terminal to breadboard ground. This provides audio feedback for access events.

Step 9: Verify Connections

Use a keypad tester or manual testing to verify all keypad connections are correct. Check that each key press registers on only one row and column combination properly.

Important: The 4×4 keypad requires proper row and column configuration. Installing the Keypad library from Arduino IDE is essential for proper operation and functionality.

How the Arduino Code Works

Initialize Keypad and Display

In setup(), Arduino initializes the keypad library with the correct pin assignments for rows and columns. The OLED display is initialized and shows a welcome message prompting password entry.

Create Secure Password Storage

A stored password string is defined in the code as a constant that only Arduino knows. This password should be unique and kept secure. Only the correct password grants access.

Accept Keypad Input

Inside the main loop, Arduino continuously monitors the keypad for key presses. The getKey() function retrieves pressed keys. Each pressed key is stored in a password entry string.

Display Asterisks for Security

As the user enters the password, each keystroke is displayed as an asterisk on the OLED display instead of showing the actual number. This prevents shoulder surfing and password observation.

Validate Password When Complete

When the user presses the enter key or after a set number of digits, Arduino compares the entered password with the stored password. If they match exactly, access is granted automatically.

Expected Output

After uploading your code, here is what happens.

After uploading your code, the OLED display shows welcome message prompting password entry. When the user presses a key, an asterisk appears on the display. After entering the correct password, the green LED illuminates, buzzer sounds, and servo unlocks.

Operational Troubleshooting

Keypad Does Not Register Presses :- Verify all keypad row and column pins connect to the correct Arduino pins. Check that the Keypad library is installed. Ensure the row and column pin definitions match your circuit.

Servo Does Not Unlock Door :- Verify the servo signal wire connects to Pin 10. Check that the servo receives proper 5V power. Test the servo with a simple sweep test to verify operation.

OLED Does Not Display Password Entry :- Verify the OLED connects to Pins A4 and A5 for I2C communication. Check that the display is powered at 5V. Verify the I2C address in your code matches the display.

Password Validation Always Fails :- Ensure the stored password in your code exactly matches the password you are entering. Check that the password comparison logic is case-sensitive if using letters. Verify password length.

Buzzer Makes No Sound :- Verify the buzzer positive terminal connects to Pin 13 and negative connects to ground. Check that the tone() or digitalWrite() command is included in your code for audio feedback.

What You Learned

By finishing this project, you now know :-

How to interface matrix keypads with Arduino for input. You understand how to implement secure password validation systems. You learned to create user-friendly input interfaces for access control. You mastered coordinating multiple actuators for access control functions. You developed practical security system building skills and applications.

Next Lesson

In Day 30, your final challenge project awaits where you combine everything you have learned to create a unique and innovative project of your own design. You will showcase your mastery of embedded systems.