Saturday, 30 May 2026

AI Smart Door Lock System Using Face and Fingerprint Recognition

AI Smart Door Lock System Using Face & Fingerprint Recognition AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Door Lock System Using Face & Fingerprint Recognition AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard 1. Project Overview Project Title AI Smart Door Lock System Using Face and Fingerprint Recognition with ESP32, n8n Automation, Telegram Voice Alerts, Google Sheets, and ThingSpeak Cloud Dashboard Objective Design and develop an intelligent smart door security system capable of: Face Recognition Authentication Fingerprint Authentication Smart Lock Control AI-based Access Decision Making Real-time Cloud Monitoring Telegram Voice Notifications Automated Logging AI Power Consumption Prediction Agentic IoT Automation using n8n 2. System Architecture +-------------------+ | Face Recognition | | ESP32-CAM | +---------+---------+ | v +-------------------+ | Authentication | | Decision Engine | +---------+---------+ | v +-------------------+ | Fingerprint | | Sensor R307 | +---------+---------+ | v +-------------------+ | ESP32 Controller | +---------+---------+ | +----------------------+ | | v v +----------------+ +----------------+ | Door Lock | | Cloud Services | | Relay + Solenoid| +----------------+ +-------+--------+ | | | v v Door Opens ThingSpeak Google Sheets Telegram Bot n8n AI Agent 3. Features Security Features Multi-Factor Authentication User must pass: Face Recognition Fingerprint Verification before door unlocks. Intruder Detection If: Unknown Face Invalid Fingerprint then: Capture image Send Telegram Alert Store evidence in cloud Voice Alert Telegram receives: "Warning! Unauthorized access attempt detected at Main Door." 4. Hardware Components List Component Quantity ESP32 Dev Board 1 ESP32-CAM 1 R307 Fingerprint Sensor 1 Relay Module 5V 1 Solenoid Door Lock 1 Buzzer 1 OLED Display (Optional) 1 PIR Motion Sensor 1 12V Adapter 1 LM2596 Buck Converter 1 Jumper Wires As Required Breadboard/PCB 1 Magnetic Door Sensor 1 5. Circuit Connections Fingerprint Sensor R307 ESP32 VCC ---------> 5V GND ---------> GND TX ----------> GPIO16 RX ----------> GPIO17 Relay Module Relay IN -----> GPIO26 Relay VCC ----> 5V Relay GND ----> GND Buzzer Buzzer + ----> GPIO25 Buzzer - ----> GND PIR Sensor OUT ----------> GPIO27 VCC ----------> 5V GND ----------> GND ESP32-CAM ESP32-CAM | WiFi | Cloud Face recognition runs on ESP32-CAM. 6. Complete Flowchart START | v Initialize WiFi | v Connect Cloud Services | v Wait for Person | v Capture Face | v Face Match? | YES ---------------- NO | | v v Scan Fingerprint Alert Intruder | | v | Fingerprint Match? | | | YES ----- NO | | | | v v | Unlock Alert | Door User | | | | v v | Log Data Log Data | | | | +--------+----------+ | v ThingSpeak | v Google Sheet | v Telegram | v END 7. ESP32 Source Code Structure Required Libraries WiFi.h HTTPClient.h ArduinoJson.h Adafruit_Fingerprint.h ESP32Servo.h WiFi Setup const char* ssid = "YOUR_WIFI"; const char* password = "PASSWORD"; Telegram Configuration String botToken="BOT_TOKEN"; String chatID="CHAT_ID"; ThingSpeak Configuration String apiKey="THINGSPEAK_WRITE_KEY"; Door Lock Pin #define LOCK_PIN 26 Unlock Function void unlockDoor() { digitalWrite(LOCK_PIN,HIGH); delay(5000); digitalWrite(LOCK_PIN,LOW); } Fingerprint Verification bool verifyFingerprint() { int id = finger.getImage(); if(id == FINGERPRINT_OK) { return true; } return false; } Send Telegram Alert void sendTelegram(String msg) { HTTPClient http; String url = "https://api.telegram.org/bot"+ botToken+ "/sendMessage?chat_id="+ chatID+ "&text="+msg; http.begin(url); http.GET(); http.end(); } Update ThingSpeak void updateThingSpeak( String status) { HTTPClient http; String url= "https://api.thingspeak.com/update?api_key="+ apiKey+ "&field1="+status; http.begin(url); http.GET(); http.end(); } 8. Face Recognition System ESP32-CAM Operation Step 1 Capture image. Step 2 Run face detection. Step 3 Compare with enrolled faces. Step 4 Send result to ESP32. KNOWN FACE | v ESP32 Unlock Request UNKNOWN FACE | v Telegram Alert 9. AI Agent Using n8n Purpose AI Agent analyzes: Entry patterns Intruder attempts Power consumption Door usage frequency n8n Workflow ESP32 Webhook | v Google Sheets | v OpenAI Node | v Decision Analysis | v Telegram Alert | v ThingSpeak Update 10. n8n Workflow Nodes Node 1: Webhook Receives data: { "user":"John", "status":"Authorized", "time":"2026-05-30 08:20" } Node 2: Google Sheets Store: Date Time User Status Node 3: AI Agent Prompt: Analyze today's door access records. Detect suspicious behavior. Predict energy consumption. Generate summary. Node 4: Telegram Send report. 11. Example n8n Workflow JSON { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "name": "Google Sheets", "type": "n8n-nodes-base.googleSheets" }, { "name": "OpenAI", "type": "@n8n/n8n-nodes-langchain.openAi" }, { "name": "Telegram", "type": "n8n-nodes-base.telegram" } ] } This is a simplified template; in deployment you would configure credentials, mappings, and error handling. 12. Telegram Bot Setup Step 1 Open Telegram. Search: Telegram Step 2 Search: BotFather Step 3 Create Bot /newbot Step 4 Copy Bot Token. Example: 123456:ABCxyz Step 5 Get Chat ID https://api.telegram.org/botTOKEN/getUpdates 13. Voice Notification Automation Event Trigger Unauthorized Access ↓ n8n ↓ Text-to-Speech ↓ Telegram Voice Message Voice Message Script Alert! Unknown person detected at the main entrance. Please check immediately. n8n Flow Webhook | v AI Agent | v Google TTS | v Telegram Voice 14. Google Sheets Integration Columns: Timestamp User Face Status Fingerprint Result 08:30 John Match Match Granted ESP32 sends: { "user":"John", "face":"match", "finger":"match", "access":"granted" } to n8n webhook. n8n appends row automatically. 15. ThingSpeak Dashboard Setup Create Channel In ThingSpeak Create fields: Field1 = Door Status Field2 = Authorized Access Field3 = Unauthorized Access Field4 = Power Consumption Field5 = AI Risk Score Dashboard Widgets Gauge Door Status Line Chart Power Usage Counter Access Count Trend Graph Unauthorized Attempts 16. AI Power Consumption Prediction Data Inputs Lock Activations Camera Usage Time WiFi Uptime Fingerprint Scans Formula E=P×t Where: E = Energy (Wh) P = Power (W) t = Time (hours) Sample Dataset Day Power 1 5.2W 2 5.4W 3 5.8W 4 6.0W AI predicts future usage and detects abnormal spikes. 17. AI Risk Scoring Logic Known Face = 40 points Known Fingerprint = 40 points Normal Time Access = 20 points Total: 100 = Safe Risk Levels Score Status 80-100 Safe 50-79 Warning 0-49 Threat 18. Database Design Access Log Table Field ID Timestamp Face_ID Finger_ID Status Power RiskScore 19. Deployment Procedure Phase 1 Hardware Assembly Phase 2 Upload ESP32 Firmware Phase 3 Enroll Faces Phase 4 Enroll Fingerprints Phase 5 Configure Wi-Fi Phase 6 Create Telegram Bot Phase 7 Deploy n8n Workflow Phase 8 Connect Google Sheets Phase 9 Connect ThingSpeak Phase 10 Field Testing 20. Testing Scenarios Test 1 Known Face + Known Fingerprint Expected: Door Opens Telegram Log Cloud Update Test 2 Known Face + Wrong Fingerprint Expected: Access Denied Alert Sent Test 3 Unknown Face Expected: Buzzer ON Image Capture Telegram Voice Alert 21. Future Enhancements Face recognition using Edge AI models (TensorFlow Lite Micro) Liveness detection against photo spoofing Visitor QR-code access Mobile app control Cloud-based user management Voice assistant integration Battery backup and solar charging Multi-door enterprise deployment Predictive maintenance analytics AI anomaly detection using historical access logs 22. Expected Outcome The final system provides: ✅ Face Recognition Security ✅ Fingerprint Authentication ✅ Smart Door Unlocking ✅ ESP32-Based IoT Control ✅ n8n Agentic Automation ✅ Telegram Text & Voice Alerts ✅ Google Sheets Logging ✅ ThingSpeak Dashboard Monitoring ✅ AI Risk Assessment ✅ Power Consumption Prediction ✅ Cloud-Based Smart Access Management This architecture is suitable for academic projects, smart homes, offices, laboratories, hostels, and industrial access-control systems, while remaining low-cost and scalable.

No comments:

Post a Comment

AI Smart Refrigerator Monitoring and Food Expiry Detection

AI Smart Refrigerator Monitoring & Food Expiry Detection System ESP32 + Agentic AI + n8n Automation + Telegram Voice Alerts + Google She...