RFID Base Door Lock System Using Arduino

RFID Base Door Lock System Using Arduino
RFID Base Door Lock System

RFID Base Door Lock System Using Arduino

In this Article, we learn about how to make RFID Base Door Lock System Using Arduino.

In the Last post, we learned about how to Interface JSN-SR04T Waterproof Ultrasonic Sensor with Arduino.

Let’s dive into

Components Require:

  1. Arduino Nano
  2. 5v DC supply
  3. 12v DC Supply
  4. Relay
  5. Solenoid Door Lock
  6. RFID (RC 522)
  7. Jumper Wires

Circuit Diagram: 

RFID Base Door Lock System Using Arduino
Circuit Diagram

How it works:

An RFID-based door lock system using Arduino works by utilizing radio-frequency identification (RFID) technology to control access to a door.

The RFID reader module is connected to the Arduino board. The Arduino sketch initializes the RFID reader, setting up communication and defining the pins used for RX and TX. RFID tags or cards are programmed with unique identification information. This information is stored in the memory of the RFID tags. In the Arduino code, a specific RFID tag ID is defined as authorized. This means that access will be granted to individuals carrying RFID tags with these specific IDs.

If the received RFID tag ID matches the authorized ID(s), the Arduino takes action to unlock the door. If the ID does not match any authorized IDs, the system denies access, and a message is usually sent to indicate unauthorized entry. Upon successful verification of the RFID tag, the Arduino activates a mechanism to unlock the door.

RFID Base Door Lock System Using Arduino
RFID Base Door Lock System


The RFID-based door lock system using Arduino finds applications in various scenarios where controlled access is required. Some common usages include:

  1. Home Security
  2. Office Access Control
  3. Hotel Room Access
  4. Educational Institutions
  5. Laboratories and Research Facilities

Video Tutorial: 

Programming Code:

#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal.h>

#define RST_PIN 9
#define SS_PIN 10

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
const int relayPin = 8;
const int buzzerPin = A0;
void setup() {
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC52
pinMode(relayPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
digitalWrite(relayPin, HIGH); // Activate relay


void loop() {
if (mfrc522.PICC_IsNewCardPresent() && mfrc522.PICC_ReadCardSerial()) {
String cardUID = “”;
for (byte i = 0; i < mfrc522.uid.size; i++) {
cardUID.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? “0” : “”));
cardUID.concat(String(mfrc522.uid.uidByte[i], HEX));
if (isValidCard(cardUID)) {
digitalWrite(relayPin, LOW); // Deactivate relay
delay(10000); // Keep the relay active for 2 seconds
digitalWrite(relayPin, HIGH); // Activate relay
} else {
digitalWrite(buzzerPin, HIGH); // Activate buzzer
delay(2000); // Keep the buzzer active for 2 seconds
digitalWrite(buzzerPin, LOW); // Deactivate buzzer
delay(1000); // Delay to prevent multiple reads

bool isValidCard(String cardUID) {
// Replace with the UID of your valid RFID cards
String validCard1 = “43884203”;
String validCard2 = “90467989”;

return (cardUID == validCard1 || cardUID ==validCard2);