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

Creating A RFID Door Latch With Arduino: Instructables

This document provides instructions for creating an RFID door latch using an Arduino. It discusses the necessary supplies including an Arduino, RFID reader, servo, and LCD screen. It describes 3D printed parts to hold components and shows the wiring diagram. The code scans RFID tags, displays access messages on the LCD, and controls a servo to unlock a door if an authorized tag is used. When completed, it functions as an electronic lock that can be unlocked wirelessly using RFID tags.

Uploaded by

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

Creating A RFID Door Latch With Arduino: Instructables

This document provides instructions for creating an RFID door latch using an Arduino. It discusses the necessary supplies including an Arduino, RFID reader, servo, and LCD screen. It describes 3D printed parts to hold components and shows the wiring diagram. The code scans RFID tags, displays access messages on the LCD, and controls a servo to unlock a door if an authorized tag is used. When completed, it functions as an electronic lock that can be unlocked wirelessly using RFID tags.

Uploaded by

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

instructables

Creating a RFID Door Latch With Arduino

by KEV_123456

This is an RFID(otherwise known as Radio-Frequency Identi cation) door latch, made to unlock then lock a
door/cabinet/locker when the corresponding RFID tag is scanned.
This is a project I have been working on for about 2 weeks, and I will show you how to make it in this instructable. There
is wood construction in this project and I will brie y discuss it. I am not good with wood or construction but it is a model
to show the project mounted.
There are also 3d print les in this that are necessary and I will discuss them when it comes up. The 3d les are not my
own and I discovered them on Makerbot Thingiverse https://www.thingiverse.com/& the DIY Life https://www.the-
diy-life.com/.
Proper credit will be given to the original creators when the 3d les are discussed.
Supplies:

The Supplies are as follows:


Arduino Uno x1
Male to Female jumper wires
Male to Male jumper wires
Breadboard x1
MFRC522 RFID reader x1
RFID tag/card x1
16 x 2 Liquid Crystal display x1
Potentiometer x1
Access to a 3d printer and lament
Micro servo x1
servo push rod x1 https://www.amazon.com/Hockus-Accessories-Multiple-Adjustable-
Connecting/dp/B07V2H39X2?th=1(this link is a picture to one if there is confusion)

Creating a RFID Door Latch With Arduino: Page 1


Creating a RFID Door Latch With Arduino: Page 2
Creating a RFID Door Latch With Arduino: Page 3
Creating a RFID Door Latch With Arduino: Page 4
Step 1: Wiring the Arduino to the Micro Servo, LCD, and the RFID Reader

Tinkercad can show the wiring for the LCD and the Micro servo but not the RFID. For the RFID I will tell you speci cally
which pin to go where.

use the RFID photo as a reference

3.3v goes to the 3.3v on the Arduino


RST goes to 9
GND goes to GND on the breadboard
skip IRQ
MISO goes to 12
MOSI goes to 11
SCK goes to 13
SDA goes to 10

Creating a RFID Door Latch With Arduino: Page 5


Step 2: 3d Print Files

For the 3d print les, the LCD Screen bezel is created by TheMakersWorkbench
https://www.thingiverse.com/thing:651963
The RFID reader holder is made by DZSYhttps://www.thingiverse.com/thing:3853458
The lock was made by Sagittario and then modi ed by Michael Klements and the micro servo holder was created by
Michael Klements, RFID Lock 3D Print Files
You could also use a metal slide lock from the department store as well.

Step 3: Code

To begin downloading the libraries, code, and view your RFID cards UID, use the video above that I created to see how to
do it. I am using Arduino create for education, so this doesn't apply to Arduino IDE, also lower your volume because it is a
bit loud.

After following its instructions, in the serial monitor after scanning your RFID card, you will see a code like 39 AA E3 B3.
This is your RFID card's UID.
#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>
#include <LiquidCrystal.h>

Here are what the libraries would look like in your code.

Creating a RFID Door Latch With Arduino: Page 6


#define SS_PIN 10
#define RST_PIN 9

#define SERVO_PIN 8
Servo myservo;

#define ACCESS_DELAY 2000


