0% found this document useful (0 votes)
64 views18 pages

RFID Door Lock System with Arduino

This document is a major project report for an RFID door lock system using an Arduino. It includes an introduction describing electronic door locks and motivation for the project. It then provides a block diagram, lists of required components, tools and software. It includes circuit diagrams and descriptions of the working principle and Arduino code. The system uses an Arduino, RFID reader module, RFID cards/tags, IR sensor, servo motor and LCD to unlock a door when a valid RFID tag is scanned.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views18 pages

RFID Door Lock System with Arduino

This document is a major project report for an RFID door lock system using an Arduino. It includes an introduction describing electronic door locks and motivation for the project. It then provides a block diagram, lists of required components, tools and software. It includes circuit diagrams and descriptions of the working principle and Arduino code. The system uses an Arduino, RFID reader module, RFID cards/tags, IR sensor, servo motor and LCD to unlock a door when a valid RFID tag is scanned.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

MAJOR PROJECT REPORT

RFID Door Lock System using


Arduino
Under the guidance of
Ms. Savita Mam

Submitted By: -
Shreyash Kushwaha (00155204919)

Bachelor Of Technology
In
Electrical & Electronics Engineering

BHAGWAN MAHAVEER COLLEGE OF ENGINEERING


AND MANAGEMENT
JAGDISHPUR, SONEPAT
AFFILIATED TO GGSIPU DWARKA, DELHI
Table of Contents
 Introduction
 Project Concept/Overview
 Block Diagram of RFID Door Lock System using Arduino
 Components Required
 Tools Required
 Software Required
 Circuit Diagram/Schematic of RFID Door Lock System
using Arduino
 Working Principle
 Arduino Code of RFID Door Lock System using Arduino

Introduction
In the previous age, a normal Lock and key are used to lock the door and
gate. But in this modern age, some houses, hotels, offices, and other places
are using electronic door locks systems, these are basically keyless door
locks i.e., don’t need a key to unlock the door. Several types of access
control systems are used in electronic door locks to access the door. The
most used access control systems are PIN/Password (Personal
Identification Number), fingerprint, and RFID based electronic door locks
systems.
In this project, we’ll learn how to make RFID based electronic door locks
systems using Arduino and RC522 RFID Module. In this system, you need
a particular card or key tag and put it in front of the RFID door locks
system box (RFID Reader) to unlock the door. If you put the wrong card
or key tag in front of the RFID door locks system box (RFID Reader) then
the door would not unlock. This system is also known as the card door
lock system or key card door lock system.

Project Concept/Overview
The RFID Door Lock System is constructed using 4 major components
these are Arduino, RFID Redder Module, RFID Card or Key Fob Tag, IR
Sensor, Servo Motor, and LCD Display. Here I’ll use Arduino Nano as the
main microcontroller that controls the whole system. You can use any
other type of Arduino board like Arduino Uno or Mega. The RFID Redder
Module is used to read the Card or Key Tag value and send the value to
the Arduino. Then the Arduino matches this value with the pre-defined
value in the code. If this value is matched then the microcontroller sends a
command to the servo motor to unlock the door. The servo motor is used
to control the lock mechanism. The IR sensor is used to check whether the
door is open or closed. LCD display shows the RFID value reading status
(Card correct or wrong) and the door status (open/close). LEDs and buzzer
are used as door status (open/close) indicators.

Block Diagram of RFID Door Lock System using


Arduino
Block Diagram of RFID Door Lock System using Arduino

Components Required
Components Name Quantity
Arduino NANO 1
RC522 RFID Module 1
RFID Card or Key Fob Tag 1
IR Sensor Module 1
16×2 LCD Display Module 1
Sg-90 Servo Motor 1
220-ohm Resistor (R1, R2, R3) 3
10K ohm Potentiometer (VR1) 1
Red LED  1
Green LED  1
5v Buzzer 1
9v Power Supply 1
Rocker Switch 1
PCB board 1
As required in the circuit
Connecting wires diagram
Tools Required

Tools Name Quantity


Soldering Iron 1
Soldering wire 1
Soldering flux 1
Soldering stand 1
Multimeter 1
Desoldering pump 1
Wire cutter 1

Software Required

Arduino IDE (Integrated Development


Environment)

Circuit Diagram/Schematic of RFID Door Lock


