Smart RFID Attendance System
Contactless Microcontroller-Based Logging & Real-Time Auth Verification
This automated, contactless tracking setup replaces manual attendance registers using high-frequency Radio Frequency Identification (RFID) technology. Powered by an Arduino Uno, the system utilizes an RC522 RFID reader module to scan cards/tags, cross-references scanned UIDs against database structures, and fires output signals (welcome status, green LED, buzzer beep) for registered users while displaying explicit Access Denied alerts for unauthorized credentials.
Prepare the following core hardware elements to assemble the contactless logging system:
| Target Component Label | Structural Allocation Quantity | Functional Deployment Purpose |
|---|---|---|
| Arduino Uno R3 | 1 Unit | Primary system processor driving the main poll loop, parsing RFID inputs, and writing I2C/SPI commands. |
| MFRC522 RFID Module | 1 Unit | Inductive transceiver reading 13.56 MHz cards and passive key fobs. |
| 16x2 LCD with I2C Backplane | 1 Unit | Outputs state indicators, dynamic user greetings, and scanning alerts. |
| Active Buzzer & LED Set | 1 Set | Acoustic-visual indicators: Green LED/tone for success, Red LED/long tone for invalid attempts. |
| 220Ω Resistors | 2 Units | Limits terminal current to safeguard status LEDs. |
Wire the modules to your microboard exactly according to the pin assignment mappings specified below:
| Device Terminal Pin Out | Arduino Target Pin Mapping | Functional Context |
|---|---|---|
| RC522 VCC | Power Pin 3.3V Only | Power supply constraint (DO NOT connect to 5V) |
| RC522 SDA (SS) | Digital Output Pin D10 | SPI Chip Select (Slave Select) line |
| RC522 SCK | Digital Output Pin D13 | SPI System Serial Clock line |
| RC522 MOSI | Digital Output Pin D11 | SPI Master Out Slave In line |
| RC522 MISO | Digital Input Pin D12 | SPI Master In Slave Out line |
| RC522 RST | Digital Output Pin D9 | SPI Hardware Reset line |
| Green LED Anode | Digital Output Pin D6 | Access Granted Visual Indicator |
| Red LED Anode | Digital Output Pin D7 | Access Denied Visual Indicator |
| Buzzer (+) Terminal | Digital Output Pin D8 | Audible Warning output |
| LCD SDA / SCL | Analog Input Pins A4 / A5 | I2C Data and Clock Interface bus |
Load this tracking program directly onto your board. Replace placeholder UIDs (e.g. A1B2C3D4) with your card UIDs obtained from the serial monitor:
#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 rfid(SS_PIN, RST_PIN);
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int greenLED = 6;
const int redLED = 7;
const int buzzer = 8;
// Store last scanned UID to prevent immediate repeat scans
String lastUID = "";
void setup()
{
Serial.begin(9600);
SPI.begin();
rfid.PCD_Init();
lcd.init();
lcd.backlight();
pinMode(greenLED, OUTPUT);
pinMode(redLED, OUTPUT);
pinMode(buzzer, OUTPUT);
lcd.setCursor(0,0);
lcd.print("Smart");
lcd.setCursor(0,1);
lcd.print("Attendance");
delay(2000);
lcd.clear();
lcd.print("Scan Your Card");
Serial.println("RFID Attendance System Ready");
}
void loop()
{
if (!rfid.PICC_IsNewCardPresent())
return;
if (!rfid.PICC_ReadCardSerial())
return;
String uid = "";
for (byte i = 0; i < rfid.uid.size; i++)
{
if (rfid.uid.uidByte[i] < 0x10)
uid += "0";
uid += String(rfid.uid.uidByte[i], HEX);
}
uid.toUpperCase();
Serial.print("UID: ");
Serial.println(uid);
if(uid == lastUID)
{
rfid.PICC_HaltA();
rfid.PCD_StopCrypto1();
return;
}
lastUID = uid;
if(uid == "A1B2C3D4")
{
attendance("Ali");
}
else if(uid == "11223344")
{
attendance("Ahmed");
}
else if(uid == "55667788")
{
attendance("Fatima");
}
else
{
denied();
}
rfid.PICC_HaltA();
rfid.PCD_StopCrypto1();
delay(1500);
lcd.clear();
lcd.print("Scan Your Card");
}
void attendance(String name)
{
digitalWrite(greenLED, HIGH);
tone(buzzer,1000,200);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Welcome");
lcd.setCursor(0,1);
lcd.print(name);
Serial.print(name);
Serial.println(" Attendance Marked");
delay(2000);
digitalWrite(greenLED, LOW);
}
void denied()
{
digitalWrite(redLED, HIGH);
tone(buzzer,400,600);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Access Denied");
Serial.println("Unknown Card");
delay(2000);
digitalWrite(redLED, LOW);
}
MFRC522 and LiquidCrystal_I2C libraries are installed in your Arduino IDE using the Library Manager before flashing the board.

0 Comments