Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Door Lock System

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 17

J. C.

BOSE UNIVERSITY OF SCIENCE


AND TECHNOLOGY ,YMCA

PASSWORD
DOOR LOCK SYSTEM
Project report
ENC {5TH SEM}

SUBMITTED BY :
19001015011 DEEPIKA
19001015019 ISHMEET KAUR
19001015054 SAROJ
SUBMITTED TO :
KUSUM ARORA MAAM
DOOR LOCK SYSTEM
Password Based Door Lock System using 8051 Microcontroller is a simple project
where a secure password will act as a door unlocking system. Traditional lock
systems using mechanical lock and key mechanism are being replaced by new
advanced techniques of locking system. These techniques are an integration of
mechanical and electronic devices and are highly intelligent. One of the prominent
features of these innovative lock systems is their simplicity and high efficiency.

Such an automatic lock system consists of electronic control assembly, which


controls the output load through a password. This output load can be a motor or a
lamp or any other mechanical/electrical load.

Here, we developed an electronic code lock system using 8051 microcontroller (a


Password based Door Lock System using 8051 Microcontroller), which provides
control to the actuating the load. It is a simple embedded system with input from
the keyboard and the output being actuated accordingly.

COMPONENTS REQUIRED:
 8051 Microcontroller(AT89C51)
 4×4 Matrix Keypad
 16×2 LCD(LM0162)
 L293D Motor Driver Board
 DC Motor
 10KΩ Potentiometer
 Crystal Oscillator
 Connecting wires
 Capacitors(store charge) -2(22pF)
 Power Supply(+5V)

 Resistor 1k Ohm - 1

 SOFTWARE REQUIREMENTS
 Keil µVision IDE
 Proteus (for circuit diagram and simulation)

INTRODUCTION:
Here, an AT89C52 Microcontroller is used and it is an 8-bit controller. This controller requires a
supply voltage of +5V DC. In order to provide regulated 5V DC voltage to the controller we
need to use 7805 power supply circuit. We can use 9V DC battery or 12V, 1A adaptor as a
power source.

L293D Motor Driver:


A motor driver IC is an integrated circuit chip which is usually used to control motors in
autonomous robots. Motor driver ICs act as an interface between microprocessors in robots
and the motors in the robot. These ICs are designed to control 2 DC motors simultaneously.
L293D consist of two H-bridge. H-bridge is the simplest circuit for controlling a low current
rated motor. For this tutorial we will be referring the motor driver IC as L293D only. L293D has
16 pins.
 4×4 Matrix Keypad:
The 4*4 matrix keypad usually is used as input in a project. The 4*4 Matrix Keypad Module is a
matrix non- encoded keypad consisting of 16 keys in parallel. The keys of each row and column
are connected through the pins outside – pins A,B,C,D as labeled beside control the rows,
when 1,2,3,4 are the columns.

WORKING OF THE SYSTEM 


When we switch on the system will display a message on the LCD screen - “Enter the
password”. The user then has to input 4 characters into the keypad. Once 4 digits are entered,
the system will check the password (by comparing the input 4 digits with the stored password-
4444). The password is checked digit by digit.
If the password entered is matched, a message will be displayed on the LCD screen- “Success”.
The microcontroller makes P2.2 LOW and P2.3 HIGH, so the motor driver gets the input signals
for the forward motion of the motor. As a result, Door Motor rotates in a forward direction to
open the door. After a delay, the microcontroller makes P2.2 LOW and P2.3 LOW, so the
motor driver gets the input signals for reverse motion. As a result, the Door motor rotates in
the reverse direction to close the door.
If the password entered is wrong, a message “Failed” will be displayed on the LCD screen. The
microcontroller maintains both P2.2 and P2.3 LOW. Hence, the door motor is stationary so
that door remains closed.
ASSEMBLY CODE 
We used the Keil µVision software to write the program in assembly language and generate
the hex file. For the circuit simulation, we use the Proteus software and the hex file is
uploaded to the microcontroller. Basic logic flow is as follows:
The program first initializes all components and data pointers, then waits for the user to input
characters. According to the character entered, the corresponding function is invoked and it is
stored to the memory as well as displayed. Once 4 characters have been entered, it is
compared to the password saved in the memory earlier. If each character matches it goes on
to call the success function, otherwise the failure function. Those functions execute their
activity and after those, the flow returns to the start and awaits the user until used next time. 
Details:-
1. User will enter the password by using keypad which is interfaced with Port 1 of 8051 Micro
Controller.

2. LCD is interfaced with micro controller on Port 2 by 8 data pins.

3. Motor Driver IC L293D is used for controlling DC motor of 12V rating. It is interfaced with
Port 3 of micro controller 8051.

4. RS (Register Select) and EN (Enable) Pins of LCD are connected to Port 3 and RW(Read-
Write) pin is grounded only for writing purpose on LCD.

5. 12V battery is used to energies DC motor though IC293D.

Concept:-
1. Password is set 4444 by using programming.

2. If user entered correct password by means of keyboard then LCD will indicate SUCCESS and
Motor will Rotate to open door.

3. If user entered incorrect password then LCD will display "FAILURE" and motor will not
rotate, eventually door will not open.

SIMULATION VIDEO:
CIRCUIT DIAGRAM
SIMULATION:
 IF PASSWORD ENTERED IS CORRECT(4444):
 IF PASSWORD ENTERED IS INCORRECT:

CODE:-
ORG 0000H

S: MOV P3,#0FFH ;(256)

CLR P3.0

CLR P3.1

CLR P3.2

CLR P3.3

CLR P2.2

CLR P2.3

MOV R0,#02FH ;Input Password is Stored at 02FH in memory(47)


MOV R1,#040H ;Preset Password is Stored at 040H in memory(64)

MOV R4,#4

MOV DPTR,#0550H

Z: MOV A,#0

MOVC A,@A+DPTR

MOV @R1,A

INC R1

INC DPTR

DJNZ R4,Z

MOV A,#38H

ACALL CMD

MOV A,#0EH

ACALL CMD

MOV A,#01H

ACALL CMD

MOV A,#080H

ACALL CMD

ACALL DEL

SJMP PRT

CMD: MOV P1,A ;SENDING CMDS TO 16X2 LCD

CLR P2.0

SETB P2.1 ;The SETB instruction sets the bit operand to a value of 1

ACALL DEL2 ;The ACALL instruction calls a subroutine located at the specified address.

CLR P2.1

RET
DAT: MOV P1,A ;DAT FUNCTION Sending data to 16×2 lcd.

SETB P2.0

SETB P2.1

ACALL DEL2

CLR P2.1

RET

DEL: MOV R1,#250

D2: MOV R2,#250

D3: DJNZ R2,D3

DJNZ R1,D2

RET

DEL2: MOV R1,#10

D2A: MOV R2,#20

D3A: DJNZ R2,D3A

DJNZ R1,D2A

RET

DEL3: MOV R1,#200

D2B: MOV R2,#200

D3B: MOV R3,#20

D4B: DJNZ R3,D4B

DJNZ R2,D3B

DJNZ R1,D2B

RET
PRT:MOV R4,#11

MOV DPTR,#0500H

TH: MOV A,#0

MOVC A,@A+DPTR

ACALL DAT

INC DPTR

DJNZ R4,TH

MOV A,#0C0H

ACALL CMD

MOV R4,#4

SJMP M

M: ACALL DEL

JNB P3.4,C1

JNB P3.5,C2

JNB P3.6,C3

JNB P3.7,C4S

CJNE R4,#0,M

JMP CHE

C4S:JMP C4

C1: DEC R4 ;C1 OF KEYPAD

INC R0

SETB P3.0

JB P3.4,SEVEN

SETB P3.1
JB P3.4,FOUR

SETB P3.2

JB P3.4,ONE

SETB P3.3

JB P3.4,STAR

C2: DEC R4 ; C2 OF KEYPAD

INC R0

SETB P3.0

JB P3.5,EIGHT

SETB P3.1