System using Arduino
Circuit Diagram/Schematic of RFID Door Lock System using Arduino

Working Principle
Initially, the IR sensor module checks whether the door is open or closed.
When the door is open the IR sensor produces High (1) output value from
the output pin. The Arduino reads this value and understands the door is
open, then sends a command to the servo motor to pull back the barrel
handle of the sliding lock to unlock the door. This time the LCD display
screen shows the message “Door is Open! Close The Door”, and the Red
LED starts blinking and the buzzer generates the “Beep Beep” sound. In
this condition, the RFID Reader Module does not read the card and key
fob tags.
When the door is closed the IR sensor produces Low (0) output value from
the output pin. Again, the Arduino reads this value and understands the
door is closed, then sends a command to the servo motor to push the barrel
handle of the sliding lock forward to lock the door. This time the LCD
display screen shows the message “Welcome – Scan Your Card>>”, and
the Red LED is turned on. In this condition, the RFID Reader Module is
Ready to read the card and key fob tags.
When an RFID Card/tag comes in the range of the RFID Reader Module
(transceiver), it is scanning the Card/tag and reads the value. Then Arduino
Nano board reads this value from the RFID Reader and matches this value
with the pre-defined value in the code. Already we have saved the value of
the Card/tag in the code.
If the Card/tag value is matched, then the Arduino produces PWM output
from Pin 6 to activate the servo motor. Now the servo motor will pull back
the barrel handle of the sliding lock to unlock the door. For a few
seconds, the LCD display screen shows the message “Welcome, Door is
Open”, and the Green LED starts blinking and the buzzer generates the
“Beep Beep” sound.
 After this time if the door is not closed then the LCD display screen
shows the message “Door is Open! Close The Door”, and the Red
LED starts blinking and the buzzer generates the “Beep Beep”
sound.
 If the door is closed during this time period, then the servo motor
pushes the barrel handle of the sliding lock forward to lock the
door. Now the system is ready to read the cards again.
If the Card/tag value does not match, then the Arduino doesn’t activate the
servo motor. So, the door will still be locked. The LCD display screen
shows two messages “Wrong Card, Access Denied! ” then “Please, Try
Again!”, Try Again”. Now the Red LED and buzzer will turn ON.
Arduino Code of RFID Door Lock System using
Arduino
/* RFID Door Lock System using Arduino and RFID Module

[Link]

*/
//Include library

#include <SPI.h>

#include <MFRC522.h>

#include <LiquidCrystal.h>

#include <Servo.h>

#define RST_PIN 9 // Define RST pin of RFID Connnected to Digital Pin 9

#define SS_PIN 10 // Define RST pin of RFID Connnected to Digital Pin 10

#define Sensor_Pin 7 // Define IR Sensor pin Connnected to Digital Pin 7

#define Red_LED 2 // Define Red LED Connnected to Digital Pin 2

#define Green_LED 3 // Define Green LED Connnected to Digital Pin 3

#define Buzzer 4 // Define Buzzer pin Connnected to Digital Pin 4

byte readCard[4];

//Unique ID of RFID Tag, which you want to give access.

String MasterTag = "A9591AB4"; // REPLACE this Tag ID with your Tag ID!!!

String tagID = "";

// Create instances

MFRC522 mfrc522(SS_PIN, RST_PIN);

LiquidCrystal lcd(A0, A1, A2, A3, A4, A5); // Define LCD Display pin Connnected to Arduino Pin

Servo myServo; // Servo motor


void setup()

// Initiating

[Link](); // SPI bus

mfrc522.PCD_Init(); // MFRC522

[Link](16, 2); // //Initialise the LCD to 16x2 Character Format

[Link](9600); //open the serial port at 9600 baudrate.

[Link](6); // declare Servo Connnected to Digital Pin 6

//Set Components pin modes

pinMode(Sensor_Pin,INPUT);

pinMode(Red_LED, OUTPUT);

pinMode(Green_LED, OUTPUT);

pinMode(Buzzer, OUTPUT);

[Link](10); // Initial lock position of the servo motor

digitalWrite(Red_LED, HIGH); // Red LED on

digitalWrite(Green_LED, LOW); // Green LED off

digitalWrite(Buzzer, LOW); // Buzzer off

//Print beginning message on LCD Display


[Link](0,0);

[Link]("[Link]");

