logologo

HOMEABOUTSERVICESBLOGSBOOKSSHOPCONTACT

+977 9803661701support@nepatronix.orgLokanthali, Bhaktapur

© 2025 NepaTronix all rigths reserved

RFID Attendance System(IoT Projects Arduino)

  Back To Blogs

This project IoT Projects Arduino is designed to create an RFID-based attendance system using an ESP32 microcontroller and an MFRC522 RFID reader. The system reads RFID card UIDs, compares them with predefined UIDs to identify users, and displays the results on a LiquidCrystal_I2C LCD screen. If the scanned card UID matches the predefined UID, a "Welcome" message is shown; IoT Projects Arduino otherwise, an "Access Denied" message is displayed. This project demonstrates the use of RFID technology for access control and attendance management.IoT Projects Arduino

Project : 50


Introduction

This project IoT Projects Arduino is designed to create an RFID-based attendance system using an ESP32 microcontroller and an MFRC522 RFID reader. The system reads RFID card UIDs, compares them with predefined UIDs to identify users, and displays the results on a LiquidCrystal_I2C LCD screen. If the scanned card UID matches the predefined UID, a "Welcome" message is shown; otherwise, an "Access Denied" message is displayed. This project demonstrates the use of RFID technology for access control and attendance management.


Components Required

  1. ESP32 Microcontroller:   The central unit that processes RFID card data and controls the LCD display.
  2. MFRC522 RFID Reader: Detects and reads RFID card UIDs.        
  3.  LiquidCrystal_I2C Display: For displaying user access status and other messages.  
  4.         
  5. Connecting Wires: For connecting the RFID reader and LCD to the ESP32. 
  6.  Power Supply: To power the ESP32 and other connected components.     
  7.                  

Pin Configuration:

 

  • RFID Reader Pins:
    • SDA (SS): Connected to GPIO 27 of the ESP32.
    • RST: Connected to GPIO 5 of the ESP32.

 

LCD Pins: Connected via I2C (SDA and SCL pins on ESP32).



Libraries Used

  1. MFRC522: For interfacing with the RFID reader.
  2. Wire: For I2C communication with the LCD.
  3. LiquidCrystal_I2C: For interfacing with the LCD display.

 

 

PCB (Printed Circuit Board) DIAGRAM:



SCHEMATIC DIAGRAM



Code

#include <Wire.h>               // Library for I2C communication

#include <LiquidCrystal_I2C.h>    // Library for LCD display via I2C

#include <SPI.h>               // Library for SPI communication

#include <MFRC522.h>           // Library for RFID reader

 

#define SS_PIN 27              // Pin for Slave Select (SS) of RFID reader

#define RST_PIN 5              // Pin for Reset (RST) of RFID reader

 

MFRC522 rfid (SS_PIN, RST_PIN); // Create an MFRC522 object with SS and RST pins

 

LiquidCrystal_I2C lcd (0x27, 16, 2); // Create an LCD object with I2C address 0x27 and 16x2 display

 

// Predefined UID for comparison (set this to the UID you want to match)

const byte predefined [] = {0x83, 0xC8, 0xFA, 0xFA}; // Example UID, adjust to your actual UID

 

void setup () {

  Serial.begin(115200); // Initialize serial communication at 115200 baud rate

  SPI.begin();        // Initialize SPI communication

  lcd.init();           // Initialize the LCD

  lcd. backlight ();              // Turn on the LCD backlight

 

  // Display initial welcome message on LCD

  lcd. setCursor (2, 0); 

  lcd.print("Attendance");

  delay (1000);    // Wait for 1 second

 

  lcd. setCursor (1, 1); 

  lcd.print("System"); 

  delay (4000);         

 

  lcd. clear ();       // Clear the LCD display

  lcd. setCursor (0, 0);

  lcd.print("Please"); 

  lcd. setCursor (0, 1);

  lcd.print ("Scan card");

 

  rfid.PCD_Init ();               // Initialize the RFID reader

  Serial.println("Scan RFID card");

}

 

