Thursday, 28 May 2026

AI-Based Voice Controlled Industrial Automation System

AI-Based Voice Controlled Industrial Automation System ESP32 + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI-Based Voice Controlled Industrial Automation System ESP32 + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard This project combines: Industrial automation using ESP32 Voice-controlled operation AI-based monitoring and prediction IoT cloud dashboard n8n workflow automation Telegram voice alert notifications Google Sheets data logging ThingSpeak live monitoring The system can: Monitor industrial parameters (temperature, gas, vibration, current, voltage) Control machines using voice commands Predict abnormal power usage Send voice alerts to Telegram Store data in Google Sheets Display live analytics on ThingSpeak Trigger AI-based automation actions 1. Project Overview Main Features ✅ Voice-controlled industrial equipment ✅ AI-powered power consumption prediction ✅ Real-time sensor monitoring ✅ ESP32 WiFi-based automation ✅ Telegram voice notification alerts ✅ Google Sheets logging ✅ ThingSpeak cloud analytics ✅ n8n automation workflows ✅ Remote monitoring dashboard ✅ Agentic AI decision making 2. System Architecture +----------------------+ | Voice Commands | | (Telegram / Web UI) | +----------+-----------+ | v +---------------------------------------------------+ | n8n Server | |---------------------------------------------------| | AI Agent Logic | | Telegram Bot | | Google Sheets Integration | | Voice Alert Generator | | Webhook Automation | +-------------------+-------------------------------+ | v +-------------------+ | ESP32 | |-------------------| | WiFi Connectivity | | Relay Control | | Sensor Monitoring | +---------+---------+ | v +----------------------------+ | Industrial Devices/Sensors | +----------------------------+ | v +----------------+ | ThingSpeak IoT | +----------------+ 3. Components Required Component Quantity Purpose ESP32 Dev Board 1 Main controller Relay Module (4-channel) 1 Machine control DHT22 Sensor 1 Temperature/Humidity ACS712 Current Sensor 1 Power monitoring MQ-2 Gas Sensor 1 Gas detection Vibration Sensor 1 Machine vibration OLED Display (Optional) 1 Local display Buzzer 1 Alarm Power Supply 5V/12V 1 System power Jumper Wires Several Connections Breadboard/PCB 1 Assembly WiFi Router 1 Internet connectivity 4. Circuit Schematic Diagram ESP32 Pin Connections Sensor/Module ESP32 Pin Relay IN1 GPIO 26 Relay IN2 GPIO 27 DHT22 Data GPIO 4 MQ2 Analog GPIO 34 ACS712 Output GPIO 35 Vibration Sensor GPIO 32 Buzzer GPIO 25 5. Working Principle Step-by-Step Process Step 1 — Sensor Data Collection ESP32 continuously reads: Temperature Humidity Current usage Gas leakage Vibration status Step 2 — WiFi Communication ESP32 sends sensor data to: ThingSpeak n8n webhook Google Sheets Step 3 — AI Analysis AI agent inside n8n: Predicts abnormal power consumption Detects machine anomalies Identifies unsafe conditions Step 4 — Automation Actions If abnormality detected: Relay OFF command Telegram alert sent Voice message generated Data stored in cloud Step 5 — Dashboard Monitoring User can monitor: Real-time charts Machine health Power usage Alerts history 6. Flowchart START | v Initialize ESP32 | Connect WiFi | Read Sensors | Send Data to n8n | Send Data to ThingSpeak | AI Analysis | Abnormal? / \ YES NO | | Send Alert | | Turn OFF Relay | | Telegram Voice Alert | Store Data in Google Sheets | Repeat Loop 7. ESP32 Source Code #include #include #include "DHT.h" #define DHTPIN 4 #define DHTTYPE DHT22 #define RELAY_PIN 26 #define MQ2_PIN 34 #define CURRENT_PIN 35 #define VIBRATION_PIN 32 #define BUZZER_PIN 25 DHT dht(DHTPIN, DHTTYPE); const char* ssid = "YOUR_WIFI_NAME"; const char* password = "YOUR_WIFI_PASSWORD"; String webhookURL = "YOUR_N8N_WEBHOOK_URL"; void setup() { Serial.begin(115200); pinMode(RELAY_PIN, OUTPUT); pinMode(BUZZER_PIN, OUTPUT); dht.begin(); WiFi.begin(ssid, password); while(WiFi.status() != WL_CONNECTED){ delay(1000); Serial.println("Connecting..."); } Serial.println("WiFi Connected"); } void loop() { float temp = dht.readTemperature(); float hum = dht.readHumidity(); int gas = analogRead(MQ2_PIN); int current = analogRead(CURRENT_PIN); int vibration = digitalRead(VIBRATION_PIN); Serial.println(temp); if(WiFi.status() == WL_CONNECTED){ HTTPClient http; http.begin(webhookURL); http.addHeader("Content-Type", "application/json"); String jsonData = "{"; jsonData += "\"temperature\":" + String(temp) + ","; jsonData += "\"humidity\":" + String(hum) + ","; jsonData += "\"gas\":" + String(gas) + ","; jsonData += "\"current\":" + String(current) + ","; jsonData += "\"vibration\":" + String(vibration); jsonData += "}"; int response = http.POST(jsonData); Serial.println(response); http.end(); } if(gas > 2500){ digitalWrite(RELAY_PIN, LOW); digitalWrite(BUZZER_PIN, HIGH); } else{ digitalWrite(RELAY_PIN, HIGH); digitalWrite(BUZZER_PIN, LOW); } delay(10000); } 8. Setting Up Arduino IDE Install Libraries Install: WiFi HTTPClient DHT sensor library Add ESP32 Board Open: File → Preferences Add board URL: https://dl.espressif.com/dl/package_esp32_index.json Install: ESP32 by Espressif Systems 9. n8n Automation Workflow Workflow Modules Nodes Used Node Purpose Webhook Receive ESP32 data IF Node Condition checking OpenAI/AI Agent Prediction Telegram Node Alert sending Google Sheets Data logging HTTP Node ThingSpeak update 10. Sample n8n Workflow JSON { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "name": "AI Analysis", "type": "n8n-nodes-base.openai" }, { "name": "Telegram", "type": "n8n-nodes-base.telegram" } ] } 11. Installing n8n Using Docker docker run -it --rm \ -p 5678:5678 \ -v ~/.n8n:/home/node/.n8n \ n8nio/n8n Open: http://localhost:5678 12. Telegram Bot Setup Step 1 — Open Telegram Search: Telegram Step 2 — Create Bot Search: @BotFather Commands: /newbot Save: Bot Token Step 3 — Get Chat ID Open: https://api.telegram.org/bot/getUpdates 13. Telegram Voice Notification Method Use: Google Text-to-Speech ElevenLabs API gTTS Python module Python Voice Generator Example from gtts import gTTS text = "Warning. Gas leakage detected in factory unit." tts = gTTS(text=text, lang='en') tts.save("alert.mp3") Send MP3 through Telegram node. 14. Google Sheets Integration Step-by-Step Create Sheet Columns: Time Temp Humidity Gas Current Enable API Open: Google Cloud Console Enable: Google Sheets API Connect in n8n Use: Google OAuth credentials 15. ThingSpeak Cloud Dashboard Setup Open: ThingSpeak Create Channel Fields: Temperature Humidity Gas Current Vibration Get API Key Copy: Write API Key ESP32 Upload URL String server = "http://api.thingspeak.com/update?api_key=YOUR_KEY"; 16. AI Power Consumption Prediction Logic AI Objective Predict: Overload Abnormal current Energy waste Equipment failure Basic AI Formula Use moving average: P avg ​ = n P 1 ​ +P 2 ​ +P 3 ​ +⋯+P n ​ ​ If: Current > Threshold Then: Send alert Turn OFF relay Advanced AI Options You can use: TensorFlow Lite Edge Impulse TinyML OpenAI API 17. Voice Command Automation Supported Commands Voice Command Action Turn ON Motor Relay ON Turn OFF Motor Relay OFF Emergency Stop Shutdown Check Temperature Send sensor value Voice Recognition Methods Option 1 Telegram voice messages → n8n → AI → ESP32 Option 2 Web dashboard microphone input Option 3 Google Assistant integration 18. AI Agent Logic Agent Decisions Condition Action High Temperature Cooling ON Gas Leakage Alarm + Relay OFF High Current Shutdown Vibration Detected Maintenance Alert 19. Cloud Dashboard Features Dashboard Includes ✅ Live sensor graphs ✅ Device status ✅ AI predictions ✅ Alert logs ✅ Power analytics ✅ Historical trends 20. Future Enhancements Upgrade Ideas AI Improvements Predictive maintenance Failure forecasting ML anomaly detection Hardware Improvements Industrial PLC integration GSM backup Solar power Software Improvements Mobile app Voice assistant Multi-user control 21. Deployment Guide Industrial Deployment Steps Step 1 Assemble PCB safely. Step 2 Use isolated relay modules. Step 3 Add fuse protection. Step 4 Use industrial-grade power supply. Step 5 Deploy cloud server. Step 6 Enable HTTPS security. Step 7 Test emergency shutdown. 22. Security Recommendations Important ✅ Use HTTPS webhooks ✅ Secure API keys ✅ Use firewall rules ✅ Enable authentication ✅ Encrypt cloud communication 23. Testing Procedure Test Cases Test Expected Result Gas leakage Relay OFF High current Alert sent Voice command Device responds WiFi disconnected Auto reconnect High temperature Cooling activated 24. Real Industrial Applications Use Cases Smart factories Chemical plants Motor monitoring Energy management Boiler automation Smart agriculture Warehouse automation 25. Final Output of the System Your completed system will provide: ✅ AI-powered industrial automation ✅ Cloud-connected ESP32 monitoring ✅ Voice-controlled operations ✅ Telegram voice emergency alerts ✅ Real-time IoT dashboard ✅ Google Sheets analytics logging ✅ Intelligent predictive maintenance ✅ Remote industrial management 26. Recommended Software Stack Software Purpose Arduino IDE ESP32 programming n8n Automation Telegram Notifications ThingSpeak Cloud dashboard Google Sheets Data storage OpenAI API AI agent Docker n8n deployment 27. Recommended Project Folder Structure Industrial_AI_IOT/ │ ├── ESP32_Code/ ├── n8n_Workflow/ ├── Dashboard/ ├── AI_Model/ ├── Documentation/ ├── Telegram_Bot/ └── GoogleSheets/ 28. Conclusion This project is a complete Industry 4.0 automation solution combining: Embedded systems Artificial intelligence IoT cloud computing Automation workflows Voice communication Predictive analytics It is suitable for: Final year projects Industrial prototypes Smart factory research IoT product development AI automation systems

