This project creates a password-protected door lock using an Arduino UNO, a 4x4 keypad, a servo motor, an I2C LCD, and a buzzer. When powered on, the system waits for the user to press the "∗" key. Once pressed, it prompts for a password. If the correct password is entered, the servo motor unlocks the door, stays open for 2 seconds, and then locks again.
🛠Parts Used:
- Arduino UNO – The brain of the system.
- 4x4 Keypad – Used to input the password.
- Servo Motor (SG90 or MG995) – Controls the door lock mechanism.
- I2C LCD Display (16x2) – Displays system status.
- Buzzer – Provides sound feedback on correct/incorrect password entry.
- Breadboard & Jumper Wires – For easy wiring and connections.
🔌 Connections & Circuit Diagram
🔗 Wiring:
| Component | Arduino UNO Pins |
|---|---|
| Keypad (4x4) | D2 - D9 (Row & Column Pins) |
| Servo Motor | PWM Pin D10 (Signal), VCC (5V), GND |
| I2C LCD | SDA (A4), SCL (A5), VCC (5V), GND |
| Buzzer | D11 (Positive), GND (Negative) |
⚡ Circuit Diagram:
(I'll describe it, but you may want to use Fritzing to visualize it.)
- Connect the 4x4 Keypad to D2–D9.
- Connect the Servo motor to D10, 5V, and GND.
- Connect the I2C LCD to SDA (A4) and SCL (A5).
- Connect the Buzzer to D11 and GND.
Circuit Diagram
Video Link: - Click Here For Video
How To Make Password-Protected Door Lock Using Arduino UNO DIY Project by WTC Zone simple Circuit: -
Arduino IDE Program
Code for Password-Protected Door Lock Using Arduino UNO DIY Project by WTC Zone
#include <Wire.h>#include <LiquidCrystal_I2C.h>#include <Keypad.h>#include <Servo.h>
// Define I2C LCD (16x2) address 0x27LiquidCrystal_I2C lcd(0x27, 16, 2);
// Define servoServo doorLock;
// Define buzzer pin#define BUZZER 11
// Define the keypad size and keysconst byte ROWS = 4; const byte COLS = 4; char keys[ROWS][COLS] = { {'1','2','3','A'}, {'4','5','6','B'}, {'7','8','9','C'}, {'*','0','#','D'}};
byte rowPins[ROWS] = {2, 3, 4, 5}; byte colPins[COLS] = {6, 7, 8, 9};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
// Set the passwordString password = "1234"; // Change as neededString inputPassword = "";bool requestPassword = false;bool doorOpen = false; // Track door state
// Function to play a startup tonevoid playStartupTone() { tone(BUZZER, 1000, 200); delay(300); tone(BUZZER, 1500, 200); delay(300); tone(BUZZER, 2000, 200); delay(300); noTone(BUZZER);}
// Function for door opening alertvoid doorOpeningTone() { tone(BUZZER, 1200, 300); delay(350); noTone(BUZZER);}
// Function for door closing alertvoid doorClosingTone() { tone(BUZZER, 800, 300); delay(350); noTone(BUZZER);}
void setup() { lcd.init(); lcd.backlight(); lcd.setCursor(0, 0); lcd.print("Door Lock System");
doorLock.attach(10); doorLock.write(0); // Keep door locked initially
pinMode(BUZZER, OUTPUT); digitalWrite(BUZZER, LOW);
// Play startup tone playStartupTone(); delay(2000); lcd.clear(); lcd.print("Press * to Start");}
void loop() { char key = keypad.getKey();
// If * is pressed, start password entry if (key == '*') { requestPassword = true; inputPassword = ""; lcd.clear(); lcd.setCursor(0, 0); lcd.print("Enter Password:"); }
// If entering password, collect input if (requestPassword && key && key != '*' && key != '#' && key != 'D') { inputPassword += key; lcd.setCursor(inputPassword.length(), 1); lcd.print('*'); // Hide actual input }
// Check password when # is pressed if (key == '#' && requestPassword) { if (inputPassword == password) { lcd.clear(); lcd.print("Access Granted");
// Beep once for success tone(BUZZER, 1000, 200); delay(300); noTone(BUZZER);
// Play door opening alert doorOpeningTone();
// Open door doorLock.write(90); doorOpen = true; // Mark door as open lcd.clear(); lcd.print("Door Open"); lcd.setCursor(0, 1); lcd.print("Press D to Close"); } else { lcd.clear(); lcd.print("Wrong Password!");
// Beep twice for wrong password for (int i = 0; i < 2; i++) { tone(BUZZER, 2000, 200); delay(300); } noTone(BUZZER);
delay(2000); lcd.clear(); lcd.print("Press * to Start"); } inputPassword = ""; requestPassword = false; }
// If door is open and 'D' is pressed, close the door if (key == 'D' && doorOpen) { lcd.clear(); lcd.print("Closing Door...");
// Play door closing alert doorClosingTone();
// Close door doorLock.write(0); doorOpen = false; // Mark door as closed delay(2000); lcd.clear(); lcd.print("Press * to Start"); }}
-------------------------------------------------------------------------------------------------------------------------------
Share, Support, and Subscribe!!! 1. PRO KAM EXPLAINED 2. Knowledge KAM 3. PRO KAM Follow us on 1. Facebook 2. Instagram 3. Pinterest 4. Blogspot 5 Twitter If you have any other ideas to make me design, you can describe them in the comment section and if I can, I will make a designing video on it. So I am waiting #prokam #wtc #Arduino #ideas #projects #diy #how #to #ArduinoProjects #UltrasonicSensor #HeightMeasurement #TechDIY #WeTechCreators #wtczo
0 Comments