-
Password-Based Security System
-
1. Introduction
This project demonstrates how to design a simple security system using an Arduino, keypad, and servo motor (acting as a lock).
The system unlocks only when the correct password is entered. It’s a good foundation for door locks, safes, and access control systems.
Component Quantity Description Arduino Uno 1 Main controller board 4×4 Keypad 1 For password input Servo Motor (SG90) 1 Acts as the door lock 16×2 LCD Display 1 To show status messages Breadboard and jumper wires — For connections Buzzer (optional) 1 To give alarm or sound feedback
3. Circuit Connections
🔌 Keypad → ArduinoKeypad Pin Arduino Pin R1 → 9 R2 → 8 R3 → 7 R4 → 6 C1 → 5 C2 → 4 C3 → 3 C4 → 2 Component Arduino Pin Description Servo signal 10 Lock control LCD RS 12 Display control LCD EN 11 Enable signal LCD D4–D7 A0–A3 Data pins Buzzer 13 Optional alert #include <Keypad.h>#include <LiquidCrystal.h>#include <Servo.h>// LCD setupLiquidCrystal lcd(12, 11, A0, A1, A2, A3);// Servo setupServo lockServo;// Keypad setupconst 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] = {9, 8, 7, 6};byte colPins[COLS] = {5, 4, 3, 2};Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);// VariablesString password = "1234";String input = "";void setup() {lcd.begin(16, 2);lcd.print("Enter Password:");lockServo.attach(10);lockServo.write(0); // locked positionpinMode(13, OUTPUT); // buzzer}void loop() {char key = keypad.getKey();if (key) {if (key == '#') {if (input == password) {lcd.clear();lcd.print("Access Granted");lockServo.write(90); // unlockdigitalWrite(13, LOW);delay(3000);lockServo.write(0); // lock againlcd.clear();lcd.print("Enter Password:");} else {lcd.clear();lcd.print("Wrong Password!");digitalWrite(13, HIGH);delay(2000);digitalWrite(13, LOW);lcd.clear();lcd.print("Enter Password:");}input = "";} else if (key == '*') {input = "";lcd.clear();lcd.print("Enter Password:");} else {input += key;lcd.setCursor(0, 1);lcd.print("*");}}}
When the system starts, the LCD shows:
“Enter Password:”
The user enters digits using the keypad.
Each key press is shown as “*” on the LCD for security.
When the user presses ‘#’, Arduino checks the input:
✅ If the password is correct, the servo rotates (door unlocks).
❌ If the password is wrong, the buzzer sounds an alarm.
The door automatically locks again after a few seconds.
6. Possible UpgradesAdd EEPROM to save password permanently
Use keypad input to change password
Add RFID reader or fingerprint sensor
Connect to Blynk app or Wi-Fi for remote access
Add motion sensor + camera for smart security
7. Applications
🔒 Smart home door locks
🏫 School lab security systems
🏢 Office access control
🧳 Safe and locker systems
-
