Arduino RFID Door Lock Hardware Project Setup

RFID Door Lock using Arduino

Arduino RFID Projects

RFID Door locks are used in these days more frequently then before. These door locks do not require any key to unlock door. Instead of using a key a card and a simple RFID card reader is used in these door locks. RFID stands for Radio Frequency Identification and electronic devices that consist of a small chip and an antenna. Whenever someone puts the card in RFID card reader box the door is unlocked with a beep and blink of an LED.

Arduino RFID Door Lock Hardware Project Setup
Arduino RFID Door Lock Hardware Project Setup

Here we are briefly explaining on how to make RFID door lock where RFID will be used to authenticate and RFID tag will be used as a key. Also Arduino capabilities along with relay will be used to develop a mechanism electric door lock.

Following items will be used in this door lock.

  • Arduino UNO
  • EM-18 Reader Module with Tags
  • Relay 5v
  • LED
  • Buzzer
  • Connecting wire
  • Resistors

The RFID device and tag serves as a same purpose as magnetic strip on ATM and its reader in an ATM machine. In this project we are using EM-18 Reader Module with tags with Arduino UNO. It operates at 125 KHz and it comes with a chip and antenna to enhance its range to 10-15cm.

12 digits are used in ASCII format for output by EM-18 RFID reader. First 10 digits are used as card number and last two are present there for last two digits.

Complete Code

The complete code is given below and is pretty much self explanatory. However, I am mentioning few important things.

In the below code, the RFID tag number are stored in the “char tag. “180088F889E1” is my RFID tag number stored in the microchip of the Transponder. The length of the tag number is 12 we have defined the array like “char input [12]”, 12 defines the no. of character or size of array.

RFID tag number is stored in char array called tag. The length of the tag numeber is 12 so we also defiend a character array called input with size 12.

After that we setup the pins of the Arduino UNO board for the operation and the serial.begin() is used for the serial data transmission. Here the pin 2 is used for the relay operation, pin 3 is for the standby red LED and pin 4 is for the buzzer.

We also need to check if any RFID is getting scanned. If any tag is scanned then it will received as input and saved in array input[]. Also if condition will be used to check if any tag is being scanned at any given moment.

Now the input will be scanned with tag defined at the start of the project i.e. arrays input[] will be compared with tag. If the code is matched then the input will be confirmed and door will be unlocked.

Setup the pins o Ardhuini UNO for the operation.

boolean flag = 0;
void setup()
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);



check if the data is avaiable and if available then save it in input array

void loop()
count = 0;
while(Serial.available() && count < 12)
input[count] =;

Now we compare the scanned RFID card number with that we saved at the start in variable called tag.

if(count == 12)
count =0;
flag = 1;
while(count<12 && flag !=0)
flag = 1;
flag= 0;
if(flag == 1)
if(flag == 0)
for(int k =0; k<= 10; k++)

For more details: Please visit Arduino RFID Door Lock

1 thought on “RFID Door Lock using Arduino

Leave comment for this post......