Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO RFID Reader with RC522 Module

View and Edit Project In Cirkit DesignerImage of Arduino UNO RFID Reader with RC522 Module

RFID Reader Circuit Documentation

Summary

This document describes a circuit designed to interface an Arduino UNO with an RFID-RC522 module. The purpose of the circuit is to read RFID tags and output their unique identifiers (UIDs) to the serial monitor. The Arduino UNO acts as the central processing unit, controlling the RFID-RC522 module via the SPI (Serial Peripheral Interface) bus. The provided code initializes the RFID module and continuously polls for the presence of RFID tags. When a tag is detected, its UID is printed to the serial monitor.

Component List

Arduino UNO

RFID-RC522 Module

Wiring Details

Arduino UNO

RFID-RC522 Module

Documented Code

/*
 * This Arduino Sketch interfaces with an RFID-RC522 module using an Arduino UNO.
 * It initializes the RFID module and continuously checks for RFID tags.
 * When a tag is detected, its UID is printed to the serial monitor.
 */

#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN 9 // Configured to pin D9
#define SS_PIN 10 // Configured to pin D10

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

void setup() {
  Serial.begin(9600); // Initialize serial communications
  SPI.begin(); // Initialize SPI bus
  rfid.PCD_Init(); // Initialize RFID reader
  Serial.println("Scan an RFID tag...");
}

void loop() {
  // Look for new cards
  if (!rfid.PICC_IsNewCardPresent()) {
    return;
  }
  // Select one of the cards
  if (!rfid.PICC_ReadCardSerial()) {
    return;
  }
  // Print UID of the card
  Serial.print("UID tag: ");
  for (byte i = 0; i < rfid.uid.size; i++) {
    Serial.print(rfid.uid.uidByte[i] < 0x10 ? " 0" : " ");
    Serial.print(rfid.uid.uidByte[i], HEX);
  }
  Serial.println();
  // Halt PICC
  rfid.PICC_HaltA();
  // Stop encryption on PCD
  rfid.PCD_StopCrypto1();
}

This code is written for the Arduino platform and is intended to be uploaded to the Arduino UNO microcontroller. It includes the necessary libraries for interfacing with the RFID-RC522 module and contains the main logic for initializing the RFID reader, detecting RFID tags, and printing their UIDs to the serial monitor.