RFID Based Attendance System construction with code examples

RFID Based Attendance System building

In this RFID based Attendance System venture, we will clarify you how might we check participation consequently by utilizing RFID cards. RFID Technology is normally utilized in schools, universities, office and stations for different purposes to naturally monitor individuals. Here we will tally the participation of an approved individual by utilizing RFID.

We can separate the total participation framework into various areas: peruser segment, control segment, driver segment and show segment. Job of each area is appeared in the underneath square outline:

RFID card square

Peruser Section

This area contains a RFID, which is a gadgets gadget which has two sections - one is RFID Reader and other is RFID tag or Card. In this point when we put RFID tag close to the RFID peruser, it peruses label information sequentially. RFID tag has 12 digit character code in a loop. This RFID is functoning at baud pace of 9600 bps. RFID utilizes electromagnet to move information from peruser to tag or tag to peruser.

Control Section:

8051 microcontroller is used for managing the total procedure of this venture. Here by utilizing 8051 we are getting RFID information along with sending status otherwise messages to Liquid Crystal Display.

Show segment:

A 16x2 Liquid Crystal Display is utilized in this undertaking for showing messages on it.

Driver segment:

This segment has an engine driver L293D for opening door and a bell with a BC547 NPN transistor for signs.

Working

In this point when an individual put their RFID tag to RFID peruser then RFID peruses label's information and send it to 8051 microcontroller and afterward microcontroller contrasts this information and characterized information or data. In case information is coordinated with characterized information, at that point microcontroller increase the participation by one of the label's individual and whenever coordinated isn't happened then microcontroller shows invalid card on LCD and ringer is signaling constantly for quite a while.

Circuit chart for RFID bassed

Circuit chart for RFID bassed participation framework venture is appeared previously. In the circuit, LCD is associated in four piece mode with 8051 microcontroller. LCD's RS, RW along with EN pins are straightforwardly associated at PORT 1 pin number P1.0, P1.1 along with P1.2. D4, D5, D6 and D7 pins of LCD are legitimately associated at pin P1.4, P1.5, P1.6 and P1.7 of port 1. Engine driver is associated at PORT pin number P2.4 and P2.5. also, signal is associated at P2.6 at PORT2. [Also check: LCD Interfacing with 8051 Microcontroller]

Program Explanation

To program for RFID based attedance framework, we first need to incorporate header documents and characterizes information and yield pin and factors.

#include<reg51.h>
#include<string.h>
#include<stdio.h>
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;

After this we have to make a capacity for delay.

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

At that point we make some capacity for LCD and instate lcd fuction,

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

 Here we have some capacity that we have utilized in our program. In this we have designed 9600bps baud rate at 11.0592MHz Crystal Frequency. We are checking the SBUF register for accepting information.

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

After this in principle program, we have instated lcd and UART and afterward we peruses the yield of RFID when any one tag on it. We stores this string in a cluster and afterward coordinate with predefined exhibit information.

lcdcmd(1);
lcdstring("Place Your Card:");
lcdcmd(0xc0);
i=0;
for(i=0;i<12;i++)
   rfid[i]=rxdata();
rfid[i]='\0';
lcdcmd(1);

In the event that coordinate occurrs, at that point controller builds the participation by one. Else signal bell runs consistently and LCD shows invalid card.

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);

PCB Layout

Here is the PCB design for RFID based Attendance System:

 

PCB design for RFID based Attendance System

Code

#include<reg51.h>
#include<string.h>
#include<stdio.h>
#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];
 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);
}
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]='\0';
        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;
        }
  }
}

 

Вас заинтересует / Intresting for you:

What Is JSON?
What Is JSON? 362 views oracle10 Fri, 12 Jul 2019, 13:31:08
How to create applications tha...
How to create applications tha... 301 views bora Fri, 12 Jul 2019, 07:33:48
Edge Avoiding Robot Using 8051...
Edge Avoiding Robot Using 8051... 165 views Валерий Павлюков Tue, 08 Sep 2020, 06:55:57