Smart Door Lock with RFID Using Arduino

Learn how to build a Smart Door Lock with RFID using Arduino in this beginner-friendly DIY electronics project. This smart security system uses an RFID reader and RFID cards to unlock a door electronically. It is a great project for students, electronics hobbyists, and smart home enthusiasts who want to create a simple and secure access control system at home.

smart-door-lock-with-rfid

What is an RFID Door Lock?

An RFID door lock is an electronic security system that uses Radio Frequency Identification (RFID) technology to control access. Instead of using a traditional key, the door unlocks when a valid RFID card or tag is scanned near the RFID reader.

This project uses an Arduino Uno, MFRC522 RFID module, and a servo motor to simulate a smart locking system. When the correct RFID card is detected, the servo rotates and unlocks the door automatically.

Features of This Smart RFID Door Lock

  • Secure RFID-based access system
  • Easy to build for beginners
  • Uses low-cost electronic components
  • Automatic locking and unlocking
  • Can be upgraded for smart home automation
  • Works with RFID cards and keychains

Components Required

ComponentQuantity
Arduino Uno1
MFRC522 RFID Module1
RFID Card/Tag1 or More
Servo Motor (SG90)1
Breadboard1
Jumper WiresSeveral
LED (Optional)1
Buzzer (Optional)1
USB Cable1
rfid-door-lock-components

RFID Module Pin Configuration

RFID Module PinArduino Uno Pin
SDA10
SCK13
MOSI11
MISO12
RST9
3.3V3.3V
GNDGND

Servo Motor Connection

  • Servo Signal Pin → Arduino Pin 6
  • Servo VCC → 5V
  • Servo GND → GND

How the Smart RFID Door Lock Works

The RFID reader continuously scans for RFID cards or tags. When a card is placed near the reader, the Arduino reads the unique ID of the card.

If the card ID matches the authorized RFID tag stored in the Arduino code, the servo motor rotates and unlocks the door. After a few seconds, the servo returns to the locked position automatically.

Arduino Code for RFID Door Lock

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

#define SS_PIN 10
#define RST_PIN 9

MFRC522 rfid(SS_PIN, RST_PIN);
Servo lockServo;

String authorizedUID = "12345678";

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();

  lockServo.attach(6);
  lockServo.write(0);

  Serial.println("RFID Door Lock Ready");
}

void loop() {

  if (!rfid.PICC_IsNewCardPresent())
    return;

  if (!rfid.PICC_ReadCardSerial())
    return;

  String tag = "";

  for (byte i = 0; i < rfid.uid.size; i++) {
    tag += String(rfid.uid.uidByte[i], HEX);
  }

  Serial.println(tag);

  if (tag == authorizedUID) {

    Serial.println("Access Granted");

    lockServo.write(90);

    delay(5000);

    lockServo.write(0);

  } else {

    Serial.println("Access Denied");

  }

  rfid.PICC_HaltA();
}

How to Find Your RFID Card UID

Upload the code to Arduino and open the Serial Monitor. Scan your RFID card near the reader. The UID number will appear on the screen. Replace the sample UID in the code with your own RFID card UID.

rfid-door-lock-circuit-diagram

Advantages of RFID Door Lock System

  • Better security than traditional locks
  • Quick and contactless access
  • Easy to expand with more RFID cards
  • Can be integrated with IoT systems
  • Low power consumption

Applications of RFID Smart Locks

  • Smart homes
  • Office access systems
  • School and college labs
  • Hotel room security
  • Cabinet and locker protection

Project Upgrades and Ideas

  • Add an LCD display for access status
  • Connect WiFi module for remote monitoring
  • Use relay module for real door locks
  • Add fingerprint authentication
  • Store multiple RFID users
  • Send notifications to smartphone

Common Problems and Solutions

ProblemSolution
RFID not detecting cardCheck SPI wiring connections
Servo not rotatingVerify power supply and signal pin
Wrong UID detectedUse Serial Monitor carefully
Arduino not uploadingSelect correct COM port and board

SEO FAQs

What is RFID in Arduino projects?

RFID stands for Radio Frequency Identification. It is used in Arduino projects to identify cards or tags wirelessly.

Can I use RFID for home security?

Yes, RFID is widely used in smart home security systems for secure door access control.

Which RFID module is best for Arduino?

The MFRC522 RFID module is one of the most popular and affordable RFID readers for Arduino projects.

Can I add multiple RFID cards?

Yes, you can store multiple RFID card UIDs in the Arduino code and allow access for different users.

Final Words

The Smart Door Lock with RFID using Arduino is an excellent DIY electronics project for learning about smart security systems and automation. This project is simple, affordable, and highly useful for real-world applications.

If you enjoyed this tutorial, explore more smart home and Arduino projects on DiySmartLab.com.

Leave a Reply

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