Wiring guide

How to wire an RC522 RFID reader to an Arduino Nano

To wire an RC522 RFID reader to an Arduino Nano, connect 3.3V to 3.3V, GND to GND, SDA to pin 10, SCK to pin 13, MOSI to pin 11, MISO to pin 12 and RST to pin 9. The module is powered from 3.3 V but the SPI lines come from 5 V pins; many modules survive that, but the chip is rated for 3.3 V logic, so use a level shifter on SCK, MOSI, SS and RST on real hardware. The sketch below uses the MFRC522 (MFRC522.h) library. It reads the card that is held to the reader and prints its UID.

  • 5 V logic
  • Library: MFRC522.h
  • 7 wires
Arduino Nano · RC522 RFID readerlive0.000 s 0.00x
Click to open it in the editor
The circuit itself, running on the simulator with the sketch below. Press what can be pressed; click anything else to open it in the editor.
Pin to pin

RC522 RFID reader to Arduino Nano wiring table

Every wire in the circuit above, with the part’s pin names and the board’s own labels. The wire colors are the ones the circuit uses; on a real bench any colors work.

RC522 RFID reader pinArduino Nano pinWire colorWhy
3.3V3.3VredThe MFRC522 is a 3.3 V chip. Never 5 V on this pin.
GNDGNDblueCommon ground.
SDA (SS)pin 10amberChip select. Labeled SDA on the module, but this is SPI, not I2C.
SCKpin 13cyanArduino Nano’s SPI clock.
MOSIpin 11violetData from the board to the reader.
MISOpin 12greenData from the reader to the board.
RSTpin 9grayReset, held high while the reader runs.
IRQnot connectedn/aThe library polls instead.
Voltage

Power and logic levels for RC522 RFID reader and Arduino Nano

Logic level

The Arduino Nano’s pins are 5 V logic. A 5 V part can drive them directly; a part whose signal pins are limited to 3.3 V needs a level shifter.

This pair

The module is powered from the Arduino Nano’s 3.3V pin, but the SPI lines come from 5 V pins. Many RC522 modules survive that, and countless Uno tutorials wire it so, but the chip is rated for 3.3 V logic; a level shifter on SCK, MOSI, SS and RST is the safe way on real hardware.

Pins to leave alone

A6 and A7 are analog only: pinMode(A6, OUTPUT) does nothing and digitalRead(A7) is not there to call. D0 and D1 are the USB serial port.

The sketch

The working code for the Arduino Nano

Library: MFRC522 (MFRC522.h). This is the sketch the circuit above runs.

RC522 RFID on Arduino Nano
#include <SPI.h>
#include <MFRC522.h>

const int SS_PIN = 10;    // SDA on the module, pin 10
const int RST_PIN = 9;   // pin 9

MFRC522 rfid(SS_PIN, RST_PIN);

void setup() {
  Serial.begin(9600);
  SPI.begin();          // SCK 13, MISO 12, MOSI 11
  rfid.PCD_Init();
  Serial.println("Hold a card to the reader");
}

void loop() {
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) {
    delay(50);
    return;
  }
  Serial.print("Card 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();    // done with this card until it is lifted
}
Output

What you should see

Open the serial monitor at 9600 baud. The sketch prints Hold a card to the reader and, when you present the card in the circuit, a Card UID line with its four bytes in hexadecimal.

The pin labeled SDA on the module is the SPI chip select, not an I2C line. IRQ is left unconnected because the library polls.

The serial monitor prints this, recorded from the circuit above with a card presented after 400 ms:

Hold a card to the reader
Card UID: C3 5A 1E 94
Pitfalls

Common mistakes wiring an RC522 RFID reader to an Arduino Nano

Powering it from 5V

The 3.3V pin means it: 5 V there damages the MFRC522. If the module gets warm or reports a version of 0x00 or 0xFF, check this first.

Treating SDA as I2C

The pin marked SDA is the SPI chip select. Wired to the Arduino Nano’s I2C data pin, the reader is never selected. It goes to SS_PIN, pin 10 here.

Expecting to read bank cards

The RC522 reads 13.56 MHz MIFARE tags and cards. Contactless bank cards answer, but only with a random ID each time, and 125 kHz key fobs not at all.

Build your own RC522 RFID reader project

Open this circuit in the editor, change the wiring or the code, and keep your version in a free account.