AI-Based Smart Vehicle Theft Detection with Face Recognition and GPS

AI-Based Smart Vehicle Theft Detection with Face Recognition and GPS Using ESP32 + Camera + GPS + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak + AI Agentic IoT Dashboard
AI-Based Smart Vehicle Theft Detection with Face Recognition and GPS Using ESP32 + Camera + GPS + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak + AI Agentic IoT Dashboard 1. Project Overview This project is an AI-powered smart vehicle security system that detects unauthorized access using: Face Recognition GPS tracking ESP32-CAM AI automation workflows Telegram voice alerts Cloud dashboards Google Sheets logging ThingSpeak IoT analytics n8n automation workflows The system continuously monitors the vehicle. When someone enters or tries to start the vehicle: ESP32-CAM captures face image AI compares face with authorized users If unauthorized: GPS location is captured Telegram alert sent Voice notification generated Data stored in Google Sheets Event uploaded to ThingSpeak dashboard Owner can remotely monitor activity 2. System Architecture ┌─────────────────────┐ │ ESP32-CAM │ │ Face Detection AI │ └─────────┬───────────┘ │ │ WiFi ▼ ┌─────────────────────┐ │ n8n │ │ Automation Server │ └──────┬───────┬──────┘ │ │ ┌─────────────────┘ └────────────────┐ ▼ ▼ ┌─────────────────┐ ┌────────────────────┐ │ Telegram Alerts │ │ Google Sheets Log │ │ Voice Messages │ │ Theft Records │ └─────────────────┘ └────────────────────┘ │ ▼ ┌──────────────────┐ │ ThingSpeak Cloud │ │ GPS + Analytics │ └──────────────────┘ 3. Features Main Features Vehicle Theft Detection Detects unauthorized access Face Recognition Authorized face database GPS Live Tracking Sends real-time vehicle location Telegram Alerts Instant notifications Voice Alerts AI-generated voice message Cloud Dashboard Real-time monitoring using ThingSpeak Data Logging Event history in Google Sheets AI Prediction Predicts power usage trends 4. Components List Component Quantity Purpose ESP32-CAM 1 Main controller + camera OV2640 Camera 1 Face capture NEO-6M GPS Module 1 GPS tracking SIM800L GSM (Optional) 1 GSM backup Relay Module 1 Vehicle ignition lock Buzzer 1 Alarm PIR Sensor 1 Motion detection OLED Display 1 Status display Lithium Battery 1 Backup power Voltage Regulator 1 Stable power Jumper Wires — Connections Breadboard/PCB — Assembly 5. Circuit Schematic Diagram ESP32-CAM Connections Module ESP32 Pin GPS TX GPIO16 GPS RX GPIO17 PIR OUT GPIO13 Relay IN GPIO12 Buzzer GPIO15 OLED SDA GPIO14 OLED SCL GPIO2 6. Working Principle Step-by-Step Working Step 1: Vehicle Monitoring ESP32 stays in monitoring mode. Step 2: Motion Detection PIR sensor detects movement. Step 3: Face Capture ESP32-CAM captures image. Step 4: AI Face Verification Face matched with authorized database. Step 5: Unauthorized Detection If face not recognized: Alarm activated GPS fetched Alert workflow triggered Step 6: n8n Automation n8n receives webhook data. Step 7: Notifications Telegram sends: Text alert GPS location Voice alert Step 8: Cloud Logging Event stored in: Google Sheets ThingSpeak 7. Flowchart START | Initialize ESP32 | Connect WiFi | Wait for Motion | Motion Detected? | NO └──> Continue Monitoring | YES | Capture Face Image | Recognized? | YES └──> Allow Access | NO | Activate Alarm | Get GPS Location | Send Data to n8n | Telegram Alert | Store in Google Sheets | Upload to ThingSpeak | END 8. ESP32 Source Code (Arduino IDE) Required Libraries Install: WiFi.h HTTPClient.h TinyGPS++ ESP32 Camera ArduinoJson ESP32 Code #include #include #include const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASSWORD"; String webhookURL = "https://your-n8n-webhook-url"; TinyGPSPlus gps; #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); } Serial.println("WiFi Connected"); } void loop() { int motion = digitalRead(PIR_PIN); if (motion == HIGH) { digitalWrite(BUZZER, HIGH); float lat = 17.3850; float lng = 78.4867; if(WiFi.status()== WL_CONNECTED){ HTTPClient http; http.begin(webhookURL); http.addHeader("Content-Type", "application/json"); String jsonData = "{"; jsonData += "\"alert\":\"Unauthorized Access\","; jsonData += "\"latitude\":" + String(lat) + ","; jsonData += "\"longitude\":" + String(lng); jsonData += "}"; int response = http.POST(jsonData); Serial.println(response); http.end(); } delay(10000); digitalWrite(BUZZER, LOW); } } 9. Telegram Bot Setup Step 1: Open Telegram Search: Telegram Step 2: Open BotFather Search: BotFather Step 3: Create Bot Commands: /newbot BotFather gives: Bot Token Save it securely. Step 4: Get Chat ID Open browser: https://api.telegram.org/bot/getUpdates Find: "chat":{"id":12345678} 10. n8n Automation Setup Install n8n Using Docker docker run -it --rm \ -p 5678:5678 \ -v ~/.n8n:/home/node/.n8n \ docker.n8n.io/n8nio/n8n Workflow Steps Node 1: Webhook Receives ESP32 data Node 2: IF Node Checks alert condition Node 3: Telegram Node Sends alert Node 4: Google Sheets Node Stores records Node 5: HTTP Request Uploads to ThingSpeak Node 6: Text-to-Speech Generates voice alert 11. n8n Workflow JSON { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "name": "Telegram", "type": "n8n-nodes-base.telegram" }, { "name": "Google Sheets", "type": "n8n-nodes-base.googleSheets" } ] } 12. Google Sheets Integration Step-by-Step Create Sheet Columns: | Time | Alert | Latitude | Longitude | Status | Connect with n8n Google Cloud Console Enable Sheets API Create OAuth Credentials Connect inside n8n 13. ThingSpeak Dashboard Setup Create Account Use: ThingSpeak Official Website Create Channel Fields: Field Data Field 1 Latitude Field 2 Longitude Field 3 Alert Status Field 4 Battery Voltage API Example https://api.thingspeak.com/update?api_key=YOUR_KEY&field1=17.3850 14. Face Recognition System Options Option 1: ESP32 Basic Face Recognition Lightweight Limited accuracy Option 2: Python AI Server Recommended Use: OpenCV FaceNet DeepFace Python Face Recognition Example from deepface import DeepFace result = DeepFace.verify( img1_path="captured.jpg", img2_path="authorized.jpg" ) print(result) 15. AI Power Consumption Prediction Logic Objective Predict: Battery drain Vehicle idle usage Theft-related abnormal consumption Parameters Parameter Description Battery Voltage Current voltage GPS Usage Tracking frequency WiFi Usage Data transmission Camera Runtime AI processing load AI Logic Simple Linear Regression: power = camera_usage*0.5 + wifi_usage*0.3 + gps_usage*0.2 16. Telegram Voice Notification Automation Process n8n receives theft event Generate TTS message Convert text to MP3 Send MP3 to Telegram Example Alert Warning! Unauthorized vehicle access detected. Current GPS location shared. 17. AI Agentic IoT Logic Agent Decision System The AI agent can: Decide theft probability Trigger emergency mode Disable ignition Notify multiple users Detect repeated attempts Sample AI Rule if unknown_face and motion_detected: trigger_theft_alert() 18. Cloud Dashboard Design Dashboard Widgets Live GPS Map Intrusion Counter Battery Analytics Face Detection Log Vehicle Status 19. Future Enhancements Advanced Features Number Plate Recognition Voice Assistant Remote Engine Lock AI Behavior Prediction Edge AI Processing Mobile App Blockchain Security Logs 4G LTE Connectivity 20. Deployment Guide Step-by-Step Deployment Hardware Assembly Connect all modules Flash ESP32 Upload firmware Configure WiFi Add credentials Setup n8n Import workflow Setup Telegram Bot Add token Connect Cloud APIs ThingSpeak Google Sheets Testing Simulate theft Vehicle Installation Hide device securely 21. Security Recommendations Important Use HTTPS Secure API Keys Encrypt Face Data Enable OTP Access Use Backup Battery 22. Testing Procedure Test Expected Result Motion Detection Camera activated Unknown Face Alert triggered GPS Tracking Coordinates updated Telegram Alert Notification received Cloud Upload Dashboard updated 23. Real-World Applications Smart Cars Bike Security Fleet Monitoring Logistics Vehicles Rental Cars School Buses 24. Software Tools Required Software Purpose Arduino IDE ESP32 programming Python AI processing n8n Automation ThingSpeak Cloud dashboard Telegram Notifications 25. Final Output of the System When theft occurs: ✅ Face captured ✅ GPS tracked ✅ Telegram alert sent ✅ Voice warning generated ✅ Google Sheet updated ✅ ThingSpeak dashboard updated ✅ AI theft analysis performed 26. Suggested Folder Structure SmartVehicleSecurity/ │ ├── ESP32_Code/ ├── AI_Server/ ├── n8n_Workflow/ ├── GoogleSheets/ ├── ThingSpeak/ ├── Documentation/ └── Images/ 27. Recommended Upgrades Hardware ESP32-S3 AI accelerator LTE module Software YOLOv8 Firebase MQTT Broker Node-RED 28. Conclusion This project combines: AI IoT Automation Cloud Computing Vehicle Security to create a modern intelligent anti-theft solution using low-cost hardware and scalable cloud services. The project is suitable for: Final year engineering projects IoT research Smart transportation systems AI security applications Startup prototypes

