NFC / RFID
Interfacing RC522 NFC / RFID with Raspberry Pi
What is the RC522?
RC522 practical reference
A low-cost SPI RFID/NFC reader operating at 13.56MHz, the go-to choice for DIY access-control and attendance-tracking builds. Built around NXP's MFRC522 chip, it reads (and writes) common Mifare-family tags and cards over SPI, letting a microcontroller check a scanned card's unique ID against a stored list to grant or deny access — the default entry point for anyone building an RFID door lock, attendance system, or simple tag-based authentication project.
Key specifications
- Chipset: NXP MFRC522 13.56MHz RFID/NFC reader IC
- Operating voltage: 3.3V DC (NOT 5V tolerant on SPI or logic pins)
- Operating current: ~13-26 mA typical during read operations
- Frequency: 13.56MHz
- Supported tags: Mifare Classic 1K/4K, Mifare Ultralight, and other ISO/IEC 14443A compliant cards/tags
- Read range: ~2.5-5cm typical, antenna and card dependent
- Interface: SPI (also supports I2C/UART on the bare IC, but most breakout boards hardwire SPI only)
- Included accessories: Modules commonly ship with a keychain tag and a card, both pre-programmed with unique IDs for testing
Pinout and connection notes
The pin labeled SDA on most RC522 breakout boards is actually the SPI chip-select line, not an I2C data pin — a frequent point of confusion for newcomers expecting I2C wiring. All logic pins are 3.3V only, so when wiring to a 5V Arduino Uno, use a logic-level shifter on MOSI, SCK, and RST (MISO can be safely read directly since the RC522 drives it).
- 3.3V: Power, 3.3V DC only — do not supply 5V
- RST: Active-LOW reset pin
- GND: Ground
- MISO: SPI data out
- MOSI: SPI data in
- SCK: SPI clock
- SDA (SS/CS): SPI chip select, active LOW (labeled SDA on the module despite being an SPI pin, a common source of confusion)
- IRQ: Interrupt output, optional — signals when a card enters the field
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.
Setting Up RC522 with Raspberry Pi
Library
mfrc522 by Pi My Life Up
pip3 install mfrc522 (pulls in RPi.GPIO and spidev), then enable SPI via raspi-config → Interface Options → SPI
Wiring
| Component pin | Raspberry Pi pin | Note |
|---|---|---|
| VCC (3.3V) | 3.3V (physical pin 1) | RC522 is 3.3V-only — do NOT use the Pi's 5V pin |
| GND | GND (physical pin 6) | |
| RST | GPIO25 (physical pin 22) | Fixed by the pimylifeup library's default wiring |
| MISO | GPIO9 / physical pin 21 | Hardware SPI0 MISO |
| MOSI | GPIO10 / physical pin 19 | Hardware SPI0 MOSI |
| SCK | GPIO11 / physical pin 23 | Hardware SPI0 SCLK |
| SDA (SS) | GPIO8 / physical pin 24 | Hardware SPI0 CE0 — labeled SDA on the board |
Swipe sideways to see every column →
RC522 is 3.3V-only, same as the Pi's GPIO header, so no level shifting is needed — just double-check VCC didn't accidentally land on the 5V pin next to it.
Related Components
Related Guides & Projects
Raspberry Pi Pico W and Pico 2 W: Install MicroPython with Thonny or UF2
Hold BOOTSEL, drag the correct UF2 file, open the REPL and blink the onboard LED. Includes the Pico vs Pico W vs Pico 2 W firmware differences and what to do when the drive does not appear.
Raspberry Pi Pico W Web Server in MicroPython: Control an LED and Read a Sensor
Connect the Pico W to WiFi, serve a responsive control page, switch an LED and display the onboard temperature or an external sensor, with timeouts and reconnect handling.
Raspberry Pi Pico Oscilloscope with MicroPython
Convert a Raspberry Pi Pico into a basic 500 kSPS oscilloscope using its 12-bit ADC and MicroPython. Displays waveforms on an SSD1306 OLED or streams samples over USB serial to a Python plotter on your PC.
Arduino RFID Door Lock with Access Log & LCD Display
Build a complete RFID access control system with Arduino, RC522 reader, LCD feedback, solenoid lock, and access logging via Serial. Works for doors, drawers, and cabinets.