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!

Ultrasonic Radar System Using Arduino (Automation Project)

In this project, an Arduino is used to control a servo motor that sweeps an ultrasonic distance sensor back and forth. The distance to obstacles is measured using the sensor, and the information is used to trigger different levels of buzzer alerts. This system is useful in applications where obstacle detection and varying levels of alerts are needed.


2.0k05

Combination of Resistance Parallel Connection(STEAM Education)

To understand the effect of resistance in parallel connection on circuit behavior, that we will observe from LED intensity.


1.9k03

Heartbeat Monitoring Using AD8232 Module(IoT Project)

The Heartbeat Monitoring System using the AD8232 module is designed to measure and display heart rate data. The AD8232 is a specialized integrated circuit designed for extracting, amplifying, and filtering small biopotential signals in noisy environments, making it ideal for heart rate monitoring. This system captures the electrical activity of the heart, processes the signal, and sends the data to a computer for real-time monitoring through serial communication.


1.5k04

Rain Alarm(STEAM Education)

To create a rain alarm circuit that activates a buzzer when water droplets are detected by a water sensor.


1.7k04