AI-Based Smart Attendance System Using Face Recognition

AI-Based Smart Attendance System Using Face Recognition ESP32 + AI Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI-Based Smart Attendance System Using Face Recognition ESP32 + AI Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard This project combines: Face Recognition Attendance ESP32 IoT Controller n8n Workflow Automation Telegram Alerts + Voice Notifications Google Sheets Logging ThingSpeak Cloud Dashboard AI-based Power Consumption Prediction Agentic AI Automation Logic 1. Project Overview Objective Build an intelligent attendance system that: Detects and recognizes faces Marks attendance automatically Sends data to cloud Stores records in Google Sheets Sends Telegram notifications and voice alerts Displays analytics on ThingSpeak Predicts power usage using AI logic Uses n8n as an automation brain 2. System Architecture Complete Workflow Camera Detects Face ↓ ESP32-CAM Captures Image ↓ Face Recognition Process ↓ Attendance Verified ↓ ESP32 Sends Data to n8n Webhook ↓ n8n Automation Executes ↓ ├── Google Sheets Entry ├── Telegram Message ├── Telegram Voice Alert ├── ThingSpeak Update └── AI Analytics Processing ↓ Dashboard Monitoring 3. Hardware Components List Component Quantity Purpose ESP32-CAM Module 1 Main controller + camera FTDI Programmer 1 Upload code OLED Display (Optional) 1 Status display Buzzer 1 Audio alert Relay Module (Optional) 1 Door control LED Indicators 2 Status LEDs Push Button 1 Enrollment mode Power Supply 5V 2A 1 Power Jumper Wires Several Connections Breadboard/PCB 1 Circuit setup WiFi Router 1 Internet connection 4. Software Requirements Software Purpose Arduino IDE ESP32 programming n8n Workflow automation Telegram Bot Notifications Google Sheets API Attendance logging ThingSpeak IoT cloud dashboard Python/OpenCV Face training Edge Impulse (Optional) AI model deployment 5. ESP32-CAM Pin Configuration ESP32-CAM Important Pins Pin Function GPIO0 Flash mode GPIO2 LED GPIO12 Camera GPIO13 Camera GPIO14 Camera GPIO15 Camera GPIO16 UART GPIO4 Flash LED 6. Circuit Schematic Diagram Basic Wiring ESP32-CAM -------------------------------- 5V → Power Supply 5V GND → Ground U0R → FTDI TX U0T → FTDI RX GPIO0 → GND (while uploading) Buzzer: GPIO15 → Buzzer + LED: GPIO2 → LED + Relay: GPIO14 → Relay IN 7. Face Recognition System Face Recognition Methods Option 1 — ESP32 Built-in Face Recognition Good for: Small attendance systems 5–20 users Option 2 — Python OpenCV Server Good for: Large databases Better accuracy Recommended: Use ESP32 for image capture Use Python/OpenCV for recognition 8. Face Enrollment Process Steps User presses enrollment button ESP32 captures multiple images Images stored in server/database AI model trains face embeddings Face ID assigned 9. Attendance Logic Workflow Face Detected? ↓ YES Face Recognized? ↓ YES Already Marked Today? ↓ NO Store Attendance Send Notification Update Cloud 10. ESP32 Source Code Arduino IDE Setup Install: ESP32 Board Package Camera libraries WiFi libraries ESP32 Attendance Code #include #include const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASSWORD"; String webhookURL = "https://your-n8n-url/webhook/attendance"; void setup() { Serial.begin(115200); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting..."); } Serial.println("WiFi Connected"); } void loop() { // Simulated recognized face String personName = "Rahul"; String timeStamp = "10:30 AM"; if(WiFi.status()== WL_CONNECTED){ HTTPClient http; http.begin(webhookURL); http.addHeader("Content-Type", "application/json"); String jsonData = "{\"name\":\"" + personName + "\",\"time\":\"" + timeStamp + "\"}"; int httpResponseCode = http.POST(jsonData); Serial.println(httpResponseCode); http.end(); } delay(10000); } 11. n8n Automation Workflow What n8n Does n8n acts as the AI automation brain. It receives attendance data and performs: Google Sheets update Telegram alert Voice notification ThingSpeak update AI prediction logic 12. n8n Workflow Architecture Webhook Trigger ↓ Data Validation ↓ Google Sheets Node ↓ Telegram Node ↓ Text-to-Speech ↓ ThingSpeak API ↓ AI Prediction Function 13. Install n8n Local Installation Using Docker: docker run -it --rm \ -p 5678:5678 \ n8nio/n8n Official Website n8n 14. Create Webhook in n8n Steps Open n8n Create new workflow Add Webhook node Method → POST Path → /attendance Copy webhook URL 15. Google Sheets Integration Create Google Sheet Columns: Name Date Time Status Setup Steps Open Google Cloud Console Enable Sheets API Create Service Account Download JSON credentials Connect credentials to n8n Official APIs Google Sheets API 16. Telegram Bot Setup Create Telegram Bot Open Telegram Search for BotFather Run: /newbot Copy API token Telegram Official Telegram Bot API 17. Telegram Alert Message Example Message ✅ Attendance Marked Name: Rahul Time: 10:30 AM Status: Present 18. Voice Notification Automation Method n8n → Google TTS → Telegram Voice Voice Message Example "Rahul attendance marked successfully." 19. ThingSpeak Dashboard Setup Create ThingSpeak Channel Fields: Field Purpose Field1 Attendance Count Field2 Power Usage Field3 Recognized Faces Field4 WiFi Strength Official Website ThingSpeak 20. Sending Data to ThingSpeak HTTP Request String url = "http://api.thingspeak.com/update?api_key=YOUR_KEY&field1=1"; 21. AI Power Consumption Prediction Goal Predict system power usage using AI logic. Parameters Parameter Description Camera usage time Active duration WiFi transmission Network activity CPU load Processing usage Flash LED usage LED activity Simple Prediction Formula P total ​ =P camera ​ +P wifi ​ +P cpu ​ +P led ​ AI Logic Example predicted_power = (camera_time * 0.5) + (wifi_packets * 0.2) + (cpu_usage * 0.1) 22. AI Agentic Features Smart AI Behaviors AI Agent Can: Detect duplicate attendance Predict abnormal activity Notify low power state Detect unauthorized access Recommend energy optimization Generate daily reports 23. Advanced Attendance Validation Anti-Spoofing Features Use: Eye blink detection Face movement analysis IR sensor validation Multi-frame recognition 24. Database Design Attendance Table ID Name Date Time Confidence 25. Security Features Recommended Security HTTPS webhook Token authentication Face encryption Local backup API rate limiting 26. n8n Workflow JSON Example { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "name": "Google Sheets", "type": "n8n-nodes-base.googleSheets" }, { "name": "Telegram", "type": "n8n-nodes-base.telegram" } ] } 27. Deployment Guide Local Deployment Good for: College projects Labs Small offices Cloud Deployment Use: AWS Railway Render VPS Docker 28. Production Architecture ESP32 Devices ↓ Cloud API Gateway ↓ n8n Server ↓ Database Cluster ↓ AI Analytics Engine 29. Future Enhancements Advanced Features AI Features Emotion detection Mask detection Crowd analytics Face aging adaptation AI attendance prediction IoT Features RFID backup Fingerprint backup Smart lock integration Battery monitoring Offline synchronization Cloud Features Mobile app Admin dashboard Multi-school support Analytics reports 30. Testing Procedure Step-by-Step Testing Hardware Test Power ESP32 Verify camera Test WiFi API Test Trigger webhook Verify Google Sheets update Check Telegram alert AI Test Train face model Test recognition accuracy 31. Troubleshooting Guide Problem Solution Camera not detected Check power supply WiFi disconnects Improve signal Face mismatch Retrain model Telegram not sending Verify bot token Sheets update fails Check API permissions 32. Recommended Folder Structure project/ │ ├── esp32_code/ ├── face_dataset/ ├── python_ai/ ├── n8n_workflow/ ├── dashboard/ ├── docs/ └── deployment/ 33. Recommended Technology Stack Layer Technology Hardware ESP32-CAM AI Vision OpenCV Automation n8n Notifications Telegram Database Google Sheets Cloud IoT ThingSpeak Backend Flask/FastAPI 34. Complete End-to-End Workflow Person Arrives ↓ Face Captured ↓ AI Recognition ↓ Attendance Verification ↓ n8n Webhook Trigger ↓ Google Sheets Updated ↓ Telegram Alert Sent ↓ Voice Notification Sent ↓ ThingSpeak Dashboard Updated ↓ AI Analytics Generated 35. Suggested Enhancements for Final Year Projects Add These for Higher Innovation Edge AI inference Real-time analytics dashboard MQTT communication Firebase integration AI chatbot assistant Voice-controlled admin system Generative AI attendance summaries 36. Recommended Learning Resources ESP32 ESP32 Official Documentation Arduino IDE Arduino IDE OpenCV OpenCV ThingSpeak ThingSpeak Documentation 37. Final Output of System The completed system will provide: ✅ AI face recognition attendance ✅ Real-time cloud monitoring ✅ Telegram alerts ✅ Voice notifications ✅ Google Sheets logs ✅ ThingSpeak analytics ✅ AI-based energy prediction ✅ Fully automated IoT workflow ✅ Smart attendance intelligence ✅ Scalable enterprise architecture 38. Conclusion This project combines: Artificial Intelligence IoT Automation Edge Computing Cloud Analytics Workflow Automation Smart Notifications into a modern smart campus/office solution suitable for: Final year projects Research projects Smart classrooms Offices Industrial attendance systems AIoT demonstrations

