0% found this document useful (0 votes)
6 views

RFID Door Lock System Using Arduino and RFID Module

The document describes an RFID Door Lock System using Arduino, which provides a keyless and secure access control solution. It outlines the system's components, workflow, and programming, emphasizing the benefits of RFID technology such as contactless entry and low maintenance. The user manual includes setup instructions, troubleshooting tips, and highlights the importance of maintaining a stable power source and secure master tag management.

Uploaded by

panesericson16
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

RFID Door Lock System Using Arduino and RFID Module

The document describes an RFID Door Lock System using Arduino, which provides a keyless and secure access control solution. It outlines the system's components, workflow, and programming, emphasizing the benefits of RFID technology such as contactless entry and low maintenance. The user manual includes setup instructions, troubleshooting tips, and highlights the importance of maintaining a stable power source and secure master tag management.

Uploaded by

panesericson16
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

RFID Door Lock System Using Arduino and RFID Module

Overview
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 that 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.
When it comes to security, RFID door lock systems are very common for access
control, as they provide a reliable, consistent experience with trackable data.
Unlike other forms of traditional access control such as swipe cards, RFID locking
systems are contactless, meaning that the credential doesn’t have to touch the
reader for it to work. RFID door lock access control system contains the user’s
credentials with a keycard with unique information called a tag. Compared to
traditional locks and keys it offers more security and convenience some of the key
benefits of using RFID door lock systems is contactless entry experience, easy to
configure, more secure, and low maintenance costs. Rather than cutting new keys
and retooling locks, configuring an RFID entry system is primarily digital, this make
adjusting settings and making changes much easier.

Project Application
An RFID based Door Lock is based on some simple concepts. We store a set of RFID
card data in our system, say 3 or 10 RFID card data. When the person with the right
RFID card (compatible to data preloaded in our program/system) come and swipes
his RFID tag, access will be granted. When the person with the wrong RFID card
(whose data is not loaded in our system) swipes his RFID tag, access will be denied.

Radio Frequency Identification Technology has been around for many years and is
used in many different industries and applications. RFID cards have the advantage
of being contactless unlike magnetic stripe cards, which means that you don’t need
to swipe the card. All you need to do is place the RFID card in close proximity to the
reader. RFID lock systems include a card equipped with an RFID chip that stores
information needed to unlock the door. An RFID reader is placed near the door
handle, which reads the information present in the card. This information is
matched with the data present in the computer system to check whether the right
key is present or not. If the key matches the data present in the database, the door
is unlocked. RFID locking systems are not only limited to the hotel industry, they
are also used in dorms, hospitals, business buildings, and commercial property.
They are much better than the traditional lock systems because they provide a high
level of security. Hackers cannot easily tap into your RFID system because of the
high-level encryption that protects it. Moreover, RFID cards do not get affected by
the environment and they are weatherproof as well.

System Design
Bill of Materials
Quantity Description Vendor/Supplier Unit Cost Total Cost
1 Arduino Uno Shopee 529.00 529.00
1 Arduino Power Shopee 185.00 185.00
Supply
1 RFID Sensor Shopee 249.00 249.00
3 RFID Tags Shopee 100.00 300.00
1 LCD Display Shopee 149.00 149.00
1 Micro Servo Shopee 150.00 150.00
1 Proximity Sensor Shopee 50.00 50.00
1 Iron Stick or GI Local Warehouse 50.00 50.00
Wire
4 Resistors Shopee 50.00 200.00
1 Door Lock Shopee 100.00 100.00
1 Breadboard and Shopee 299.00 299.00
Jumpers

Graphical Wiring Diagram


Before going through the code of the RFID door lock system, the components and
circuit schematics of the project should be examined. In addition to the RFID
module, a proximity sensor will be used to check whether the door is closed or
opened, a servo motor will be used for the lock mechanism, and a character display
will also be utilized.

System Workflow / Device Manual


