Circuit Diagram:
ESP32 Security Hub: Multi-Layered Biometric, RFID & Blynk Control
In this project, we are developing an advanced, multi-layered ESP32 Security Hub. This terminal features biometrics (fingerprint scanning), RFID credential tracking, an ultra-responsive capacitive touch sensor acting as a master state toggle, a crisp local I2C OLED interface, and full Blynk IoT cloud integration for remote relay manipulation and real-time security logging.
System Architecture & Security Pipelines
The control firmware handles local biometric validation alongside a dual-channel remote cloud pathway:
- Biometric & Contactless Identification: The local authentication matrix uses a secure optical fingerprint reader (via hardware
Serial2) and an SPI-based MFRC522 RFID module. Successfully scanning either credential flags an authorized access event, driving both output channels high for 5 seconds. - Cloud-Connected Overrides (Blynk): Operating via Wi-Fi telemetry pipelines, the ESP32 constantly listens for state packets. Through your mobile dashboard app, Virtual Pins V1 and V2 allow independent remote execution to actuate either relay loop on the fly.
- Master Touch Toggle: The capacitive touch sensor is implemented as an instant master switch toggle, providing rapid tactical configuration adjustments straight at the hardware node.
Hardware Connection Pinout
To safely deploy this layout onto your prototyping workbench without creating data conflicts on the SPI or I2C communication buses, wire your modules using this precise index:
| Target Component | Component Pin Function | ESP32 Assigned GPIO Pin | Interface Bus / Signal Type |
|---|---|---|---|
| Relay Module 1 | IN1 Control Trigger | GPIO 25 | Digital Output Logic |
| Relay Module 2 | IN2 Control Trigger | GPIO 26 | Digital Output Logic |
| Touch Sensor | SIG Signal Output | GPIO 32 | Digital Input Logic |
| SSD1306 OLED Display | SDA Line | GPIO 21 | Shared I2C Data Bus |
| SSD1306 OLED Display | SCL Line | GPIO 22 | Shared I2C Clock Bus |
| Fingerprint Sensor | RX Receive Pin | GPIO 16 | ESP32 Hardware Serial2 TX |
| Fingerprint Sensor | TX Transmit Pin | GPIO 17 | ESP32 Hardware Serial2 RX |
| MFRC522 RFID Reader | SDA / SS (Slave Select) | GPIO 5 | SPI Master Select Line |
| MFRC522 RFID Reader | RST (Hardware Reset) | GPIO 4 | Digital Hardware Reset |
| MFRC522 RFID Reader | SCK (Serial Clock) | GPIO 18 | SPI Shared Clock Bus |
| MFRC522 RFID Reader | MOSI | GPIO 23 | SPI Main Out Slave In |
| MFRC522 RFID Reader | MISO | GPIO 19 | SPI Main In Slave Out |
Blynk Platform Integration Credentials
Make sure the identification tokens at the start of your script match your cloud configuration template parameters exactly to enable wireless telemetry syncing:
#define BLYNK_TEMPLATE_NAME "Bike Automation"
#define BLYNK_AUTH_TOKEN "HQVv8n4wc7lOrsHh3mV9hhkBCji59CEU"
Arduino Code Configuration
Below is the complete integrated code structure configured for cloud and local authentication. It runs on top of the BlynkSimpleEsp32, Adafruit_Fingerprint, MFRC522, and Adafruit_SSD1306 frameworks:
#define BLYNK_TEMPLATE_ID "TMPL6Rscc2EfI"
#define BLYNK_TEMPLATE_NAME "Bike Automation"
#define BLYNK_AUTH_TOKEN "HQVv8n4wc7lOrsHh3mV9hhkBCji59CEU"
#include <SPI.h>
#include <MFRC522.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_Fingerprint.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
// --- Pin Definitions ---
#define RELAY_1 25
#define RELAY_2 26
#define TOUCH_PIN 32
#define RST_PIN 4
#define SS_PIN 5
// --- Display Setup ---
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
// --- RFID Instance ---
MFRC522 mfrc522(SS_PIN, RST_PIN);
// --- Fingerprint Sensor Instance (Hardware Serial2: RX=16, TX=17) ---
HardwareSerial mySerial(2);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
// --- WiFi & Blynk Setup ---
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "Your_WiFi_SSID";
char pass[] = "Your_WiFi_Password";
void setup() {
Serial.begin(115200);
// Pin Modes
pinMode(RELAY_1, OUTPUT);
pinMode(RELAY_2, OUTPUT);
pinMode(TOUCH_PIN, INPUT);
// Ensure Relays start OFF
digitalWrite(RELAY_1, LOW);
digitalWrite(RELAY_2, LOW);
// Initialize Modules
SPI.begin();
mfrc522.PCD_Init();
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("OLED failed"));
for(;;);
}
updateDisplay("SYSTEM BOOTING...", "Connecting Cloud...");
// Initialize Fingerprint Sensor
finger.begin(57600);
if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
}
// Sync with Blynk Cloud
Blynk.begin(auth, ssid, pass);
updateDisplay("SECURITY HUB", "READY FOR SCAN");
}
// --- Blynk App Remote Switches ---
// V1: Remote Relay 1 Switch
BLYNK_WRITE(V1) {
int val = param.asInt();
digitalWrite(RELAY_1, val);
}
// V2: Remote Relay 2 Switch
BLYNK_WRITE(V2) {
int val = param.asInt();
digitalWrite(RELAY_2, val);
}
void loop() {
Blynk.run();
// 1. Check Master Touch Sensor Toggle
if (digitalRead(TOUCH_PIN) == HIGH) {
updateDisplay("TOUCH ACTIVE", "OVERRIDE TRIGGERED");
digitalWrite(RELAY_1, HIGH);
digitalWrite(RELAY_2, HIGH);
delay(2000);
digitalWrite(RELAY_1, LOW);
digitalWrite(RELAY_2, LOW);
updateDisplay("SECURITY HUB", "READY FOR SCAN");
}
// 2. Evaluate RFID Card Scan Pipeline
if (mfrc522.PICC_IsNewCardPresent() && mfrc522.PICC_ReadCardSerial()) {
executeGrantAccess("RFID AUTHORIZED");
mfrc522.PICC_HaltA();
}
// 3. Evaluate Biometric Fingerprint Pipeline
int fingerprintID = getFingerprintID();
if (fingerprintID > 0) {
executeGrantAccess("BIOMETRIC MATCH");
}
}
// Access Granted Sequence
void executeGrantAccess(String localMessage) {
updateDisplay("ACCESS GRANTED", localMessage);
digitalWrite(RELAY_1, HIGH);
digitalWrite(RELAY_2, HIGH);
delay(5000); // Keep open for 5 seconds
digitalWrite(RELAY_1, LOW);
digitalWrite(RELAY_2, LOW);
updateDisplay("SECURITY HUB", "READY FOR SCAN");
}
// Helper to quickly update SSD1306 screen
void updateDisplay(String header, String details) {
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 10);
display.println(header);
display.setCursor(0, 35);
display.println(details);
display.display();
}
// Biometric Parser Routine
int getFingerprintID() {
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK) return -1;
p = finger.image2Tz();
if (p != FINGERPRINT_OK) return -1;
p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK) return -1;
// Match found!
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID;
}
System Testing Checklist
- Network Connection: Upon initial boot, verification logs are sent over the serial lines at 115200 baud. The OLED will confirm network connection, then flip to the standby screen layout.
- Biometric Match Verification: Rest an enrolled finger onto your scanner prism. A match forces the core loop straight to the
executeGrantAccess()pipeline, cycling both relays. - Blynk Virtual Controls: Access your smartphone app configuration setup. Turning the V1 or V2 dashboard widget switches on or off changes the state of your load relay loops instantly via the network link.
Biometric IoT Ignition & Security Hub: ESP32, RFID, and Blynk
In this project, we are engineering a robust, multi-layered security and ignition hub using an ESP32. Perfect for smart bench configurations, security enclosures, or vehicle automation, this system integrates a master Touch Sensor toggle, Biometric Fingerprint authentication, high-frequency RFID card scanning, and a live Blynk IoT cloud interface for full remote management and diagnostic tracking.
System Architecture & Dual-Mode Mechanics
The system is architected to operate across two separate software frameworks, offering both decentralized local security and full IoT cloud integration:
- 1. Standalone Verification Mode: The local micro-controller monitors the biometric optical matrix and the SPI RFID module. Upon successful authorization of a registered finger profile or safe key tag, both hardware relays trigger into an active high state for a 5-second control window before resetting.
- 2. Blynk IoT Cloud Mode: Expands your security infrastructure to the web. It mirrors local operations while mapping structural control overrides out to Virtual Pins V1 (Relay 1) and V2 (Relay 2) on your Blynk App panel, sending live feedback telemetry straight back to your smartphone.
Complete Hardware Connection Pinout
To avoid signal degradation or communication faults across the high-speed SPI and UART busses, map your hardware components exactly to the following ESP32 GPIO allocation table:
| Target Component | Component Pin Function | ESP32 Assigned GPIO Pin | Bus / Interface Type |
|---|---|---|---|
| Relay 1 | Control Trigger Signal | GPIO 25 | Digital Output Logic |
| Relay 2 | Control Trigger Signal | GPIO 26 | Digital Output Logic |
| Touch Sensor | Signal Interrupt Output | GPIO 32 | Digital Input Logic |
| OLED Display | SDA (Data) Line | GPIO 21 | I2C Communication Bus |
| OLED Display | SCL (Clock) Line | GPIO 22 | I2C Communication Bus |
| Fingerprint Sensor | RX (Receive Data) | GPIO 16 | Hardware Serial2 (UART) |
| Fingerprint Sensor | TX (Transmit Data) | GPIO 17 | Hardware Serial2 (UART) |
| RFID RC522 Module | SS / SDA (Slave Select) | GPIO 5 | SPI Master/Slave Select |
| RFID RC522 Module | RST (Hardware Reset) | GPIO 4 | Digital Hardware Reset |
| RFID RC522 Module | SCK (Serial Clock) | GPIO 18 | SPI Shared Clock Bus |
| RFID RC522 Module | MOSI | GPIO 23 | SPI Main Out Slave In |
| RFID RC522 Module | MISO | GPIO 19 | SPI Main In Slave Out |
Firmware Dependencies & Blynk Provisioning
Before launching compile sequences inside your IDE environment, ensure you have included these structural library wrappers via the Library Manager:
Adafruit SSD1306&Adafruit GFX(To manage the frame-buffers on the I2C OLED display).Adafruit Fingerprint Sensor Library(For processing UART biometric character files).MFRC522(To manage the SPI registry of the RFID reader module).Blynk(To maintain network socket persistence with cloud instances).
Blynk Credentials Structure
To establish successful handshakes between your hardware node and the smartphone interface, ensure your template definitions match your project configuration block exactly at the top of your sketch code:
#define BLYNK_TEMPLATE_NAME "Bike Automation"
#define BLYNK_AUTH_TOKEN "HQVv8n4wc7lOrsHh3mV9hhkBCji59CEU"
System Deployment Bench Check
Flash the code out to your ESP32, and bring up your diagnostics terminal. Once internet negotiation completes, testing your dual-mode switch options becomes seamless. Placing an authorized token against the reader or touching the biometric panel triggers the relay coils instantly, accompanied by a status message on your custom OLED panel. You can then override either channel using your newly deployed smartphone widgets!

Comments
Post a Comment