Door_Lock_System_Phase_1
Door_Lock_System_Phase_1
GROUP PARTICIPANTS:
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:
Hardware Components
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
Code Structure
3
• Keypad scanning and input processing
• Password validation
• Motor control
• Timing and sequencing
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.
The next phase will focus on enhancing security and user functionality through the following
additions:
EEPROM Integration
Security Enhancements
4
C Code Extract for the Implementation
#include<reg51.h>
#include<string.h>
// Pin definitions
// Constants
#define PASSWORD_LENGTH 4
// Function prototypes
void lcd_init(void);
void clear_password_field(void);
5
// Main function
void main(void)
// Initialize LCD
lcd_init();
lcd_string("Enter Password:");
while(1)
key = keypad_scan();
6
{
pos = 0;
lcd_cmd(0xC0);
clear_password_field();
lcd_cmd(0xC0);
password[pos] = key;
pos++;
if(pos == PASSWORD_LENGTH)
lcd_string("Checking...");
delay(500);
7
// Check if password is correct
if(strcmp(password, CORRECT_PASSWORD) == 0)
lcd_string("Access Granted!");
lcd_cmd(0xC0);
lcd_string("Door Opening...");
IN1 = 1;
IN2 = 0;
// Stop motor
IN1 = 0;
IN2 = 0;
else
8
lcd_cmd(0x01);
lcd_string("Access Denied!");
lcd_cmd(0xC0);
lcd_string("Try again");
delay(100);
lcd_cmd(0x0C); // Display on
delay(100);
delay(200);
lcd_cmd(0x01);
lcd_string("Enter Password:");
lcd_cmd(0xC0);
pos = 0;
9
}
unsigned int i, j;
P2 = cmd;
RS = 0; // Command mode
EN = 1; // Enable high
10
delay(1);
EN = 0; // Enable low
P2 = dat;
RS = 1; // Data mode
EN = 1; // Enable high
delay(1);
EN = 0; // Enable low
while(*str != '\0')
lcd_data(*str);
11
str++;
// Initialize LCD
void lcd_init(void)
void clear_password_field(void)
unsigned char i;
lcd_data(' ');
12
}
// Scan keypad for pressed key and return the character if a key is pressed
return 0;
delay(20); // Debounce
// Row 1 scan
// Row 2 scan
13
P1 = 0xFD; // Ground row 2
// Row 3 scan
// Row 4 scan
14
return 0; // No valid key detected
15