First, a master tag must be set to activate the normal mode of the system. If an
unknown tag is scanned, the access will be denied. However, if the master tag is
scanned, the system will enter a program mode that allows for the addition and
authorization of unknown tags. Once an unknown tag is authorized, access will be
granted upon subsequent scans, allowing the door to be opened.
Once the door is closed, it will automatically lock. To remove a tag from the system,
one must enter program mode again, scan the known tag, and the tag will be
removed from the authorized list.
When the door is closed the proximity sensor produces Low (0) output value from
the output pin. The Arduino reads this value and understands that 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 “- Access Control -, Scan Your Tag!” this serves as the normal mode
message. In this condition, the RFID reader module is ready to read the card and
key fob tags.
After scanning a tag, the system will check whether it is the previously registered
master tag. If the tag is the master tag, the program mode will be entered. In
program mode, if a previously authorized tag is scanned, it will be removed from
the system. If an unknown tag is scanned, it will be added to the system as
authorized.
In the normal mode, if the tag is matched to any of the registered tags the LCD
display screen shows the message “Access Granted!” and the Arduino produces
PWM output 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 normal mode message.
If the tag does not match to any of the registered tags the LCD display screen show
the message “Unregistered Tags, Access Denied!” before it shows the normal mode
message again.

Program Code / Sketch


Here’s the complete code of the project:
/*
* Arduino Door Lock Access Control Project
*/

#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal.h>
#include <Servo.h>

#define RST_PIN 9
#define SS_PIN 10

byte readCard[4];
char* myTags[100] = {};
int tagsCount = 0;
String tagID = "";
boolean successRead = false;
boolean correctTag = false;
int proximitySensor;
boolean doorOpened = false;

// Create instances
MFRC522 mfrc522(SS_PIN, RST_PIN);
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); //Parameters: (rs, enable, d4, d5, d6, d7)
Servo myServo; // Servo motor

void setup() {
// Initiating
SPI.begin(); // SPI bus
mfrc522.PCD_Init(); // MFRC522
lcd.begin(16, 2); // LCD screen
myServo.attach(8); // Servo motor

myServo.write(10); // Initial lock position of the servo motor


// Prints the initial message
lcd.print("-No Master Tag!-");
lcd.setCursor(0, 1);
lcd.print(" SCAN NOW");
// Waits until a master card is scanned
while (!successRead) {
successRead = getID();
if ( successRead == true) {
myTags[tagsCount] = strdup(tagID.c_str()); // Sets the master tag into position
0 in the array
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Master Tag Set!");
tagsCount++;
}
}
successRead = false;
printNormalModeMessage();
}

void loop() {
int proximitySensor = analogRead(A0);
// If door is closed...
if (proximitySensor > 200) {
if ( ! mfrc522.PICC_IsNewCardPresent()) { //If a new PICC placed to RFID reader
continue
return;
}
if ( ! mfrc522.PICC_ReadCardSerial()) { //Since a PICC placed get Serial and
continue
return;
}
tagID = "";
// The MIFARE PICCs that we use have 4 byte UID
for ( uint8_t i = 0; i < 4; i++) { //
readCard[i] = mfrc522.uid.uidByte[i];
tagID.concat(String(mfrc522.uid.uidByte[i], HEX)); // Adds the 4 bytes in a single
String variable
}
tagID.toUpperCase();
mfrc522.PICC_HaltA(); // Stop reading

correctTag = false;
// Checks whether the scanned tag is the master tag
if (tagID == myTags[0]) {
lcd.clear();
lcd.print("Program mode:");
lcd.setCursor(0, 1);
lcd.print("Add/Remove Tag");
while (!successRead) {
successRead = getID();
if ( successRead == true) {
for (int i = 0; i < 100; i++) {
if (tagID == myTags[i]) {
myTags[i] = "";
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Tag Removed!");
printNormalModeMessage();
return;
}
}
myTags[tagsCount] = strdup(tagID.c_str());
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Tag Added!");
printNormalModeMessage();
tagsCount++;
return;
}
}
}
successRead = false;
// Checks whether the scanned tag is authorized
for (int i = 0; i < 100; i++) {
if (tagID == myTags[i]) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Access Granted!");
myServo.write(170); // Unlocks the door
printNormalModeMessage();
correctTag = true;
}
}
if (correctTag == false) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Access Denied!");
printNormalModeMessage();
}
}
// If door is open...
else {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Door Opened!");
while (!doorOpened) {
proximitySensor = analogRead(A0);
if (proximitySensor > 200) {
doorOpened = true;
}
}
doorOpened = false;
delay(500);
myServo.write(10); // Locks the door
printNormalModeMessage();
}
}
uint8_t getID() {
// Getting ready for Reading PICCs
if ( ! mfrc522.PICC_IsNewCardPresent()) { //If a new PICC placed to RFID reader
continue
return 0;
}
if ( ! mfrc522.PICC_ReadCardSerial()) { //Since a PICC placed get Serial and
continue
return 0;
}
tagID = "";
for ( uint8_t i = 0; i < 4; i++) { // The MIFARE PICCs that we use have 4 byte UID
readCard[i] = mfrc522.uid.uidByte[i];
tagID.concat(String(mfrc522.uid.uidByte[i], HEX)); // Adds the 4 bytes in a single
String variable
}
tagID.toUpperCase();
mfrc522.PICC_HaltA(); // Stop reading
return 1;
}

