Mini Project Report - Khalishah Nisa Group 16
Mini Project Report - Khalishah Nisa Group 16
TITLE:
NAME:
SUPERVISOR:
SUBMISSION DATE:
10/7/2023
ACKNOWLEDGEMENT
We have finally finished the project after numerous attempts, and the end result is what we had
aimed to accomplish. We owe a tremendous debt of gratitude to everyone who helped in any way
possible.
First and foremost, our supervisor Dr Ahmad Nazri Ali, who had given a suggestion and
corrected the mistakes that we have made with patients throughout the process. Each time we
encounter a problem with our circuit, our supervisor is not hesitant to help us fix the problem. It
was a very enlightening experience working under his guidance to complete this mini project
with ease thanks to his depth of knowledge.
Secondly, our fellow friends that have helped us in this mini project by helping us fixing the
problem outside the lab and sharing their experience in handling certain components. Without
them, we may not be able to complete this mini project.
Lasly, to our lab partners that have sacrificed their time to finish this project. The money and
time spent are paid off after succeeding to present our final product. Without the combination of
both of us , this project will not be completed in time.
1
ABSTRACT
Our mini project involves a security door lock with a password that we modified by adding a
buzzer and an IR sensor. The objective of our assignment is to put the knowledge we have
learned in EEE226 to use through building a code and designing a security password door lock.
Our project's goal is to make the area more secure in order to deter crime. After conducting
online research and discussing the assignment with our supervisor, we chose this project. This is
because it is closer to us because we also sense the need for security in our own home. Every
challenge we face has a solution, which we have discovered. for instance, about the connection
and altered the code to suit our requirements. Additionally, we decided to upgrade the door lock
by adding a buzzer and an infrared sensor, which would prompt the user for their password when
there are persons near.Our project was successful, and the end result was what we were aiming
for. Future modifications may be developed to make daily tasks easier for people.
2
TABLE OF CONTENT
1.0 Introduction 4
Aim 4
Problem Statement 5
Objectives 5
2.0 Literature Review 6
3.0 Methodology 7
3.1 List of Components 7
3.2 Block Diagram to Illustrate Password Digital Lock 14
3.3 Description of Project 14
3.4 Flowchart 16
3.5 Schematic Diagram 18
3.6 Programming in 8051 Assembly Language 19
3.7 Programming in ESP32 27
4.0 Results and Discussion 29
4.1 Project Cost 29
4.2 Output of the circuit 30
4.3 Weakness and Limitations 34
4.4 Future Works 34
5.0 Conclusion 35
6.0 References 35
7.0 Appendix 36
3
1.0 Introduction
The security password door lock in general is a password-based electronic code lock. In this
project, we have designed the digital door lock using an 8051 microcontroller and a keypad. We
designed a simple digital door lock utilizing the 8051 processor that may be used as a security
checking system to grant password-protected users exclusive access to a certain area or room.
The lock system in our project uses a preset five-digit password that is saved inside the
programme. If the user input and stored password match, access will be granted by opening the
door and if the user input and stored password does not match, access will be prohibited by not
opening the closed door and the buzzer will turn on.
In this mini project, our team has developed a multidisciplinary approach to the security door
lock. The door will remain open until no one enters inside by adding a sensor and motor. Also,
an ESP32 is being added for Internet of Things (IoT) motives, and it will use the Telegram
application to issue a warning when someone is close to the IR Sensor. It is important to make
sure that the owner of the property is more cautious so that unwanted events can be prevented.
Aim
To develop a smartphone-controlled home security system with the help of 8051 microcontroller,
Arduino Nano and ESP32.
4
Problem Statement
One of the most important aspects of home security is the increase in criminal activity
around the world. Homes are regularly used by criminals as easy targets. Because of this, having
a secure home is crucial. Smart door locks work to discourage criminal activities. If incorrect
unlocking attempts are made, this door lock will sound an alarm. Most industrialized nations
have seen a decline in crime thanks to smart door locks.
Accidents and dangers are never wanted by visitors. Having a safe place to live is
essential. It protects your personal property from theft. People look for peace of mind at home as
well. Additionally, they favor smart door locks as a home security option. The level of care given
to the valuables in your home is determined by the state of your home's security. Smart door
locks are essential for ensuring the safety of your house.
Smart doors can also assist you in preventing financial losses. It is a prerequisite for
today. Traditional door locks are easy to unlock. As a result, security risks could target your
home or other residence. In addition to deterring burglars, smart door locks are a smart purchase
for your front door. Your home's security is constantly at risk from intruders. To counter this
hazard, digital door locks are necessary.
Objectives
● To code and design an 8051 system for a specific task which is the password door lock
● To tighten the security of people’s home in order to prevent crimes
● To provide a better solution regarding security
5
2.0 Literature Review
The first article S. Umbarkar et al. [1] explained the uses of a three-mode electronic door
lock system using the Arduino platform, including keypad, Bluetooth, and GSM modules. These
three modules utilize a keypad matrix and a 4-character password. The door lock was connected
to a smartphone via a Bluetooth module, and a password was entered to unlock the door. To
unlock or unlock the door, the GSM module was used to SMS passwords to his cell phone. In
addition, it used the buzzer to alert users of unauthorized login attempts after three failed
password entry attempts and texted them about this module. The locking and opening of the door
were modeled using a servo motor. The 16X2 LCD display was used to engage with the person
attempting to lock or unlock the door by displaying messages like "Enter Password" and
"Incorrect Password," which represent the model's usage at the time. Utilize an electronic door
lock system with the Arduino platform using the keypad, Bluetooth, and GSM modules,
respectively. These three modules utilize a keypad matrix and a 4-character password. The door
lock was connected to a smartphone via a Bluetooth module, and a password was entered to
unlock the door. To unlock or unlock the door, the GSM module was used to SMS passwords to
his cell phone.
In the second article Mei-Chuan Tseng et al. [2], it was suggested that a single wrist-worn
sensor could be utilized for monitoring the door opening procedure. It may keep track of how an
individual moves their upper limb while they go about their regular lives. There were three
subtitles that described the full motion of opening the door, including holding, rotating, and
opening. These signals can be found and recognised by the suggested system. A wrist-worn
gyroscope data sensor and a 3-axis accelerometer are used in the data gathering phase.
6
3.0 Methodology
3.1 List of Components
● Atmel AT89S51 Microcontroller IC
● Arduino Nano
● 4x4 Keypad
● 16x2 LCD Screen
● ESP32
● 11.059Mhz - Crystal
● IC 7408
● 33pF Capacitor
● 10uF Capacitor
● 0.1uF Capacitor
● 10K ohm Resistor
● Potentiometer
● 4.7K ohm Resistor
● 100 ohm Resistor
● 330 ohm Resistor
● IR Sensor
● Buzzer
● Breadboards
● Jumper
● LED
7
List of Components with Its Respective Quantity
8
a) 8051-microcontroller
8051 is an 8-bit microcontroller designed by Intel in 1981. It has 40 pin DIP (dual
inline package), 4KB ROM storage and 128 byte RAM storage and two 16-bit timers. It
consists of four parallel 8-bit ports, programmable and addressable as needed. Single chip
integrated crystal chip, crystal frequency of 12 MHz. In the 8051-microcontroller
architecture, the system bus plays a key role to connect all the devices to the central
processing unit. This bus includes a data bus- an 8-bit, an address bus-16-bit & bus control
signals.
● Scrutinizes and manages all processes that are carried out in the Microcontroller.
● Manages different types of registers in the 8051 microcontrollers.
9
Interrupt
● Interrupt is a subroutine call that reads the Microcontroller’s key function or job
and helps it to perform some other program which is extra important then
● Provide a method to postpone or delay the current process, carry out a sub-routine
task and then all over again restart standard program implementation.
Memory
BUS
b) 4x4 Keypad
A 4X4 keypad has eight terminals. In them four are rows and four are columns of the matrix.
These 8 PINS are driven out from 16 buttons present in the module. Those 16 alphanumeric
digits on the module surface are the 16 buttons arranged in matrix formation.
10
c) 16x2 Liquid Crystal Display (LCD)
16X2 LCD screen, each line can display 16 characters, a total of 2 lines. The LCD has
two registers, the command registers, and the data register. RS (register selection) is mainly
used to switch from one register to another. When RS is' 0 ', it is called a command register,
and if it is set to '1', it is called a data register. The main function of the command register is
to store command instructions to the display, while the main function of the data register is to
store information to be displayed on the LCD screen.
11
Infrared sensors are classified into two types: active and passive. Infrared radiation is
emitted and detected by active infrared sensors. Active infrared sensors are made up of two
components: a light emitting diode (LED) and a receiver. When an object comes close to the
sensor, the LED's infrared light reflects off of it and is detected by the receiver. Active
infrared sensors function as proximity sensors and are widely used in obstacle detection
systems (such as in robots). Passive infrared (PIR) sensors detect infrared radiation but do
not emit it.
e) LED
A Light Emitting Diode (LED) is a semiconductor device, which can emit light when an
electric current passes through it. The major uses of LED (Light Emitting Diodes) are to
illuminate objects and even places. Its application is everywhere due to its compact size,
low consumption of energy, extended lifetime, and flexibility in terms of use in various
applications.
f) Arduino Nano
12
g) Buzzer
h) ESP32
13
3.2 Block Diagram to Illustrate Password Digital Lock
The project began with an 8051-microcontroller and the Arduino Nano. The Arduino Nano is
connected to the 8051-microcontroller using the pin configuration below.
14
Port Connection on 8051-microcontroller
15
3.4 Flowchart
16
Flowchart for ESP32
17
3.5 Schematic Diagram
18
3.6 Programming in 8051 Assembly Language
To minimize error for LCD interfacing, the commands as in figure above are defined as constant.
The program starting address is 000. The instruction CLR P2.0 and P2.2 are reset to logic low
which is IR Sensor and buzzer. To select timer 1, the command ‘MOV TMOD, #00100001 B’ is
given and to make the serial port function in mode 1, the command of ‘MOV SCON, #50H’ is
given. The command ‘SETB TR1’ which sets the logic to high, starts running. After the timer is
on, the text will called out by the command line 15 until line 20 are called out and displayed on
LCD.
19
The code initializes the LCD module, displays two next strings on the LCD (one on the second
line and one of the first line), clears a specific port pin, introduces delays, reads a keypad or input
device, checks a password and loops back to the beginning. The instruction at command line 33
is to check if the bit P2.3 is set to high and jumps to the current address if it is not set. This
creates a loop until P2.3 becomes set. The command on line 40 is a short jump which is the jump
instruction to jump back to ‘MAIN’ label, creating a loop and allowing the program to run
continuously.
LCD_INIT and LCD_OUT subroutines are written to initialize the LCD display. The command
‘MOV DPTR, #INITIAL’ is to move INITIAL into DPTR. Command ‘SETB SEL’ set the SEL
20
pin to high. Next, the LCD_OUT subroutine is called and the SEL pin is being cleared by
command ‘CLR SEL’.
At the LCD_OUT subroutine, the instruction “MOVC A, @A+DPTR” is used to move a byte
which is the sum of Acc and DPTR into Acc. The command will jump to the next line if the SEL
pin is high. Otherwise, it will process to DATA_WRITE by command ‘JB SEL, CMD’.
For LINE2 and LINE1 subroutine, the instructions ‘MOV A’ will move the value 0C0h and 80H
into the accumulator register.This value is used to position the cursor or start writing on the
second line and first line of the LCD. For the CLRSCR subroutine, 01H is loaded into Acc to
clear the display screen of the LCD. In the DATA_WRITE subroutine, the command ‘MOV
P0,A’ will move the value in the accumulator to the P0 register. The ‘SETS RS’ will set the RS
pin to 1 and the data register will be selected. The ACALL DELAY subroutine will delay to
ensure the LCD has enough time to process the data.
21
The DELAY subroutine is for creating a delay. There are two delay routines written in the
program. DELAY1 – is used as a delay for outputting messages on the LCD module properly.
After sending a message/data to the LCD module, DELAY1 is called so that the message stays
on the LCD screen for the stipulated delay time. DELAY2 (is a 2.5 seconds delay) is used to
provide the necessary debouncing effect for the keypad.
22
READ_KEYPRESS is the subroutine to collect user inputs. A counter is set up using register R0
to count 5 times (this will limit the user input collection to the first 5 key presses). Register R1 is
assigned address location 160D. The collected user inputs are saved in address location starting
from 160D. This location is incremented successively using INC R1 – command of 8051. So
first user input is stored in 160D, second user input in 161D, third in 162D, fourth in 163D, and
fifth user input in 164D. At command line 121 which is when IR Sensor detect the heat radiation,
command ‘MOV DPTR, #IPMSG’ will display the message ‘INPUT 5 DIGITS’ on LCD.
Command ‘MOV R0, #1D’ make sure that only five words can be input by the user.
The CHECK_PASSWORD subroutine is used to compare user input password (5 digits) with the
actual stored password in the program. Comparison is made digit by digit by selecting each digit
from the stored password with the help of DPTR and loading it to Accumulator (with MOVC
A,@A+DPTR). Each digit loaded to the accumulator is then compared with the corresponding
digit stored as user input (in address locations 16D to 164D) by loading them one by one to
register R1. Digits are compared by X-OR in them with command XRL A,@R1. Based on the
outcome of the comparison, this subroutine has commands written to either allow access (and
turn ON relay) or to not allow access and display an “Access Denied” message on the LCD
screen.
23
24
The KEY_SCAN subroutine used to identify a keypress. The method of column scanning is
employed in identifying the pressed key. The pressed key is identified and is assigned a decimal
equivalent value (ASCII value) of the pressed key. The columns and rows of the 4x4 keypad are
connected to an input port and an output port, respectively. A function called ‘KEY SCAN’ is
built to recognise the pressed key in order to detect it. By sending bit 0 to the output latch, the
microcontroller grounds all rows before reading the columns. First, the command ‘MOV P3,
#11111111B’ loads 11111111B onto port 3. Then, P3.0 is cleared with the instruction ‘CLR
P3.0’. Then, the command ‘JB P3.4, NEXT1’ checks the first column (C1). If bit P3.4 is set to 1,
the microcontroller will jump to NEX1 to determine whether column 1 is low . P3.1, P3.2, P3.3,
P3.0, and P3.1 are all being grounded simultaneously. The operation will continue until a key
press is detected if the data read from the columns is C1 - C4 = 1111, which indicates that no key
has been pressed. It scans the columns, grounds the following row, and looks for any zeros. If a
zero appears in one of the column bits, a key press has taken place. For instance, if C1 - C4 =
1101, means a key in the C3 column has been pressed. The microcontroller will proceed to
identify the key after sensing a key press. It grounds each row individually, reading the columns
each time to determine which row a key press corresponds to. The key press cannot correspond
to that row if it discovers that all columns are set to "1." In order to locate the row that the key
press corresponds to, it grounds the following row and keeps going. The "LJMP KEY SCAN ''
instruction tells the microcontroller to return to the KEY_SCAN subroutine and keep looping it
until a key is pressed if there isn't any indication of a key press.
25
Lastly, above lines will initialize the commands for the LCD module. The 0CH command will
turn on the display and set the display to normal mode. 01H acts as clears the display. 06H
command sets the entry mode. 80H commands set the cursor to home position. The 3CH
command acts to set the function mode. 0 is the byte that serves as the null terminator to mark
the end of the command.
26
3.7 Programming in ESP32
27
28
4.0 Results and Discussion
4.1 Project Cost
The overall money spent on the component to build the security password door lock has been
computed in the table below. Most of the components we borrow from the lab.
TOTAL RM100.80
29
4.2 Output of the circuit
Figure 1
In this figure, it shows the complete circuit of the arduino connected with AT89S52
microcontroller, 16x2 LCD Screen, 4x4 Keypad, IR Sensor, Buzzer, LED and ESP32 without
uploading the coding.
Figure 2
When the coding is uploaded into the Arduino Nano, it will display ‘PASSWORD BASED
SECURITY SYSTEM’ on LCD.
30
Figure 3
Next, when the IR Sensor detects the heat radiation the LCD will display ‘Input 5 Digits’. The
user needs to input the 5 digits password by using the keypad.
Figure 4
31
Figure 5
If the password is correct, the output that will display is ‘ACCESS-GRANTED’ and ‘DOOR
OPENED’.
Figure 6
When the user inputs a password, the system will check whether it is correct or not. If the
password is wrong, the LCD will display ‘WRONG PASSWORD’ and ‘ACCESS DENIED’.
Buzzer also will turn ON.
32
For the ESP32
Coding for ESP32 will be uploaded from Arduino IDE. It also will be connected to Blynk Apps.
Figure above shows connection ESP32 with Blynk apps. At the 1 Device it show
MINIPROJECT. It is the device that connected to ESP32.
33
4.3 Weakness and Limitations
Our project has some weaknesses, the doors are not automated and need to be opened by the
user. We only made it just to notify the user about the security if someone input the wrong
password. We are having limitations of time and some other components to make this project
working as real. Furthermore if someone just plays with the sensor at the doorlock, the message
that the LCD display ‘INPUT 5 DIGITS’ will not jump back to ‘PASSWORD BASED
SECURITY DOOR’. This is our weakness because of limitations of time.
34
5.0 Conclusion
As a result, this mini project's successful completion illustrates the value of combining the
Internet of Things (IoT), Arduino, and the 8051 microcontroller to create a security system by
utilizing a combination of LCD,keypad, Infrared Sensor and other electronics components. Users
may simply type in passwords or carry out system operations with the keypad, which has acted
as an easy input device. LED and LCD displays have been successfully incorporated, delivering
direct feedback and status messages that have enhanced user convenience and system
transparency. It highlighted the importance of adding mechanical parts, like locks or sensors, to
strengthen physical security and improve the level of reliability of the entire system as a whole.
In conclusion, this mini project was successfully accomplished, and the end product was just
what we had envisioned the outcome would be.
6.0 References
[1] S. Umbarkar, G. Rajput, S. Halder, P. Harname and S. Mendgudle, “Keypad/
Bluetooth/GSM Based Digital Door Lock Security System,” in ICCASP/ ICMMD-2016,
Vol. 137, Pp.749-757.
[2] M. Tseng, K. Liu, C. Hsieh, S. J. Hsu and C. Chan, \"Gesture spotting algorithm for
door opening using single wearable sensor,\" 2018 IEEE International Conference on
Applied System Invention (ICASI), Chiba, 2018, pp.854-856.
35
7.0 Appendix
RS EQU P2.7
RW EQU P2.6
E EQU P2.5
ORG 000H
CLR P2.0
CLR P2.2
MOV TMOD,#00100001B
MOV TH1,#253D
MOV SCON,#50H
SETB TR1
ACALL LCD_INIT
MOV DPTR,#TEXT1
ACALL LCD_OUT
ACALL LINE2
MOV DPTR,#TEXT2
ACALL LCD_OUT
MAIN:ACALL LCD_INIT
MOV DPTR,#TEXT1
ACALL LCD_OUT
ACALL LINE2
MOV DPTR,#TEXT2
36
CLR P2.0
ACALL LCD_OUT
ACALL DELAY1
ACALL DELAY1
JB P2.3,$
ACALL READ_KEYPRESS
ACALL LINE1
MOV DPTR,#CHKMSG
ACALL LCD_OUT
ACALL DELAY1
ACALL CHECK_PASSWORD
SJMP MAIN
SETB SEL
ACALL LCD_OUT
CLR SEL
RET
LCD_OUT: CLR A
MOVC A,@A+DPTR
JZ EXIT
INC DPTR
JB SEL,CMD
ACALL DATA_WRITE
37
SJMP LCD_OUT
SJMP LCD_OUT
EXIT: RET
LINE2:MOV A,#0C0H
ACALL CMD_WRITE
RET
ACALL CMD_WRITE
RET
ACALL CMD_WRITE
RET
CLR RS
CLR RW
SETB E
CLR E
ACALL DELAY
RET
38
DATA_WRITE:MOV P0,A
SETB RS
CLR RW
SETB E
CLR E
ACALL DELAY
RET
DELAY: CLR E
CLR RS
SETB RW
MOV P0,#0FFh
SETB E
MOV A,P0
JB ACC.7,DELAY
CLR E
CLR RW
RET
DELAY1:MOV R3,#46D
MOV TL0,#00000000B
SETB TR0
CLR TR0
39
CLR TF0
DJNZ R3,BACK
RET
MOV TL0,#018H
SETB TR0
CLR TR0
CLR TF0
DJNZ R3,BACK2
RET
ACALL LINE1
JB P2.3,$
MOV DPTR,#IPMSG
ACALL LCD_OUT
ACALL LINE2
MOV R0,#5D
MOV R1,#160D
ROTATE:ACALL KEY_SCAN
MOV @R1,A
ACALL DATA_WRITE
40
ACALL DELAY2
INC R1
DJNZ R0,ROTATE
RET
CHECK_PASSWORD:MOV R0,#5D
MOV R1,#160D
MOV DPTR,#PASSW
RPT:CLR A
MOVC A,@A+DPTR
XRL A,@R1
JNZ FAIL
INC R1
INC DPTR
DJNZ R0,RPT
ACALL CLRSCR
ACALL LINE1
MOV DPTR,#TEXT_S1
ACALL LCD_OUT
ACALL LINE2
ACALL DELAY1
MOV DPTR,#TEXT_S2
ACALL LCD_OUT
ACALL DELAY1
SJMP GOBACK
41
FAIL:ACALL CLRSCR
ACALL LINE1
MOV DPTR,#TEXT_F1
ACALL LCD_OUT
ACALL DELAY1
ACALL LINE2
MOV DPTR,#TEXT_F2
ACALL LCD_OUT
SETB P2.0
ACALL DELAY1
CLR P2.0
GOBACK:RET
KEY_SCAN:MOV P3,#11111111B
CLR P3.0
JB P3.4, NEXT1
MOV A,#49D
RET
NEXT1:JB P3.5,NEXT2
MOV A,#50D
RET
NEXT2: JB P3.6,NEXT3
MOV A,#51D
42
RET
NEXT3: JB P3.7,NEXT4
MOV A,#65D
RET
NEXT4:SETB P3.0
CLR P3.1
JB P3.4, NEXT5
MOV A,#52D
RET
NEXT5:JB P3.5,NEXT6
MOV A,#53D
RET
NEXT6: JB P3.6,NEXT7
MOV A,#54D
RET
NEXT7: JB P3.7,NEXT8
MOV A,#66D
RET
NEXT8:SETB P3.1
CLR P3.2
43
JB P3.4, NEXT9
MOV A,#55D
RET
NEXT9:JB P3.5,NEXT10
MOV A,#56D
RET
NEXT10: JB P3.6,NEXT11
MOV A,#57D
RET
NEXT11: JB P3.7,NEXT12
MOV A,#67D
RET
NEXT12:SETB P3.2
CLR P3.3
JB P3.4, NEXT13
MOV A,#42D
RET
NEXT13:JB P3.5,NEXT14
MOV A,#48D
44
RET
NEXT14: JB P3.6,NEXT15
MOV A,#35D
RET
NEXT15: JB P3.7,NEXT16
MOV A,#68D
RET
NEXT16:LJMP KEY_SCAN
INIT_COMMANDS: DB 0CH,01H,06H,80H,3CH,0
PASSW: DB 50D,53D,49D,48D,54D,0
END
45
Teaching assessment
46