Simple RFID based Door Lock using Arduino

jojo April 7, 2015 5 Comments

Its quiet fun to work with RFID based projects! In the previous article, we saw how to interface RFID with Arduino. Interfacing is the first step to create any useful project. So why don’t we create an RFID based Access Control System or an RFID based Door Lock using Arduino? The system I have designed here is a simple version of the project. This project can be enhanced with a lot of features (which I will be doing in the next version of this project – Advanced RFID based Door Lock). So lets begin!

Note:- You must read and do Interfacing RFID Reader with Arduino before proceeding with this project!

The circuit diagram to build this Simple RFID based Door Lock is given below. It’s the same circuit we used for interfacing tutorial. We will be enhancing this project with an LCD Module Display towards the end of this article. For the time being we will use Serial Monitor to display outputs.

Simple RFID Based Door Lock using Arduino

So that’s the circuit diagram! You need nothing more than this when you use Serial Monitor for output display. We need an LCD Display to make this project stand alone. So we will be wiring the LCD towards end of this article.

About the System Design

An RFID based Door Lock is based on some simple concepts. We store a set of RFID card data in our system, say 3 or 10 RFID card data. When the person with the right RFID card (compatible to data preloaded in our program/system) come and swipes his RFID tag, access will be granted. When the person with the wrong RFID card (whose data is not loaded in our system) swipes his RFID tag, access will be denied. I hope you understand the system concept of RFID based Door Lock.


Program/Code for RFID based Door Lock using Arduino

SoftwareSerial mySerial(9,10);
int read_count=0;
int j=0,k=0; // Variables to iterate in for loops
char data_temp, RFID_data[12];
char Saved_Tags[3][12]={
boolean tag_check,tag_status,entry_control;
void setup()

void loop()

void RecieveData()

void CheckData()

void AccessCheck()
Serial.println("Access Granted");
Serial.println("Access Denied");

About the Program

Note:- I have reused many parts from the interfacing RFID with Arduino tutorial. This will help you to understand the program better!

Lets begin with variables used in the program.

The variables data_temp, read_count and one dimensional array RFID_data[] serve the same purpose in interfacing RFID with Arduino tutorial.

Saved_Tags – is our 2 Dimensional array which holds preloaded RFID card data. In this example, I have loaded this array with data of 3 RFID cards.

tag_check – is a boolean variable used to hold the status of for inner for loop iteration (of CheckData() function). The comparison between preloaded data and the swiped card data happens inside CheckData() function. The swiped card data is available in one dimensional array RFID_data[]. The data in this array is compared with each card value inside our 2 Dimensional array (preloaded card data). The inner for loop performs this comparison of each row data of 2 D array with data inside RFID_data. With each successful comparison of elements, tag_check will maintain true value. If a comparison between elements fail, tag_check will be moved to false value.

tag_status – is another boolean variable used hold status of a completed comparison. This variable status is changed after one complete execution of the inner for loop. If the value of tag_check remains true after one complete cycle of inner for loop, it means the swiped card is a valid one and access can be granted. So we set this variable tag_status to true to make use of it in AccessCheck() function.

So that’s all! Now lets add an LCD module to this door lock and display lock status on LCD.

Simple RFID based Door Lock with LCD Display

The circuit diagram of our simple RFID based Door Lock using Arduino and LCD Display is given right below! You may wire up as shown in the diagram.

Simple RFID based Door Lock using Arduino

Simple RFID based Door Lock using Arduino

Note:- You may read our tutorial on Interfacing LCD Module to Arduino (if you are new to interfacing LCD with Arduino)

Implementation Photograph!

I am adding a photograph of my tested prototype!


Program for Adding LCD

We are using the above written program as such here as well. We just need to add a few lines to display on LCD module. I have attached the code below for downloading!

Download Program (RAR File) –  Simple_RFID_based_Door_Lock_with_LCD

  • jong
    October 7, 2015


    Do you have a version for interfacing Mifare RFID CR038 with Arduino?

  • alvin
    April 14, 2015

    how much is this?

    • jojo
      April 22, 2015

      @Alvin – We are yet to release a kit on this project.

  • emma
    April 1, 2015

    Good! So when are you coming up with the LCD version?

    • jojo
      April 1, 2015

      @emma -Next week!

Leave a Reply to alvin Cancel reply

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