AI-Based Human Following Robot with Gesture Recognition

AI-Based Human Following Robot with Gesture Recognition + Agentic IoT System
AI-Based Human Following Robot with Gesture Recognition + Agentic IoT System This project combines: Human-following robot using AI and sensors Hand gesture recognition ESP32 IoT control system AI-based automation workflows Telegram voice alerts Google Sheets cloud logging ThingSpeak dashboard monitoring n8n workflow automation AI power prediction logic 1. Project Overview The robot can: ✅ Follow a human automatically ✅ Detect hand gestures for commands ✅ Send real-time Telegram alerts ✅ Store sensor data in Google Sheets ✅ Upload live telemetry to ThingSpeak cloud ✅ Use AI logic for battery/power prediction ✅ Trigger automated workflows using n8n ✅ Generate voice notifications 2. System Architecture Camera/Sensors ↓ ESP32 Controller ↓ Motor Driver + Motors ↓ WiFi Network ↓ n8n Automation Server ↓ ├── Telegram Voice Alerts ├── Google Sheets Logging ├── ThingSpeak Dashboard └── AI Prediction Engine 3. Required Components List Main Controller Component Quantity ESP32 Dev Board 1 L298N Motor Driver 1 DC Geared Motors 2 Robot Chassis 1 Wheels 2 Castor Wheel 1 Sensors Sensor Purpose Ultrasonic Sensor HC-SR04 Distance measurement IR Sensors Obstacle detection Camera Module ESP32-CAM Gesture recognition MPU6050 Motion sensing Servo Motor Camera rotation Power Item Specification Li-ion Battery 12V Battery Holder 1 Buck Converter 5V output Cloud & Automation Service Purpose ESP32 Documentation Microcontroller platform n8n Workflow automation Telegram Bot API Notification system Google Sheets Data storage ThingSpeak IoT dashboard 4. Hardware Connections ESP32 Pin Connections ESP32 Pin Connected To GPIO 12 Motor IN1 GPIO 13 Motor IN2 GPIO 14 Motor IN3 GPIO 27 Motor IN4 GPIO 26 Trigger HC-SR04 GPIO 25 Echo HC-SR04 GPIO 33 Servo Signal GPIO 32 IR Sensor Left GPIO 35 IR Sensor Right 5. Circuit Schematic Diagram +----------------+ | ESP32 | +----------------+ | | | | | | | +---- Ultrasonic Sensor | | +-------- Servo Motor | +------------ Motor Driver +---------------- WiFi Communication Motor Driver → DC Motors Battery → ESP32 + Motor Driver 6. Working Principle Human Following The ultrasonic sensor continuously measures distance. Logic: If human detected within 50cm: Move Forward Else: Stop Gesture Recognition Using ESP32-CAM: Gesture Action Palm Open Stop Thumb Up Move Forward Left Hand Turn Left Right Hand Turn Right 7. Complete Flowchart START ↓ Initialize ESP32 ↓ Connect WiFi ↓ Read Sensors ↓ Detect Human? ↓ YES Move Robot ↓ Check Gestures ↓ Execute Commands ↓ Send Data to Cloud ↓ Trigger n8n Workflow ↓ Telegram Voice Alert ↓ Store Data in Google Sheets ↓ Repeat 8. ESP32 Source Code (Main Logic) #include #include const char* ssid = "YOUR_WIFI"; const char* password = "PASSWORD"; #define TRIG 26 #define ECHO 25 void setup() { Serial.begin(115200); pinMode(TRIG, OUTPUT); pinMode(ECHO, INPUT); WiFi.begin(ssid, password); while(WiFi.status() != WL_CONNECTED) { delay(500); Serial.println("Connecting..."); } Serial.println("WiFi Connected"); } void loop() { long duration; int distance; digitalWrite(TRIG, LOW); delayMicroseconds(2); digitalWrite(TRIG, HIGH); delayMicroseconds(10); digitalWrite(TRIG, LOW); duration = pulseIn(ECHO, HIGH); distance = duration * 0.034 / 2; Serial.println(distance); if(distance < 50) { Serial.println("Human Detected"); } sendToThingSpeak(distance); delay(1000); } void sendToThingSpeak(int distance) { if(WiFi.status()== WL_CONNECTED){ HTTPClient http; String url = "http://api.thingspeak.com/update?api_key=YOUR_API_KEY&field1=" + String(distance); http.begin(url); int httpCode = http.GET(); Serial.println(httpCode); http.end(); } } 9. Setting Up Arduino IDE Install Required Libraries WiFi.h HTTPClient.h ESP32Servo.h NewPing.h Install board support: ESP32 by Espressif Systems 10. ThingSpeak Dashboard Setup Step-by-Step Open: ThingSpeak Platform Create account Create New Channel Add fields: Distance Battery Temperature Copy: Write API Key Channel ID Add API key in ESP32 code 11. Telegram Bot Setup Create Bot Open Telegram Search: @BotFather Type: /newbot Give bot name Copy Bot Token Get Chat ID Open: https://api.telegram.org/botYOUR_BOT_TOKEN/getUpdates Find: "chat":{"id":123456789} 12. Telegram Voice Notification System Workflow ESP32 Alert ↓ n8n Receives Webhook ↓ Text-to-Speech Conversion ↓ Telegram Voice Message 13. n8n Automation Workflow Install n8n Cloud Version Open: n8n Cloud Local Installation npm install n8n -g n8n start 14. n8n Workflow Logic Webhook Trigger ↓ IF Distance < Threshold ↓ Generate Alert Message ↓ Google Sheets Entry ↓ ThingSpeak Update ↓ Telegram Voice Alert 15. Sample n8n Workflow JSON { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "name": "Telegram", "type": "n8n-nodes-base.telegram" } ] } 16. Google Sheets Integration Steps Open: Google Sheets Create Sheet Columns: Timestamp Distance Battery Gesture Status Connect Google account inside n8n Use: "Append Row" operation 17. AI-Based Power Consumption Prediction Purpose Predict remaining battery life. Inputs Parameter Description Motor Speed RPM Distance Traveled cm Battery Voltage V Current Draw A Simple Prediction Formula P=V×I Battery percentage: Battery%= Maximum Voltage Current Voltage ​ ×100 AI Logic IF battery < 20% Send alert Reduce motor speed 18. Voice Automation Using AI Text-to-Speech APIs You can use: Service Usage Google TTS Voice generation ElevenLabs AI realistic voice Telegram Voice Voice delivery 19. Cloud Dashboard Features Real-Time Monitoring Display: Robot status Gesture detected Battery level Human distance WiFi signal Temperature 20. Advanced Enhancements Future Improvements AI Features Face recognition Object detection Emotion recognition Voice command support Robotics SLAM navigation Autonomous mapping GPS tracking Cloud Firebase integration AWS IoT MQTT broker 21. Deployment Guide Indoor Deployment Use smooth flooring Stable WiFi Proper lighting Outdoor Deployment Add: Waterproof casing GPS module Solar charging 22. Security Recommendations Important Use HTTPS APIs Secure Telegram token Enable firewall on n8n server Use encrypted WiFi 23. Testing Procedure Test Expected Result Human detection Robot follows Gesture detection Executes command WiFi disconnection Auto reconnect Low battery Alert triggered Obstacle detection Robot stops 24. Final Project Outcome After completion, your system will: ✅ Follow humans intelligently ✅ Recognize gestures ✅ Send AI voice alerts ✅ Store cloud data ✅ Provide remote monitoring ✅ Predict battery usage ✅ Support full IoT automation 25. Recommended Software Stack Software Purpose Arduino IDE ESP32 programming Python AI processing OpenCV Vision system n8n Automation Telegram Bot Alerts ThingSpeak Dashboard 26. Suggested Folder Structure Project/ │ ├── ESP32_Code/ ├── n8n_Workflow/ ├── AI_Model/ ├── Documentation/ ├── Circuit_Diagram/ ├── Telegram_Bot/ └── Cloud_Dashboard/ 27. Recommended AI Extensions Add These Later YOLO object detection MediaPipe gesture recognition TensorFlow Lite Edge AI inference 28. Conclusion This project is a complete Industry 4.0 style intelligent robotics system combining: Embedded systems Artificial Intelligence Cloud IoT Automation Robotics Real-time communication It is suitable for: Final year engineering projects Research prototypes Smart surveillance Industrial automation Smart assistant robots

