Password Based Door Lock System Using Arduino Uno, code of Password Based Door Lock System Using Arduino Uno, circuit diagram of Password Based Door Lock System Using Arduino Uno

As we all know, security is the need of the hour. The numbers of theft cases are significantly increasing. We all are concerned about security of our houses and locker, so a password based door lock system can solve your problem. The door will open only when correct password is entered.

Objective

The main objective of this project is to replace the traditional door lock system where we use mechanical lock and key mechanism by the password based door lock system.

  • Low power consumption
  • Simple and easy to implement
  • Economical

Component Required

Hardware

  1. Arduino UNO: The Arduino Uno-board is a 8 bit-microcontroller. It has I/0 pins including both digital and analog pins.
    Arduino Uno a MicrocontrollerBuy it here: Arduino Uno

  2. Bread board: It is a rectangular board having mounting holes present everywhere on it in a systematic manner. They are used for creating connections between components. The connections are not permanent and therefore can be removed and placed again.
    830-point bread boardBuy it here: 830 Points Breadboard

  3. Jumpers Wires: It is an electrical wire having connector (pin) at each end which is used for connecting the components. There is no need of soldering if one is using the breadboard for making connections between components in their project.
    Male to male jumper wire, male to female jumper wire and female to female jumper wire for circuit connections
    Buy it here: Male-To-Male, Male-to-Female and Female-To-Female

  4. SG-90 Servo Motor: It is small and light weight server motor with large output power. A servo motor can turn 90 degree in either direction.
    Servo Motor to control the locking system in Password based door lock systemBuy it here: SG-90 Servo Motor

  5. 4*4 Matrix Keypad Membrane: It is used as an input in a project. It has total 16 keys.
    4x4 Keypad Matrix the 16 input buttonsBuy it here: 4x4 Keypad Matrix Membrane

  6. Cardboard: It is a small piece of cardboard that can be used as surface base of the project.
    Card board for base of the Password based lock system
  7. Door Latch:
    Door Latch

Software

  1. Arduino Software (IDE): It is an open-source Software (IDE) which makes it easy for us to write code and upload it to the Arduino boards. It runs on Windows, Linux etc.

Description

Here in this project called password based door lock system; 4*4 keypad matrix is used to take input. Users have to enter the correct password to unlock the door. When the password is entered by the user, it is compared with the predefined password. If the password entered is correct then the system will open the door latch with the help of servo motor.

Connections

  • Keypad to Arduino
    1 pin – 2D pin
    2 pin – 3D pin
    3 pin – 4D pin
    4 pin - 5D pin
    5 pin – 9D pin
    6 pin – 6D pin
    7 pin – 7D pin
    8 pin – 8D pin
  • Servo to Arduino
    Positive (red) - +5V
    Negative (brown) – Ground
    Signal (yellow) – 11 pin

Code

#include <Servo.h>
#include <Keypad.h>
Servo ServoMotor;
char* password = "953";  // change the password here, pick any 3 numbers
int position = 0;
const 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] = { 8, 7, 6, 9 };
byte colPins[COLS] = { 5, 4, 3, 2 };
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
int RedpinLock = 12;
int GreenpinUnlock = 13;


void setup()
{
ServoMotor.attach(11);
LockedPosition(true);
}

void loop()
{
char key = keypad.getKey();
if (key == '*' || key == '#')
{
position = 0;
LockedPosition(true);
}
if (key == password[position])
{
position ++;
}
if (position == 3)
{
LockedPosition(false);
}
delay(100);
}
void LockedPosition(int locked)
{
if (locked)
{
digitalWrite(RedpinLock, HIGH);
digitalWrite(GreenpinUnlock, LOW);
ServoMotor.write(11);
}
else
{
digitalWrite(RedpinLock, LOW);
digitalWrite(GreenpinUnlock, HIGH);
ServoMotor.write(90);
}
}

Conclusion

Hope this project ensures the safety of your houses and locker. Hence one may replace their manual door lock with this password based door lock system. 

Diy projects

Leave a comment

All comments are moderated before being published