void printNormalModeMessage() {
delay(1500);
lcd.clear();
lcd.print("-Access Control-");
lcd.setCursor(0, 1);
lcd.print(" Scan Your Tag!");
}

Troubleshooting
Depending on the surrounding conditions and setup of the RFID door lock system
there may be various types of issues that could arise. Here are some
troubleshooting steps that can be taken to address potential problems:
1. Check the power source: Ensure that the power source for the system is
functioning properly and that all connections are secure.
2. Verify the RFID module: Check the RFID module and ensure that it is properly
connected to the circuit board. Try scanning different tags to see if they are
recognized.
3. Inspect the servo motor: Verify that the servo motor is functioning properly
and that it is correctly attached to the locking mechanism. Test the motor
using a separate power source to confirm that it is working.
4. Check the proximity sensor: Ensure that the proximity sensor is installed
properly and that it is detecting whether the door is open or closed.
5. Verify the character display: Test the character display to ensure that it is
working properly and displaying the correct information.
6. Check the wiring: Inspect the wiring and connections to ensure that they are
properly connected and that there are no loose or broken connections.
7. Confirm the programming: Review the programming code to ensure that it
is correctly written and that there are no syntax errors or logical mistakes.

User Manual
The Arduino RFID Door Lock System is designed to provide secure access to a
designated area. This user manual provides instructions on how to use the system.
1. Setting up the system
• Assemble the components of the system as per the circuit schematics
provided.
• Upload the code to the Arduino board.
• Connect the system to a power source.
2. Setting the master tag
• Place the master tag near the RFID module.
• The system will detect the tag and set it as the master tag.
• The system will now be in normal mode.
3. Normal mode
• Scan an authorized tag to unlock the door.
• The door will automatically lock when closed.
4. Program mode
• To enter program mode, scan the master tag.
• Once in program mode, scan an authorized tag to remove it from the
system.
• Scan an unknown tag to add it to the system as authorized.
5. Troubleshooting
• Refer to the troubleshooting section of this manual for assistance with
any issues that may arise.
Important notes:
✓ Keep the master tag in a safe place.
✓ Ensure that the power source is stable and reliable.
✓ Regularly check the system for loose or broken connections.
By following the instructions outlined in this user manual, you can use the Arduino
RFID Door Lock System to provide secure access to a designated area.

Conclusion
In conclusion, the Arduino RFID Door Lock System is a reliable and secure way to
control access to a designated area. By setting a master tag and scanning
authorized tags, the system can unlock the door and automatically lock it when
closed. Additionally, the program mode allows for the removal of authorized tags
and the addition of unknown tags.
While setting up the system, it is important to follow the circuit schematics and
upload the code correctly. Regularly checking for loose or broken connections and
ensuring a stable power source can prevent potential issues. By following the
instructions provided in the user manual, anyone can use the Arduino RFID Door
Lock System to provide secure access control.

You might also like