You are on page 1of 19

Construction of an electronic door access key

Abstract :

Unlike the traditional door lock system, keypad door locks do not have any need
for physical keys. They are basically keyless; that is, anyone can lock or unlock them even
without keys. Technically, they work like the ATMs. People only need to punch in their secret
combination numbers in order to lock or unlock their doors. With this kind of entry system,
people no longer have to worry about lost or stolen keys and they never have to bring keys with
them everywhere they go or hide them in secret places to keep them away from the hands of
unauthorized individuals.

The secret numbers of the keypad door locks can be easily changed into another combination.
When people feel that their current number combinations have been divulged to unauthorized
individuals, they can always change the codes anytime. In addition, if the current owners of the
house decide to sell the property or have the house rented to others, they can always just let the
new people living there know about the access codes to the locks. There is no need to change
locks at all.
Introduction :

Many years ago, when security was less of a concern in the society, our forefathers
comfortably used simple sleeping mats to cover the doors of their huts. They were not bothered
at all by any event of a burglary attack because they had a system that wouldn‟t allow that to
happen. Everyone knew their neighbours and virtually everyone else in the village.

Nowadays it has become almost impossible to achieve that kind of sanity and therefore various
tools have been employed over the years to safeguard the lives and properties of its owners.

The present electronic security system we now enjoy have unequivocally been around for a
very long time, although it has gone through a series of evolutionary changes to cater for the
needs and security concerns of the present generation.

From using sticks to wedge doors to using mechanical locks, security systems have
metamorphosed into using electronic equipment such as the microcontrollers which is intended
to be used for this project to achieve a satisfactory security system.

PROBLEM STATEMENT :

One could attest to the fact that the metallic keys used to access mechanical door
locks are very susceptible to getting lost, which would mean breaking the locks over and over
again if there are more occurrences of such scenarios, moreover, such access keys can be
duplicated by unauthorized users.

Using an electronic door lock as said earlier would counteract the damning consequences of
such repugnant occurrences.
LIMITATIONS AND SCOPE :

This project would only feature a password-based electronic door access system.
In other words, it only incorporates the hexadecimal keypad only for authentication.

Other more advanced security features such as a fingerprint sensor, an iris scanner or a facial
recognition camera would not be incorporated.
LITERATURE REVIEW

INTRODUCTION :

The literatures related to the use of microcontrollers to achieve a keyless security system
over the years have been reviewed by various researchers in other to find the system that best
suits the present needs of the society. An exhaustive compilation of the researches would be
expatiated during the cause of this chapter.

Many systems have been developed for securing our homes and offices, aiming to reduce
the cost of security and at the same time tackle the menace of increasing burglary with high
efficiency. It is observed that most of the research carried out belongs to the following
categories :

a. Use of 8051 microcontrollers.


b. Use of ATmega-328 and Arduino Uno board.
c. Use of passwords, RFIDs or smart cards for authentication.

d. Use of Bluetooth technology for authentication.


e. Use of the GSM and the IOT for alerting the owner of an intruder.

Other categories worthy of mention are the different types of locks used for achieving a secure
home or office.
Reviews On Microcontroller And Authentication Method

(Sanket, Z. et al., 2017) sees the 8051 as the brain of the circuit, also calling it the CPU of the
circuit. The 8051 which has a Program Memory of 2Kbytes (EEPROM) is used to store the
predetermined password during the time of installation, which is taken into consideration
during the operation to compare the input password with the predetermined password. It is also
used to show the input numbers from the input device through an LCD screen. To complete the
system, two relays are used, one of them to drive the motor in such direction with which the
door can be opened, this operates when the correct password is entered, whereas the second
relay is used to block the direction of D.C motor drive or to rotate the drive in opposite
direction to keep the door in a closed state, and this is done when the wrong password is
entered.

