Skip to content
Advanced 4 hours

Arduino RFID Access Control System with Logs

By Amit1379
July 13, 2026

RFID access control systems are used in offices, schools, and apartment buildings worldwide. This project builds a functional version: swipe an authorised RFID card or fob and the servo unlocks the door for 5 seconds. Unknown cards trigger a red LED and buzzer. Every event — card UID, authorised/denied, and timestamp from a DS3231 real-time clock — is appended to a CSV log file on an SD card, giving you a complete access history.

What You’ll Need

  • Arduino Uno or Mega
  • MFRC522 RFID reader module (SPI, 13.56 MHz)
  • 2 × RFID cards or key fobs (typically supplied with MFRC522 kit)
  • DS3231 RTC module (I2C)
  • Micro-SD card module (SPI)
  • Micro-SD card (any size, FAT32 formatted)
  • SG90 servo (door latch actuator)
  • Green LED + red LED + 2 × 220 Ω resistors
  • Piezo buzzer
  • 9 V power supply
  • Project enclosure

Step-by-Step Instructions

  1. Install libraries: Install MFRC522 by miguelbalboa, RTClib by Adafruit, and SD (built into Arduino IDE) via Library Manager.
  2. Wire MFRC522 (SPI): SDA → pin 10, SCK → pin 13, MOSI → pin 11, MISO → pin 12, RST → pin 9, VCC → 3.3 V, GND → GND.
  3. Wire SD module (SPI shared bus): CS → pin 4, SCK/MOSI/MISO shared with MFRC522. VCC → 5 V, GND → GND.
  4. Wire DS3231 (I2C): SDA → A4, SCL → A5, VCC → 3.3 V, GND → GND. Set current time once with a calibration sketch.
  5. Wire servo and indicators: Servo signal → pin 6. Green LED through 220 Ω → pin 7. Red LED → pin 8. Buzzer → pin 5.
  6. Read card UIDs: Upload the MFRC522 DumpInfo example. Scan each authorised card and note the UID (e.g. “A3 F2 B1 04”). Store these as byte arrays in your sketch in an AUTHORISED_CARDS array.
  7. Main logic: When a card is presented, read its UID. Compare against AUTHORISED_CARDS. If match: rotate servo to unlock position, green LED on, 2-second access grant, re-lock. If no match: red LED + 3 buzzer beeps. Either way: get timestamp from DS3231, write CSV row (timestamp, UID, GRANTED/DENIED) to SD card via SD.open(“log.csv”, FILE_WRITE).
  8. Add/revoke cards: Add a special master card UID — presenting it followed by a new card adds that card to the list (stored in EEPROM). Presenting master + existing card removes it.

Safety Notes

  • Do not use this as the sole security measure on any important door — it is a learning project, not a certified security product.
  • Always maintain a physical key override in case of power failure or firmware bug.
  • RFID cards at 13.56 MHz can be cloned with cheap consumer equipment — consider this a convenience lock, not a high-security solution.

Tips & Troubleshooting

  • SD and MFRC522 share SPI but have different CS pins — ensure only one CS is LOW at any time; the libraries handle this if wired correctly.
  • If MFRC522 returns no cards: check it is powered from 3.3 V not 5 V — 5 V will damage the module over time.
  • Extend the project with a GSM module (SIM800L) to send an SMS notification every time the door is accessed.

Leave a Comment

Your email address will not be published. Required fields are marked *