AI-Based Smart ATM Security System with Face Recognition

AI-Based Smart ATM Security System with Face Recognition ESP32 + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI-Based Smart ATM Security System with Face Recognition ESP32 + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard 1. Project Overview Project Title AI-Powered Smart ATM Security Monitoring System using ESP32-CAM, Face Recognition, n8n Automation, Telegram Voice Alerts, Google Sheets Logging, and ThingSpeak Cloud Analytics Objective Develop an intelligent ATM security system that: Detects unauthorized persons near ATM. Performs face recognition. Captures and uploads images. Sends instant Telegram alerts. Generates AI voice notifications. Logs events to Google Sheets. Stores sensor data in ThingSpeak Cloud. Uses AI to predict suspicious activity and power consumption. Provides real-time monitoring dashboard. 2. System Architecture +------------------+ | ESP32-CAM | | Face Recognition | +---------+--------+ | | WiFi / Internet Connection | v +---------------------------------------+ | n8n Server | | AI Agent + Automation Engine | +---------------------------------------+ | | | | | | v v v Telegram Bot Google Sheets ThingSpeak Voice Alert Logging Dashboard | v Security Personnel 3. Features Security Features Face Recognition Recognizes: Authorized ATM staff Security guards Maintenance personnel Detects: Unknown visitors Suspicious loitering Intrusion Detection Using PIR sensor: Human motion detection ATM door opening detection Night-time monitoring Real-Time Alerts Telegram notifications: ⚠ ATM ALERT Unknown person detected Location: ATM Branch 03 Time: 11:42 PM Confidence: 91% Image Captured Voice Alerts AI-generated voice: Warning. Unauthorized person detected near ATM. Please verify immediately. Cloud Monitoring ThingSpeak dashboard displays: Motion events Face recognition confidence Temperature Humidity Power usage Security score 4. Hardware Components Component Quantity ESP32-CAM AI Thinker 1 FTDI Programmer 1 PIR Motion Sensor HC-SR501 1 Magnetic Door Sensor 1 Buzzer 1 Relay Module 1 DHT22 Sensor 1 OLED Display 0.96" 1 LEDs 2 Jumper Wires Several Breadboard 1 5V Adapter 1 5. Pin Connections PIR Sensor PIR ESP32 VCC 5V GND GND OUT GPIO13 Door Sensor Sensor ESP32 One End GPIO12 Other End GND Buzzer Buzzer ESP32 Positive GPIO15 Negative GND DHT22 DHT22 ESP32 VCC 3.3V GND GND DATA GPIO14 6. Circuit Schematic +----------------+ | ESP32 CAM | +----------------+ GPIO13 ------ PIR OUT GPIO12 ------ Door Sensor GPIO15 ------ Buzzer GPIO14 ------ DHT22 DATA 5V ---------- Sensors VCC GND --------- Sensors GND 7. System Workflow Start | v Initialize ESP32 | Connect WiFi | Motion Detected? | Yes | Capture Image | Face Recognition | Known Face? / \ Yes No | | Log Trigger Alert | | Store Event | | Send Telegram | | Voice Alert | | Update Sheets | | ThingSpeak Update | Loop 8. Detailed Flowchart +--------------------+ | Power ON | +---------+----------+ | v +--------------------+ | Connect WiFi | +---------+----------+ | v +--------------------+ | Motion Detection | +---------+----------+ | v +--------------------+ | Capture Face | +---------+----------+ | v +--------------------+ | Face Recognition | +---------+----------+ | +----+----+ | | v v Known Unknown | | v v Log Telegram Alert | v Voice Message | v Google Sheets | v ThingSpeak 9. ESP32 Source Code (Core Example) #include #include const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASSWORD"; #define PIR_PIN 13 #define BUZZER 15 void setup() { Serial.begin(115200); pinMode(PIR_PIN, INPUT); pinMode(BUZZER, OUTPUT); WiFi.begin(ssid,password); while(WiFi.status()!=WL_CONNECTED) { delay(500); } } void loop() { if(digitalRead(PIR_PIN)) { digitalWrite(BUZZER,HIGH); HTTPClient http; http.begin("YOUR_N8N_WEBHOOK"); http.addHeader("Content-Type", "application/json"); http.POST("{\"event\":\"motion\"}"); http.end(); delay(5000); digitalWrite(BUZZER,LOW); } } 10. Face Recognition Logic Face Enrollment Store authorized faces: Security Guard ATM Manager Maintenance Engineer Cash Loading Staff Recognition Process Camera Capture ↓ Face Detection ↓ Feature Extraction ↓ Embedding Generation ↓ Database Comparison ↓ Known / Unknown 11. n8n Automation Workflow Workflow Modules Webhook Trigger ↓ Receive ESP32 Event ↓ AI Agent ↓ Decision Engine ↓ Telegram Alert ↓ Google Sheets ↓ ThingSpeak Update ↓ Voice Notification Sample n8n JSON Structure { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "name": "Telegram", "type": "n8n-nodes-base.telegram" }, { "name": "Google Sheets", "type": "n8n-nodes-base.googleSheets" } ] } 12. Telegram Bot Setup Step 1 Open Telegram. Search: @BotFather Step 2 Create Bot /newbot Step 3 Provide: ATM Security Bot Step 4 Receive: BOT TOKEN Example: 123456:ABCDEFxxxxx Save it. Step 5 Get Chat ID Use: @getidsbot Save Chat ID. 13. Telegram Alert Automation Message: 🚨 ATM SECURITY ALERT Unknown Person Detected Location: ATM Branch Hyderabad Confidence: 93% Timestamp: 2026-06-11 22:05:00 Image Attached 14. Telegram Voice Alert Automation n8n Flow Alert Generated ↓ AI Text ↓ Text-To-Speech API ↓ Generate MP3 ↓ Telegram Send Audio Voice: Attention. Suspicious activity detected near ATM. Immediate verification required. 15. Google Sheets Integration Columns Timestamp Face Status Confidence Motion Power Example: |2026-06-11|Unknown|94%|Detected|12W| n8n Node Google Sheets Append Row Stores every event. 16. ThingSpeak Setup Create Account Use the official platform: ThingSpeak Create Channel Fields: Field1 Motion Field2 Face Confidence Field3 Temperature Field4 Humidity Field5 Power Usage Field6 Security Score API Write URL https://api.thingspeak.com/update 17. ThingSpeak Dashboard Widgets: Gauge Security Score Line Chart Power Usage Bar Chart Motion Events Heat Map Intrusion Frequency 18. AI Agent Logic The AI Agent inside n8n evaluates: Motion Frequency Face Confidence Time of Day Door Status Power Consumption Risk Score Formula Risk Score=0.4M+0.3F+0.2D+0.1T Where: M = Motion Risk F = Face Risk D = Door Status Risk T = Time Risk Classification Score Status 0-30 Safe 31-60 Warning 61-100 High Risk 19. AI Power Consumption Prediction Inputs Temperature Camera ON Time WiFi Usage Sensor Activity Alert Frequency Linear Prediction Model P=aT+bC+cW+dS+eA Where: P = Predicted Power T = Temperature C = Camera Usage W = WiFi Activity S = Sensor Usage A = Alert Count Output Predicted Daily Consumption: 2.8 kWh Expected Monthly: 84 kWh 20. AI Decision Engine Example: Unknown Face + Motion Detected + After Midnight = Critical Alert Response: Activate Buzzer Capture 5 Images Send Voice Alert Notify Security Team 21. Security Enhancements Multi-Factor Verification Face Recognition Motion Detection Door Sensor Anti-Spoofing Detect: Mobile screen attacks Printed photographs Video replay attacks Techniques: Blink detection Head movement tracking Depth estimation 22. Deployment Architecture ATM Site | ESP32-CAM | Internet | n8n Cloud Server | +-------------+ | AI Agent | +-------------+ | Telegram Sheets ThingSpeak 23. Future Enhancements AI Enhancements YOLO person detection Weapon detection Crowd analysis Behavior analytics Anomaly detection Cloud Enhancements AWS IoT Core integration Azure IoT Hub integration MQTT broker support Edge AI inference ATM Security Upgrades SMS backup alerts Email escalation Police notification workflow Geofencing Multi-ATM centralized dashboard 24. Expected Project Outcome The completed system will: ✅ Detect suspicious ATM activity in real time ✅ Recognize authorized and unauthorized individuals ✅ Send instant Telegram text and voice alerts ✅ Log every event to Google Sheets ✅ Visualize security metrics on ThingSpeak ✅ Use AI-based risk analysis and power prediction ✅ Enable centralized monitoring through n8n automation ✅ Provide a scalable smart ATM security solution suitable for academic projects, research prototypes, and pilot deployments in banking environments.

Comments