(Raj Mehta, 2017) similarly designed a password-based door lock system using an 8051
microcontroller to store a user defined password which can be set up during startup/booting.
The password is set using push buttons which represent numbers from 0 to 9. A 16×2 LCD is
used for the interface and displays the entered password. When anyone tries to enter the
password, it is compared with the initially set password. If it matches, the LCD displays
„system unlocked‟ else it displays „wrong password‟. A lock button is used to reset the system
so that password can be locked again. You can use a relay or a solenoid valve as actuator to any
system you would like to control using password.

(Ankit Jain, et al., 2016) designed a password protected home automation system with an
automatic door lock using the Arduino Uno board which is controlled by the ATmega-328.
First, the user combination will be compared with pre-decided password stored in the system
memory. If the user‟s combination matches with the password, the door, light and fan will be
unlocked. The system was also built in a way that it could be locked by just pressing one key.
In this system Arduino UNO microcontroller board is used for interfacing the various hardware
peripherals. If the password is matched with pre-decided password then the Arduino simply
operates the relay to open the lights and fan. The Arduino simultaneously operates a DC motor
through a motor driver for operating the door.

MATERIALS AND METHODOLOGY

INTRODUCTION :

The electronic door access key consists of three main parts – the INPUT, CONTROL and
OUTPUT. Materials explored for the input are essentially authentication necessary for granting
access into the secured apartment.

Similarly, the components of the control system handle the overall organization of all the
hardware components. Microcontrollers which serve as the brain of the system could be said to
be one of the most vital electronic components in a security system.

The output likewise consists of components like the lock system, the alarm system and display
system. They are necessary for the execution of the results of input and control systems.

METHODOLOGY :

After reviewing the all the materials possible, a few of them have been selected for various
reasons. Below is a run-down of such.
BLOCK DIAGRAM :

The INPUT :

For the input, a 4x4 hexadecimal keypad would be used. In order to open the lock to gain
access to the apartment, the correct password would have to be pressed otherwise the door
remains shut. If the password is typed wrongly, the buzzer would be activated.
The OUTPUT :

The Output would consist of:

1. The LCD: which would be used as the display

2. The Buzzer: which is activated when the wrong password is entered.

3. The Lock: the lock would be activated only after the entered password matches with the
predefined password.

Hardware :

First of all, the 4x4 keypad is connected to pin 0 ~ 7, taking note of the rows and columns of
the keypad. The keypad shown above consists of mathematical symbols but were
reprogrammed to operate just like fig. 3.9. This is because the software used for the simulation
(proteus) does not include the exact replica of the keypad required.
Secondly, pins D4 ~ D7 of the LCD are connected to pin 8 ~ 11 of the Arduino. The rest of the
pins (RS and E) are connected to pin 12 and 13 of the Arduino, while VDD is connected to the
positive of the battery, VEE to a resistor of 1k ohms before it is connected to ground along with
RW.

Next up is the motor and motor driver, which are similarly connected to pins A3 and A4 of the
Arduino. The buzzer setup which includes the BC547 NPN transistor which is used to amplify
the signal to the buzzer, the 220 ohms resistor are connected to pin A0 for signal and the 9v
external battery for power.

Once the simulation is started, the LCD comes up with a welcome message, and then displays
“Enter Password” to indicate that the system is ready to accept commands.

If the entered password is correct, i.e. after the password is compared with the one stored in the
EEPROM, the Arduino sends signals to pin A3 where one leg of the motor/motor driver is
connected, this signal is translated as positive voltage by the motor driver which it sends to the
motor, after 10 seconds, another signal is sent to pin A4 which is translated by the driver as
negative voltage, thus causing the motor to rotate anti-clockwise.

As said earlier, the buzzer goes off after the wrong password has been typed. This is achieved
by sending a HIGH signal to pin A0 where the buzzer setup is situated.

Software :

Before heading straight to the software design, a flow chart is designed to highlight the main
purpose of each section of the code and how it should work together to make everything work.

For this project, the flow chart includes a section which is responsible for accepting the
inputted password. It then checks and compares the entered password with the one stored in the
EEPROM. If the password is correct, the message “Access Granted” is displayed on the LCD
display, the door opens and is shut after ten (10) seconds.

In the event that the wrong password is entered, the message “Access Denied” and the door
would refuse to open.
After designing a flow chart, the next step is to write the actual code. Below

