> Source: https://www.tinkered.ai/components/rfid-rc522/esp32 (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/components/rfid-rc522/esp32. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# MFRC522 RFID Reader with an ESP32 DevKit V1

The RC522 is a 3.3 V part, which makes the ESP32 DevKit V1 a natural match: its 3V3 pin feeds the module and the SPI lines need no level shifting. It uses the VSPI pins, SCK GPIO18, MOSI GPIO23 and MISO GPIO19, with SDA (chip select) on GPIO5 and RST on GPIO13.

## Wiring

| MFRC522 RFID Reader | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| 3V3 | 3V3 |  |
| GND | GND |  |
| SDA | GPIO5 (D5) |  |
| SCK | GPIO18 (D18) |  |
| MOSI | GPIO23 (D23) |  |
| MISO | GPIO19 (D19) |  |
| RST | GPIO13 (D13) |  |

## What to know on the ESP32 DevKit V1

- The MFRC522 runs from 2.5 V to 3.6 V and its antenna driver draws 60 mA typical, 100 mA maximum, on top of its analog and digital supplies. The DevKit's 3V3 pin carries that, but keep the module off VIN: its supply pins are rated 4.0 V absolute maximum. (NXP MFRC522 data sheet Rev 3.9, pp. 2, 3, 74)
- SDA sits on GPIO5, the VSPI default chip select, and GPIO5 is also a strapping pin with an internal pull-up at reset. The RC522's SDA is an input, so it does not disturb the boot; do not hang anything there that pulls GPIO5 low during reset. (Espressif ESP32 Series Datasheet v5.3, p. 22; Espressif ESP32 Series Datasheet v5.3, p. 36)
- SPI.begin() with no arguments starts VSPI on GPIO18, 19 and 23, the pins the page uses. Do not share GPIO19 with a microSD module that drives MISO at all times; give one of them the ESP32's other SPI bus. (Espressif ESP32 Series Datasheet v5.3, p. 36)

## Code

Libraries: miguelbalboa/MFRC522

```cpp
// MFRC522 RFID Reader on ESP32 DevKit V1: wiring and a free simulation at https://www.tinkered.ai/components/rfid-rc522/esp32
#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN  5
#define RST_PIN 13
MFRC522 rfid(SS_PIN, RST_PIN);

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();
  Serial.println("Scan a 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(rfid.uid.uidByte[i] < 0x10 ? " 0" : " ");
    Serial.print(rfid.uid.uidByte[i], HEX);
  }
  Serial.println();
  rfid.PICC_HaltA();
}
```

Compiled for esp32:esp32:esp32 on 2026-10-30.

## Questions

### Does the RC522 need a level shifter on the ESP32?

No. The ESP32 is a 3.3 V board and the MFRC522 is a 3.3 V part (NXP data sheet, p. 2); a level shifter is only needed on 5 V boards.

### Which pins does the RC522 use on the ESP32 DevKit V1?

SCK GPIO18, MOSI GPIO23, MISO GPIO19 (VSPI, ESP32 datasheet p. 36), SDA on GPIO5 and RST on GPIO13, matching MFRC522 rfid(5, 13) in the sketch.

### Why is my RC522 not detected on the ESP32?

Check that SDA is on the pin given as SS (GPIO5), that RST is on GPIO13, and that the module is on 3V3. A microSD module on the same MISO line can also block it.

## More

- [MFRC522 RFID Reader reference](https://www.tinkered.ai/components/rfid-rc522.md): pinout, specs, rules and common mistakes

## Try it

Tinkered simulates the MFRC522 RFID Reader on the ESP32 DevKit V1 in the browser, with this wiring and code, free: https://www.tinkered.ai/components/rfid-rc522/esp32
