Customary lock frameworks utilizing mechanical bolt and key instrument are being supplanted by new propelled methods of locking framework. These methods are a joining of mechanical and electronic gadgets and exceedingly insightful. One of the unmistakable elements of these imaginative lock frameworks is their effortlessness and high effectiveness.

Such a programmed lock framework comprises of electronic control get together which controls the yield load through a secret key. This yield burden can be an engine or a light or whatever other mechanical/electrical burden.

Here we build up an electronic code lock framework utilizing 8051 microcontroller, which gives control to the impelling the heap. It is a straightforward inserted framework with data from the console and the yield being activated appropriately.

This framework shows a watchword based entryway lock framework wherein once the right code or secret word is entered, the entryway is opened and the concerned individual is permitted access to the secured region. Again if someone else arrives it will request that enter the secret key. In the event that the secret word isn't right then entryway would stay shut, denying the entrance to the individual.






Password Based Door Locking System Project Required Components:

Hardware Requirements:

  1. at89c51 controller
  2. 8051 programming board
  3. Programming cable
  4. DC battery or 12V,1A adaptor
  5. 4×3 matrix keypad
  6. 16×2 LCD
  7. 5V Relay
  8. DC motor
  9. BC 547 Transistor
  10. 10k, 330 Ω  resistor (1/4 watt)
  11. 10uF electrolytic capacitor
  12. 33pF capacitors – 2
  13. 12MHz Crystal
  14. Pot 10k (1/4 watt) – 1
  15. connecting wires

Software Requirements:

  1. Keil compiler
  2. Flash magic
  3. Proteus

Electronic Code Lock System Circuit Design:

Password based door lock circuit design uses five major components – a Microcontroller, a Relay, a DC motor, a 4×3 matrix keypad and a LCD. Here AT89C51 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.
Reset Circuit Design: The reset pin of the microcontroller is kept active till the power supply is in the specified range and a minimum oscillation level is maintained.  In other words to ensure the supply voltage does not falls below the threshold level of 1.2V and the reset pulse width is greater than 100ms (recommended for 89C51),  we select the values of resistor and capacitor such that RC >=100ms.  Here we select a 10K resistor and a 10uF electrolyte capacitor.
Oscillator Circuit Design: A crystal oscillator is used to provide external clock signal to the microcontroller. To ensure smooth operation, we connect two ceramic capacitors ranges from 20pF to 40pF. This crystal oscillator is connected between pin 18 and 19 of the microcontroller.
Compilation of Microcontroller Code: Once the circuit is designed and drawn on a piece of paper, the next step is to write and compile the code. Here we select the Kiel uVision software to write the program in C language.
Prior to writing the code, general steps needs to be followed like creating a new project and selecting the target device or the required microcontroller. Once the code is written, we saved it with .c extension and then added it to the source file group under the target folder.  The code is then compiled by pressing F7 key.
Once the code is compiled, a hex file is created.  In the next step, we use Proteus software to draw the circuit. The code is dumped into the microcontroller by right clicking on the IC and then adding the hex file.
Recommend Reading: Password Based Circuit Breaker Project Circuit Diagram and Working.
Circuit Diagram:

  The Code:
Keypad Code:
sbit r0=P2^4;  
sbit r1=P2^5;
sbit r2=P2^6;
sbit r3=P2^7;

sbit c0=P2^0;  
sbit c1=P2^1;
sbit c2=P2^2;


char keypad_lut[4][3]={1,2,3,4,5,6,7,8,9,'*',0,'#'};

bit colscan()
{
return(c0&c1&c2);
}

unsigned char keyscan()
{
unsigned char rowval,colval;
c0=c1=c2=1;
r0=r1=r2=r3=0;
while(colscan());
r0=0;
r1=r2=r3=1;
if(!colscan())
{
rowval=0;
goto colcheck;
}
r1=0;
r0=r2=r3=1;
if(!colscan())
{
rowval=1;
goto colcheck;
}
r2=0;
r0=r1=r3=1;
if(!colscan())
{
rowval=2;
goto colcheck;
}
r3=0;
r0=r1=r2=1;
if(!colscan())
{
rowval=3;
}

colcheck:
            if(c0==0)
            colval=0;
            else if(c1==0)
            colval=1;
            else if(c2==0)
            colval=2;
            while(!(c0&&c1&&c2));
            return keypad_lut[rowval][colval];
}

The LCD:

#define lcd_data P1

sbit rs=P3^7;
sbit rw=P3^6;
sbit en=P3^5;


void delay_ms(unsigned int n)
{
int i,j;
for(i=0;i<n;i++)
for(j=0;j<124;j++);
}


void write_lcd(unsigned char dat)
{
lcd_data=dat;
rw=0;
en=1;
delay_ms(2);
en=0;
}

void cmd_lcd(unsigned char cmd)
{
rs=0;
write_lcd(cmd);
}

void disp_lcd(unsigned char c)
{
rs=1;
write_lcd(c);
}

void init_lcd(void)
{
cmd_lcd(0x02);
cmd_lcd(0x38);
cmd_lcd(0x01);
cmd_lcd(0x0c);
cmd_lcd(0x06);
cmd_lcd(0x80);
//delay_ms(2);
}

void str_lcd(unsigned char *s)
{
  while(*s)
  disp_lcd(*s++);
}

void int_lcd(unsigned int n)
{
char a[5]={0},i=0;
if(n==0)
{
disp_lcd('0');
return;
}
else
{
while(n>0)
{
a[i++]=(n%10)+48;
n/=10;
}
for(--i;i>=0;i--)
{
disp_lcd(a[i]);
}
}
}

Password Based Door locker:


#define lcd_data P1

sbit rs=P3^7;
sbit rw=P3^6;
sbit en=P3^5;


void delay_ms(unsigned int n)
{
int i,j;
for(i=0;i<n;i++)
for(j=0;j<124;j++);
}


void write_lcd(unsigned char dat)
{
lcd_data=dat;
rw=0;
en=1;
delay_ms(2);
en=0;
}

void cmd_lcd(unsigned char cmd)
{
rs=0;
write_lcd(cmd);
}

void disp_lcd(unsigned char c)
{
rs=1;
write_lcd(c);
}

void init_lcd(void)
{
cmd_lcd(0x02);
cmd_lcd(0x38);
cmd_lcd(0x01);
cmd_lcd(0x0c);
cmd_lcd(0x06);
cmd_lcd(0x80);
//delay_ms(2);
}

void str_lcd(unsigned char *s)
{
  while(*s)
  disp_lcd(*s++);
}

void int_lcd(unsigned int n)
{
char a[5]={0},i=0;
if(n==0)
{
disp_lcd('0');
return;
}
else
{
while(n>0)
{
a[i++]=(n%10)+48;
n/=10;
}
for(--i;i>=0;i--)
{
disp_lcd(a[i]);
}
}
}

Password Based Door Lock System Circuit Simulation Video:

Before going to read the working of this circuit, Watch the following simulation video to get clear idea about how the above circuit works.

Password Based Door Locking System Circuit Operation:

Once the circuit is powered, microcontroller sends commands to the LCD to display “enter password” on LCD.  Now we need to enter the password using the keypad. Once password is entered, it displays 5 stars on LCD to indicate that controller read password successfully.
Now the controller compares the entered password with predefined password. If the password is matched then controller makes P3.0 high. So the base of the transistor gets sufficient current to drive the relay, as a result Door motor rotates to open the door. If the password is not matched then microcontroller makes P3.0 low. Hence door motor is at stationary so that door remains close.  
Note: while giving the connections, make sure that there is no common connection between AC and DC supplies.

Password Based Door Lock System Algorithm:

  1. Initially declare the PORT1 to LCD data pins and control pins to P3.5, P3.6 and P3.7 and declare PORT2 to keypad. And use P3.0 to Door motor.
  2. Initially display enter password on LCD.
  3. Now read the five digit password from the user, while reading each digit from the keypad display * symbol on LCD.
  4. Compare the entered password with stored password.
  5. If password is correct then make P3.0 pin high for some time to open the door. After that display “Door is opened” on LCD.
  6. If the password is wrong then display “pwd is wrong” on LCD.
  7. After some delay again ask to enter password.

Advantages of Password Based Door Lock System:

  • This project provides security
  • Power consumption is less
  • Used commonly available components
  •  Project is simple and easy

Applications of Password Based Door Lock System Circuit:

  • This simple circuit can be used at residential places to ensure better safety.
  • It can be used at organizations to ensure authorized access to highly secured places.
  • With a slight modification this Project can be used to control the switching of loads through password.
Limitations of Password Based Door Lock System:
  • It is a low range circuit, i.e. it is not possible to operate the circuit remotely.
  • If you forget the password it is not possible to open the door.
Note: If you are interested to get code, kindly take some time and answer following questions in the comment section, so that we will send you the code.
  • Why you need this project code?
  • Are you trying to make the same project or different one?
  • Give us more details about your project.



Post a Comment

 
Top