This project can be improved using the LM35 temperature sensor in this time of pandemic, where along with the identity, even temperature plays an important factor to let the person in the premises or not.
1) main_prg.c
// RFID BASED SECURITY SYSTEM
#include<reg51.h>
#include"lcd.h"
#include"rfid.h"
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
/*
Few RFID passive cards
EM-18 Card reader
LCD
Motor for door
*/
#define psw1 "1234567" // used actual identification numbers for hardware simulation 12 byte
#define psw2 "abcdefg"
#define psw3 "pqrstuv"
// Motor pins
sbit v=P1^0;
sbit r=P1^1;
void open()
{
v=1;
r=0;
}
void close()
{
v=0;
r=1;
}
void allow(char * name)
{
delay(1000);
lcd_cmd(0X90);
lcd_disp("Welcome ");
lcd_cmd(0X98);
lcd_disp(name);
lcd_disp("!");
lcd_cmd(0XD0);
lcd_disp("Please Step In");
open();
delay(5000);
close();
delay(5000);
}
void main()
{
int i=0,count=0;
char str[8];
v=0,r=0;
rf_init();
lcd_init();
lcd_disp("PLACE CARD");
lcd_cmd(0XC0);
lcd_disp("OVER READER");
for(;psw1[i]!='\0';i++);
while(count<i) str[count++]=rf_rx();
display_str("Input received...");
rf_tx('\n');
rf_tx('\r');
if(strcmp(psw1,str)==0)
{
allow("abc");
}
else if(strcmp(psw2,str)==0)
{
allow("XYZ");
}
else if(strcmp(psw3,str)==0)
{
allow("Mno");
}
else
{
delay(1000);
lcd_cmd(0X90);
lcd_disp("Wrong password");
delay(5000);
}
}
On Hardware
3 cards : Authorized
1 card : Unauthorized
No comments:
Post a Comment