All projects

Arduino RFID access control

Finished 2024

A card reader that lights a green LED for the right card and sounds a buzzer for the wrong one, built on an Arduino Uno with an RC522 module, plus a few smaller sensor labs.

An Arduino Uno wired to an RC522 RFID module and a breadboard with a green LED, a red LED and a buzzer

The build

An Elegoo Uno R3, an RC522 RFID module on SPI, a green LED, a red LED and a buzzer. The pins are reset on 9, chip select on 10, green on 5, red on 4 and the buzzer on 6, and the MFRC522 library does the talking.

My wiring sketch

The first program just prints card UIDs over serial at 9600 baud. That’s the library’s example. The second one compares the card’s 4-byte UID with one stored in the code, byte by byte. A match prints “Access Granted” and turns the green LED on for 2 seconds. A mismatch prints “Access Denied” and turns the red LED and the buzzer on for 1 second, then halts the card. The sketch is 5316 bytes, 16% of the flash. It isn’t secure: matching a 4-byte UID is easy to clone, and the allowed UID sits in the sketch.

The serial monitor below shows what a run looks like: a few denied scans, then four granted ones with the right card, then one more denied.

A good card, green LED
The serial monitor

The smaller labs

These were lab-partner labs, and the code and wiring sketches are mine.