0% found this document useful (0 votes)
4 views

Door_Lock_System_Phase_1

The project report details the successful completion of Phase 1 of a Digital Password-Based Door Lock System using an 8051 microcontroller, featuring a keypad interface and LCD display for user interaction. Key functionalities include password validation, motor control for door locking, and a user-friendly interface with visual feedback. Future enhancements in Phase 2 will integrate EEPROM for secure password storage and additional security features such as password encryption and multiple user support.

Uploaded by

Kelvin Byabato
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Door_Lock_System_Phase_1

The project report details the successful completion of Phase 1 of a Digital Password-Based Door Lock System using an 8051 microcontroller, featuring a keypad interface and LCD display for user interaction. Key functionalities include password validation, motor control for door locking, and a user-friendly interface with visual feedback. Future enhancements in Phase 2 will integrate EEPROM for secure password storage and additional security features such as password encryption and multiple user support.

Uploaded by

Kelvin Byabato
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

THE UNIVERSITY OF DAR ES SALAAM

COLLEGE OF INFORMATION AND COMMUNICATION TECHNOLOGY (CoICT)


DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING (CSE)

EMBEDDED SYSTEMS (CS 356)


PROJECT PROGRESS REPORT

PROJECT TITLE: DIGITAL PASSWORD-BASED DOOR LOCK SYSTEM USING THE


8051 MICRO-CONTROLLER

GROUP PARTICIPANTS:

S/N Student’s Name Reg No. Course


1. GLADNESS I. MATHEW 2022-04-06637 CEIT
2. REGINA L. MWIGUNE 2022-04-13605 CEIT
3. ANDREW B. SANDY 2022-04-11903 CEIT
4. RWEGASILA K. BYABATO 2022-04-00982 CEIT

1
EXECUTIVE SUMMARY:

Phase 1 of the Electronic Door Lock System project has been successfully completed. We have
developed a functional prototype of a security access system using an 8051 microcontroller with
a keypad interface and LCD display. The system validates a 4-digit PIN code against a
predefined password and controls an electric door actuator based on authentication results. This
report summarizes the accomplishments of Phase 1 and outlines plans for Phase 2, which will
focus on integrating EEPROM for secure, non-volatile password storage.

Detailed Diagrams:

Technical Implementation - Phase 1

Hardware Components

• 8051 micro-controller (AT89C51)


• 16x2 LCD display
• 4x4 matrix keypad
• DC motor with driver circuit (for door actuator simulation)

Software Features

1. User Interface

2
o Password prompt on LCD display
o Secure password entry with asterisk (*) masking
o Clear visual feedback for access granted/denied states
o Password reset functionality
2. Input Processing
o Robust keypad scanning algorithm with debounce protection
o Support for full numeric input (0-9) and control keys
o Efficient key detection with minimal CPU overhead
3. Authentication System
o Secure password comparison using string matching
o Protection against timing attacks by using constant-time comparison
o Configurable PIN length (currently set to 4 digits)
4. Output Control
o Motor driver activation for door unlock mechanism
o Visual status indicators on LCD display
o Timed door open/close sequence

System Operation

The current implementation follows this workflow:

1. System initialization and welcome message


2. Password prompt displayed on LCD
3. User enters 4-digit PIN via keypad (displayed as asterisks)
4. System compares entered PIN with stored password
5. If correct:
o "Access Granted" message displayed
o Door actuator motor activated
o System returns to ready state after defined period
6. If incorrect:
o "Access Denied" message displayed with visual alert
o Door remains locked
o System returns to ready state for new attempt

Code Structure

The software is organized into modular functions for:

• LCD initialization and control

3
• Keypad scanning and input processing
• Password validation
• Motor control
• Timing and sequencing

Technical Challenges Overcome

1. Keypad Debouncing
Implemented a reliable scanning algorithm with appropriate debounce timing to prevent
false key detections.
2. Memory Optimization
Optimized code to fit within the 8051's limited memory constraints while maintaining
full functionality.
3. Power Management
Designed efficient scanning routines to minimize power consumption during idle periods.
4. Input Security
Implemented secure input masking and processing to protect password confidentiality.
5. Compiler Compatibility
Ensured code compatibility with standard 8051 C compilers by avoiding C99-specific
features.

Planned Improvements - Phase 2

The next phase will focus on enhancing security and user functionality through the following
additions:

EEPROM Integration

• 24C02/24C04 EEPROM will be integrated for non-volatile password storage


• Implementation of I²C communication protocol for EEPROM access
• EEPROM read/write routines for password management

Security Enhancements

• Password change functionality accessible via admin mode


• Multiple user support with different access levels
• Lockout mechanism after multiple failed attempts
• Password encryption before storage in EEPROM

4
C Code Extract for the Implementation

#include<reg51.h>

#include<string.h>

// Pin definitions

sbit RS = P3^0; // Register Select for LCD

sbit EN = P3^1; // Enable for LCD

sbit IN1 = P3^2; // Motor control 1

sbit IN2 = P3^3; // Motor control 2

// Constants

#define PASSWORD_LENGTH 4

