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

How to Use RFID RC522: Examples, Pinouts, and Specs

Image of RFID RC522Design with RFID RC522 in Cirkit Designer

Introduction

The RFID RC522 is a low-cost RFID reader/writer module that operates at a frequency of 13.56 MHz. It is widely used for reading RFID tags and cards, enabling wireless communication in a variety of applications. This module is based on the MFRC522 IC and supports ISO/IEC 14443 Type A cards. Its compact size, low power consumption, and ease of integration make it a popular choice for projects involving access control, inventory management, attendance systems, and identification systems.

Explore Projects Built with RFID RC522

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!

Technical Specifications

Below are the key technical details and pin configuration of the RFID RC522 module:

Key Technical Details

Pin Configuration and Descriptions

The RFID RC522 module has 8 pins, as described in the table below:

Pin Name Description
1 VCC Power supply input (3.3V). Can be connected to 5V with a level shifter.
2 RST Reset pin. Active LOW. Used to reset the module.
3 GND Ground connection.
4 IRQ Interrupt pin. Can be used to signal events (optional).
5 MISO/SCL/TX SPI MISO (Master In Slave Out), I2C clock (SCL), or UART TX (default: SPI MISO).
6 MOSI/SDA/RX SPI MOSI (Master Out Slave In), I2C data (SDA), or UART RX (default: SPI MOSI).
7 SCK SPI clock input.
8 NSS/SDA SPI chip select (NSS) or I2C address select (SDA).

Usage Instructions

How to Use the RFID RC522 in a Circuit

  1. Power the Module: Connect the VCC pin to a 3.3V power source and the GND pin to ground.
  2. Connect to a Microcontroller: Use the SPI interface to connect the module to a microcontroller (e.g., Arduino UNO). The typical connections are:
    • VCC → 3.3V
    • GND → GND
    • RST → Any digital pin (e.g., D9 on Arduino UNO)
    • SCK → D13 (SPI clock)
    • MOSI → D11 (SPI data out)
    • MISO → D12 (SPI data in)
    • NSS → D10 (SPI chip select)
  3. Install Required Libraries: For Arduino, install the "MFRC522" library from the Arduino Library Manager.
  4. Upload Code: Use the example code below to test the module.

Example Code for Arduino UNO

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

// Define pins for the RC522 module
#define RST_PIN 9  // Reset pin connected to D9
#define SS_PIN 10  // Slave Select pin connected to D10

MFRC522 rfid(SS_PIN, RST_PIN); // Create an instance of the MFRC522 class

void setup() {
  Serial.begin(9600); // Initialize serial communication
  SPI.begin();        // Initialize SPI bus
  rfid.PCD_Init();    // Initialize the RC522 module
  Serial.println("Place your RFID card near the reader...");
}

void loop() {
  // Check if a new card is present
  if (!rfid.PICC_IsNewCardPresent()) {
    return; // Exit if no card is detected
  }

  // Check if the card can be read
  if (!rfid.PICC_ReadCardSerial()) {
    return; // Exit if the card cannot be read
  }

  // Print the UID of the card
  Serial.print("Card UID: ");
  for (byte i = 0; i < rfid.uid.size; i++) {
    Serial.print(rfid.uid.uidByte[i], HEX); // Print each byte in hexadecimal
    Serial.print(" ");
  }
  Serial.println();

  // Halt the card to stop communication
  rfid.PICC_HaltA();
}

Important Considerations and Best Practices

Troubleshooting and FAQs

Common Issues and Solutions

  1. Module Not Responding:

    • Check the wiring and ensure all connections are secure.
    • Verify that the module is powered with 3.3V.
    • Ensure the correct SPI pins are used on the microcontroller.
  2. Card Not Detected:

    • Ensure the card is within the reading range (up to 5 cm).
    • Check for interference from nearby metal objects or other RFID devices.
  3. UID Not Displayed:

    • Verify that the MFRC522 library is installed and included in the code.
    • Ensure the card is compatible with the ISO/IEC 14443 Type A standard.

FAQs