Door Lock System
Door Lock System
Door Lock System
TECHNOLOGY, JALANDHAR
Jaskaran Singh
Branch: ECE-1A
Univ.. Roll No. 1803770
DECLARATION
I hereby certify that the work which is being presented in the dissertation entitled ”Digital security lock”
in the partial fulfilment of the requirements for the Institute Summer Training and submitted to the
Electronics and Communication department of the DAV Institute of Engineering and Technology,
Jalandhar, Punjab is an authentic record of my own work carried out.
This is to certify that the above statement made by the candidate is correct to the best of our knowledge.
I would like to express my sincere gratitude to all those who have been a source of guidance, co-operation
and help during my summer vacation training at DAV INSTITUTE OF ENGINEERING AND
TECHNOLOGY, JALANDHAR. I would hereby take the opportunity to express my indebtedness to
people who have helped me to accomplish this task which include my seniors Manpreet and Harish and
also my group members. Without them it was not possible to accomplish this project in the limited time
frame.
I am highly indebted to Mr. Sukhdeep Singh for his guidance and constant supervision as well as for
providing necessary information regarding the project. Also, I am very grateful to Mr. Hari Singh for
introducing and explaining the basics of the topic to us. Further words of thanks are expressed to Mr.
Amit Arora and Mr. Navleen Singh Rekhi for motivating us and giving their valuable suggestions
throughout the pursuance of this report.
ABSTRACT
Security is a prime concern in our day-to-day life. Doors locked using conventional locks are not as safe
as they used to be, anyone can break in by breaking these locks. Password based door lock system allows
only authorized persons to access restricted areas. The system is fully controlled by Arduino. The
password can be entered through a keypad. If the password is matched with the one stored in Arduino it
instructs the dc lock to open the door. The password can be changed by the user interfacing Arduino with
a pc and using a keypad to change the password. The need of safety can be achieved by making locks
which can be electrical or mechanical with one or a few keys, but locking a big area many locks are
required. As everyone knows old fashioned locks are heavy weight and fragile also depending on the
tools. Therefore, electronic locks are given more value than those of mechanical locks. Nowadays every
device’s operation is based on digital technology. For example, technology-based identity devices are
used for automatic door unlocking and locking. These locking systems are used to control the movement
of door and are functional without requiring a key to lock or unlock the door. These locking systems are
controlled by a keypad and are installed at the side hedge of the door. The main objective of this project is
to give safety at every common place like home, public places. In this user would give a known password.
The information will be stored in database. When the correct passcode will be entered, the
microcontroller will give instruction to dc lock. Dc lock will perform the action on door unlocking. Thus,
what we want is digital technology to construct an integrated and well customized safety at a price which
is reasonable.
Advantages of Password Based Door Lock System
This project provides security.
Power consumption is less.
Used commonly available components.
Project is simple and easy.
Applications of Password Based Door Lock System
This simple circuit can be used at residential places to ensure better safety.
It can be used at organizations to ensure authorized access to highly secured places.
With a slight modification this project can be used to control the switching of loads through
password.
Limitations of Password Based Door Lock System
It is a low range circuit, i.e. it is not possible to operate the circuit remotely.
If you forget the password, it is not possible to open the door.
TABLE OF CONTENTS
Chapter 2……………………………………………………………………………...…...11
2.1 Block Diagram…………………….………………………………………..…11
Chapter 3…………………………………………………………………………...……...12
3.1 Experiment………………………………………………………………..…....12
3.1.1 Arduino keypad lock code…………………………….…………………..…13
3.2 Result………………………………………………………………………......16
Chapter 4……………………………………………………………………………….…..17
4.1 Conclusion………………...………………………………………………...,….17
4.2 Future Scope…………………………………………………………………….17
Appendix 1
References…………………………………………………………………………...A1
LIST OF FIGURES
1.1: INTRODUCTION
MATLOCK is a locking system that allows the individual to test their mathematics to open the lock. The
user is first greeted and then followed by an equation. 30 seconds is given to the user to solve the equation
and use the basic principles of mathematics to get the code. The user can solve the equation by any
means. The code is of 4 digits. On getting the correct password, the user is awarded with the gift kept
inside the MATLOCK.
The equation given to a person is 6^2 + log (1000) + 4! + 6.
The Arduino Uno is a microcontroller board based on the ATmega328. It has 14 digital input/output pins
(of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB
connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the
microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter
or battery to get started. The Uno differs from all preceding boards in that it does not use the FTDI USB-
to-serial driver chip. Instead, it features the Atmega8U2 programmed as a USB-to-serial converter.
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz
1.2.2: KEYPAD
The buttons on a keypad are arranged in rows and columns. A 4X4 keypad has 4 rows and 4 columns.
Beneath each key is a membrane switch. Each switch in a row is connected to the other switches in the
row by a conductive trace underneath the pad. Each switch in a column is connected the same way – one
side of the switch is connected to all of the other switches in that column by a conductive trace. Each row
and column is brought out to a single pin, for a total of 8 pins on a 4X4 keypad.
Pressing a button closes the switch between a column and a row trace, allowing current to flow between a
column pin and a row pin. The Arduino detects which button is pressed by detecting the row and column
pin that’s connected to the button.
The Liquid Crystal Library allows you to control LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin
interface. The LCDs have a parallel interface, meaning that the microcontroller has to manipulate several
interface pins at once to control the display. The interface consists of the following pins:
1.2.4: BREADBOARD
1.2.5: DC LOCK
A DC lock is a lock that uses an electric current to produce the magnetic force. Due to the increased
strength because of the current, the doors can withstand pressure, so they can’t be forced open without use
of the confirmed access method. A DC lock is also called electromagnetic lock.
An electromagnetic lock creates a magnetic field when energized or powered up, causing
an electromagnet and armature plate to become attracted to each other strongly enough to keep a door
from opening. As they require power to remain locked, this allows them to be fail-safe, making
electromagnetic door locks safe for use as emergency exits. If the power was to go out in a fire via a fire
relay or call button, the door would unlock, allowing people to exit the building.
Also, it can be used to control the access of a room by cutting of the current when the password entered is
right and maintain the supply of current when the password entered is wrong.
Fig 1.6: DC lock
1.2.6: RELAY MODULE
A relay is an electrically operated switch that can be turned on or off, letting the current go through or
not, and can be controlled with low voltages, like the 5V provided by the Arduino pins. This relay module
has one channels (those blue cube). There are other models with two, four and eight channels. This
module should be powered with 5V, which is appropriate to use with an Arduino. There are other relay
modules that are powered using 3.3V, which is ideal for ESP32, ESP8266, and other microcontrollers. It
is designed to interface with microcontroller such as Arduino, PIC and etc. The relays
terminal (COM, NO and NC) is being brought out with screw terminal. It also comes with a
LED to indicate the status of relay.
Specification:
CHAPTER 2:
BLOCK DIAGRAM AND ITS DISCRIPTION
The above block diagram gives a brief idea as to how the project works. The Arduino is connected with
power supply using a USB cable. A 4*4 keypad is attached to it, which is used to enter the solution of the
given equation. If the digits entered are matched with the code saved in Arduino, the Arduino will instruct
the relay module to lower its voltage supply. Relay module which is further connected with DC lock,
reduces the voltage to zero thereby, opening the lock. Also, a 16*2 LCD is attached with Arduino to
display the equation and required instructions to the user. If the entered code is incorrect, the lock will not
open and the user is asked to improve its mathematical skills.
CHAPTER 3:
EXPERIMENT AND ITS RESULT
3.1: EXPERIMENT
First, connect the 4X4 keypad to the Arduino; connect the first six pins on the 4X4 keypad with the A0
and A5 pins on the Arduino. Then connect the last two pins on the 4X4 keypad module to digital pins 3
and 2 on the Arduino.
After that, connect the LCD to the Arduino. The connections for connecting the LCD with the Arduino
are as follows
Connect pin 1 on the LCD, which is the VSS pin, to GND on the Arduino
Connect pin 2, which is the VDD pin, to the 5V pin on the Arduino
Connect pin 3, which is the V0, to the middle of the 10k potentiometer and connect the other two
pins on the potentiometer to 5V and GND on the Arduino. This pin is for setting the LCD’s contrast.
Connect pin 4, which is the RS pin, to pin 7 on the Arduino
Connect pin 5, which is the R/W pin, to the GND pin on the Arduino
Connect pin 6, which is the Enable pin, to pin 6 on the Arduino
Connect pins 11, 12, 13, and 14 which are the data pins, to the pins 5, 4, 3, and 2 on the Arduino
Connect pin 15, which is the LCD’s backlight pin, to 5V on the Arduino through the 220-ohm
resistor
Connect pin 16 on the Arduino, which is the negative pin of the backlight, to GND on the Arduino
Last, we will connect the DC lock with the Arduino. The Lock operates on a voltage from 7 to 12V, so
we cannot directly connect it to the Arduino. To connect it to the Arduino, we will require a relay and a
battery. Connect the signal pin of the relay to pin 10 on the Arduino and the lock’s VCC and GND to 5V
and GND on the Arduino. Then on the other end of the relay, connect the negative of the battery to the
common on the relay and the NO (Normally open) on the relay to one side of the lock. Then connect the
other side of the lock to the positive terminal on the battery.
#include<Keypad.h>
#include<LiquidCrystal.h>
#include<EEPROM.h>
char set_password[4],entered_password[4];
int relay_pin=10; int i=0;
char key_pressed=0;
const byte rows=4; const byte cols=4;
char hexaKeys [rows][cols]=
{
{'1','2','3','A'}, {'4','5','6','B'}, {'7','8','9','C'},{'*','0','#','D'}
};
byte rows_pin[rows]= {A0, A1, A2, A3};
byte column_pin[cols]= {A4, A5,3,2};
Keypad keypad_key=Keypad(makeKeymap(hexaKeys),rows_pin,column_pin,rows,cols);
LiquidCrystal lcd(9,8,7,6,5,4);
void setup ()
{
pinMode (relay_pin, OUTPUT);
lcd.begin(16,2);
lcd.print("Hey!");
lcd.setCursor(0,1);
lcd.print("How are you?");
delay(2000);
lcd.clear();
lcd.print("solve the eqn");
lcd.setCursor(0,1);
lcd.print("to get code");
delay(3000);
lcd.clear();
lcd.print("equation is");
lcd.setCursor(0,1);
lcd.print("6^2+log1000+4!+6");
delay(20000);
lcd.clear();
lcd.print("enter the code");
lcd.setCursor(0,1);
intialpassword();
}
void loop()
{
digitalWrite(relay_pin,HIGH);
key_pressed=keypad_key.getKey();
if(key_pressed)
{ entered_password[i++]=key_pressed; lcd.print("*"); }
if(i==4)
{
delay (200);
for(int j=0;j<4;j++) set_password[j]=EEPROM.read(j);
if(!(strncmp(set_password,entered_password,4)))
{
lcd.clear();
lcd.print("Code Accepted");
digitalWrite(relay_pin,LOW);
delay(2000);
lcd.setCursor(0,1);
lcd.print("Mathematician");
delay(10000);
lcd.clear();
lcd.print("solve the eqn");
lcd.setCursor(0,1);
lcd.print("to get code");
delay(3000);
lcd.clear();
lcd.print("equation is");
lcd.setCursor(0,1);
lcd.print("6^2+log1000+4!+6");
delay(20000);
lcd.clear();
lcd.print("enter the code");
lcd.setCursor(0,1);
i=0;
}
else
{
digitalWrite(relay_pin,HIGH);
lcd.clear();
lcd.print("Access Denied");
lcd.setCursor(0,1);
lcd.print("Go learn Maths");
delay(2000);
lcd.clear();
lcd.print("solve the equation");
lcd.setCursor(0,1);
lcd.print("to get code");
delay(3000);
lcd.clear();
lcd.print("equation is");
lcd.setCursor(0,1);
lcd.print("6^2+log1000+4!+6");
delay(20000);
lcd.clear();
lcd.print("enter the code");
lcd.setCursor(0,1);
i=0;
}
}
}
void intialpassword()
{
for(int j=0;j<4;j++)
{
set_password[0]=0; set_password[1]=0; set_password[2]=6; set_password[3]=9;
EEPROM.write (j,set_password[j]+48);
}
}
3.2: RESULT
Entering password----
When 0069 is entered, the lock is opened.
When wrong password is entered the lock remain closed.
Chapter-4
4.1 – Conclusion
This project is productive in providing enough security as long as the password is not shared. In future
this “Password based Door Lock System” can be provided maximum security by the above enhancements
in order to completely satisfy user’s needs.
Hence, a common man can afford to buy such locking system in minimal cost to keep his valuables safely
without any worries.
The security level can be increased by adding a biometric fingerprint scanner. We can interface sensors
like Fire, LPG, PIR motion detector to microcontroller in case of any accident so that door will open
automatically. We can interface camera to the micro controller so that it could capture the picture of the
thief who is trying to breach the security. This simple circuit can be used at places like home to ensure
better safety. With a slight modification, this project can also be used to control the switching of loads
through password. It can also be used at organizations to ensure authorized access to highly secured
places.
Appendix-1
References
https://projecthub.top/
https://maker.pro/storage/61680d2/61680d2c3680fb6a259fe26128cb1b8f.png
https://github.com/
https://maker.pro/arduino/projects/arduino-keyless-door-lock-system-keypad-lcd#project-materials
https://playground.arduino.cc/
https://github.com/MamunTech/PassWordDoorLock/blob/master/PassWard_door_lock.ino
https://electrosome.com/arduino-uno/
https://maker.pro/arduino/projects/arduino-keyless-door-lock-system-keypad-lcd