Use Coupon WELCOME100 for රු100.00 Off!
Eleberric
Back to Blog
Robotics & DIY Projects

Creating an RFID Security Door Lock Access Control System

June 4, 2026
14 min read
Creating an RFID Security Door Lock Access Control System

Ditch standard brass keys for digital tags! This RFID access terminal validates tags and operates a micro servo latch accordingly.

Introduction & Concept

This project uses the RC522 card reader, which emits radio frequency fields at 13.56 MHz. When an RFID tag or key fob passes close to the reader, it energizes and transmits its unique identification number (UID). The Arduino matches the UID against stored authorization codes. If valid, a servo turns 90 degrees to unlock the latch.

Key Parts

Component Name Store Link
RFID RC522 Reader Set Buy RC522 RFID Set
SG90 Micro Servo Buy SG90 Servo

SPI Wiring Table

RC522 Pin Arduino Uno Pin
SDA (SS) Pin 10
SCK Pin 13
MOSI Pin 11
MISO Pin 12
RST Pin 9
3.3V 3.3V Pin (Do not use 5V!)

Source Code

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

MFRC522 mfrc522(10, 9); // SS, RST
Servo lockServo;

void setup() {
  Serial.begin(9600);
  SPI.begin();
  mfrc522.PCD_Init();
  lockServo.attach(6);
  lockServo.write(0); // Latch locked position
}

void loop() {
  if ( ! mfrc522.PICC_IsNewCardPresent()) return;
  if ( ! mfrc522.PICC_ReadCardSerial()) return;
  
  // Read card UID
  String uid = "";
  for (byte i = 0; i < mfrc522.uid.size; i++) {
    uid += String(mfrc522.uid.uidByte[i], HEX);
  }
  
  if (uid == "e324a1b") { // Master Key UID
    lockServo.write(90); // Unlock
    delay(5000);
    lockServo.write(0); // Relock
  }
}

Ready to build this project?

Shop all the required components at Eleberric Sri Lanka with fast island-wide delivery.