void loop () {

  // Check if a new RFID card is present

  if (! rfid. PICC_IsNewCardPresent ()) {

    return; // Exit if no new card is detected

  }

 

  // Try to read the UID from the detected card

  if (! rfid. PICC_ReadCardSerial ()) {

    return; // Exit if reading the UID fails

  }

 

  lcd. clear ();         

 

  Serial.print("Card UID: ");

  byte scannedUID[rfid.uid.size]; // Array to store the scanned UID bytes

 

  // Read the UID bytes from the RFID card

  for (byte i = 0; i < rfid.uid.size; i++) {

    scannedUID[i] = rfid.uid.uidByte[i]; // Store each byte of UID

    Serial.print(rfid.uid.uidByte[i], HEX); // Print each byte in hexadecimal format

    Serial.print(" ");

  }

  Serial.println();

 

  // Compare the scanned UID with the predefined UID

  bool match = true; // Flag to indicate if UIDs match

  if (rfid.uid.size == sizeof(predefinedUID)) { // Check if the size of UID matches

    for (byte i = 0; i < rfid.uid.size; i++) {

      if (scannedUID[i] != predefinedUID[i]) { // Compare each byte

        match = false; // Set flag to false if any byte does not match

        break; // Exit the loop if mismatch is found

      }

    }

  } else {

    match = false;

  }

 

  // Display result based on UID comparison

  lcd.setCursor(0, 0);

  if (match) {        

    lcd.print("Welcome");

    lcd.setCursor(0, 1); 

    lcd.print("Nepatronix");

    Serial.println("Registered");

  } else {             

    lcd.print("Access Denied");

    Serial.println("Access Denied");

  }

 

  delay(4000);

 

  lcd.clear();      

  lcd.setCursor(0, 0); 

  lcd.print("Please");

  lcd.setCursor(0, 1);

  lcd.print("Scan card");

 

  rfid.PICC_HaltA();  

  rfid.PCD_StopCrypto1(); // Stop encryption on the RFID reader

}

Working of IoT Projects Arduino

  1. Initialization:
    • Serial Communication: The ESP32 initializes serial communication at 115200 baud rate.
    • LCD Initialization: I2C communication is set up for the LCD, and an initial message is displayed.
    • RFID Reader Initialization: The RFID reader is initialized to start reading cards.
  2. Main Loop:
    • Card Detection: The system continuously checks for the presence of a new RFID card.
    • UID Reading: When a card is detected, its UID is read and displayed on the LCD.
    • UID Comparison: The read UID is compared with a predefined UID. Based on the comparison, a "Welcome" or "Access Denied" message is displayed.
  3. UID Comparison:
    • Byte-by-Byte Comparison: The scanned UID is compared byte-by-byte with the predefined UID.
    • Display Result: If the UID matches, the LCD shows "Welcome"; otherwise, it shows "Access Denied".

 

Testing


  1. Setup: Connect all components according to the pin configuration.
  2. Power Up: Power the ESP32 and ensure all components are properly connected.
  3. RFID Scanning: Scan an RFID card and verify that the UID is correctly read and displayed.
  4. UID Matching: Test with both matching and non-matching RFID cards to ensure that the system correctly identifies registered users and denies access to unregistered ones.
  5. LCD Display: Verify that the correct messages ("Welcome" or "Access Denied") are displayed on the LCD based on the UID comparison.

 

Conclusion

The RFID-Based Attendance System project effectively demonstrates how an ESP32 microcontroller can be used in conjunction with an MFRC522 RFID reader to create a secure access control system. By integrating the RFID reader with an LCD display, this project provides a clear and immediate indication of user access status. The system is suitable for various applications requiring secure identification and access management.


 

Team Members:

·      Nehasha Ale

·      Tasmina Khatri

·      Sujan Saru

·      Utsav Paudyal

·      Ashwin Gautam

·      Trilochan Gaha

College Name: Nepathya College ,Rupandehi ,Nepal


 




Total likes : 7

Comments







Read More Blogs!

Obstacle Avoiding Robot(Robotics Project)

The Line Following Robot is a simple autonomous robot that follows a predefined path marked by a contrasting line on the ground. It utilizes infrared sensors to detect the line and adjust its movement accordingly. This project demonstrates the basic principles of robotics, including sensor integration, decision-making, and motor control.


1.7k04

Capacitor Charge/Discharge(STEAM Education)

To understand the charging and discharging process of capacitors and their storage behavior in electronic circuits.


1.6k05

TEMPERATURE HUMIDITY READER ON MOBILE (IoT Project)

The Temperature Humidity Reader project utilizes an ESP32 microcontroller in conjunction with a DHT11 sensor to monitor temperature and humidity levels. The collected data is displayed on an LCD and transmitted to a mobile application using the Blynk platform. This project provides an efficient way to remotely monitor environmental conditions in real time, making it useful for applications such as home automation, weather stations, and greenhouse monitoring.


2.1k03

Research on Web-Based Smoke and Gas Detection System

This project presents a Smoke and Gas Detection System designed primarily for household applications but also suitable for industrial use. Utilizing an ESP32 microcontroller along with MQ-135 and MQ-3 sensors, the system effectively detects harmful gases and Smokes. Data from the sensors is transmitted to a web-based interface via the ThingSpeak platform, enabling real-time monitoring and alerts. The integration of a buzzer provides immediate audio notifications in the event of a detected hazard. This project aims to enhance safety by providing an efficient, reliable solution for early detection of Smoke and gas leaks, ultimately minimizing risks to life and property. By exploring various applications of the components used, this report further emphasizes the versatility and potential of IoT technology in safety systems.


1.5k00