logologo

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!

Musical Tone with Push Button(STEAM Education)

The aim of this project is to understand the functioning of a musical alarm circuit using basic electronic components.


1.5k04

Smart Cold Storage(IoT Projects Agriculture)

IoT Projects Agriculture Smart cold storage is a modern way to store food that uses high-tech sensors and computer systems to keep items like fruits, vegetables, and other perishable goods fresh for longer. It monitors things like temperature and humidity, adjusting conditions automatically to prevent spoilage. IoT Projects Agriculture This technology also helps save energy and improves overall efficiency, making sure food stays safe and of good quality until it reaches your table.


2.4k09

Water level Indicator(STEAM Education)

To learn and create about water level indication using a simple circuit.


1.6k04

Top 5 IoT Final Year Projects

Welcome to Nepatronix Blog - Your Gateway to IoT and Robotics Innovation! At Nepatronix, we’re passionate about exploring the latest in IoT, robotics, and technology. Our blog is designed to inspire tech enthusiasts, students, and professionals alike by sharing in-depth tutorials, cutting-edge project ideas, and hands-on guides in the world of Arduino programming, IoT solutions, robotics development, and beyond. Whether you're a beginner just starting your tech journey or an expert looking to dive deeper into complex projects, you'll find valuable resources, step-by-step guides, and insightful articles here. Join us as we delve into exciting topics, from smart automation to innovative product development, and be part of a community dedicated to pushing the boundaries of what’s possible. Stay tuned for updates, project showcases, and expert advice to help you grow your knowledge and bring your ideas to life!


3.4k08