RFID Based Door Lock System Using Arduino Uno

by Technoesolution2020 in Circuits > Arduino

7232 Views, 11 Favorites, 0 Comments

RFID Based Door Lock System Using Arduino Uno

Thubnail.jpg

Hello, friends in this post I'll show you How to make RFID based door lock system using Arduino Uno RC522 RFID module in a simple way. To make this project I used Arduino Uno as a microcontroller. I have 2 RFID cards & 1 RFID tag/Keychain. The LCD display is used to show instructions to the user. I used a 12V solenoid lock to unlock the door.

I make a detailed article on my website, you can visit my website for complete details of this project.

Click to visit my Website:- "Techno-E-Solution"

I already make a complete tutorial video on this project so you can also refer to my youtube channel for more interesting projects.

Follow us on:-
| YOUTUBE | INSTAGRAM | FACEBOOK | INSTRUCTABLES | DAILYMOTION | HACKSTER |

Watch Complete Video Tutorial:-

Material Required

10-14-2014-5-54-33-PM-e1604145229274.png

To make this project we need the following components:-

[ Above links are affiliated link If you buy from the above links we get some bonus from them ]

Circuit Diagram

Circuit Diagram.png

Follow the circuit diagram to make the connection.

Arduino Code

Copy the following code & upload it to the Arduino

For Complete Article visit my WEBSITE for more details.

/*
 * Hello,Welcome TO Techno-E-Solution
 * Check out Video Tutorial of this project:- <a href="https://www.youtube.com/watch?v=mmF7q6Nuj6Y" rel="nofollow"> https://www.youtube.com/watch?v=mmF7q6Nuj6Y
</a>
 * Here is the Arduino Code for "RFID Based Door Lock System Using Arduino"
 */
#include <Wire.h>
#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal_I2C.h> 
LiquidCrystal_I2C lcd(0x27, 16, 2);
 
#define SS_PIN 10
#define RST_PIN 9
#define LED_G 4 // Green LED pin
#define LED_R 5 // Red LED pin
#define lock 3

MFRC522 mfrc522(SS_PIN, RST_PIN);
int Btn = 6;
 
void setup() 
{
  Serial.begin(9600);
  SPI.begin();
  mfrc522.PCD_Init();
  pinMode(LED_G, OUTPUT);
  pinMode(LED_R, OUTPUT);
  pinMode(Btn,INPUT);
  pinMode(lock,OUTPUT);
  Serial.println("Place your card on reader...");
  Serial.println();
  lcd.init();
  lcd.backlight();
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print(" Scan Your RFID "); 
  lcd.setCursor(0,1);
  lcd.print("   Door Locked   ");
 }
void loop() 
{
if(digitalRead(Btn) == HIGH){
    Serial.println("Access Granted");
    Serial.println();
    delay(500);
    digitalWrite(LED_G, HIGH);
    lcd.setCursor(0,1);
    lcd.print(" Door Un-Locked ");
    digitalWrite(lock,HIGH);
    delay(3000);
    digitalWrite(lock,LOW);
    delay(100);
    digitalWrite(LED_G, LOW);
    lcd.setCursor(0,1);
    lcd.print("   Door Locked   ");
  }
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) 
  {
    return;
  }
  //Show UID on serial monitor
  Serial.print("UID tag :");
  String content= "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++) 
  {
     Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
     Serial.print(mfrc522.uid.uidByte[i], HEX);
     content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
     content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();


 if (content.substring(1) == "6A 7F 65 B3") //change here the UID of card/cards or tag/tags that you want to give access
  {
    Serial.println("Access Granted");
    Serial.println();
    delay(500);
    digitalWrite(LED_G, HIGH);
    lcd.setCursor(0,1);
    lcd.print(" Door Un-Locked ");
    digitalWrite(lock,HIGH);
    delay(3000);
    digitalWrite(lock,LOW);
    delay(100);
    digitalWrite(LED_G, LOW);
    lcd.setCursor(0,1);
    lcd.print("   Door Locked   ");
  }
else
{
    lcd.setCursor(0,1);
    lcd.print("Invalid RFID Tag");
    Serial.println(" Access denied");
    digitalWrite(LED_R, HIGH);
    digitalWrite(LED_R, LOW);
    delay(100);
    digitalWrite(LED_R, HIGH);
    delay(500);
    digitalWrite(LED_R, LOW);
    delay(100);
    digitalWrite(LED_R, HIGH);
    delay(500);
    digitalWrite(LED_R, LOW);
    lcd.setCursor(0,1);
    lcd.print("   Door Locked   ");
 }
 delay (100);
 }<br>

Demo & Working

If you like this project Subscribe to our youtube channel for a more interesting project.