Skip to main content

RFID based attendance system




  • Aim: To take attendance using passive RFID tags.
  • Code:
#define F_CPU 8000000UL
#define BAUD RATE 9600
#include<avr/io.h>
#include<util/delay.h>
#include<avr/io.h>
#include<util/delay.h>
void initialize();
void lcd_cmd(char value);
void lcd_data(char value);
void lcd_string(char *str);
void lcd_num(unsigned int number);
void usart_init();
void usart_transmit(char x);
char usart_recieve();
void initialize()
{
lcd_cmd(0x01); //clear LCD
lcd_cmd(0x02);    //home position
lcd_cmd(0x06);    //L-R
//lcd_cmd(0x04);
lcd_cmd(0x28); //4 bit mode
lcd_cmd(0x0C);    //character generation
}

void lcd_cmd(char value)
{
int un,ln; // pc7-pc4 = un ; pc3-pc4 =ln
un=value&0xF0; // & is anding function
PORTC=0x04|un;
_delay_ms(2);
PORTC=0x00|un;
_delay_ms(2);
ln=(value<<4)&0xF0; //<<=left shif by 4 bits
_delay_ms(2);
PORTC=0x04|ln;
_delay_ms(2);
PORTC=0x00|ln;
}

void lcd_data(char value)
{
int un,ln; // pc7-pc4 = un ; pc3-pc4 =ln
un=value&0xF0; // & is anding function
PORTC=0x05|un;
_delay_ms(2);
PORTC=0x01|un;
_delay_ms(2);
ln=(value<<4)&0xF0; //<<=left shif by 4 bits
_delay_ms(2);
PORTC=0x05|ln;
_delay_ms(2);
PORTC=0x01|ln;
}

void lcd_string(char *str)
{
int i=0;
while(str[i]!='\0')
{
lcd_data(str[i]);
i++;
}
}



void lcd_num(unsigned int number)
{
lcd_cmd(0x04);
int d=0;
if(number>0){
while(number!=0)
{
d=number%10;
lcd_data(d+48);
number=number/10;
}}
else lcd_string("0");
}

void usart_init();
void usart_transmit(char x);
char usart_recieve();


void usart_init(){
UBRRH=0;
UBRRL=51; // or 0x33
UCSRB=0x18;
UCSRC=0x86;
}

void usart_transmit(char x){
while((UCSRA&0x20)==0);
UDR=x; //data gets stored in UDR

}

char usart_recieve(){
while((UCSRA&0x80)==0);//Till it gets overflow
return UDR;
}
char a[11];
void check(){
int i=0;
lcd_cmd(0x01);
for(i=0;i<12;i++){
a[i]=usart_recieve();
}
i=0;
}


int main()
{
DDRC=0xFF;
initialize();
_delay_ms(2);
usart_init();
_delay_ms(2);

check();
int i=0;

while(i<12){


if(a[0]=='1' && a[1]=='8' && a[2]=='0' && a[3]=='0' && a[4]=='3' && a[5]=='D' && a[6]=='A' && a[7]=='C' && a[8]=='D' && a[9]=='4' && a[10]=='5' && a[11]=='D')
{
lcd_cmd(0x01);
lcd_cmd(0x80);
lcd_string("Vishal Present");
_delay_ms(1000);
i=0;
check();
i=0;
}

else if(a[0]=='0' && a[1]=='D' && a[2]=='0' && a[3]=='0' && a[4]=='7' && a[5]=='7' && a[6]=='0' && a[7]=='9' && a[8]=='9' && a[9]=='B' && a[10]=='E' && a[11]=='8')
{
lcd_cmd(0x01);
lcd_cmd(0x80);
lcd_string("Vishnu Present");
_delay_ms(1000);
i=0;
check();
i=0;
}
 else{
 i=0;
check();

lcd_cmd(0xC0);
lcd_string("NOT VALID");
_delay_ms(100);
i=0;
 }
i++;
}
}


  • Hardware information: 
Module used to read RFID tag code: EM 18 module
  • EM18 Module






  •  Additional Information
1)Passive RFID tags have a distance limit of nearly 10 cm.
2)Active RFID tags have much larger range but they need an external power supply.
3) Its applications are :
a) can be used in supermarkets for shopping which will eliminate counters and time wasted there.
b) Can be used in toll gates for instant payment and save us some time.
c) Can be used in security systems.
Note: However, one major issue is that RFID tags are easy to hack and may be that's why these are not used in security systems. So maybe in future with more advanced RFID tags this would be possible.
  • Conclusion: 
RFID based attendance system has been created using C programming in Avr studio software.

Comments

Popular posts from this blog

Python Ping Pong Game

Game: Ping Pong Libraries used: 1) pygame  2) Math 3) Random Version: Python 3.7 Python Code: -------------------------------------------------------------------------------------------------------------------------- import pygame import math import random pygame.init() dis=pygame.display.set_mode((600,400)) gameover=False white=(255,255,255) black=(0,0,0) red=(255,0,0) blue=(0,0,255) col=(0,255,0) x1=575 y1=200 dx1=0 dy1=0 x2=25 y2=185 dx2=1 dy2=0 c=0 t=0 font_style = pygame.font.SysFont(None, 50) def message(msg,color):     mesg = font_style.render(msg, True, color)     dis.blit(mesg, [300, 200]) font_style1 = pygame.font.SysFont(None, 30)    def show(msg,color):     mesg = font_style1.render(msg, True, color)     dis.blit(mesg, [300, 10])    clock=pygame.time.Clock() while not gameover:     for event in pygame.event.get():       ...

The Projectile Motion

GRAVITY This is a projectile motion simulator. It takes velocity and angle as input and gives an animated projectile motion with time of flight and range Time of flight: seconds Max height: meters Select option: Velocity(m/s): Angle: degrees Action

Lighting of a marriage garden

Aim: To design a basic lighting system for a standard marriage garden. Software: Autodesk Revit 2019 Plan of the Garden: Entrance: Stage: Food Area: 3D View of Stage: