Projects / RFID door log

RFID door log

Intermediate1 hGuided buildReviewed
Arduino Uno3.3VD10D13D11D12D9D5D6tap cardRC522 readerAllowedRefused
Card: Your card

Tap a part to see what it does.

Tap the parts to see what each one does. A teaching simulation, not a circuit simulator.

Build it step by step

0 of 5 done
  1. UNORC522

    Place the reader

    RC522 at the breadboard edge with its 8 pins in separate rows.

  2. UNO

    Power at 3.3 V

    3.3V to the Uno's 3.3V pin, GND to GND. Never 5 V.

  3. UNO

    Wire the SPI bus

    SDA to D10, SCK to D13, MOSI to D11, MISO to D12, RST to D9.

  4. UNO11.0 mA

    Add the two LEDs

    D5 through 220 Ω to green, D6 through 220 Ω to red, short legs to GND.

  5. UNO

    Learn your card

    Upload, tap your card, copy its ID from the log into allowed[], upload again.

In short

How do you build an RFID door log?

Tap a card on an RC522 reader: known cards light green and are logged, unknown cards light red. You need Arduino Uno R3, RC522 RFID reader, LED 5 mm green, LED 5 mm red, Resistor 220 Ω × 2 and Breadboard 830 Tie Points. It takes 5 steps and about 60 minutes.

Level
Intermediate
Time
About 60 min
Parts
6

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
RC522 3.3VUno 3.3VPower (never 5 V)
RC522 GNDUno GNDGround
RC522 SDA (SS)Uno D10Chip select
RC522 SCK / MOSI / MISOUno D13 / D11 / D12SPI bus
RC522 RSTUno D9Reset
Uno D5 / D6220 Ω to green / red LEDAllowed / refused

Code

Arduino IDE. Install the "MFRC522" library. The RC522 runs on 3.3 V; many modules work with Uno logic, but a level shifter or a 3.3 V board (ESP32) is safer for long-term use.

Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

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

MFRC522 rfid(10, 9);  // SS, RST
const int GREEN = 5, RED = 6;
byte allowed[][4] = { {0xDE, 0xAD, 0xBE, 0xEF} };  // replace with your card's ID

bool isAllowed(byte *uid) {
  for (auto &a : allowed) if (memcmp(a, uid, 4) == 0) return true;
  return false;
}

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();
  pinMode(GREEN, OUTPUT); pinMode(RED, OUTPUT);
  Serial.println("seconds,uid,result");
}

void loop() {
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) return;
  bool ok = isAllowed(rfid.uid.uidByte);
  Serial.print(millis() / 1000); Serial.print(',');
  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); }
  Serial.println(ok ? ",allowed" : ",refused");
  digitalWrite(ok ? GREEN : RED, HIGH);
  delay(2000);
  digitalWrite(GREEN, LOW); digitalWrite(RED, LOW);
  rfid.PICC_HaltA();
}

What the serial monitor should show

Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Uno with its sensors at their default values. Your numbers will follow your real readings, but the format should match.

seconds,uid,result

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Tap your card after adding itGreen for 2 s, log line ends "allowed"
Tap another cardRed for 2 s, "refused"
Hold the card stillOne log line per tap

If it does not work

Nothing happens on tap

Check SDA is on D10 and RST on D9, and the module has 3.3 V.

Works then stops

Loose SPI wires are common: use short wires and press them in firmly.

Every card is refused

Copy the ID exactly as printed, 4 bytes, into allowed[].

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the RFID door log?

Arduino Uno R3, RC522 RFID reader, LED 5 mm green, LED 5 mm red, Resistor 220 Ω × 2 and Breadboard 830 Tie Points.

How long does the RFID door log take to build?

About 60 minutes for a intermediate maker, in 5 steps.

How do I know the RFID door log works?

Tap your card after adding it: Green for 2 s, log line ends "allowed". Tap another card: Red for 2 s, "refused". Hold the card still: One log line per tap.

Nothing happens on tap: what should I check?

Check SDA is on D10 and RST on D9, and the module has 3.3 V.

Works then stops: what should I check?

Loose SPI wires are common: use short wires and press them in firmly.

Every card is refused: what should I check?

Copy the ID exactly as printed, 4 bytes, into allowed[].