RFID control system

RFID Control System – Using Arduino and RC522 In this project, we will use an RFIDRC522 module with an Arduino Uno to control access based on RFID tags. When an authorized tag is scanned, a green LED lights up. If an unauthorized tag is scanned, a red LED blinks for 5 seconds to indicate access denial.


Components Required




Circuit Connections

Below is the connection setup for our RFID-based access control system:
 
Component RFID Module Arduino Uno
VCC 3.3V 3.3V
RST RST Pin 9
GND GND GND
MISO MISO Pin 12
MOSI MOSI Pin 11
SCK SCK Pin 13
SDA SDA Pin 10


Arduino Code for RFID Access System

Below is the complete Arduino code for this RFID-based system. 
#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN 9
#define SS_PIN 10
#define GREEN_LED 7
#define RED_LED 8

MFRC522 mfrc522(SS_PIN, RST_PIN);
byte authorizedUID[] = {0xC3, 0x64, 0x45, 0xDA}; // Authorized Tag

void setup() {
  Serial.begin(9600);
  SPI.begin();
  mfrc522.PCD_Init();
  pinMode(GREEN_LED, OUTPUT);
  pinMode(RED_LED, OUTPUT);
  Serial.println("Scan an RFID tag...");
}

void loop() {
  if (!mfrc522.PICC_IsNewCardPresent()) return;
  if (!mfrc522.PICC_ReadCardSerial()) return;

  Serial.print("Card UID: ");
  bool authorized = true;
  for (byte i = 0; i < mfrc522.uid.size; i++) {
    Serial.print(mfrc522.uid.uidByte[i], HEX);
    Serial.print(" ");
    if (mfrc522.uid.uidByte[i] != authorizedUID[i]) {
      authorized = false;
    }
  }
  Serial.println();

  if (authorized) {
    Serial.println("Authorized Access: Welcome, CREATOR!");
    digitalWrite(GREEN_LED, HIGH);
    delay(2000);
    digitalWrite(GREEN_LED, LOW);
  } else {
    Serial.println("Unauthorized Access: ERROR!");
    for (int i = 0; i < 5; i++) {
      digitalWrite(RED_LED, HIGH);
      delay(500);
      digitalWrite(RED_LED, LOW);
      delay(500);
    }
  }
}


How It Works?


 1️⃣ Place the RFID tag near the RFID reader. 
 2️⃣ If the tag is authorized, the green LED turns ON for 2 seconds.
 3️⃣ If the tag is unauthorized, the red LED blinks for 5 seconds.

Applications of RFID Control System

 ✅ Security Systems – Used in offices, homes, and industries. 
 ✅ Access Control – Allows only authorized personnel to enter. 
 ✅ Attendance System – Used in schools and workplaces. 
 ✅ Automated Toll Booths – Used for vehicle identification. 





~by CREATOR

Post a Comment

Previous Post Next Post