RFID Card Reading Experiment

Objective

This experiment demonstrates how to use an RFID reader to read RFID tags and cards.

Components Required

Working Principle

The RFID reader emits a radio frequency signal that is used to read data from an RFID card. The card responds with its unique ID, which can be read by the Arduino.

Circuit Diagram

RFID Circuit Diagram

Code

/*
 * RFID Card Reading Experiment
 * This code reads the unique ID from an RFID card.
 */

#include 
#include 

#define SS_PIN 10
#define RST_PIN 9

MFRC522 mfrc522(SS_PIN, RST_PIN);  // Create MFRC522 instance

void setup() {
  Serial.begin(9600);  // Initialize serial communication
  SPI.begin();  // Initialize SPI bus
  mfrc522.PCD_Init();  // Initialize RFID reader
}

void loop() {
  if (mfrc522.PICC_IsNewCardPresent()) {
    if (mfrc522.PICC_ReadCardSerial()) {
      Serial.print("Card UID: ");
      for (byte i = 0; i < mfrc522.uid.size; i++) {
        Serial.print(mfrc522.uid.uidByte[i], HEX);
        Serial.print(" ");
      }
      Serial.println();
    }
  }
}
            

Results

The serial monitor will display the unique ID of the scanned RFID card.

Applications