Arduino Keypad door lock

Robotshapers.com is proud to introduce our advanced keypad door locks, offering easy and reliable security solutions for residential and commercial properties. With our innovative keyless entry system, users can enter a unique code to unlock doors, eliminating the hassle of traditional keys. These locks find applications in various settings, including homes, businesses, hotels, universities, healthcare facilities, government offices, and industrial sites. By providing personalized access codes and allowing easy control and reprogramming, our keypad door locks ensure enhanced security and convenience. Featuring sleek designs, backlit keypads, and compatibility with alarm and home automation systems, our locks offer a modern and efficient solution for secure access control. Join the future of door security with Robotshapers' keypad door locks.

Arduino Keypad door lock

Key locks are advanced security systems that provide easy and reliable protection for residential and commercial properties. These locks allow entry via a numeric keypad, eliminating the need for traditional keys. The user enters a unique code (usually a string of numbers) to unlock the door.
Door lock with key consists of fixed door lock, control unit and electronic lock mechanism. The agency reviews the access process and decides whether to grant access.
After entering the correct code, the electronic lock will be activated to open the door. The main benefits of the key door lock include the added security of an individual number that eliminates the risk of keys being lost or stolen. They provide easy control by activating transfer codes or temporary codes for guests or service providers. Keyed door locks are also useful because users can quickly enter the password without having to search for the key.

These locks come in a variety of designs and features, including backlit keypads for ease of use in low light, and additional security features such as integration with alarm or home automation systems. With its security, convenience and convenience, the Keypad door lock has become a popular choice for modern homes and businesses looking for a security control solution.

Components required:

  1. Arduino Uno
  2. 16 x 2 LCD
  3. 4 x 4 keypad
  4. SG90 Servo motor
  5. 10 K variable resistor
  6. Buzzer
  7. 5V DC power supply

Circuit diagram:

Code:

#include 
#include
LiquidCrystal lcd(A0,A1,A2,A3,A4,A5);
#include 
#include 

#define buzzer 12

Servo servo;


String newPasswordString; //hold the new password
char newPassword[6]; //charater string of newPasswordString
byte a = 5;
bool value = true;

Password password = Password("1234"); //Enter your password

byte maxPasswordLength = 6;
byte currentPasswordLength = 0;
const byte ROWS = 4; // Four rows
const byte COLS = 4; // Four columns


char keys[ROWS][COLS] = {
  {'D', 'C', 'B', 'A'},
  {'#', '9', '6', '3'},
  {'0', '8', '5', '2'},
  {'*', '7', '4', '1'},
};


byte rowPins[ROWS] = {2, 3, 4, 5};
byte colPins[COLS] = {6, 7, 8, 9};

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );


void setup() {
  Serial.begin(9600);
  pinMode(buzzer, OUTPUT);
  servo.attach(10);
  servo.write(50);
  lcd.begin(16,2);
  lcd.setCursor(3, 0);
  lcd.print("ROBOTSHAPERS");
  lcd.setCursor(0, 1);
  lcd.print("KEYPD LOCK");
  delay(1500);
  lcd.clear();
}

void loop() {
  lcd.setCursor(1, 0);
  lcd.print("ENTER PASSWORD");

  char key = keypad.getKey();
  if (key != NO_KEY) {
    delay(60);
    if (key == 'C') {
      resetPassword();
    } else if (key == 'D') {
      if (value == true) {
        doorlocked();
        value = false;
      } else if (value == false) {
        dooropen();
        value = true;
      }
    } else {
      processNumberKey(key);
    }
  }
}

void processNumberKey(char key) {
  lcd.setCursor(a, 1);
  lcd.print("*");
  a++;
  if (a == 11) {
    a = 5;
  }
  currentPasswordLength++;
  password.append(key);

  if (currentPasswordLength == maxPasswordLength) {
    doorlocked();
    dooropen();

  }
}

void dooropen() {
  if (password.evaluate()) {
    digitalWrite(buzzer, HIGH);
    delay(300);
    digitalWrite(buzzer, LOW);
    servo.write(50);
    delay(100);
    lcd.setCursor(0, 0);
    lcd.print("CORRECT PASSWORD");
    lcd.setCursor(0, 1);
    lcd.print("OPEN THE DOOR...");
    delay(2000);
    lcd.clear();
    a = 5;
  } else {
    digitalWrite(buzzer, HIGH);
    delay(200);
    digitalWrite(buzzer, LOW);
    delay(200);
    digitalWrite(buzzer, HIGH);
    delay(200);
    digitalWrite(buzzer, LOW);
    delay(200);
    digitalWrite(buzzer, HIGH);
    delay(200);
    digitalWrite(buzzer, LOW);
    delay(200);
    lcd.setCursor(0, 0);
    lcd.print("WRONG PASSWORD!");
    lcd.setCursor(0, 1);
    lcd.print("PLEASE TRY AGAIN");
    delay(2000);
    lcd.clear();
    a = 5;
  }
  resetPassword();
}

void resetPassword() {
  password.reset();
  currentPasswordLength = 0;
  lcd.clear();
  a = 5;
}

//void changePassword() {
//  newPasswordString = "1234";
//  newPasswordString.toCharArray(newPassword, newPasswordString.length() + 1); //convert string to char array
//  password.set(newPassword);
//  resetPassword();
//  lcd.clear();
//  lcd.setCursor(0, 0);
//  lcd.print("Password changed");
//  delay(1000);
//  lcd.clear();
//}

void doorlocked() {
  if (password.evaluate()) {
    digitalWrite(buzzer, HIGH);
    delay(300);
    digitalWrite(buzzer, LOW);
    servo.write(110);
    delay(100);
    lcd.setCursor(0, 0);
    lcd.print("CORRECT PASSWORD");
    lcd.setCursor(2, 1);
    lcd.print("DOOR LOCKED");
    delay(2000);
    lcd.clear();
    a = 5;
  } else {
    digitalWrite(buzzer, HIGH);
    delay(200);
    digitalWrite(buzzer, LOW);
    delay(200);
    digitalWrite(buzzer, HIGH);
    delay(200);
    digitalWrite(buzzer, LOW);
    delay(200);
    digitalWrite(buzzer, HIGH);
    delay(200);
    digitalWrite(buzzer, LOW);
    delay(200);
    lcd.setCursor(0, 0);
    lcd.print("WRONG PASSWORD!");
    lcd.setCursor(0, 1);
    lcd.print("PLEASE TRY AGAIN");
    delay(2000);
    lcd.clear();
    a = 5;
  }
  resetPassword();
}

Applications:

Keyed door lock is suitable for many places where security access is required. Here are some key applications:

  1. Home Appliances: Keyed door locks are widely used in homes and buildings to provide homeowners with a convenient way of keyless entry. 
  2. Business Buildings: Businesses and offices use door locks to control access to various areas of the building.
  3. Treatment: Hotels and resorts use keyed door locks in guest rooms to provide security and keyless entry. 
  4. Universities: Schools, colleges, and universities use door locks in classrooms, laboratories, and administrative areas. This provides access control and increases campus security by restricting access.
  5. Medical Facilities: Hospitals, clinics, and medical facilities use keyed door locks to restrict access to sensitive areas such as operating rooms, medicine rooms, and patient information.
  6. Government: Government offices, courts, and military facilities rely on keypad door locks to secure restricted areas and control access to confidential information.
  7. Industrial Facilities: Building factories, warehouses and industrial estates use keyed door locks to control access to manufacturing facilities, warehouses and storage areas, protect valuables and comply with process security.

Best projects in Bhilai, Chhattisgarh, India. Contact: 7067150002