Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

RFID-Enabled Arduino Door Lock System with LCD Feedback

View and Edit Project In Cirkit DesignerImage of RFID-Enabled Arduino Door Lock System with LCD Feedback

RFID Door Lock System Documentation

Summary

The RFID Door Lock System is designed to control access through a door using RFID technology. The system uses an Arduino Micro as the central processing unit, interfacing with an RFID-RC522 module to read RFID tags. When a valid RFID tag is presented, the system activates a solenoid lock, allowing access. The system provides visual feedback through red and green LEDs and audible feedback with a piezo buzzer. An LCD screen displays the system status. A pushbutton is included to manually override the system and unlock the door. The system is powered by a 9V battery and uses a relay module to control the higher voltage required by the solenoid.

Component List

Wiring Details

RFID-RC522

Solenoid

LED (Red)

LED (Green)

Piezo Buzzer

Pushbutton

Resistor (220 Ohms)

Resistor (1000 Ohms)

Resistor (220 Ohms)

Relay Module (5V-30V)

LCD Screen (16x2 I2C)

9V Battery

Documented Code

The code for the Arduino Micro is written in C++ and uses several libraries to interface with the RFID-RC522 module, the LCD screen, and to control the GPIO pins. The code is structured into two main functions: setup() and loop(). The setup() function initializes the serial communication, SPI bus, RFID reader, GPIO pins, and the LCD screen. The loop() function continuously checks for the presence of an RFID card, reads the card's UID, and compares it to a predefined valid UID. If the UID matches, it grants access by activating the solenoid lock, turning on the green LED, and sounding the buzzer. If the UID does not match, it denies access, activates the red LED, and sounds the buzzer in a different tone. The pushbutton provides a manual override to unlock the door.

#include <Wire.h>
#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 16, 2);

#define SS_PIN 10
#define RST_PIN 9
#define LED_G 4 //define green LED pin
#define LED_R 5 //define red LED
#define BUZZER 2 //buzzer pin
#define lock 3
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.
int Btn = 6;

void setup() 
{
  Serial.begin(9600);   // Initiate a serial communication
  SPI.begin();      // Initiate SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522
  pinMode(LED_G, OUTPUT);
  pinMode(LED_R, OUTPUT);
  pinMode(BUZZER, OUTPUT);
  noTone(BUZZER);
  pinMode(Btn, INPUT);
  pinMode(lock, OUTPUT);
  Serial.println("Place your card on reader...");
  Serial.println();
  lcd.begin();
  lcd.backlight();
  lcd.clear();
  lcd.setCursor(0,0); // column, row
  lcd.print(" Scan Your RFID "); 
  lcd.setCursor(0,1); // column, row
  lcd.print("   Door Locked   ");
}

void loop() 
{
  // Manual override button
  if (digitalRead(Btn) == HIGH)
  {
    // Unlock door sequence
  }

  // RFID card detection and validation
  if (!mfrc522.PICC_IsNewCardPresent()) 
  {
    return;
  }

  if (!mfrc522.PICC_ReadCardSerial()) 
  {
    return;
  }

  // Process the read UID and compare with authorized UID
  // Grant or deny access based on the UID
}

Note: The code provided above is a simplified version of the actual implementation. It includes the main structure and key functionalities. The full code includes additional logic for handling the RFID reading, access granting, and system feedback through LEDs and buzzer.