Introduction: RFID Lock System Using Arduino

About: Mechatronics Engineer who loves to implement new ideas. Expertise in mechanical design, electronics, 3D printing, and robotics.

Hello everyone, This is my first instructable and was presented by Judhi Prasetyo. The workshop was hosted by Assembly , where I am working as an intern and its one of the best place to work if you are a maker.

Coming back to the RFID lock system, I will explain to you how it works.


  • We use RFID tag and reader in this system.
  • Now every tag has a unique code
  • when you place the tag on the reader which is connected to Arduino
  • The reader decodes the radio frequency code to multiple characters and sends it to Arduino
  • Arduino already has stored RF code in its memory which is written by us
  • Arduino checks if the RF code received matched to the code in its memory
  • If it matches then servomotor opens the lock with rack and pinion mechanism that converts rotation motion to linear motion

Step 1: Materials Required

Here are some of the materials needed:-

  1. RFID-RC522 Module
  2. Arduino Uno
  3. 3D Printed Parts from here - here
  4. Any Standard size servo motor (40.8 × 20.1 × 38 mm) with 180 degree rotation. Eg:- Mg995 servo
  5. M3 screws and nut to mount the motor
  6. Breadboard and 2 LED lights

Here are the 3D printed files below

If you have the 3D printer then use the settings from the Thingiverse link otherwise use 3DHubs who will ship the parts to you.

Step 2: Assembly and Circuit Diagram

Above is the circuit diagram which you have to follow.

Assembly of gear with servo can be done with normal mount screws which come with servo itself.

During the workshop, there was a problem of servo motor not being fit inside the 3D printed part. It happens due to the inaccuracy of 3d printer occasionally. If that happens then use a soldering iron to melt the material and make it correct.

Step 3: Arduino Code

Download the code above and upload it to your Arduino Uno. I have explained the code also. Make sure that you first scan the RFID tag to find it's code on the serial port and put it in the 'cardno' variable.

Step 4: Trouble Shooting

Here are the possible problems which you can come across. It's the same problem which happened during the workshop.

1) Servo motor not fitting inside the lock system?

A) This is not a design fault but happens mainly due to inaccuracy of 3d printer occasionally. Just use a soldering iron to increase the gap for servo mount.

2) Servo not moving at all?

A) There is a possibility of connection being loose or connected the wire in the wrong place. There is no error in programming so cross-check again.

3) RFID reader not recognizing the tag?

A) Looks like you forgot to scan your card number and put it in the 'cardno' variable. Do that and see.

4) Does servo lock the door instead of opening it when tagged with RFID?

A) This happens when you mount the servo in the opposite direction. Just change the orientation of servo or put this code instead if you are feeling too lazy to change.

Step 5: Congratulation!

As you can see that we used a smaller version of lock structure and servo motor. We did that to reduce the cost and mainly to teach people. But if you are serious about implementing this lock system to your home then go for the normal 3d printed design and good servo.

Well done for completing the project. If you did this project differently, find something new or need help then let me know in the comments below.

Step 6: Smart Lock System Using Arduino

Video credits - Amit Jindani