Arduino RFID Based Door Lock
by hIOTron IoT in Circuits > Arduino
1505 Views, 2 Favorites, 0 Comments
Arduino RFID Based Door Lock
The RFID Door Lock is the lock that can be installed simply at your home and allows to easily lock and unlock doors.
Supplies
Hardware Components
Arduino Uno
EM 18 RFID reader module
Relay (generic)
LED
Buzzer
Connecting Wires
Software Components
Arduino IDE
About Project
EM-18 RFID Reader
EM-18 RFID reader works at 125 kHz and it comes with an on-chip antenna and it can be powered with 5V power supply. It gives serial output along with Weigand (Wiegand is the most popular communication method utilized by access control devices)output. The range is around 8-12cm. serial communication parameters are 9600bps, 8 data bits, 1 stop bit. The output provided by EM-18 RFID reader is in 12 digit ASCII format.
The RFID system contains two components: an RFID tag and a Reader. An antenna is for sending the data to the RFID reader module. Whenever the RFID tag arrives in the range of RFID reader, RF signal power the tag and then tag begins sending data serially. Data is further accepted by the RFID reader and the reader transfers it to the Arduino board. After that as per the code, the different tasks will perform.
In this circuit, we have saved the value of the RFID tag in the code. So, whenever that specific tag comes in range, the relay gets initiated. Whenever the Relay gets initiated the door lock will be opened.
If we scan any other RFID card than a specific tag, the buzzer will begin to beep as it’s the wrong RFID tag. IoT Training Online will help you to learn all IoT Concepts.
Arduino RFID Door Lock
Run a Program
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);
}
}
}
}
}