AI-Based Fire and Smoke Detection with Real-Time Alerts

AI-Based Fire and Smoke Detection with Real-Time Alerts AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Cloud Dashboard
AI-Based Fire and Smoke Detection with Real-Time Alerts AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Cloud Dashboard 1. Project Overview This project is an intelligent IoT-based fire and smoke monitoring system using an ESP32 microcontroller, environmental sensors, cloud platforms, and AI-powered automation workflows. The system continuously monitors: Smoke concentration Temperature Flame detection Air quality When abnormal conditions are detected, the ESP32 sends data to: Telegram for instant alerts Google Sheets for logging ThingSpeak dashboard for cloud visualization n8n automation server for AI-based workflows and voice notifications The system can: Detect fire/smoke in real-time Send AI-generated voice alerts Store sensor history Predict power consumption trends Trigger smart automations Enable future AI-based emergency response systems 2. Key Features Core Features ✅ Real-time fire detection ✅ Smoke monitoring ✅ ESP32 WiFi connectivity ✅ Telegram instant alerts ✅ AI voice notifications ✅ Google Sheets logging ✅ ThingSpeak cloud dashboard ✅ n8n workflow automation ✅ Agentic IoT automation ✅ AI power consumption prediction ✅ Remote monitoring dashboard 3. System Architecture ┌──────────────────┐ │ Smoke Sensor MQ2 │ └────────┬─────────┘ │ ┌────────▼─────────┐ │ Flame Sensor │ └────────┬─────────┘ │ ┌────────▼─────────┐ │ DHT11/DHT22 │ │ Temp Sensor │ └────────┬─────────┘ │ ┌────────▼─────────┐ │ ESP32 Controller │ └────────┬─────────┘ │ WiFi ┌────────────────┼─────────────────┐ │ │ │ ▼ ▼ ▼ Telegram Bot ThingSpeak n8n Automation │ │ │ ▼ ▼ ▼ Voice Alerts Cloud Dashboard Google Sheets 4. Components List Component Quantity Purpose ESP32 Dev Board 1 Main controller MQ-2 Smoke Sensor 1 Smoke detection Flame Sensor Module 1 Fire detection DHT22 Sensor 1 Temperature monitoring Buzzer Module 1 Local alarm LED Indicator 2 Status indication Breadboard 1 Circuit assembly Jumper Wires Multiple Connections 5V Power Supply 1 Power source WiFi Router 1 Internet connection 5. Circuit Schematic Diagram ESP32 CONNECTIONS MQ2 Sensor VCC → 3.3V GND → GND AOUT → GPIO34 Flame Sensor VCC → 3.3V GND → GND DOUT → GPIO27 DHT22 VCC → 3.3V GND → GND DATA → GPIO4 Buzzer + → GPIO26 - → GND Red LED + → GPIO25 - → GND 6. Working Principle The ESP32 continuously reads data from: MQ2 smoke sensor Flame sensor DHT22 temperature sensor If: Smoke exceeds threshold Flame is detected Temperature becomes dangerous Then: Local buzzer activates Telegram alert is sent Voice notification generated Data uploaded to ThingSpeak Event logged in Google Sheets n8n AI workflow processes event 7. Flowchart START │ ▼ Initialize ESP32 │ ▼ Connect WiFi │ ▼ Read Sensor Data │ ▼ Smoke/Fire Detected? ┌────┴────┐ YES NO │ │ ▼ ▼ Activate Alarm Continue Monitoring │ ▼ Send Telegram Alert │ ▼ Trigger Voice Alert │ ▼ Upload to ThingSpeak │ ▼ Store in Google Sheets │ ▼ AI Analysis via n8n │ ▼ LOOP 8. ESP32 Source Code (Arduino IDE) #include #include #include "DHT.h" #define DHTPIN 4 #define DHTTYPE DHT22 #define MQ2_PIN 34 #define FLAME_PIN 27 #define BUZZER 26 #define LED 25 DHT dht(DHTPIN, DHTTYPE); const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASSWORD"; String botToken = "YOUR_TELEGRAM_BOT_TOKEN"; String chatID = "YOUR_CHAT_ID"; String thingSpeakApi = "YOUR_THINGSPEAK_API_KEY"; void setup() { Serial.begin(115200); pinMode(FLAME_PIN, INPUT); pinMode(BUZZER, OUTPUT); pinMode(LED, OUTPUT); dht.begin(); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting..."); } Serial.println("WiFi Connected"); } void sendTelegram(String message) { HTTPClient http; String url = "https://api.telegram.org/bot" + botToken + "/sendMessage?chat_id=" + chatID + "&text=" + message; http.begin(url); http.GET(); http.end(); } void sendThingSpeak(float temp, int smoke) { HTTPClient http; String url = "http://api.thingspeak.com/update?api_key=" + thingSpeakApi + "&field1=" + String(temp) + "&field2=" + String(smoke); http.begin(url); http.GET(); http.end(); } void loop() { float temperature = dht.readTemperature(); int smoke = analogRead(MQ2_PIN); int flame = digitalRead(FLAME_PIN); Serial.println(smoke); if (smoke > 2500 || flame == 0 || temperature > 50) { digitalWrite(BUZZER, HIGH); digitalWrite(LED, HIGH); sendTelegram("🔥 FIRE ALERT DETECTED!"); sendThingSpeak(temperature, smoke); delay(5000); } else { digitalWrite(BUZZER, LOW); digitalWrite(LED, LOW); } delay(2000); } 9. n8n Automation Workflow Workflow Features The n8n automation: Receives webhook data Checks fire thresholds Generates AI response Sends Telegram message Creates voice alert Logs to Google Sheets Updates dashboards n8n Workflow Steps Webhook Trigger Parse Sensor Data AI Decision Node Telegram Notification Text-to-Speech Node Google Sheets Append Emergency Alert Routing Sample n8n Workflow JSON { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "name": "Telegram", "type": "n8n-nodes-base.telegram" }, { "name": "Google Sheets", "type": "n8n-nodes-base.googleSheets" } ] } 10. Telegram Bot Setup Step 1: Create Bot Open Telegram and search: Telegram Search for: BotFather Commands: /newbot Copy: Bot Token Step 2: Get Chat ID Send message to your bot. Open: https://api.telegram.org/bot/getUpdates Copy: Chat ID 11. Google Sheets Integration Requirements Google Cloud Project Google Sheets API Service Account Steps Create Google Sheet Enable Sheets API Generate credentials JSON Connect Google Sheets node in n8n Map: Time Smoke Level Temperature Alert Status 12. ThingSpeak Cloud Dashboard Setup Using: ThingSpeak Official Platform Steps Create account Create channel Add fields: Temperature Smoke Fire Status Copy Write API Key Paste into ESP32 code 13. AI Power Consumption Prediction Logic The AI agent estimates power usage based on: Sensor sampling rate WiFi transmission frequency Alarm activation duration CPU active time Formula P=V×I Where: P = Power V = Voltage I = Current Prediction Model predicted_power = (sensor_reads * 0.02) + (wifi_transmissions * 0.15) + (alarm_usage * 0.4) AI can optimize: Sleep intervals Upload timing Sensor polling frequency 14. Voice Notification Automation Workflow Fire Detected ↓ n8n Receives Data ↓ AI Generates Alert Text ↓ Text-to-Speech Conversion ↓ Telegram Voice Message ↓ Emergency Notification Example Voice Alert “Warning! Fire and smoke detected in the monitored area. Please take immediate action.” 15. Cloud Dashboard Features Dashboard Displays Real-time temperature Smoke graph Alert history AI prediction status Device online/offline Notification logs 16. Future Enhancements AI Enhancements Machine learning fire prediction Computer vision smoke detection AI camera integration Edge AI analytics Hardware Enhancements GSM backup alerts Solar-powered ESP32 Battery backup Multi-room deployment Software Enhancements Mobile app MQTT architecture Firebase integration Voice assistant support 17. Deployment Guide Suitable Locations Smart homes Industries Warehouses Laboratories Server rooms Smart buildings 18. Advantages ✅ Low cost ✅ Real-time monitoring ✅ AI-enabled automation ✅ Cloud accessible ✅ Expandable architecture ✅ Remote alerts ✅ Energy efficient 19. Applications Smart Home Safety Industrial Fire Detection Warehouse Monitoring Forest Fire Early Warning Smart Cities Data Center Protection 20. Conclusion This project combines: IoT ESP32 AI automation Cloud monitoring Real-time emergency alerts to create an intelligent fire and smoke detection ecosystem capable of proactive safety monitoring and smart emergency response. The integration of: ESP32 n8n workflows Telegram voice alerts Google Sheets ThingSpeak AI-based automation

