Header Ads Widget

Responsive Advertisement

Smart attendance system RFID main

Smart RFID Attendance System

Contactless Microcontroller-Based Logging & Real-Time Auth Verification

📊 Operational Overview & Video Guide System Live Demo

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.

RF Interface Freq
📡 RC522 SPI 13.56 MHz Standard
Dynamic Auth Response
🟢 Green LED (Grant) | 🔴 Red LED (Deny)
🛠️ Structural BOM Requirements Hardware List

Prepare the following core hardware elements to assemble the contactless logging system:

Target Component Label Structural Allocation Quantity Functional Deployment Purpose
Arduino Uno R31 UnitPrimary system processor driving the main poll loop, parsing RFID inputs, and writing I2C/SPI commands.
MFRC522 RFID Module1 UnitInductive transceiver reading 13.56 MHz cards and passive key fobs.
16x2 LCD with I2C Backplane1 UnitOutputs state indicators, dynamic user greetings, and scanning alerts.
Active Buzzer & LED Set1 SetAcoustic-visual indicators: Green LED/tone for success, Red LED/long tone for invalid attempts.
220Ω Resistors2 UnitsLimits terminal current to safeguard status LEDs.
🔌 Device Interface Pin Maps I/O Infrastructure

Wire the modules to your microboard exactly according to the pin assignment mappings specified below:

Interface Wiring Configurations:
Device Terminal Pin OutArduino Target Pin MappingFunctional Context
RC522 VCCPower Pin 3.3V OnlyPower supply constraint (DO NOT connect to 5V)
RC522 SDA (SS)Digital Output Pin D10SPI Chip Select (Slave Select) line
RC522 SCKDigital Output Pin D13SPI System Serial Clock line
RC522 MOSIDigital Output Pin D11SPI Master Out Slave In line
RC522 MISODigital Input Pin D12SPI Master In Slave Out line
RC522 RSTDigital Output Pin D9SPI Hardware Reset line
Green LED AnodeDigital Output Pin D6Access Granted Visual Indicator
Red LED AnodeDigital Output Pin D7Access Denied Visual Indicator
Buzzer (+) TerminalDigital Output Pin D8Audible Warning output
LCD SDA / SCLAnalog Input Pins A4 / A5I2C Data and Clock Interface bus
💻 Optimized Production Code Engine Firmware Source

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);
}
Required Software Dependencies: Please ensure that both MFRC522 and LiquidCrystal_I2C libraries are installed in your Arduino IDE using the Library Manager before flashing the board.

Post a Comment

0 Comments