Project report
On
DOOR LOCKING SYSTEM using
8051 Microcontroller
By
[Link] LAKSHMI 22261A04B2
[Link] JASWANTH 22261A04B3
[Link] REDDY 22261A04B4
3-ECE-2
Guided By
[Link]
Assistant Professor
Department of ECE
Department of Electronics and Communication Engineering
MAHATMA GANDHI INSTITUTE OF TECHNOLOGY
(Autonomous)
(Kokapet Village, Gandipet, Hyderabad, Telangana – 500 075)
2023
1
MAHATMA GANDHI INSTITUTE OF
TECHNOLOGY
(Autonomous)
(Kokapet Village, Gandipet, Hyderabad, Telangana –
500 075
Department of Electronics and Communication Engineering
CERTIFICATE Date:
T h i s i s t o c e r t i f i e d t h a t p r o j e c t e n t i t l e d DOOR LOCKING SYSTEM using 8051
Microcontroller has been submitted to Department of Electronics and Communication
Engineering, Mahatma Gandhi Institute of Technical for the partial fulfillment of the
requirement of [Link]. 5-Sem Micro Controllers course.
Signature Signature
Dr. S P Singh
[Link]
Project guide Professor & Head of ECE
2
INDEX
List of Contents Page NO.
[Link] 4
[Link] 5
[Link] 6
[Link] Explanation 7-8
[Link] Diagram 8
[Link] 9
[Link] 10
[Link] 11
ABSTRACT
This project presents a secure, automated door locking system designed using the 8051 microcontroller,
aimed at enhancing security and user convenience in residential, commercial, and industrial
environments. Traditional locks with physical keys face vulnerabilities such as duplication, tampering,
or loss of keys. By replacing them with a microcontroller-based system, this project offers a reliable and
efficient solution to mitigate these risks.
The system employs an 8051 microcontroller as the central processing unit, integrating various
components such as a keypad, motorized locking mechanism, LCD display, and a buzzer. Users enter a
predefined password through the keypad, which the microcontroller processes to validate access. A
correct password triggers the motor to unlock the door, while an incorrect password activates an alert
system via a buzzer. The LCD provides real-time feedback, displaying prompts and system status to
enhance user interaction.
Key features of the system include password protection, unauthorized access detection with limited retry
attempts, and an alert mechanism. It is designed to be user-friendly, cost-effective, and scalable. The
system is adaptable for further enhancements, such as incorporating biometrics, remote control, or IoT
connectivity, making it future-ready for advanced security applications.
Applications of this system are versatile and include use cases such as secure access for homes, offices,
lockers, or industrial sites. The integration of microcontroller technology ensures a compact, efficient,
and low-power solution compared to traditional or complex alternatives.
In conclusion, this 8051-based door locking system is an innovative approach to address modern
security challenges. It effectively combines simplicity, functionality, and adaptability, making it a
reliable and practical choice for improving access control and enhancing security in diverse settings.
INTRODUCTION
The door locking system using the 8051 microcontroller is a technologically advanced solution designed
to improve security and streamline access control in homes, offices, and industrial settings. Traditional
locks with physical keys are prone to risks such as key duplication or tampering. This project addresses
these limitations by implementing a password-based locking mechanism, ensuring enhanced security
and user convenience.
At the core of the system is the 8051 microcontroller, which processes user inputs from a keypad to
verify the entered password. Upon successful authentication, the microcontroller activates a motorized
lock, granting access. In case of incorrect password entries, a buzzer alerts about unauthorized attempts.
The system also features an LCD to provide real-time feedback, guiding users through the authentication
process and displaying system status.
This microcontroller-based solution is reliable, cost-effective, and scalable. It offers the flexibility to
integrate additional features such as remote control, biometric authentication, or wireless
communication for more advanced applications. Designed for ease of use and maintenance, the system
is a practical and efficient replacement for conventional locking methods.
With its ability to enhance security, reduce vulnerabilities, and adapt to evolving needs, the 8051-based
door locking system is an ideal choice for modern access control requirements.
CODE
; Program for Door Locking System with Password 52H (high byte) and 0FEH (low byte)
ORG 0000H ; Start of program memory
MAIN:
; Store password in internal memory
MOV R2, #52H ; High byte of the password
MOV R3, #0FEH ; Low byte of the password
WAIT_INPUT:
; Read high byte of the password from P2
MOV A, P2 ; Read user input from port P2
CJNE A, #52H, INCORRECT ; Compare high byte with stored password (R2)
; Read low byte of the password from P1
MOV A, P1 ; Read user input from port P1
CJNE A, #0FEH, INCORRECT ; Compare low byte with stored password (R3)
CORRECT:
SETB P3.0 ; Turn ON LED at P3.0 (correct password indication)
CLR P3.1 ; Turn OFF LED at P3.1
SJMP WAIT_INPUT ; Wait for the next input
INCORRECT:
CLR P3.0 ; Turn OFF LED at P3.0
SETB P3.1 ; Turn ON LED at P3.1 (incorrect password indication)
SJMP WAIT_INPUT ; Wait for the next input
END ; End of program
CODE EXPLAINATION
1. Password Initialization
The password is stored in two registers:
R2: Holds the high byte of the password (52H).
R3: Holds the low byte of the password (0FEH).
This allows for a two-step verification process.
2. Main Program Flow
WAIT_INPUT:
This is the main loop where the system continuously monitors for user input from ports P2 and P1:
P2: Used to input the high byte of the password.
P1: Used to input the low byte of the password.
The program compares the user-provided input with the stored password bytes.
Password Verification
High Byte Verification:
The input from P2 is read into the accumulator A.
The instruction CJNE A, #52H, INCORRECT compares it with 52H (the high byte of the password
stored in R2).
If it does not match, the program jumps to the INCORRECT label.
Low Byte Verification:
If the high byte matches, the input from P1 is read into A.
The instruction CJNE A, #0FEH, INCORRECT compares it with 0FEH (the low byte of the
password stored in R3).
If this comparison also passes, the program jumps to the CORRECT label.
3. Output Indications
CORRECT Label:
SETB P3.0: Turns ON the LED connected to P3.0, indicating a correct password.
CLR P3.1: Turns OFF the LED connected to P3.1, which signals incorrect password attempts.
SJMP WAIT_INPUT: Loops back to wait for the next input.
INCORRECT Label:
CLR P3.0: Turns OFF the LED at P3.0.
SETB P3.1: Turns ON the LED at P3.1, signaling an incorrect password.
SJMP WAIT_INPUT: Loops back to wait for the next input.
KEY CONCEPTS
Two-Byte Password: Requires both a high byte (52H) and a low byte (0FEH) for secure access,
reducing unauthorized entry risks.
Port Usage:
P2: High byte input.
P1: Low byte input.
P3.0: LED indicates correct password.
P3.1: LED signals incorrect attempts.
Continuous Monitoring: Constantly checks for input and provides real-time feedback without
requiring resets.
Expandable: Can control motorized locks and integrate alarms, biometrics, or wireless control for
enhanced functionality.
CIRCUIT DIAGRAM
OUTPUT
CORRECT PASSWORD
SETB P3.0: If both the high and low bytes match, the LED connected to Port 3.0 will turn ON, indicating that
the correct password was entered.
CLR P3.1: The LED connected to Port 3.1 is turned OFF, indicating that the password is correct
INCORRECT PASSWORD
CLR P3.0: If either byte of the password is incorrect, the LED connected to Port 3.0 will turn OFF.
SETB P3.1: The LED connected to Port 3.1 will turn ON, signaling an incorrect password entry.
APPLICATIONS
The 8051 microcontroller-based door locking system offers enhanced security and reliability for
various applications. Its versatility makes it suitable for a wide range of environments, from
residential spaces to commercial and industrial areas. Here are five key applications of this system:
1. Residential Security
The system can be used in homes to provide secure, keyless access to doors. Traditional keys are
prone to being lost or copied, but with a password-based system, only authorized individuals can gain
entry. This system can also be integrated into safes and lockers to protect valuable items. Additionally,
it can be incorporated into a smart home setup for remote monitoring and control.
2. Commercial and Office Security
In commercial settings, the system can be installed at the entrances of offices or private workspaces,
ensuring that only authorized personnel can enter. It can be used to secure office cabinets, staff rooms,
or data rooms containing sensitive information. The system ensures high levels of security and
reduces the risks associated with traditional key management.
3. Industrial Security
In industries and factories, the door locking system can be applied to secure access to production
areas, storage rooms, and machinery that requires restricted access. By requiring a password for entry,
it minimizes the risks of unauthorized access, protecting both employees and equipment. It can also
be used in secure locker rooms or maintenance areas where tools and equipment are stored.
4. Educational Institutions
Schools and universities can benefit from this system by securing restricted areas such as laboratories,
staff rooms, and libraries. It ensures that only authorized students, faculty, or staff can access critical
resources and facilities. The system can also be used to protect research materials and sensitive
equipment in various departments.
5. Healthcare Facilities
Hospitals and clinics can implement the door locking system in areas requiring restricted access, such
as pharmacies, medical storage rooms, and operating theaters. By controlling entry to these sensitive
areas.
RESULT
The 8051 microcontroller-based door locking system successfully demonstrates a secure and efficient
method of access control using a two-byte password authentication. The system was tested by
inputting a predefined password, with the high byte stored in register R2 (52H) and the low byte in
register R3 (0FEH). Upon successful entry of both the correct high and low bytes via the input ports
(P2 and P1), the system activates an LED connected to port P3.0, indicating correct authentication.
In contrast, incorrect password entries triggered an LED connected to P3.1, signaling an unauthorized
attempt. The system continuously monitored user input and responded in real-time, ensuring
immediate feedback to the user, whether the password was correct or incorrect. This feature confirmed
the system's reliability and responsiveness.
Additionally, the system's scalability was tested, showing its potential to be expanded further with
additional features like a motorized lock mechanism or alarm systems. The use of LEDs for feedback
provides simple, clear indications, making the system user-friendly.
Overall, the results confirmed that the door locking system operates efficiently, providing a reliable
and secure solution for controlled access. Its ability to be expanded for more advanced features makes
it a practical option for a wide range of applications.