How to Make RFID Based Door Lock System Using Arduino in Easy Way

by ROBO HUB in Circuits > Arduino

2188 Views, 36 Favorites, 0 Comments

How to Make RFID Based Door Lock System Using Arduino in Easy Way

make rfid door lock.JPG
rfid dor loc.gif
arduino lock.JPG

Hey there in this instructables i will show you how I made this RFID door lock system that uses a tag that can open and close the lock upon tapping, and the catch here is like the physical key you can use the tag.

Like th fingerprint that is unique for every individual we can refer to the tags of an RFID scanner that are unique and don't match with the other tags this feature of this will enable us to use this as a key and keep the lock system secure.

The project main part is the open and close mechanism that is controlled by the servo, and the mechanism hardware is made with 3d printed parts to keep the system running without any obstructions.

In simple ways i will explain how this project works

There will be unique tag that you need to keep safe because this is your key to access the door, If you tap on the scanner with this key there will be green light and the servo opens in other way the door lock is open and this is achieved by gears that moves the slider in and out.

On the other way round if the wrong id is tapped the red led glows and there will be no movement in the servo.

There is a detailed instruction with code, circuit diagram and working video if you are building this project.

You can install this door lock system to your farm gates or any door that needs additional layer of security, all the best with your project


Supplies

114d.png
6d.png
5d.png
15d.png

Below are the list of components that you will need to build this project, i recommend using same components since the 3d printed parts rely on these exact parts.

Arduino Uno board

MFRC522 RFID Reader

Micro Servo plastic geared

LEDs (Green and Red)

Jumper Wires

Piece of cardboard

Hot glue

3D printer

Arduino IDE and programming Cable

3D Printing

2d.png
4d.png
3d.png
d003.jpg
doo2.jpg
doo.jpg
1d.png

You can see that this is the part that enables the lock and unlock mechanism and will let you open and close the door, To make this work without any errors this part was made with 3d print.

You can simply go below and find the attached stl files, import them to curea slicer and print them.

Since the parts are simple there is no need of using rafts or support at the time of printing, you can simply follow the settings that i have given from the cura application and head over to printing

There are total 3 parts that needs to be 3d printed, the first one is the actual main body that holds the slider with teeth and also the servo, I used PLA filament to print the parts and the choice of color is left to you.

Second part is the Gear that will be attached to the horns of the servo that will control the movement of slider in and out when the servo is activated.

The third is the slider with the teeth, this teeth aligns with the gear teeth thereby taking the control of entire system.


Circuit Diagram

rfid door lock circuit.jpg
7d.png
flexxible pcbs.png
rigid flex pcbs.jpg
rigid flex pcbs.png
rigid pcb.jpg
sixth design compet.jpg

To make this circuit easier i will break down the entire circuit into 3 different parts.

RFID, Servo motor and LED connections, all the components were connected using jumper wires and for the power supply ill use the USB power via powerbank.

RFID Reader (MFRC522) Connections.

  • SDA (SS_PIN) is Connect to Digital Pin 10
  • SCK IS Connect to Digital Pin 13 on the Arduino
  • MOSI Connect to D11
  • MISO Connect to D12
  • IRQ Not connected.
  • GND to GND
  • RST (RST_PIN) To D9 on the Arduino
  • 3.3V is connected to 3.3V on the Arduino

Servo Motor Connections, the servo has 3 pins and we are connecting as follows

  • Signa to Digital Pin 3
  • VCC is Connect to 5V on the Arduino
  • GND is Connected to GND on the Arduino

LED Connections

We are using 2 types of LED, one is red and the other is green

Green is connected to d5 and the red to d4, Note that these are for positive pins

The other leg that is negative is connected to gnd on the uno, if you think you have no pin for the connection you can combine the gnd pin of servo and LED together.

You also can simplify this circuit with a Simple small PCBComplete your electronic projects in the best way from PCBWay

Why them? They have provided me with the best PCB and The quality is just amazing compared to other providers in the market, They also have Color PCB printing Try it out.

Don't have a 3d printer? You can get the best 3d printing service here

Check Here for Rigid-flex Pcbs with this your circuit becomes flexible! I have added the images to this step kindly check.

A revolutionary solution that combines the best of both rigid and flexible circuitry to elevate your electronic projects to new heights.

With their expertise in advanced manufacturing techniques, they offer a seamless integration of rigid and flexible components, ensuring enhanced reliability, durability, and space-saving benefits.

PCBWay's 10th anniversary is approaching, and there will be a special event in June/July! Stay tuned for exciting offers.

Arduino Code

cod.jpg
10d.png
12d.png
13d.png

This is the arduino program we will be using in this project, You can simply download the code from below and paste it on the arduino IDE.

After you upload the code there is one important step that you need to do to make this circuit work.

Open the serial monitor, select proper port and type of board and click on upload, Now again open serial monitor and you should see a message asking for tapping the tag on the scanner.

Copy this ID and paste on the actual code by replacing the old id in the code with yours.

Now you should again reuplaod the code and then disconnect the power cable.

Circuit Testing

arduino rfid.gif
16d.png
19d.png

After the code is uplaoded to the board we can test the circuit, Connect the USB supply to the powerbank or any other USB devices.

Here you need 2 tags to test this, i already had multiple tags that look exactly same so to mark the valid and non valid i added a small steel ring to the valid tag so that i can show you the difference.

Power on the circuit and tap on the valid or invalid tag, if your tag is valid the green light glows and immediately the servo make movement and this time can be adjusted in the code as per your requirement.

In the other case if the tag is not valid or not preregistred the red led starts to glow, i earlier thought of adding a buzzer but that buzzer runs for a few seconds creating chaos, So thought not to add that here.

There is a code for the buzzer you can have a look it if you are interested, But if you are new to this i recommend to proceed with my current setup.

Electronics

21d.png
23d.png
22d.png
25d.png
24d.png

I will place all the electronics on a piece of cardboard, to begin with i will place arduino and to couple this instead of using hot glue i recommend to use double side adhesives.

To add the scanner you can select your best place but in my current setup i thought the side are the best places since it is clearly visible and there is no risk of touching wires when its working.

You can also replace this cardboard with wood or 3d printed base, anyways you can also add this directly to door using adhesives.

Assembling Mechanism

31d.png
32d.png
34d.png
33d.png

To add the 3d printed mechanism that control the open and closing of the lock we can either add it directly to the door but it makes difficult to demonstrate to you so i placed all these on a cardboard.

Use hot glue to stick the main body, Now insert the servo to the dedicated slot and finally add the gear and the slider to this.

Now the project is ready for testing all you have to do is power this and tap on the scanner with tag and any one of the 2 instances will happen like given below.

To have an Authorized Access a registered card should be scanned, the green LED lights up, and the servo unlocks the door.

Unauthorized Access is when an unrecognized card is scanned, the red LED lights up to indicate that access is denied.

In the future i will add a display that shows these messages but the problem with display is it consumes more power which drains the battery and make the project unusable for a long period in case you are planning to use battery.

This problem can be eliminated if you are using a supply from USB cable


Working Video

How to Make Arduino RFID Door Lock system | Arduino project ideas

You can clearly see the tag registration part that i said above in the program part on this video also there is a detailed tutorial and working video too.

If you still have any question or suggestion for improving this project and taking this to another level you can leave us a comment, Thank you for reading this instructables and see you soon with new project.