11:18:48 AM NPT Arduino, Robotics & IoT tutorials for Nepal
Beginner

RFID Attendance System with Arduino and a Web Dashboard (CSIT Project Guide)

Plan an RFID attendance system with Arduino, RC522, PHP/MySQL or Node.js: wiring, modules, ER diagram, algorithm notes and viva tips.

On this page
RFID Attendance System with Arduino and a Web Dashboard (CSIT Project Guide)

An RFID attendance system is one of the most chosen BSc CSIT and BE Computer projects, which is both good and bad. It is good because the idea is clear and the scope is manageable. It is bad because examiners have seen many of them, so a plain "scan card, save name" version does not impress. This guide shows how to build a working version and how to add enough depth to make it yours.

The system has three layers: a card reader (hardware), a small API (backend) and a dashboard (web). We outline each one, give the wiring and the Arduino code, and then cover the database design and the logic you can explain in your viva.

System overview

  1. A student taps an RFID card on the reader.
  2. The Arduino reads the card's unique ID (UID) and sends it to the computer or server.
  3. The server checks the UID, finds the student, decides if it is a valid attendance event, and stores it.
  4. A web dashboard shows today's attendance, per-student history and reports.

You can connect the Arduino to the server in two ways:

Scroll sideways to see all columns.

Option How Good for
USB serial bridge Arduino prints the UID, a small Python or Node script on the PC reads the serial port and calls the web API Simple demos, no Wi-Fi needed
ESP32 or ESP8266 over Wi-Fi The microcontroller sends an HTTP request directly to the API A more complete and impressive IoT version

This article wires an Arduino Uno with a USB bridge. The same RC522 wiring and API work with an ESP32 if you change the board pins.

What you need

Scroll sideways to see all columns.

Item Qty Notes
Arduino Uno 1
RC522 RFID reader module 1 13.56 MHz, SPI interface
RFID cards or key tags (MIFARE 1K) several Usually included with the module
Passive piezo sounder 1 Rated for 5 V logic drive; used with tone()
LEDs (green, red) and 220 Ω resistors 1 each Optional feedback
SPI-capable logic level shifter 1 Four channels from Uno to RC522 and one from RC522 to Uno; share ground
Jumper wires, breadboard 1 set
A computer running PHP + MySQL (XAMPP or similar) or Node.js 1 Backend and dashboard

Connection table

Important: the RC522 runs on 3.3 V. Powering the module from 5 V can damage it. Its data pins are designed for 3.3 V logic as well, so use an SPI-capable level shifter on SCK, MOSI, SDA/SS and RST from the Uno and a reverse-direction channel on MISO as shown below.

Scroll sideways to see all columns.

RC522 pin Arduino Uno pin
3.3V 3.3V
GND GND
RST D9 through a 5 V to 3.3 V logic shifter
SDA (SS) D10 through the logic shifter
MOSI D11 through the logic shifter
MISO D12 through the 3.3 V to 5 V channel
SCK D13 through the logic shifter
IRQ Not connected
Piezo + / − D8 / GND
Green LED D6 through 220 Ω, cathode to GND
Red LED D7 through 220 Ω, cathode to GND

Arduino code

sketch-1.inoDownload code
// RFID reader: prints card UID over serial - not compiled yet
#include <SPI.h>
#include <MFRC522.h>

const int SS_PIN = 10, RST_PIN = 9;
const int BUZZER = 8, LED_OK = 6, LED_ERR = 7;

MFRC522 rfid(SS_PIN, RST_PIN);
String lastUid = "";
unsigned long lastScan = 0;

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();
  pinMode(BUZZER, OUTPUT);
  pinMode(LED_OK, OUTPUT);
  pinMode(LED_ERR, OUTPUT);
}