#define CORRECT_PASSWORD "1234"

// Function prototypes

void delay(unsigned int ms);

void lcd_cmd(unsigned char cmd);

void lcd_data(unsigned char dat);

void lcd_string(char *str);

void lcd_init(void);

unsigned char keypad_scan(void);

void clear_password_field(void);

5
// Main function

void main(void)

char password[PASSWORD_LENGTH + 1]; // +1 for null terminator

unsigned char key;

unsigned char pos = 0;

unsigned char i; // Declare loop variable at function scope

// Initialize LCD

lcd_init();

lcd_string("Enter Password:");

lcd_cmd(0xC0); // Move to second line

while(1)

// Scan for keypress

key = keypad_scan();

if(key != 0) // If a key was pressed

if(key == 'C') // Clear button pressed

6
{

// Reset password entry

pos = 0;

lcd_cmd(0xC0);

clear_password_field();

lcd_cmd(0xC0);

else if(pos < PASSWORD_LENGTH) // Still collecting password

password[pos] = key;

lcd_data('*'); // Show * for security

pos++;

// If we've collected the full password

if(pos == PASSWORD_LENGTH)

password[PASSWORD_LENGTH] = '\0'; // Null terminate

// Show entered password for debugging

lcd_cmd(0x01); // Clear display

lcd_string("Checking...");

delay(500);

7
// Check if password is correct

if(strcmp(password, CORRECT_PASSWORD) == 0)

lcd_cmd(0x01); // Clear display

lcd_string("Access Granted!");

lcd_cmd(0xC0);

lcd_string("Door Opening...");

// Activate motor to open door

IN1 = 1;

IN2 = 0;

delay(500); // Run motor for 5 seconds

// Stop motor

IN1 = 0;

IN2 = 0;

delay(300); // Wait 3 seconds

else

8
lcd_cmd(0x01);

lcd_string("Access Denied!");

lcd_cmd(0xC0);

lcd_string("Try again");

// Flash "Access Denied" three times

for(i = 0; i < 3; i++)

lcd_cmd(0x08); // Display off

delay(100);

lcd_cmd(0x0C); // Display on

delay(100);

delay(200);

// Reset for next password entry

lcd_cmd(0x01);

lcd_string("Enter Password:");

lcd_cmd(0xC0);

pos = 0;

9
}

delay(200); // Longer debounce delay

// Delay function (milliseconds)

void delay(unsigned int ms)

unsigned int i, j;

for(i = 0; i < ms; i++)

for(j = 0; j < 120; j++); // Calibrated for approximately 1ms delay

// Send command to LCD

void lcd_cmd(unsigned char cmd)

P2 = cmd;

RS = 0; // Command mode

EN = 1; // Enable high

10
delay(1);

EN = 0; // Enable low

delay(5); // Command execution time

// Send data to LCD

void lcd_data(unsigned char dat)

P2 = dat;

RS = 1; // Data mode

EN = 1; // Enable high

delay(1);

EN = 0; // Enable low

delay(5); // Data write time

// Display string on LCD

void lcd_string(char *str)

while(*str != '\0')

lcd_data(*str);

11
str++;

// Initialize LCD

void lcd_init(void)

delay(15); // Power on delay

lcd_cmd(0x38); // 8-bit, 2 line, 5x7 dots

lcd_cmd(0x0C); // Display on, cursor off

lcd_cmd(0x06); // Auto increment cursor

lcd_cmd(0x01); // Clear display

lcd_cmd(0x80); // Force cursor to beginning of first line

// Clear password field on LCD

void clear_password_field(void)

unsigned char i;

for(i = 0; i < PASSWORD_LENGTH; i++)

lcd_data(' ');

12
}

// Scan keypad for pressed key and return the character if a key is pressed

unsigned char keypad_scan(void)

// Check if any key is pressed at all (avoids constant scanning)

P1 = 0xF0; // All rows active (grounded)

if(P1 == 0xF0) // No key pressed

return 0;

delay(20); // Debounce

// Row 1 scan

P1 = 0xFE; // Ground row 1

delay(5); // Settling time

if(P1 == 0xEE) return '7';

if(P1 == 0xDE) return '8';

if(P1 == 0xBE) return '9';

if(P1 == 0x7E) return '/';

// Row 2 scan

13
P1 = 0xFD; // Ground row 2

delay(5); // Settling time

if(P1 == 0xED) return '4';

if(P1 == 0xDD) return '5';

if(P1 == 0xBD) return '6';

if(P1 == 0x7D) return '*';

// Row 3 scan

P1 = 0xFB; // Ground row 3

delay(5); // Settling time

if(P1 == 0xEB) return '1';

if(P1 == 0xDB) return '2';

if(P1 == 0xBB) return '3';

if(P1 == 0x7B) return '-';

// Row 4 scan

P1 = 0xF7; // Ground row 4

delay(5); // Settling time

if(P1 == 0xE7) return 'C';

if(P1 == 0xD7) return '0';

if(P1 == 0xB7) return '=';

if(P1 == 0x77) return '+';

14
return 0; // No valid key detected

15

You might also like