← All parts

RC522 RFID Reader/Writer

NXP

13.56 MHz RFID reader/writer module built on the NXP MFRC522. Reads and writes MIFARE tags over SPI (also supports I2C/UART on the chip). Runs at 3.3V — do not power from 5V.

In stock

Specifications

0

No specs listed.

Pinout

8
PinNameFunctionsNotes
1SDA
SPI
SPI chip select (NSS)
2SCK
SPI
SPI clock
3MOSI
SPI
SPI master out / slave in
4MISO
SPI
SPI master in / slave out
5IRQ
GPIO
Interrupt request (optional)
6GND
GND
Ground
7RST
GPIO
Reset
83.3V
POWER
3.3V supply (NOT 5V)

Interactive pinout

Highlight:
BOARD

Click a pin to copy its name · tap a tag above to spotlight a bus.

Starter code

Community starter examples — minimal, unofficial, and provided to get you wiring fast. Verify against the manufacturer datasheet before relying on them.

Arduino (C++)

Arduino library: MFRC522 (by GithubCommunity)

arduino
// RC522 RFID reader (SPI) — community starter example
#include <SPI.h>
#include <MFRC522.h>

#if defined(ESP32)
  #define SS_PIN 5      // SDA/CS=GPIO5
  #define RST_PIN 4     // RST=GPIO4
#else
  #define SS_PIN 10     // SDA/CS=D10
  #define RST_PIN 9     // RST=D9
#endif

MFRC522 rfid(SS_PIN, RST_PIN);

void setup() {
  Serial.begin(115200);
  SPI.begin();
  rfid.PCD_Init();
  Serial.println("Tap an RFID card...");
}

void loop() {
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) return;
  Serial.print("UID:");
  for (byte i = 0; i < rfid.uid.size; i++) {
    Serial.print(' '); Serial.print(rfid.uid.uidByte[i], HEX);
  }
  Serial.println();
  rfid.PICC_HaltA();
}

MicroPython

MicroPython library: mfrc522 (wendlers/micropython-mfrc522)

python
# RC522 RFID (ESP32) — community starter example
# lib: wendlers/micropython-mfrc522 (mfrc522.py on the board)
from machine import Pin, SPI
from mfrc522 import MFRC522

spi = SPI(2, baudrate=1000000, sck=Pin(18), mosi=Pin(23), miso=Pin(19))
rdr = MFRC522(spi, cs=Pin(5), rst=Pin(4))   # CS=GPIO5, RST=GPIO4

while True:
    (stat, tag_type) = rdr.request(rdr.REQIDL)
    if stat == rdr.OK:
        (stat, uid) = rdr.anticoll()
        if stat == rdr.OK:
            print("UID:", uid)

Wiring

PinArduino Uno R3ESP32 DevKitC (WROOM-32)Notes
3.3V+3V33V33.3 V only
GNDGNDGND
SDAD10GPIO5SPI chip-select (SS)
SCKD13 (SCK)GPIO18
MOSID11 (MOSI)GPIO23
MISOD12 (MISO)GPIO19
RSTD9GPIO4
IRQ--Not used by the basic library flow

Typical uses

  • 13.56 MHz RFID/NFC tag reading (MIFARE)
  • Access control, attendance, tap-to-act