Door Lock System Using 8051 Microcontroller
Door Lock System Using 8051 Microcontroller
8051 microcontroller.
MICROPROCESSORS AND MICROCONTROLLERS
-VANYA NANDWANI
21BEC0434
DATE: 3/04/23
VANYA NANDWANI MICROPROCESSORS AND MICROCONTROLLERS 21BEC0434
Introduction:
Door lock systems are essential for providing security and privacy to
individuals and businesses. They prevent unauthorized access to buildings,
homes, and other private spaces. Here are some of the key reasons why door
lock systems are important:
Control Access: Door lock systems allow you to control who enters your
building or home. With advanced features like keyless entry, you can restrict
access to specific areas or individuals, ensuring that only authorized persons
can access them.
Peace of Mind: Knowing that your property is secure and protected gives you
peace of mind. This can help you focus on your work or other activities
without worrying about the safety of your premises.
Overall, door lock systems are essential for maintaining privacy, safety, and
security in both residential and commercial settings.
LCD
KEYPAD
BUZZER 1 MOTOR
DRIVER
STEPPER
MOTOR
Components Used:
Hardware used:
AT89C51
Keypad
DC Motor
LCD (LM016)
L293D (MOTOR DRIVER)
VANYA NANDWANI MICROPROCESSORS AND MICROCONTROLLERS 21BEC0434
Software used:
Concept:
The system is built using an 8051 microcontroller, which serves as the main
control unit for the system.
To enter the password, the user inputs a series of digits using a keypad that is
connected to Port 1 of the microcontroller. The microcontroller processes the
input and compares it with a predefined password for authentication.
To control the DC motor, the system uses a Motor Driver IC L293D, which is
interfaced with Port 3 of the microcontroller. The L293D is responsible for
providing the necessary power and signals to the motor to drive it in the
desired direction and speed.
Finally, the system is powered by a 12V battery that is used to supply power
to the DC motor through the L293D. The microcontroller also receives power
from the same source.
Circuit Diagram:
Working:
2. Correct Password Input: If the user enters the correct password using the
keyboard, the LCD display will indicate "Correct" and the DC motor will
rotate, resulting in the opening of the door.
Code Used:
}
}
void lcdint()
{
cmd(0x01);
cmd(0x38);
cmd(0x0E);
cmd(0x80);
void main()
{
char pass[5] = "1234";//etting passcode to “1234”
char pass2[5];
int i=0;
char *ptr;
ptr = pass2;
lcdint();
display("Password-");
pass2[4]='\0';
while(1)
{
while(i<4)
{
P1=0xFE;
if(P1==0xEE)
{
*(ptr+i)='7';
dat('7');
delay(200);
cmd(0x06);
i++;
}
else if(P1==0xDE)
{
*(ptr+i)='8';
VANYA NANDWANI MICROPROCESSORS AND MICROCONTROLLERS 21BEC0434
dat('8');
delay(200);
cmd(0x06);
i++;
}
else if(P1==0xBE)
{
*(ptr+i)='9';
dat('9');
delay(200);
cmd(0x06);
i++;
}
else if(P1==0x7E)
{
*(ptr+i)='/';
dat('/');
delay(200);
cmd(0x06);
i++;
}
P1=0xFD;
if(P1==0xED)
{
*(ptr+i)='4';
dat('4');
delay(200);
cmd(0x06);
i++;
}
else if(P1==0xDD)
{
*(ptr+i)='5';
VANYA NANDWANI MICROPROCESSORS AND MICROCONTROLLERS 21BEC0434
dat('5');
delay(200);
cmd(0x06);
i++;
}
else if(P1==0xBD)
{
*(ptr+i)='6';
dat('6');
delay(200);
cmd(0x06);
i++;
}
else if (P1==0x7D)
{
*(ptr+i)='*';
dat('*');
delay(200);
cmd(0x06);
i++;
}
P1=0xFB;
if(P1==0xEB)
{
*(ptr+i)='1';
dat('1');
delay(200);
cmd(0x06);
i++;
}
else if(P1==0xDB)
{
*(ptr+i)='2';
dat('2');
VANYA NANDWANI MICROPROCESSORS AND MICROCONTROLLERS 21BEC0434
delay(200);
cmd(0x06);
i++;
}
else if(P1==0xBB)
{
*(ptr+i)='3';
dat('3');
delay(200);
cmd(0x06);
i++;
}
else if(P1==0x7B)
{
*(ptr+i)='-';
dat('-');
delay(200);
cmd(0x06);
i++;
}
P1=0xF7;
if(P1==0xE7)
{
*(ptr+i)='C';
dat('C');
delay(200);
cmd(0x06);
i++;
}
else if(P1==0xD7)
{
*(ptr+i)='0';
VANYA NANDWANI MICROPROCESSORS AND MICROCONTROLLERS 21BEC0434
dat('0');
delay(200);
cmd(0x06);
i++;
}
else if(P1==0xB7)
{
*(ptr+i)='=';
dat('=');
delay(200);
cmd(0x06);
i++;
}
else if(P1==0x77)
{
*(ptr+i)='+';
dat('+');
delay(200);
cmd(0x06);
i++;
}
}
while(i==4)
{
if ((strcmp(pass, pass2)) == 0)
{
cmd(0xC0);
display("Correct");
IN1 = 1;
IN2 = 0;
delay(100);
}
else
{
cmd(0xC0);
VANYA NANDWANI MICROPROCESSORS AND MICROCONTROLLERS 21BEC0434
display("Incorrect");
IN1 = 0;
IN2 = 0;
delay(100);
}
}
}
}
When Password is entered incorrectly, i.e. when user enters a number other
than the set password 1234, the motor does not rotate and LCD displays
“Incorrect”, Hence the door does not unlock.
When Password is entered correctly i.e. 1234, The motor rotates and hence the
door unlocks. The LCD displays “Correct”
VANYA NANDWANI MICROPROCESSORS AND MICROCONTROLLERS 21BEC0434
VANYA NANDWANI MICROPROCESSORS AND MICROCONTROLLERS 21BEC0434
REFERENCES: