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!

TEMPERATURE HUMIDITY READER ON MOBILE (IoT Project)

The Temperature Humidity Reader project utilizes an ESP32 microcontroller in conjunction with a DHT11 sensor to monitor temperature and humidity levels. The collected data is displayed on an LCD and transmitted to a mobile application using the Blynk platform. This project provides an efficient way to remotely monitor environmental conditions in real time, making it useful for applications such as home automation, weather stations, and greenhouse monitoring.


2.3k03

Capacitor Charge/Discharge(STEAM Education)

To understand the charging and discharging process of capacitors and their storage behavior in electronic circuits.


1.7k05

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.7k07

Bluetooth Control Car( Robotic Project)

This proposal outlines the development of a Bluetooth-controlled car using an Arduino microcontroller. This car will be controllable remotely using a smartphone or tablet, offering a fun and educational introduction to robotics and electronics.


1.7k04