1
This is a Password based Door locking system with GSM. The project mainly consisting of PIC microcontroller (16F877), 16x2 LCD Display, GSM Modem, Keypad and misc.(Relay, Crystal oscillator, power supply which is not shown in circuit diagram) The program is compiled using PICC Compiler and simulated on Proteus 8. All Header and simulation files are given at the bottom of this post. The default password is set as 123.

This project can be implemented anywhere where, higher security is required. If the user enters correct password, that is “123”, the relay gets active and opens the door. If an un-authorised person trying to access the system and enters the password incorrectly three times, the system gets locked and alert the owner by sms using Gsm modem. Once the system gets locked a count down timer will appear on lcd and you have to wait that predetermined time period.


Embedded C Program


#include <16f877.h>
#include <lcd_4bit.c>
#include <keypad.c>
#include <string.h>
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
void main()
{
char m[30];
signed int ss=60,mm=10,hh=00; //Setting the Count Down Timer.
int count=3;
lcd_init();
 lcd_str("Password Door");
    gotoxy(0,1);
    lcd_str("Locking System");
    delay_ms(1500);
    char u[]="123",p[10],k;   //set Password as 123
l1:  
int i=0,d;
    lcd_clear();
    lcd_str("Enter Password:");
    gotoxy(0,1);
   while(TRUE)
   {
    k=key();
    if(k=='c')
    {
    lcd_clear();
    gotoxy(0,0);
    lcd_str("Enter Password:");
    gotoxy(0,1);
    i=0;
    }
    else if(k=='=')
    {
    p[i]='\0';
    goto l;
    }
    else
    {
    lcd_str(k);
    p[i]=k;
    i++;
    }
   }
   l:
   gotoxy(0,1);
   d=strcmp(u,p);
   if(d==0)
   {
   count=3;
   gotoxy(0,0);
   lcd_str("Correct Password");
   delay_ms(500);
   gotoxy(0,1);
   lcd_str("Door Opening.."); // Here you can activate Relay or anything
   delay_ms(1500);
   goto l1;
   }
   else
   {
   lcd_str("Wrong...");
   count--;
   if(count==0)
   {
   lcd_clear();
   lcd_str("SYSTEM LOCKED");
   printf("AT\r");    //GSM Configuration
    delay_ms(10);
   printf("AT+CMGF=1\r");
    delay_ms(10);
   printf("AT+CMGS=+91999500xxxx\r");  //Set the mobile Number to receive sms alert.
   delay_ms(10);
   printf("Door Security Alert!!");  //Alerting Message.
   delay_ms(10);
   putc(0x1A);
   delay_ms(100);
   goto timer;
   }
   delay_ms(1500);
    goto l1;
   }
 timer:
   while(1)
{
ss--;
delay_ms(1000);
if(ss==0)
{
ss=60;
mm--;
if(mm<0)
{
mm=59;
hh--;
if(hh<0)
{
goto l1;
}
}
}
gotoxy(2,1);
sprintf(m,"%02d:%02d:%02d",hh,mm,ss);
lcd_array(m);
}
}

Circuit Diagram

password door locker


This project is not tested using hardwares. The GSM Modem is simulated using Virtual Terminal. After entering the password using keypad press “=” button.


GSM Configuration













Download Headers and Simulation files.

Post a Comment

  1. Where do i connect the relay?
    Does the code above need any modification?
    Thanks

    ReplyDelete

 
Top