logologo
Contact

HOMEABOUTSERVICESBLOGSBOOKSSHOPCONTACT

+977 9803661701support@nepatronix.orgLokanthali, Bhaktapur

© 2025 NepaTronix all rigths reserved

RFID Door Lock Using Arduino Uno(Automation Project )

  Back To Blogs

The RFID Door Lock system is a secure and convenient access control solution that uses RFID technology to allow or deny access to a door. By scanning an RFID card, the system can identify authorized users and trigger a servo motor to unlock the door if access is granted. This technology is widely used in offices, homes, and restricted areas to ensure only authorized personnel can enter.

 Project : 1


RFID Door Lock

Description

The RFID Door Lock system is a secure and convenient access control solution that uses RFID technology to allow or deny access to a door. By scanning an RFID card, the system can identify authorized users and trigger a servo motor to unlock the door if access is granted. This technology is widely used in offices, homes, and restricted areas to ensure only authorized personnel can enter.


Required Components

  1. Arduino Board: The main microcontroller to process the RFID data and control the servo motor and LEDs.

  2. RFID Module (MFRC522): Used to read RFID cards and tags.
    • SS (Slave Select) pin: Pin 10
    • RST (Reset) pin: Pin 9

  3. Servo Motor: Controls the locking mechanism of the door.
  4. LEDs: Indicate the access status (Red for denied, Green for granted).
    • Red LED: Pin 6
    • Green LED: Pin 5

  5. Connecting Wires: For establishing connections between components.
  6. Power Supply: Adequate power supply for the Arduino and the RFID module.

Working Principle

  1. Initialization:
    • The Arduino initializes serial communication for debugging.
    • The RFID module is set up to start scanning for RFID cards.
    • The servo motor and LEDs are configured to their respective pins.

  2. Card Scanning:
    • The RFID module continuously scans for RFID cards.
    • When a card is detected, the RFID module reads the card’s serial number and converts it into a string format.

  3. Access Verification:
    • The scanned card number is compared against a list of pre-stored authorized card numbers.
    • If the card number matches one of the authorized numbers, access is granted.
    • If the card number does not match, access is denied.

  4. Access Control:
    • If access is granted, the green LED lights up, and the servo motor moves to unlock the door.
    • The servo motor then returns to its original position after a delay, re-locking the door.
    • If access is denied, the red LED lights up, indicating that the card is not authorized.


Circuit Diagram:

Code:

#include <RFID.h>

#include <SPI.h>

#include <Servo.h>

 

RFID rfid(10, 9); // SS, RST PIN

Servo myServo;

int serNum[5];

int RedLED = 6;

int GreenLED = 5;

int ServoPin = 3;

String cardno;

// change below numbers to your card number later

char *mycards[] = {"22841931649","0000","13646335144"};

 

void setup() {

  pinMode(RedLED, OUTPUT);

  pinMode(GreenLED, OUTPUT);

  pinMode(ServoPin, OUTPUT);

  myServo.attach(ServoPin);

  Serial.begin(9600);

  SPI.begin();

  rfid.init(); // Function to start the RFID scan

}

 

void loop() {

  myServo.write(0); // Setting the servo to the locked position

  digitalWrite(RedLED, LOW);

  digitalWrite(GreenLED, LOW);

 

  if (rfid.isCard()) { // Loop begins when the card is scanned

    if (rfid.readCardSerial()) {

      cardno = ""; // Defining an empty array to store the card number received

      for (int i = 0; i < 5; i++) { // Iterate through every character of card number and send to cardno variable

        cardno += String(rfid.serNum[i]);

      }

      Serial.print("Card detected: #");

      Serial.println(cardno);

    }

    int access = 0;

    for (int i = 0; i < sizeof(mycards); i++) {

      if (cardno == mycards[i]) { // Matches the card number received to card number stored within Arduino memory

         access = 1;

      }

    }

    if (access == 1) {

        accessGranted(); // If card is matched then servo will move

    } else {

        accessDenied();

    }

  }

  rfid.halt();

  delay(1000);

}

 

// AccessGranted is the function executed when the card is matched.

// Servo motor will open the lock and come back to the original position.

 

void accessGranted() {

  Serial.println("Access Granted!");

  digitalWrite(RedLED, LOW);

  digitalWrite(GreenLED, HIGH);

  myServo.write(120);

  delay(2000); // Change the delay time for your convenience to keep the lock open

  myServo.write(0);

}

 

void accessDenied() {

  Serial.println("Access Denied!");

  digitalWrite(RedLED, HIGH);

  digitalWrite(GreenLED, LOW);

}


Conclusion

The RFID Door Lock system provides a reliable and secure method of access control by utilizing RFID technology. The integration of an Arduino microcontroller with an RFID reader, servo motor, and LEDs ensures that only authorized users can unlock the door. This system is highly versatile and can be implemented in various settings where secure access is required. With further enhancements, such as adding a logging system or integrating with a network, the functionality and security of the RFID Door Lock system can be significantly improved.

 




Total likes : 4

Comments







Read More Blogs!

FIRE DETECTION THROUGH ESP32 MOBILE APP (IoT Project in Nepal)

This project is designed to detect fire using an ESP32 microcontroller and a flame sensor. The system monitors the flame sensor's readings and sends data to a mobile app via the Blynk platform. Additionally, it displays the status on an LCD screen. If fire is detected, an alert message is displayed on both the mobile app and the LCD. This project demonstrates how IoT can be leveraged for fire detection and safety systems.


2.9k04

Power LED with Solar Panel(STEAM Education)

To understand and demonstrate the utilization of solar energy to power an LED light.


2.0k05

Development of a Library Noise Alert System Using Arduino(Automation Project)

This proposal outlines the development of a library noise alert system using an Arduino microcontroller. This system will monitor noise levels and alert users when the noise exceeds a predefined threshold, promoting a quiet and conducive environment for study and research.


1.5k08

20 ESP Project For beginner

The world of IoT (Internet of Things) is rapidly expanding, and the NodeMCU (ESP8266/ESP32) microcontroller has become a favorite tool for building smart, connected devices. In this blog, we explore 20 exciting and innovative projects using NodeMCU, ranging from home automation to smart security systems. Each project offers hands-on experience, allowing enthusiasts, hobbyists, and developers to dive into the realm of IoT and create practical, real-world applications. These NodeMCU projects demonstrate how everyday tasks can be automated and controlled remotely, whether it's monitoring air quality, controlling lighting, securing your home, or managing energy consumption. With detailed explanations and step-by-step guidance, this blog serves as a comprehensive resource for those eager to learn, experiment, and build projects that connect the physical world with the digital realm. Whether you're a beginner or an experienced maker, these projects will inspire you to unlock the potential of IoT with NodeMCU and explore the endless possibilities of smart technology.


4.9k07