RC522 RFID reader (13.56 MHz) with ESP32
Supply 3.3 V
Bus SPI
Pins and ESP32 wiring
| Pin | Role | ESP32 pin | Notes |
|---|---|---|---|
| SDA | SPI chip select | D5 | This is the SPI chip select (CS), despite the SDA label |
| SCK | SPI clock | D18 | |
| MOSI | SPI MOSI | D23 | |
| MISO | SPI MISO | D19 | |
| IRQ | Interrupt | D35 | Interrupt, optional. Leave unconnected |
| GND | Ground | GND | |
| RST | Input (the ESP32 drives it) | D25 | Reset, active LOW |
| 3.3V | Power | 3V3 | 3.3 V only. Never 5 V |
Suggested wiring for the 30-pin ESP32 DevKit, avoiding flash, input-only and strapping pins. BoardPilot checks it for you as you wire.
Starter code (Arduino)
void setup() { pinMode(25, OUTPUT); } // RST
void loop() {
digitalWrite(25, HIGH);
delay(500);
digitalWrite(25, LOW);
delay(500);
}
Sources
- NXP MFRC522 datasheet, SPI interface; supply 2.5 to 3.6 V
Try it in 3D in BoardPilot
Related parts
Part data: CC BY 4.0, free to reuse with credit to BoardPilot.