RO EN

Finding UID with RFID module

01/04/2026

This project is very easy to build and will be useful for future projects. In the images above, most of the cards are bank cards, but when you buy an RFID module, you usually receive an RFID card and a key fob, which are much better for testing.

In the Serial Monitor, you will be able to see the UID of the card or tag.

Required components:

  • Arduino Uno (or any compatible microcontroller)

  • RC522 RFID module (MFRC522, 13.56 MHz)

  • RFID card / NFC tag

  • MIFARE Classic 1K

  • RFID key fob

  • NFC card

  • Jumper wires

  • At least 6 wires, male–female

  • USB cable (for programming and power)

RC522 → Arduino Uno connections:

  • SDA → D10

  • SCK → D13

  • MOSI → D11

  • MISO → D12

  • RST → D9

  • 3.3V → 3.3V

  • GND → GND

(IRQ is not used because it's not necessary, especially for such a simple project.)

⚠️ Important: The RC522 works only at 3.3V, NOT 5V.


Code:

#include <SPI.h>

#include <MFRC522.h>

#define SS_PIN 10

#define RST_PIN 9

MFRC522 mfrc522(SS_PIN, RST_PIN);

void setup() {

Serial.begin(9600);

SPI.begin();

mfrc522.PCD_Init();

Serial.println("Apropie cardul RFID...");

}

void loop() {

// Verifică dacă e un card nou

if (!mfrc522.PICC_IsNewCardPresent()) return;

if (!mfrc522.PICC_ReadCardSerial()) return;

// Afișează UID

Serial.print("UID: ");

for (byte i = 0; i < mfrc522.uid.size; i++) {

Serial.print(mfrc522.uid.uidByte[i], HEX);

Serial.print(" ");

}

Serial.println("\n--------------------");

delay(1000);

}