You are on page 1of 18

DAV INSTITUTE OF ENGINEERING AND

TECHNOLOGY, JALANDHAR

Institute Summer Vacation Training


(BTEC-321-18)

Submitted To: Submitted by:

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.

Signature of the Candidate _________________


ACKNOWLEDGEMENTS

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 NO. PAGE NO.


Chapter 1…………………………………………………………………………………… 7
1.1 Introduction………………………………………………………………..……. 7
1.2 Components……………………………………………………………….……..7
1.2.1 Arduino…………………………………………………………………...…... 7
1.2.1.1 Arduino UNO………………………………………………………………. 7
1.2.2 Keypad…………………………………………………………………..…......8
1.2.3 LCD……………………………………………………………………...…… 9
1.2.4 Breadboard………………………………………………………………….... 9
1.2.5 DC lock……………………………………………………………………….. 9
1.2.6 Relay module…………………………………………………………...…….10
1.2.7 Other components……………………………………………………….........10

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

FIGURE NO. TITLE PAGE NO.


1.1 Arduino UNO 7
1.2 4*4 Keypad 8
1.3 Inner connection of keypad 8
1.4 LCD 9
1.5 Breadboard 9
1.6 Dc Lock 9
1.7 Relay Module 10
1.8 Jumper Wires 10
1.9 220ohm Resistor 10
1.10 10k Potentiometer 10
1.11 12v Adaptor 10
2.1 Block Diagram 11
3.1 Schematic diagram 12
CHAPTER-1

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.

1.2: COMPONENTS USED


1.2.1: ARDUINO
Arduino is an open source programmable circuit board that can be integrated into a wide variety of
makerspace projects both simple and complex. This board contains a microcontroller which is able to be
programmed to sense and control objects in the physical world. By responding to sensors and inputs, the
Arduino is able to interact with a large array of outputs such as LEDs, motors and displays.
Arduino can sense the environment by receiving input from a variety of sensors and can affect its
surroundings by controlling lights, motors, and other actuators. The microcontroller on the board is
programmed using the Arduino programming language (based on Wiring) and the Arduino development
environment (based on Processing). Arduino projects can be stand-alone or they can communicate with
software on running on a computer (e.g. Flash, Processing, MaxMSP).

1.2.1.1: Arduino UNO

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.

Fig 1.1: Arduino UNO


Specifications

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.

Fig 1.2: 4X4 Keypad

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.

Fig 1.3: Inner connections of keypad


1.2.3: LCD

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:

 A register select (RS) pin that controls where in the


LCD's memory you're writing data
to.
 A Read/Write (R/W) pin that selects reading mode or
writing mode.
 An Enable pin that enables writing to the registers.
 8 data pins (D0 -D7). The states of these pins (high or low) are the
bits that you're writing to a register when you write, or the values
you're reading when you read.
There's also a display contrast pin (Vo), power supply
pins (+5V and Gnd) and LED Backlight pins that you can use to power the LCD, control
the display contrast, and turn on and off the LED backlight.

1.2.4: BREADBOARD

A breadboard is a construction base for prototyping of


electronics. The Arduino has multiple power and ground
pins that you can connect to the power rails or other rows
on a breadboard. Connecting the Ground (GND) pin from
an Arduino to a row on a mini breadboard. Now any leg or
wire connected to that row will also be connected to
Ground.

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:

 Digital output controllable


 Compatible with any 5V microcontroller such as
Arduino.
 Rated through-current: 10A (NO) 5A (NC)
 Control signal: TTL level
 Max. switching voltage 250VAC/30VDC
 Max. switching current 10A fig 1.7: Relay Module

1.2.7: OTHER COMPONENTS


1. Jumper wires
2. Potentiometer (10k)
3. Resistor (220 ohm)
4. Adapter (12v)

Fig 1.8: Jumper Wires

Fig 1.9: Potentiometer

Fig 1.10: 220ohm Resistor


Fig 1.11: 12v Adaptor

CHAPTER 2:
BLOCK DIAGRAM AND ITS DISCRIPTION

2.1: BLOCK DIAGRAM

FIG 2.1: Block Diagram

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

FIG 3.1 SCHEMATIC DIAGRAM

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.

3.1.1: ARDUINO KEYPAD LOCK CODE

#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.

4.2 - Future Scope

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

You might also like