void loop() {
  // Read the reply from the PC: "OK" or "ERR"
  if (Serial.available()) {
    String reply = Serial.readStringUntil('\n');
    reply.trim();
    if (reply == "OK") { digitalWrite(LED_OK, HIGH); tone(BUZZER, 2000, 150); delay(300); digitalWrite(LED_OK, LOW); }
    else if (reply == "ERR") { digitalWrite(LED_ERR, HIGH); tone(BUZZER, 400, 400); delay(500); digitalWrite(LED_ERR, LOW); }
  }

  if (!rfid.PICC_IsNewCardPresent() || !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();

  // Ignore the same card read again within 2 seconds
  if (uid != lastUid || millis() - lastScan > 2000) {
    Serial.println(uid);
    lastUid = uid;
    lastScan = millis();
  }
  rfid.PICC_HaltA();
  rfid.PCD_StopCrypto1();
}

A tiny PC script reads each UID line from the serial port, sends it to your API as POST /api/scan and writes "OK" or "ERR" back to the Arduino. Python with the pyserial and requests packages is the quickest way. With an ESP32, you replace this script with an HTTP request in the sketch.

Backend outline (PHP/MySQL or Node.js)

Whichever stack you choose, keep the structure the same. The serial bridge reads a newline-terminated UID at 9600 baud, sends it to the API and replies to the Uno with OK\n or ERR\n.

Scroll sideways to see all columns.

Endpoint Purpose
POST /api/scan Receives a UID, validates it, records attendance
GET /api/attendance?date= Returns attendance for a day
GET /api/students/:id/history One student's records
POST /api/students Register a student and link a card
POST /api/login Teacher or admin login

Use prepared statements for every query to prevent SQL injection, store admin passwords with a proper hash (password_hash in PHP, bcrypt in Node), and protect the dashboard routes with a session or token. Do not trust the UID alone for anything high-risk (see limitations below).

Modules

  1. Hardware and firmware: reader, UID read, feedback, debounce.
  2. Student and card management: register a student, assign a card, deactivate a lost card.
  3. Course and class management: subjects, sections, class schedule.
  4. Attendance engine: validates scans and records them (see algorithm).
  5. Dashboard: today view, filters by class and date.
  6. Reports: per-student percentage, low-attendance list, export to CSV.
  7. Admin and authentication: teacher and admin roles.
  8. Notifications (optional): email or SMS for low attendance.

Database design (ER diagram description)

Draw these entities with primary keys (PK) and foreign keys (FK):

Scroll sideways to see all columns.

Entity Main attributes Relationships
students id (PK), roll_no, name, section_id (FK), card_uid (unique), active belongs to one section; has many attendance records
sections id (PK), name, semester has many students and classes
courses id (PK), code, name has many classes
classes id (PK), course_id (FK), section_id (FK), teacher_id (FK), weekday, start_time, end_time has many attendance records
teachers id (PK), name, email, password_hash, role teaches many classes
attendance id (PK), student_id (FK), class_id (FK), scanned_at, status links student and class on a date
scan_log id (PK), card_uid, scanned_at, result raw log of every scan, including unknown cards

Relationships to state in your diagram: section 1-to-many students; course 1-to-many classes; student many-to-many classes through attendance; teacher 1-to-many classes. Add a unique key on (student_id, class_id, date) so a student cannot be marked twice for the same class.

Algorithm notes (what to explain in your viva)

Scan validation flow. On each scan: (1) look up the UID in students; unknown UID goes to scan_log with result "unknown"; (2) find the class running now for that student's section by comparing the current time to start_time and end_time; (3) if there is no class, reject; (4) if the student is already marked for this class today, reject as duplicate; (5) mark "present" if within the first N minutes, otherwise "late"; (6) write the record and return OK.

Duplicate prevention. Two layers: the Arduino ignores the same card within 2 seconds, and the database unique key stops duplicates even if the device misbehaves.

Attendance percentage. present_classes / total_classes_held x 100. Explain how you count "total classes held" (from the class schedule or from the days with at least one scan).

Time window logic. A window of start_time minus 10 minutes to end_time is a simple rule you can defend. Do not claim any official rule: ask your department what attendance requirement to show.

Limitations to mention honestly

  • A card UID can be copied, so one student can scan for a friend. Mitigation ideas: add a camera snapshot at scan time, a PIN, or a second factor.
  • RC522 range is only a few centimetres.
  • A lost card must be deactivated quickly.
  • Student data is personal data, so say how you store it safely.

Make it stand out

  • Add a face snapshot from a webcam at each scan and store it as evidence.
  • Add a "low attendance" alert by email.
  • Use an ESP32 and Wi-Fi so no PC bridge is needed.
  • Build a mobile-friendly dashboard with charts of weekly attendance.

FAQ

Can I use an ESP32 instead of an Arduino Uno?

Yes, and it is a good upgrade. The ESP32 also runs on 3.3 V logic, which matches the RC522 perfectly, and it can call your API over Wi-Fi.

Is PHP or Node better for this project?

Either is fine. Choose the one your team already knows, and keep the API design the same.

How many students can it handle?

The reader handles one card at a time, so a queue forms at class start. For a large class, use two readers or a short grace period.

Is the card UID secure?

No. It is an identifier, not a password. Mention this in your report and propose a mitigation.

Related tutorials

See all BSc CSIT Projects →