Introduction: RFID Door Lock Using Arduino

Hi guys in this instructables we will learn how to create a door lock with arduino using RFID card & RFID reader.

Since RFID card is used in most of the offices and other secure buildings for door access so i thought we should also build our secure door lock using RFID reader & RFID Card to access the door lock.

Step 1: Things You Need

For this instructables we will need following things :

Arduino UNO


EM-18 Reader Module with Tags

Relay 5v

LED

Buzzer

Connecting wire

Resistors

Breadboard

Step 2: Connections

Please follow the shown schmatics and connect everything together.

Step 3: Code

Please copy the following code & upload the code to your arduino Board :

char tag[] ="180088F889E1";


char input[12];

int count = 0;

boolean flag = 0;

void setup()

{

pinMode(2,OUTPUT);

pinMode(3, OUTPUT);

pinMode(4, OUTPUT);

Serial.begin(9600);

}

void loop()

{

digitalWrite(3,1);

if(Serial.available())

{

count = 0;

while(Serial.available() && count < 12)

{

input[count] = Serial.read();

count++;

delay(5);

}

if(count == 12)

{

count =0;

flag = 1;

while(count<12 && flag !=0)

{

if(tag[count]==input[count])

flag = 1;

else

flag= 0;

}

if(flag == 1)

{

digitalWrite(2,HIGH);

digitalWrite(3,LOW);

delay(5000);

digitalWrite(2,LOW);

}

if(flag == 0)

{

for(int k =0; k<= 10; k++)

{

digitalWrite(4,HIGH);

}

}

}

}

}

Step 4: Project in Action

So after connecting everything together and uploading the code to your arduino. Its finally ready for action so connect the power and when you put your RFID card to your card reader it will give access to the door and if it is another card it will not give access. So have fun making your own door lock with Arduino.