Attendance System using RFID

Arduino Arduino RFID Projects

The most common thing that we observe in every office, school, college or any industry is the attendance system. The need of a state of the art and cheap attend yet reliable attendance system is always. In this post we will talk about building an RFID based attendance system. The count of attendance will be done as the number of RFID cards scanned on this system.

The entire system can be explained into three different sections. The first is the reader section that is required to take input via RFID card or tag. The second section is the actual control section and the third section is basically the driver section that is used to open up gate and buzzer.

The below mentioned block diagram is used to explain the structure and working of the entire system.

Equipment

Equipment used for this system is mentioned below.

  • RFID Reader and RFID Cards or tags
  • 8051 Microcontroller
  • 16×2 LCD Display
  • DC Motor L293D
  • Buzzer using BC547 NPN transistor

The RFID reader section has the ability of read RFID cards as an input to the system. The input data is read in serial format in RFID machine readers and these readers have a very limited range.  It takes 12 digits character code as a tag in which 2 digits are also used as error code.

We are using 8051 microcontroller that acts as the brain of this project. 8051 is used to receive RFID data from the input and sending the signal or status to LCD to display the input. The motor driver is used for opening gate and buzzer with a transistor for indications.

 

Code

 

/***********************************************************************
At the start we are including headers and defining the variables that will be used later
***********************************************************************/

#include
#include
#include
#define lcdport P1

sbit rs=P1^0;
sbit rw=P1^1;
sbit en=P1^2;
sbit m1=P2^4;
sbit m2=P2^5;
sbit buzzer=P2^6;
char i,rx_data[50];
char rfid[13],ch=0;
int count1, count2, count3;
unsigned char result[1];

/***********************************************************************
this is a simple delay function that becomes very handy later
***********************************************************************/

void delay(int itime)
{
int i,j;
for(i=0;i<itime;i++)
for(j=0;j<1275;j++);
}

void daten()
{
rs=1;
rw=0;
en=1;
delay(5);
en=0;
}

void lcddata(unsigned char ch)
{
lcdport=ch & 0xf0;
daten();
lcdport=(ch<<4) & 0xf0;
daten();
}

void cmden(void)
{
rs=0;
en=1;
delay(5);
en=0;
}

void lcdcmd(unsigned char ch)
{
lcdport=ch & 0xf0;
cmden();
lcdport=(ch<<4) & 0xf0;
cmden();
}

void lcdstring(char *str)
{
while(*str)
{
lcddata(*str);
str++;
}
}

void lcd_init(void)
{
lcdcmd(0x02);
lcdcmd(0x28);
lcdcmd(0x0e);
lcdcmd(0x01);
}

/***********************************************************************
Here we have some function that we have used in our program. In this we have configured 9600bps baud rate at 11.0592MHz Crystal Frequency. We are monitoring the SBUF register for receiving data.
The below mentioned function is used for the configuration of 9600bps baud rate at 11.0592MHz Crystal Frequency. SBUG registers are used receiving data.
***********************************************************************/

void uart_init()
{
TMOD=0x20;
SCON=0x50;
TH1=0xfd;
TR1=1;
}
char rxdata()
{
while(!RI);
ch=SBUF;
RI=0;
return ch;
}

void main()
{
buzzer=1;
uart_init();
lcd_init();
lcdstring(” RFID Based “);
lcdcmd(0xc0);
lcdstring(“Attendance Systm”);
delay(400);
while(1)
{
lcdcmd(1);
lcdstring(“Place Your Card:”);
lcdcmd(0xc0);
i=0;
for(i=0;i<12;i++)
rfid[i]=rxdata();
rfid[i]=’′;
lcdcmd(1);
lcdstring(“Your ID No. is:”);
lcdcmd(0xc0);
for(i=0;i<12;i++)
lcddata(rfid[i]);
delay(100);
if(strncmp(rfid,”160066A5EC39″,12)==0)
{
count1++;
lcdcmd(1);
lcdstring(” Attendance “);
lcdcmd(0xc0);
lcdstring(” Registered”);
delay(200);
lcdcmd(1);
lcdstring(” Student1 “);
lcdcmd(0xc0);
lcdstring(“Attnd. No.: “);
sprintf(result, “%d”, count1);
lcdstring(result);

m1=1;
m2=0;
delay(300);
m1=0;
m2=0;
delay(200);
m1=0;
m2=1;
delay(300);
m1=0;
m2=0;
}

else if(strncmp(rfid,”160066BD7AB7″,12)==0)
{
count2++;
lcdcmd(1);
lcdstring(” Attendance “);
lcdcmd(0xc0);
lcdstring(” Registered”);
delay(200);
lcdcmd(1);
lcdstring(” Student2 “);
lcdcmd(0xc0);
lcdstring(“Attnd. No.: “);
sprintf(result, “%d”, count2);
lcdstring(result);

m1=1;
m2=0;
delay(300);
m1=0;
m2=0;
delay(200);
m1=0;
m2=1;
delay(300);
m1=0;
m2=0;
}

else if(strncmp(rfid,”160066203060″,12)==0)
{
count3++;
lcdcmd(1);
lcdstring(” Attendance “);
lcdcmd(0xc0);
lcdstring(” Registered”);
delay(200);
lcdcmd(1);
lcdstring(” Student3 “);
lcdcmd(0xc0);
lcdstring(“Attnd. No.: “);
sprintf(result, “%d”, count3);
lcdstring(result);

m1=1;
m2=0;
delay(300);
m1=0;
m2=0;
delay(200);
m1=0;
m2=1;
delay(300);
m1=0;
m2=0;

}

else
{
lcdcmd(1);
lcdstring(“Invalid Card”);
buzzer=0;
delay(300);
buzzer=1;
}
}
}

RFID Based Attendance System

Leave comment for this post......