[Link](0, 1);

[Link](" RFID DOOR LOCK ");

delay(2000);

digitalWrite(Buzzer, HIGH);// Buzzer on

delay(50);

digitalWrite(Buzzer, LOW);// Buzzer off

printNormalModeMessage(); // print Normal Mode Message on LCD Display

void loop()

int sensorValue = digitalRead(Sensor_Pin); // Read IR Sensor Output

[Link] (sensorValue); // IR Sensor Output on Serial Monitor

// If Door is Closed

if (sensorValue == 0)

[Link](10); // Initial lock position of the servo motor

printNormalModeMessage(); // print Normal Mode Message on LCD Display

digitalWrite(Red_LED, HIGH); // Red LED on

digitalWrite(Green_LED, LOW); // Green LED off


//Wait until new tag is available

while (getID())

// If RFID Card or Key fob tag is Correct

if (tagID == MasterTag)

[Link](170); // // Initial unlock position of the servo motor

//Print message on LCD Display

[Link]();

[Link](0,0);

[Link](" Welcome ");

[Link](0,1);

[Link](" Door is Open ");

Green_LED_Blink(); // Green LED & Buzzer function

digitalWrite(Red_LED, LOW); // Red LED off

digitalWrite(Buzzer, LOW); // Buzzer off

// If RFID Card or Key fob tag is Wrong

if (tagID != MasterTag)

//Print message on LCD Display


[Link]();

[Link](0,0);

[Link](" Wrong Card ");

[Link](0,1);

[Link](" Access Denied! ");

delay(2000);

Red_LED_Blink2();// Red LED & Buzzer function2

//Print message on LCD Display

[Link]();

[Link](0,0);

[Link](" Please ");

[Link](0,1);

[Link](" Try Again! ");

delay(2000);

digitalWrite(Green_LED, LOW); // Green LED off

digitalWrite(Buzzer, LOW); // Buzzer off

printNormalModeMessage(); // print Normal Mode Message on LCD Display

}
// If door is open...

else

[Link](170); // // Initial unlock position of the servo motor

//Print message on LCD Display

[Link]();

[Link](0, 0);

[Link](" Door is Open! ");

[Link](0, 1);

[Link](" Close The Door ");

Red_LED_Blink1(); // Red LED & Buzzer function2

//Read new tag if available

boolean getID()

// Getting ready for Reading PICCs