SmartSecure Vault : Hybrid Authentication and Surveillance Locker System

SmartSecure Vault: Hybrid Authentication & Surveillance Locker System AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Cloud Dashboard
SmartSecure Vault: Hybrid Authentication & Surveillance Locker System AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Cloud Dashboard 1. Project Overview Project Title SmartSecure Vault – Hybrid Authentication and Surveillance Locker System Abstract SmartSecure Vault is an advanced AI-powered smart locker system using an ESP32 integrated with: Hybrid authentication Intrusion surveillance IoT cloud monitoring AI-based analytics Telegram voice alert notifications Automated workflows using n8n Cloud storage using Google Sheets Real-time dashboard using ThingSpeak The system provides: RFID/PIN/Biometric authentication Motion-based intrusion detection AI power consumption prediction Smart alerts with voice notifications Remote monitoring dashboard Automated incident logging 2. Key Features Security Features RFID authentication PIN-based access Face/Fingerprint support (optional) Servo-controlled locker Buzzer alarm system Intrusion detection Surveillance Features PIR motion sensor ESP32-CAM live image capture Telegram image alerts Voice alert generation IoT & Cloud Features Cloud dashboard monitoring Google Sheets data logging Real-time analytics Remote notifications AI & Automation Features AI-based anomaly detection Power consumption prediction Smart automation using n8n workflows Agentic IoT behavior 3. Components List Component Quantity Purpose ESP32 Dev Board 1 Main controller ESP32-CAM 1 Surveillance camera RFID RC522 Module 1 Card authentication Servo Motor SG90 1 Locker lock mechanism 4x4 Keypad 1 PIN entry PIR Motion Sensor 1 Intrusion detection OLED/LCD Display 1 Status display Buzzer 1 Alarm Relay Module 1 External control Fingerprint Sensor (optional) 1 Biometric access LEDs 2 Status indication Power Supply 5V 1 System power Jumper Wires — Connections Breadboard/PCB 1 Assembly 4. System Architecture +----------------------+ | User Access | | RFID / PIN / Finger | +----------+-----------+ | v +----------------+ | ESP32 | +-------+--------+ | +--------------+--------------+ | | v v +-----------+ +-------------+ | Servo Lock| | ESP32-CAM | +-----------+ +-------------+ | v Telegram Alerts ESP32 → WiFi → n8n | +--------------------------+----------------------+ | | | v v v Google Sheets ThingSpeak Dashboard AI Agent 5. Circuit Schematic Diagram ESP32 Pin Connections Module ESP32 Pin RC522 SDA GPIO 5 RC522 SCK GPIO 18 RC522 MOSI GPIO 23 RC522 MISO GPIO 19 RC522 RST GPIO 22 Servo Signal GPIO 13 PIR OUT GPIO 27 Buzzer GPIO 14 Relay IN GPIO 26 OLED SDA GPIO 21 OLED SCL GPIO 22 Keypad Rows GPIO 32–35 Keypad Columns GPIO 25,33,4,15 6. Working Principle Authentication Flow User scans RFID card or enters PIN. ESP32 validates credentials. If authenticated: Servo unlocks locker. Event logged to cloud. If invalid: Alarm activates. Telegram alert sent. Intrusion Detection PIR sensor detects movement. ESP32-CAM captures image. n8n workflow triggers: Telegram notification Voice alert Google Sheets logging ThingSpeak update 7. Flowchart START | v Initialize ESP32 | v Connect to WiFi | v Wait for Authentication / \ Valid Invalid | | v v Unlock Locker Trigger Alarm | | v v Log Data Send Alert | | +--------+---------+ | v Monitor Sensors | v Intrusion? / \ Yes No | | v | Capture Image| | | Send Telegram| Alert & Log | | | +------+ | END 8. ESP32 Source Code (Arduino IDE) #include #include #include const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASSWORD"; Servo lockerServo; #define PIR_PIN 27 #define BUZZER 14 String webhookURL = "YOUR_N8N_WEBHOOK"; void setup() { Serial.begin(115200); pinMode(PIR_PIN, INPUT); pinMode(BUZZER, OUTPUT); lockerServo.attach(13); WiFi.begin(ssid, password); while(WiFi.status() != WL_CONNECTED){ delay(500); Serial.print("."); } Serial.println("WiFi Connected"); } void sendAlert(String type){ if(WiFi.status()== WL_CONNECTED){ HTTPClient http; http.begin(webhookURL); http.addHeader("Content-Type", "application/json"); String payload = "{\"event\":\"" + type + "\"}"; int httpResponseCode = http.POST(payload); Serial.println(httpResponseCode); http.end(); } } void loop() { int motion = digitalRead(PIR_PIN); if(motion == HIGH){ digitalWrite(BUZZER, HIGH); sendAlert("INTRUSION"); delay(5000); digitalWrite(BUZZER, LOW); } delay(1000); } 9. n8n Workflow Automation Workflow Features Receive ESP32 webhook Analyze event Send Telegram text Convert text-to-speech Send voice alert Store logs in Google Sheets Push data to ThingSpeak n8n Workflow Steps Nodes Webhook Node IF Condition Node Telegram Node HTTP Request Node (TTS API) Google Sheets Node ThingSpeak HTTP Node AI Agent Node Sample Workflow Logic { "event": "INTRUSION", "timestamp": "2026-05-28", "status": "ALERT" } 10. n8n Workflow JSON (Basic) { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "name": "Telegram", "type": "n8n-nodes-base.telegram" }, { "name": "Google Sheets", "type": "n8n-nodes-base.googleSheets" } ] } 11. Telegram Bot Setup Step 1: Create Bot Open Telegram and search: Telegram Use: BotFather Commands: /start /newbot Save: Bot Token Chat ID Step 2: Add Telegram Node in n8n Use: Bot token Chat ID Enable: Send Message Send Voice Send Image 12. Google Sheets Integration Create Sheet Columns Timestamp Event Status User n8n Google Sheets Setup Connect Google account Select spreadsheet Use Append Row operation Logged data: Intrusion alerts Access attempts Power usage AI predictions 13. ThingSpeak Cloud Dashboard Setup Create Channels Fields: Temperature Motion Status Locker State Power Usage Security Score ESP32 API Format https://api.thingspeak.com/update?api_key=YOUR_KEY&field1=1 14. AI Power Consumption Prediction Logic Objective Predict abnormal power usage indicating: Tampering Forced entry Hardware faults AI Logic Inputs Servo activity Camera runtime Motion events WiFi transmission count Prediction Formula P=VI Estimated Consumption E=P×t Simple AI Rule Engine if power_usage > threshold: alert = "Abnormal Usage" 15. Voice Notification Automation Process ESP32 triggers webhook n8n receives event AI generates message TTS converts text to voice Telegram sends audio alert Example Alert Warning! Unauthorized access detected in SmartSecure Vault. 16. Security Enhancements Recommended Improvements AES encryption MQTT secure communication JWT authentication Edge AI anomaly detection Face recognition Cloud backup 17. Future Enhancements AI Features Behavioral analytics AI facial recognition Voice authentication Predictive maintenance IoT Features Mobile app Remote unlock GPS tracking Battery backup monitoring Cloud Features AWS IoT integration Firebase sync Real-time analytics 18. Deployment Guide Hardware Deployment Use PCB instead of breadboard Install backup battery Use metal enclosure Add cooling vents Software Deployment Host n8n on VPS/Raspberry Pi Enable HTTPS Secure APIs Configure OTA updates 19. Applications Bank lockers Office cabinets Smart homes Industrial storage Pharmacy vaults Data center racks 20. Advantages Low cost Real-time monitoring AI-powered automation Cloud analytics Remote security alerts Scalable architecture 21. Conclusion SmartSecure Vault combines: Embedded systems IoT automation AI analytics Cloud computing Smart surveillance to create a next-generation intelligent locker system capable of autonomous monitoring, security enforcement, and predictive analysis. Useful Platforms ESP32 Documentation n8n Official Website ThingSpeak IoT Cloud Telegram Bot API Google Sheets API