JB P3.5,FIVE

SETB P3.2

JB P3.5,TWO

SETB P3.3

JB P3.5,ZERO

SEVEN: MOV A,#'7'

ACALL DAT

ACALL DEL

MOV @R0,#'7'

JMP H

FOUR: MOV A,#'4'

ACALL DAT

ACALL DEL
MOV @R0,#'4'

JMP H

ONE: MOV A,#'1'

ACALL DAT

ACALL DEL

MOV @R0,#'1'

JMP H

STAR: MOV A,#'*'

ACALL DAT

ACALL DEL

MOV @R0,#'*'

JMP H

EIGHT: MOV A,#'8'

ACALL DAT

ACALL DEL

MOV @R0,#'8'

JMP H

FIVE: MOV A,#'5'

ACALL DAT

ACALL DEL

MOV @R0,#'5'

SJMP H
TWO: MOV A,#'2'

ACALL DAT

ACALL DEL

MOV @R0,#'2'

SJMP H

ZERO: MOV A,#'0'

ACALL DAT

ACALL DEL

MOV @R0,#'0'

SJMP H

C4: DEC R4 ;C4 OF KEYPAD

INC R0

SETB P3.0

JB P3.7,AA

SETB P3.1

JB P3.7,BB

SETB P3.2

JB P3.7,CC

SETB P3.3

JB P3.7,DD

NINE: MOV A,#'9'

ACALL DAT

ACALL DEL

MOV @R0,#'9'

SJMP H
SIX: MOV A,#'6'

ACALL DAT

ACALL DEL

MOV @R0,#'6'

SJMP H

THREE: MOV A,#'3'

ACALL DAT

ACALL DEL

MOV @R0,#'3'

SJMP H

HASH: MOV A,#'#'

ACALL DAT

ACALL DEL

MOV @R0,#'#'

SJMP H

AA: MOV A,#'A'

ACALL DAT

ACALL DEL

MOV @R0,#'A'

SJMP H

BB: MOV A,#'B'

ACALL DAT

ACALL DEL
MOV @R0,#'B'

SJMP H

CC: MOV A,#'C'

ACALL DAT

ACALL DEL

MOV @R0,#'C'

SJMP H

DD: MOV A,#'D'

ACALL DAT

ACALL DEL

MOV @R0,#'D'

SJMP H

H: CLR P3.0

CLR P3.1

CLR P3.2

CLR P3.3

JMP M

CHE:MOV A,#01H

ACALL CMD

MOV A,#080H

ACALL CMD

ACALL DEL
MOV R0,#02FH

MOV R1,#03FH

MOV R4,#4

CH: INC R0

INC R1

MOV A,@R0

MOV B,@R1

CJNE A,B,FA ;(compare and jump if not equal) The CJNE instruction compares two operands, and jumps if they
are not equal.

DJNZ R4,CH ; Decrement and Jump if Not Zero

MOV R4,#7

MOV DPTR,#0600H

TH2:MOV A,#0

MOVC A,@A+DPTR ; The Data Pointer (DPTR) is the 8051's only user-accessible 16-bit (2-byte) register. The
Accumulator, R0–R7 registers and B register are 1-byte value registers.

INC DPTR ;DPTR is meant for pointing to data. It is used by the 8051 to access external memory using the
address indicated by DPTR.

ACALL DAT

DJNZ R4,TH2

H2:CLR P2.2

SETB P2.3

ACALL DEL3

CLR P2.3

CLR P2.3

ACALL DEL3

SETB P2.2

CLR P2.3
ACALL DEL3

JMP S

FA: MOV R4,#7

MOV DPTR,#0650H

TH3:MOV A,#0

MOVC A,@A+DPTR

ACALL DAT

INC DPTR

DJNZ R4,TH3

MOV R4,#10

WA: ACALL DEL

DJNZ R4,WA

JMP S

ORG 0500H

DB "ENTER CODE:"

ORG 0550H

DB "4444"

ORG 0600H

DB "SUCCESS"

ORG 0650H

DB "FAILURE"

END

You might also like