if ( ! mfrc522.PICC_IsNewCardPresent()) { //If a new PICC placed to RFID reader continue

return false;

}
if ( ! mfrc522.PICC_ReadCardSerial()) { //Since a PICC placed get Serial and continue

return false;

tagID = "";

for ( uint8_t i = 0; i < 4; i++) { // The MIFARE PICCs that we use have 4 byte UID

//readCard[i] = [Link][i];

[Link](String([Link][i], HEX)); // Adds the 4 bytes in a single String variable

[Link]();

mfrc522.PICC_HaltA(); // Stop reading

return true;

// print Normal Mode Message on LCD Display Function

void printNormalModeMessage()

[Link]();

[Link](0,0);

[Link](" Welcome ");

[Link](0, 1);

[Link]("Scan Your Card>>");

// Red LED & Buzzer function1

void Red_LED_Blink1()

{
for( int i = 0; i < 2; i = i +1 )

digitalWrite(Red_LED, HIGH); // Red LED on

digitalWrite(Buzzer, HIGH); // Buzzer on

delay(700);

digitalWrite(Red_LED, LOW); // Red LED off

digitalWrite(Buzzer, LOW); // Buzzer off

delay(700);

// We can adjust the delay time accordingly

// Red LED & Buzzer function2

void Red_LED_Blink2()

for( int i = 0; i < 5; i = i +1 )

digitalWrite(Red_LED, HIGH); // Red LED on

digitalWrite(Buzzer, HIGH); // Buzzer on

delay(100);

digitalWrite(Red_LED, LOW); // Red LED off

digitalWrite(Buzzer, LOW); // Buzzer off

delay(100);

// We can adjust the delay time accordingly

}
}

// Green LED & Buzzer function

void Green_LED_Blink()

for( int i = 0; i < 15; i = i +1 )

digitalWrite(Green_LED, HIGH); // Green LED on

digitalWrite(Buzzer, HIGH); // Buzzer on

delay(150);

digitalWrite(Green_LED, LOW); // Green LED off

digitalWrite(Buzzer, LOW); // Buzzer off

delay(150);

// We can adjust the delay time accordingly

Common questions

Powered by AI

LEDs and buzzers serve as indicators providing visual and auditory feedback. The Red LED indicates the door's locked status, while the Green LED signals an unlocked status . The buzzer provides auditory signals for actions such as unlocked or incorrect card entries, enhancing user interaction by generating a "Beep Beep" sound when the door status changes or an incorrect card is used . This feedback mechanism informs users of successful card reads, access denial, and system readiness to read cards again .

RFID technology in door lock systems introduces both security strengths and vulnerabilities. On the positive side, RFID allows for rapid, keyless access control, reducing unauthorized access when properly managed . However, security concerns include the potential for cloning RFID cards/tags, eavesdropping on RFID communication, and relay attacks. Therefore, securing RFID systems involves implementing encryption, regularly updating access codes, and utilizing multifactor authentication to mitigate these risks . Proper installation and routine audits can further enhance system security .

The RFID module reads the value from an RFID card or key fob when it is placed near the module . This value is then sent to the Arduino board, which compares it with predefined values stored in the Arduino's code . If the card's value matches the predefined value, the Arduino sends a PWM signal to the servo motor via pin 6, effectively unlocking the door by pulling back the barrel handle of the lock .

Scalability in RFID-based door lock systems can be achieved by using modular components that allow for easy expansion, such as using Arduino Mega for more I/O ports as the system grows . Flexibility is enhanced by programmable Arduino boards that allow updates and customization of access rules and integration with other smart home systems through IoT connectivity . Utilizing wireless communication protocols like WiFi or Bluetooth can also enhance system adaptability to various networking environments, facilitating remote control and monitoring .

The Arduino Nano microcontroller serves as the central processing unit that integrates various components such as the RFID module, servo motor, IR sensor, LEDs, and buzzer . It reads data from the RFID module and IR sensor, processes these inputs, and based on predefined conditions, sends commands to the servo motor to unlock or lock the door. It also controls the status displays on the 16x2 LCD and the feedback mechanisms of the LEDs and buzzer, thereby managing the system's overall operation and ensuring smooth interaction between components .

Technical challenges in the installation and maintenance of RFID door lock systems include ensuring proper electrical connections, code integrations, and compatibility with existing systems. Loose connections or improper soldering during installation can cause intermittent failures, which can be mitigated by using quality tools and conducting rigorous testing post-installation . Maintenance challenges involve ensuring RFID tags and components remain functional over time, which can be achieved through regular system diagnostics, software updates, and replacing worn components like RFID readers or cards .

RFID technology has diverse applications beyond door lock systems, including supply chain management for tracking goods, inventory control in retail stores, and automated payment systems like toll booths . In healthcare, RFID is used for patient identification and tracking medical equipment. Libraries employ RFID for book tracking and self-checkout systems. Moreover, it finds applications in animal tracking for husbandry and wildlife conservation, enhancing management efficiency and security across various fields .

The Arduino code differentiates RFID tags by comparing the read tag ID with the predefined MasterTag ID stored in the code . If the ID matches, the code activates the servo motor to unlock the door and displays a welcoming message on the LCD, with the Green LED blinking and the buzzer sounding . Conversely, if the ID does not match, it displays an "Access Denied" message, blinks the Red LED, sounds the buzzer, and prompts the user with "Please, Try Again!" messages .

If the RFID reader fails to detect an RFID tag, the first strategy is to check the connections between the RFID module and Arduino for any loose wires . Another strategy is to verify the RFID tag's functionality with a multimeter or replace it with a new one if faulty. Additionally, ensuring the Arduino IDE is properly set up with the correct library and using serial monitoring can help diagnose issues between the Arduino and RFID module . Verifying the operational status of the power supply and checking the RFID module for damage could also solve detection issues .

The IR sensor module determines whether the door is open or closed by producing a high output when the door is open and a low output when it is closed. The Arduino reads this output to either unlock or lock the door using the servo motor. If the door is open, the IR sensor signals the Arduino to pull back the barrel handle to unlock it . Conversely, when the door is closed, the IR sensor notifies the Arduino, which then locks the door by pushing the handle forward .

You might also like