is a brief excerpt and explanation of the sections of the code.

The first thing that is done is to include the libraries for the Keypad, EEPROM,

and the LCD. The default password in the EEPROM is usually “1234”. After

initializing the libraries, the pins of the Arduino in which the pins of the LCD

are connected are defined accordingly.

#include <Keypad.h>
#include<LiquidCrystal.h
> #include<EEPROM.h>
LiquidCrystal
lcd(13,12,11,10,9,8);
Next is defining pins for connecting 4×4 hexa-decimal keypad. We are using 4×4

keypad therefore we will define 4 pins for rows and 4 pins for columns. If you are

using 4×3 keypad then you need only 4 pins for rows and 3 pins for columns.

const byte ROWS = 4; //four


rows const byte COLS = 4;
//four columns char
hexaKeys[ROWS][COLS] = {
{'7','8','9','A'},
{'4','5','6','B'},
{'1','2','3','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {3,2,1,0}; //connect to the row pinouts of the
keypad byte colPins[COLS] = {4,5,6,7}; //connect to the column
pinouts of the keypad
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS,
COLS);

After that, a command is given to start the LCD i.e. make the LCD begin to show

that it is working, set the buzzer and also set the cursor in the LCD.

lcd.begin(16,2);
pinMode(buzzer,
OUTPUT); lcd.print("
Electronic ");
lcd.setCursor(0,1);
lcd.print(" Keypad Lock
"); delay(2000);

The next section of code will read any key pressed from the keypad and shows it

on LCD as well. The Arduino will read the keys one by one and make a beep
sound whenever a key is pressed.

customKey = customKeypad.getKey();
if(customKey=
='#') change();
if (customKey)
{ password[i+
+]=customKey;
lcd.print(customKey);
//Serial.print(customKey);
beep();
}
The next section provides the code which will compare the entered key with the

password stored in the EEPROM. If the password is correct, then it will show

“Access Granted” otherwise it will show “Access Denied”. Aside showing “Access

Granted”, it also opens the door and shuts it again after ten (10) seconds.

if(i==4)
{
delay(200);
for(int
j=0;j<4;j++)
pass[j]=EEPROM.read(j);
if(!(strncmp(password,
pass,4)))
{
beep();
lcd.clear();
lcd.print("Access Granted");
//This code will turn Motor clockwise for
2 sec. digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
delay(2000);
// stops Motor after opening the door for
10 sec. digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
delay(10000);
//This code will turn Motor anti-clockwise
for 2 sec. digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
delay(2000);
// stops Motor after opening the door for 5
sec. digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
//motor code ends
here
lcd.setCursor(0,1);
lcd.clear();
lcd.print("Enter
Password:");
lcd.setCursor(0,1);
i=0;
}
else{
digitalWrite(buzzer,
HIGH); lcd.clear();
lcd.print("Access
Denied!");
lcd.setCursor(0,1);
delay(2000);
lcd.clear();
lcd.print("Enter
Password:");
lcd.setCursor(0,1);
i=0;
digitalWrite(buzzer, LOW);
}
}
}
The code below changes the password stored in the EEPROM when the key “#” is

pressed The new password is also stored in the EEPROM.

int j=0;
lcd.clear
();
lcd.print("Current
Password");
lcd.setCursor(0,1);
while(j<4)
{
char key=customKeypad.getKey();

if(key)
{
pass1[j+
+]=key;
lcd.print(key)
;
//
Serial.print(key
); beep();
}
key=0;
}
delay(500);
RESULTS AND DISCUSSION

After the design and construction of the project, two tests were carried out, simulation and
physical tests. They would be discussed below.
SIMULATION OF THE DESIGN
Simulation of the project was carried out using proteus 8 professional.

Fig. 4.1 Interface of proteus


Fig 4.2 Schematic diagram in proteus

Fig 4.3 Simulation: when the system is turned on

Fig 4.4 Simulation: Request to input password


Fig 4.5 Simulation: Access granted

Fig 4.6 Simulation: Access Denied

You might also like