#define DENIED_DELAY 1000
MFRC522 mfrc522(SS_PIN, RST_PIN);// Create MFRC522 instance.
LiquidCrystal lcd(6,7,5,4,3,2);

This is de ning the pins for the RFID module, the Mini Servo pins, and the LCD pins.

void setup()
{
Serial.begin(9600); // Initiate a serial communication
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522
lcd.begin(16, 2);
lcd.print("Scan RFID Card");

myservo.attach(SERVO_PIN);
myservo.write( 75 ); // starting degree the motor will be at
Serial.println("Put your card to the reader...");
Serial.println();

This code is initiating a serial communication, SPI bus, and the MFRC522( RFID module)
the LCD turns on and then starts on the grid (16,2), displaying "Scan RFID Card".
the Mini servo begins and moves to degree 75, while the serial monitor prints, "Put your card to the reader."

void loop()
{
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
//Show UID on serial monitor
lcd.clear();
lcd.begin(16, 2);
lcd.print("UID tag :");
String content= "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)

Creating a RFID Door Latch With Arduino: Page 7


{
lcd.setCursor(0,1);
lcd.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
lcd.print(mfrc522.uid.uidByte[i], HEX);
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
lcd.clear();
lcd.begin(16,2);
lcd.print("Message : ");
content.toUpperCase();

if (content.substring(1) == "39 AA E3 B3") //change here the UID of the card


{
lcd.clear();
lcd.setCursor(1,0);
lcd.print("Access Granted");
myservo.write( 158 ); // the degree the motor will be at
delay(7500); // how long the motor will stay at 158
myservo.write( 75 ); // goes back to 75 degrees
lcd.clear();
lcd.print("Scan RFID Card"); // says Scan RFID Card again
setup();

this is looking for the UID of the RFID card and when it is found the Cursor goes to (1,0), printing Access Granted while
moving the Mini Servo to degree 158, keeping it there for about 7 1/2 seconds then going back to 65 degrees, clearing
the LCD, then printing "Scan RFID card" again.

else {
lcd.clear();
lcd.setCursor(1,0);
lcd.print(" Access Denied");
delay(4000); // displays Access Denied for about 4 seconds
lcd.clear();
delay(DENIED_DELAY);
lcd.print("Scan RFID Card");
setup();

}
}

This part is when an RFID card is scanned but it is not an approved UID so "Access Denied" is displayed for about 4
seconds, then the LCD clears and says "Scan RFID Card" and the whole process restarts

In summary, this code is looking for a card while displaying "Scan RFID Card". when the incorrect card is scanned, then
the words "Access Denied" are displayed for about 4 seconds and the motor doesn't move. When the correct Card is
scanned the motor will open a certain amount of degrees to unlock the lock for about 7 seconds, displaying "Access
Granted" then it will lock again, continuing to display "Scan RFID Card".

https://vimeo.com/647551607

Creating a RFID Door Latch With Arduino: Page 8


Download
https://www.instructables.com/ORIG/FN7/1RB9/KW3JDUX4/FN71RB9KW3JDUX4.ino

Step 4: Wood Construction(model)

This is a model to show what the layout could look like on a door, with the front having the doorknob, 3d print RFID case,
LCD screen bezel, and a random piece of metal that serves as the door stopper.
The backside has the 3d printed lock, micro servo holder, the hole where the LCD screen goes, Arduino, mini breadboard,
and the negative and positive part of a breadboard that I ripped out.

Creating a RFID Door Latch With Arduino: Page 9


Creating a RFID Door Latch With Arduino: Page 10
Creating a RFID Door Latch With Arduino: Page 11
Creating a RFID Door Latch With Arduino: Page 12
Creating a RFID Door Latch With Arduino: Page 13
Creating a RFID Door Latch With Arduino: Page 14
Step 5: Conclusion

So, there we go! You have made a functional RFID Security door latch for your cabinet, door, or locker.
If you wish to use this for actual security make sure to use a metal door latch from a Home improvement company, like
Home Depot, also make sure to keep the LCD and the RFID module well protected and secure to prevent tampering.

Creating a RFID Door Latch With Arduino: Page 15

You might also like