Wednesday, 27 May 2026

AI-Based ECG and Heart Disease Prediction System

AI-Based ECG & Heart Disease Prediction System Agentic IoT using ESP32 + AI + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI-Based ECG & Heart Disease Prediction System Agentic IoT using ESP32 + AI + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard 1. Project Overview This project is an advanced AI-powered IoT healthcare monitoring system that continuously monitors ECG signals using an ESP32 microcontroller and predicts possible heart abnormalities using AI logic. The system integrates: ESP32 for sensor data acquisition ECG sensor module (AD8232) AI-based heart disease prediction n8n automation workflows Telegram voice alerts Google Sheets cloud logging ThingSpeak real-time dashboard Agentic IoT automation Web dashboard visualization The solution can be used for: Remote patient monitoring Smart healthcare systems Elderly monitoring Preventive cardiac diagnosis Wearable healthcare projects AI-assisted hospital systems 2. System Architecture ECG Sensor (AD8232) │ ▼ ESP32 Board │ ┌───────────┼───────────┐ ▼ ▼ ▼ ThingSpeak n8n Workflow AI Engine Dashboard │ │ ▼ ▼ Telegram Alerts Heart Disease Voice Msg Prediction │ ▼ Google Sheets 3. Features Core Features ✅ Real-time ECG Monitoring ✅ Heart Disease Prediction using AI ✅ Cloud Dashboard Visualization ✅ Telegram Notification Alerts ✅ Voice Notification Automation ✅ Google Sheets Data Logging ✅ ESP32 WiFi Connectivity ✅ ThingSpeak IoT Dashboard ✅ Agentic AI Decision Making ✅ Abnormal Heartbeat Detection ✅ BPM Calculation ✅ ECG Waveform Monitoring 4. Components List Component Quantity Purpose ESP32 Dev Board 1 Main controller AD8232 ECG Sensor 1 ECG signal acquisition Jumper Wires Several Connections Breadboard 1 Prototyping USB Cable 1 ESP32 programming Power Supply 1 System power WiFi Network 1 Cloud communication Smartphone 1 Telegram alerts Laptop/PC 1 n8n & monitoring 5. Working Principle ECG sensor captures heartbeat signals. ESP32 reads analog ECG waveform. BPM is calculated. AI logic evaluates ECG abnormalities. Data uploaded to ThingSpeak cloud. n8n receives webhook data. Telegram sends alert notifications. Voice alerts generated automatically. Google Sheets stores historical records. 6. Circuit Schematic Diagram AD8232 to ESP32 Connections AD8232 Pin ESP32 Pin OUTPUT GPIO34 3.3V 3.3V GND GND LO+ GPIO26 LO- GPIO27 7. Circuit Diagram (Text Representation) +-------------------+ | ESP32 | | | ECG OUT --> GPIO34 | LO+ --> GPIO26 | LO- --> GPIO27 | 3.3V --> 3.3V | GND --> GND | +-------------------+ 8. Flowchart START │ ▼ Initialize ESP32 WiFi │ ▼ Read ECG Sensor Data │ ▼ Calculate BPM │ ▼ AI Prediction Logic │ ┌──────┴───────┐ ▼ ▼ Normal Abnormal │ │ ▼ ▼ Upload Data Send Alert │ │ ▼ ▼ ThingSpeak Telegram Voice │ │ └──────┬───────┘ ▼ Google Sheets │ ▼ LOOP 9. ESP32 Source Code (Arduino IDE) #include #include const char* ssid = "YOUR_WIFI_NAME"; const char* password = "YOUR_WIFI_PASSWORD"; String apiKey = "THINGSPEAK_API_KEY"; const int ecgPin = 34; int threshold = 550; void setup() { Serial.begin(115200); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting..."); } Serial.println("WiFi Connected"); } void loop() { int ecgValue = analogRead(ecgPin); Serial.println(ecgValue); String condition = "Normal"; if(ecgValue > threshold) { condition = "Abnormal"; } if(WiFi.status() == WL_CONNECTED) { HTTPClient http; String url = "http://api.thingspeak.com/update?api_key=" + apiKey + "&field1=" + String(ecgValue); http.begin(url); int httpCode = http.GET(); Serial.println(httpCode); http.end(); } delay(2000); } 10. AI Heart Disease Prediction Logic Basic AI Logic The AI engine analyzes: ECG amplitude BPM variations Signal irregularities Threshold crossings Heart rhythm pattern Prediction Categories ECG Condition Prediction Normal waveform Healthy Irregular spikes Arrhythmia Risk High BPM Tachycardia Low BPM Bradycardia Noise patterns Sensor Error 11. Advanced AI Enhancement You can improve prediction using: TensorFlow Lite TinyML on ESP32 Edge AI inference Deep learning ECG classification Possible datasets: MIT-BIH Arrhythmia Dataset PhysioNet ECG Database 12. ThingSpeak Cloud Dashboard Setup Using ThingSpeak Steps Create account Create new channel Add fields: ECG Value BPM Prediction Copy Write API Key Insert API key into ESP32 code View real-time graphs 13. Google Sheets Integration Using: Google Apps Script n8n webhook automation Stored Parameters Timestamp ECG BPM Prediction Time ECG Value Heart Rate AI Result 14. Telegram Bot Setup Using Telegram BotFather Steps Open Telegram Search: BotFather Create new bot Copy Bot Token Obtain Chat ID Integrate into n8n workflow 15. Voice Notification Automation Example Voice Alerts Warning! Abnormal heart activity detected. Please check patient condition immediately. Voice Generation Methods Google Text-to-Speech Telegram Voice API ElevenLabs TTS gTTS Python library 16. n8n Automation Workflow Using n8n Automation Platform Workflow Process Webhook Trigger │ ▼ Receive ECG Data │ ▼ AI Analysis │ ▼ Condition Check │ ┌────┴─────┐ ▼ ▼ Normal Abnormal │ │ ▼ ▼ Log Data Telegram Alert │ │ ▼ ▼ Google Sheets Voice Message 17. Example n8n Workflow JSON { "nodes": [ { "parameters": {}, "name": "Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 1, "position": [250, 300] }, { "parameters": {}, "name": "Telegram", "type": "n8n-nodes-base.telegram", "typeVersion": 1, "position": [600, 300] } ], "connections": {} } 18. Web Dashboard Features Dashboard Includes Real-time ECG graph BPM display AI prediction result Alert status Patient history Device connectivity status 19. Agentic AI Features The system behaves like an autonomous AI agent: ✅ Detects anomalies ✅ Makes decisions ✅ Sends alerts automatically ✅ Stores data autonomously ✅ Predicts heart abnormalities ✅ Triggers emergency notifications 20. Power Consumption Prediction Logic AI Power Optimization The ESP32 predicts usage patterns: State Power Mode Idle Deep Sleep Monitoring Active Alert Mode High Performance Optimization Techniques Deep sleep mode Sensor polling intervals Adaptive WiFi transmission Edge AI processing 21. Security Enhancements Recommended Security HTTPS APIs Secure MQTT Token authentication Encrypted cloud communication User authentication 22. Future Enhancements Future Scope AI Enhancements Deep learning ECG analysis CNN-based arrhythmia detection Cloud AI diagnosis IoT Enhancements MQTT communication Firebase integration AWS IoT Core Edge AI Healthcare Enhancements Multi-patient monitoring Doctor dashboard Emergency ambulance alerts GPS tracking Hardware Enhancements OLED display Battery backup Wearable ECG device Mobile app integration 23. Deployment Guide Hardware Deployment Assemble ECG circuit Upload ESP32 firmware Connect WiFi Verify sensor readings Configure ThingSpeak Configure n8n Setup Telegram bot Test alerts 24. Testing Procedure Test Expected Result ECG Reading Real-time waveform BPM Calculation Accurate BPM Cloud Upload Data visible Telegram Alert Alert message received Voice Notification Audio alert plays Google Sheets Data logged 25. Applications Healthcare Applications Smart hospitals Remote healthcare Elderly monitoring ICU monitoring Fitness tracking Home healthcare systems 26. Advantages ✅ Low-cost healthcare solution ✅ Real-time monitoring ✅ AI-assisted diagnosis ✅ Remote accessibility ✅ Cloud integration ✅ Automation support ✅ Scalable architecture 27. Limitations ⚠ Not a certified medical device ⚠ Requires proper ECG electrode placement ⚠ AI predictions are indicative only ⚠ Internet required for cloud features 28. Conclusion The AI-Based ECG and Heart Disease Prediction System combines: Embedded systems Artificial intelligence IoT cloud monitoring Automation workflows Agentic healthcare intelligence This project demonstrates how ESP32, AI, n8n automation, and cloud technologies can create an intelligent remote healthcare monitoring ecosystem capable of real-time prediction, autonomous alerts, and scalable deployment. 29. Recommended Software & Platforms Arduino IDE ESP32 Board Package ThingSpeak Cloud n8n Workflow Automation Google Sheets Telegram API Documentation TensorFlow Lite for Microcontrollers

AI - IoT Integrated Emergency Response System for Women Protection Using ESP32

AI–IoT Integrated Emergency Response System for Women Protection Using ESP32, n8n, Telegram, Google Sheets & ThingSpeak AI–IoT Integra...