Header Ads Widget

Responsive Advertisement

Bank-Safe Using RFID , PIR Sensor ,Arduino , Relay , Leds & Buzzer

 Circuit Diagram:

🛡️ RFID Secure Relay Terminal

Industrial-Grade RFID Access Control

Designed for heavy-duty security, this system utilizes the MFRC522 RFID module to authenticate users against a Master Key database. Unlike standard locks, this system controls a high-power relay, capable of driving industrial magnetic locks or electronic door strikes.

✨ Key Features

  • 💳 Card Authentication: Scans unique UIDs to grant or deny access based on authorized credentials.
  • Relay-Driven Locks: Integrated 5V Relay allows control of high-voltage or high-current locking mechanisms.
  • 🚨 Motion-Triggered Alarm: PIR sensor actively guards the terminal, triggering warnings if loitering is detected.
  • 📡 SPI Communication: High-speed data exchange between the MCU and RFID reader for near-instant access.

📟 Hardware Pinout Mapping

RFID Component Arduino Pin Notes
SCK / MISO / MOSID13 / D12 / D11SPI Bus (Hardcoded)
SDA (SS) / RSTD10 / D9Slave Select & Reset
Relay ModuleD8Digital Logic Output
PIR SensorD4Digital Input
OLED SDA / SCLA4 / A5I2C Data/Clock

⚠️ Power Note: The MFRC522 module requires 3.3V. Connecting it to the 5V rail will result in hardware failure.

RFID Security Lock Node with PIR Motion Intercept

In this project, we are developing a high-responsiveness hardware firmware for a standalone RFID Security Terminal Module. Designed for rapid deployment across storage units or prototyping lab racks, this configuration handles background card scanning and real-time perimeter surveillance loops simultaneously.

System Architecture & Operations

The code is structured around two parallel checking pipelines to optimize facility safety metrics:

[PIR Passive Infrared Scan] ────► Interrupt Loop Matrix ──► [Flash RED LED / Alarm] │ ▼ [SPI RFID Card Insertion] ──────► Reads Serial Block │ ▼ [ACCESS GRANTED] • Actuate Relay Pin (5s) • GREEN Indicator Active • Pulse Buzzer Feedback
  • Surveillance Intercept Loop: A PIR digital output acts as a high-priority interrupt checker. If motion is captured near the locker chassis, the terminal shifts instantly into an active alert configuration, flashing red lines before returning control to standby.
  • Card Access Processing: The high-speed SPI bus handles scanning continuously. To simplify deployment arrays, the firmware operates on a generic card capture sequence: detecting any structured card transponder will instantly release the heavy relay mechanism for a 5-second workspace access window.

Hardware Connection Pinout

To wire this system on your prototyping workbench, route your modules to the microcontroller pins according to this layout:

Component Hardware Module Pin Function Microcontroller Target Pin Bus / Control Interface
MFRC522 RFID SS / SDA (SDA Line) Digital Pin 10 SPI Master Select Line
MFRC522 RFID RST (Reset) Digital Pin 9 Digital Hardware Reset
Relay Module IN Control Trigger Digital Pin 8 Digital Output Logic
GREEN LED Anode Terminal (+) Digital Pin 7 Access Approved Light
RED LED Anode Terminal (+) Digital Pin 6 Intrusion Alert Light
Buzzer Module Positive Lead (+) Digital Pin 5 Audio Telemetry Output
PIR Motion Sensor OUT Data Signal Digital Pin 4 Digital Input Reference
SSD1306 OLED SDA / SCL Pins Hardware I2C Interface System Text Display Panel

Arduino Code Configuration

Below is the complete project source code. It relies on standard MFRC522 and Adafruit_SSD1306 driver frameworks to execute card evaluation and screen printing routines:

📁 RFID_PIR_Security.ino
#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// --- Hardware Pins ---
#define SS_PIN 10
#define RST_PIN 9
#define RELAY_PIN 8
#define GREEN_LED 7
#define RED_LED 6
#define BUZZER_PIN 5
#define PIR_PIN 4

// --- Display Setup ---
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

// --- RFID Setup ---
MFRC522 rfid(SS_PIN, RST_PIN);

void setup() {
  Serial.begin(115200);
  SPI.begin();       
  rfid.PCD_Init();       

  pinMode(RELAY_PIN, OUTPUT);
  pinMode(GREEN_LED, OUTPUT);
  pinMode(RED_LED, OUTPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  pinMode(PIR_PIN, INPUT);
  
  digitalWrite(RELAY_PIN, LOW); // Ensure relay starts OFF

  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    for(;;);
  }

  showStandby();
  Serial.println("System Active. Scan ANY card to open...");
}

void loop() {
  // 1. Check for Motion (PIR Sensor)
  if (digitalRead(PIR_PIN) == HIGH) {
    securityAlert();
    showStandby(); 
  }

  // 2. Check for RFID Cards
  if (!rfid.PICC_IsNewCardPresent()) return;
  if (!rfid.PICC_ReadCardSerial()) return;

  // 3. Logic: ANY card detected will trigger access
  Serial.println("Card detected! Opening relay...");
  grantAccess();
  
  rfid.PICC_HaltA();
  showStandby(); 
}

void showStandby() {
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(20, 15);
  display.println("SECURE TERMINAL");
  display.setCursor(25, 40);
  display.println("TAP ANY CARD");
  display.display();
}

void grantAccess() {
  display.clearDisplay();
  display.setCursor(25, 20);
  display.setTextSize(2);
  display.println("GRANTED");
  display.display();

  digitalWrite(GREEN_LED, HIGH);
  digitalWrite(RELAY_PIN, HIGH); // <--- RELAY TURNS ON HERE
  tone(BUZZER_PIN, 1500, 500);   
  
  delay(5000); // Keep relay on for 5 seconds
  
  digitalWrite(RELAY_PIN, LOW);  // <--- RELAY TURNS OFF HERE
  digitalWrite(GREEN_LED, LOW);
}

void securityAlert() {
  display.clearDisplay();
  display.setCursor(15, 20);
  display.setTextSize(2);
  display.println("WARNING!");
  display.setCursor(20, 45);
  display.setTextSize(1);
  display.println("Motion Detected");
  display.display();
  
  digitalWrite(RED_LED, HIGH);
  tone(BUZZER_PIN, 2000, 100); 
  delay(500);
  digitalWrite(RED_LED, LOW);
}

System Diagnostics Checklist

  • Standby Interface: Upon completing the setup loop, the OLED interface should continuously render the "SECURE TERMINAL - TAP ANY CARD" interface block.
  • Intrusion Check: Triggering the PIR sensor interrupts the card processing framework immediately, flashing the RED alert sequence to warm onlookers.
  • Relay Deployment Test: Tapping any standard 13.56MHz tag or keycard should trigger the green indicator light and shift the active relay contact for a full 5-second interval.

Post a Comment

0 Comments