Arduino RFID Door Lock


On this page I will document and explain how to build a relatively cheap electric door lock based on an Arduino Nano and a RFID shield. I have a small garden with a bicycle shed that has a door to the common area behind our house. I have a lock on this door, but a lot of people have a key, my children, my neighbor and buying a new spare key takes long and is expensive. And then people lose their key, so I thought of a simple solution where I could make many keys and could authorize, but also unauthorize keys. I though of a solution using simple 125 Khz RFID keys and a cheap reader and an Arduino Nano processor. I ordered an electric lock online because it was hard to get here in a shop and rather expensive. I gave everyone who needs access to my garden (fi. to feed the animals) a small RFID key, and created a 3D printed reader next to the door and its working fine. On thsi page I will show you how I build it, because it’s all standard components, you could design your own version, if for instance you add a clock chip you could even give certain RFID keys only access at specific times. You can download all the files from this website, if hope this project will inspire you to create your own version. Regards, Hein Pragt

Step 1: So What Components Do You Need?

  • An Arduino Nano board;
  • EM4100 RDM-6300 RFID card reader 125 khz (or compatible);
  • Some 125 Khz RFID badges;
  • Led with 330 Ohm resistor;
  • 2N7002 Mosfet;
  • 10 K resistor;
  • 1N4004 diode;
  • 5 Volt relay;
  • 7808 voltage regulator;
  • 12V power supply at least 2A;
  • Terminal connector for power;
  • Terminal connector for lock wires;
  • An electric lock (Fail-Secure);
  • PCB board to mount the parts;
  • Female header pins to mount the Arduino and RFID reader.

I usually mount the Arduino Nano and other boards with a female pin header so they can be easily replaced when broken or if they are failing. The lock needs 12V power and I wanted a single power supply, so in order to save the Arduino from becoming very hot, I put a 7808 power regulator chip between the 12V power line and the Vin of the Arduino, I use a 5 Volt relay to switch the power to the electric lock because this device will draw a lot of current. I have used a cheap 12v switching power supply, but you can use any power supply that’s 12 V and can deliver at least 2 or 3 Amp current. For the RFID badges I use the read-only ones, they have a fixed number inside and are cheaper than the R/W badges,

Step 2: The Whole Diagram


This is the diagram of the lock system.I build it on a PCB board using several colors of wire, the diagram is not that complex. I use a 7808 power converter to lower the 12 voltage for the Arduino to 8 volt, I don’t use the capacitors on both sides as the input power is stable and the Arduino does not use too much power. But you could put two 1 uf capacitors on bothe sides of the 7808. I use the +5v output from the Arduino to power the rest of the circuit. I use a mosfet (the old common 2n7002) to drive a relay to switch the 12 v power to the lock. As the lock can draw a lot of current its save to use a relay. I took a little plastic case to hold the electronics and I 3D printed a little case on the outside to hold the antenna and the indicator led.

The Antenna and the Indicator Led.

Mount the Hardware on and Next to the Door. Mount the Hardware on and Next to the Door. Mount the Hardware on and Next to the Door.


I also designed a holder for the lock to mount it next to the door. I also used a standard door lock on the door with a latch that will move inside when the door closes. I designed a knob to mount on the lock to be able to open the lock from the inside without a RFID badge. (The third file of the knob, the axis, should be printed with 100% infill to make it strong enough) I also created a 4mm spacer for the lock, so you can mount it right in front of the latch. The lock and latch should fit loosely otherwise the unlock won’t work. I used a 12 volt 3 A switching power supply for the 12 volt and I mounted it in the top of the bicycle shed in a dry space. I have used a 3 meter wire to connect the 12 volt to the lock system.

Step 5: The Software.

I wrote a very small Arduino program to read the RFID badges and display them on the serial interface so you can read the value inside the badge. Then you can add the hexadecimal number to the array at the top of the file (don’t forget to increment the number of cards below the array). When a valid card is detected the pin 12 of the Arduino controlling the relay pin will be activated for 5 seconds. You can adjust this time to your own needs. I use the software serial to read the badge so the other serial port is free for other use. There are a lot of pins left on the Arduino, you could add a I2C clock module and enable certain badges only at certain times. There is programming space left so add what you want. The basic version is working code and currently mounted in my own backyard.


More pages on embedded software

Leave a Reply

Your email address will not be published. Required fields are marked *