Skip to content
Buy 10+ on select items — save 10% auto-applied
Free US shipping on orders $35+
Order by 3pm ET — ships same-day from the US
Skip to main content

Arduino RC522: Read RFID Card UIDs via SPI | ShillehTek

May 14, 2026 26 views

Arduino RC522: Read RFID Card UIDs via SPI | ShillehTek
Project

Build an Arduino RC522 RFID reader project that reads MIFARE card and key fob UIDs over SPI, with simple wiring and Serial Monitor output from ShillehTek.

20 min Beginner5 parts

Project Overview

Arduino + RC522 RFID reader: In this build, you will wire an MFRC522 (RC522) 13.56 MHz RFID module to an Arduino over SPI and print the UID of any MIFARE card or key fob you tap on the reader.

The RC522 is a common RFID reader for Arduino projects with a typical read range of about 3 cm, plus MIFARE and NTAG support out of the box. Use it for door locks, attendance systems, inventory trackers, or maker-space access control.

  • Time: ~20 minutes
  • Skill level: Beginner
  • What you will build: An Arduino that prints the UID of any card or fob you tap on the reader.
RC522 RFID reader module with a MIFARE card and 13.56 MHz key fob used for reading UIDs
RC522 reader, MIFARE 1K card, and a 13.56 MHz key fob.

Parts List

From ShillehTek

External

  • USB cable + Arduino IDE

Note: The RC522 is 3.3 V only on its logic side. The breakout has a level shifter on VCC, but if you are wiring direct to GPIOs ensure your board outputs 6 3.3 V on SPI lines.

Step-by-Step Guide

Step 1 - Identify the Pins

Goal: Confirm the RC522 pin names so you can wire SPI correctly.

What to do: Locate the labeled pins on the RC522 module. The board has 8 pins; in this project we use 7 of them. IRQ is optional and not required for reading UIDs.

RC522 (MFRC522) RFID module pin labels used for SPI wiring to an Arduino
RC522 has 8 pins; we use 7 of them (IRQ is optional).

Expected result: You can identify VCC, GND, RST, SDA (NSS/CS), MOSI, MISO, and SCK on the RC522.

Step 2 - Wire SPI

Goal: Connect the RC522 to the Arduino using SPI and the correct power pin.

What to do: Wire the RC522 to the Arduino using the mapping below. Make sure VCC goes to 3.3 V (not 5 V).

RC522 RFID reader wired to an Arduino using SPI lines and 3.3 V power
Standard SPI hookup - VCC, RST, GND, MISO, MOSI, SCK, SDA(CS).
  • VCC 3.3 V (not 5 V)
  • GND GND
  • RST D9
  • SDA (NSS / CS) D10
  • MOSI D11
  • MISO D12
  • SCK D13

Expected result: The RC522 is powered from 3.3 V and connected to Arduino SPI pins with RST on D9 and CS on D10.

Step 3 - Install the Library

Goal: Add the Arduino library needed to communicate with the MFRC522 reader.

What to do: In the Arduino IDE, open Library Manager and install MFRC522 by GithubCommunity.

Expected result: The MFRC522 library is installed and available for your sketch.

Step 4 - Upload the Sketch

Goal: Program the Arduino to detect a tag and print the UID to Serial Monitor.

What to do: Copy the sketch below, select the correct board and port, then upload. After uploading, open Serial Monitor at 9600 baud.

Code:

#include <SPI.h>
#include <MFRC522.h>

const int RST_PIN = 9;
const int SS_PIN  = 10;
MFRC522 rfid(SS_PIN, RST_PIN);

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();
  Serial.println("Tap a card...");
}

void loop() {
  if (!rfid.PICC_IsNewCardPresent()) return;
  if (!rfid.PICC_ReadCardSerial()) return;

  Serial.print("UID: ");
  for (byte i = 0; i < rfid.uid.size; i++) {
    if (rfid.uid.uidByte[i] < 0x10) Serial.print('0');
    Serial.print(rfid.uid.uidByte[i], HEX);
    if (i < rfid.uid.size - 1) Serial.print(':');
  }
  Serial.println();

  rfid.PICC_HaltA();
  rfid.PCD_StopCrypto1();
}

Expected result: Serial Monitor prints Tap a card... and waits for an RFID tag.

Step 5 - Tap a Card

Goal: Verify the RC522 is reading tags by checking the UID output.

What to do: Hold a MIFARE card or key fob close to the RC522 antenna area. Each time you tap, watch Serial Monitor for a new UID line.

Arduino Serial Monitor showing RC522 RFID tag UID values printed after tapping a card
Each tap prints the unique 4 or 7-byte UID.
13.56 MHz RFID tags including MIFARE cards and key fobs used to test RC522 UID reads
Standard 1K MIFARE cards, key fobs, and stickers all read the same way.

Expected result: Each tap prints a UID in hex (often 4 or 7 bytes) to Serial Monitor.

Step 6 - Where to Take It Next

Goal: Use the UID read as an input to larger projects.

What to do: Extend the sketch logic using the UID string as a key for actions like access control, logging, or display.

  • Compare UID against an allow-list and toggle a relay = electronic lock
  • Log UIDs to an SD card with a timestamp = attendance system
  • Write data to MIFARE blocks for stored balances or names
  • Combine with an OLED to show the cardholders name on tap

Expected result: You have clear next steps to turn UID reads into an action, a record, or on-screen feedback.

Conclusion

You built an Arduino project that uses the RC522 (MFRC522) RFID reader over SPI to detect 13.56 MHz tags and print each card or key fob UID to Serial Monitor. Once you can reliably read UIDs, you can use them as IDs for access control, logging, or UI feedback.

Want the exact parts used in this build? Grab them from ShillehTek.com. If you want help customizing this project or building something for your product, check out our IoT consulting services.