Thursday, 28 May 2026

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-Based Automatic Street Light Control with Traffic Prediction

AI-Based Automatic Street Light Control with Traffic Prediction Agentic IoT System using ESP32 + AI + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak
1. Project Overview This project is an AI-powered smart street lighting system that automatically controls street lights based on: Traffic density Ambient light conditions Motion detection AI-based prediction Cloud analytics The system uses: Espressif Systems ESP32 microcontroller PIR motion sensors LDR light sensor AI prediction logic n8n workflow automation Telegram voice alerts Google Sheets logging ThingSpeak cloud dashboard The system reduces: Electricity wastage Manual maintenance Urban energy costs while enabling: Smart city automation Predictive street lighting Remote monitoring Voice-based AI notifications 2. Key Features Smart Features ✅ Automatic ON/OFF street lights ✅ Traffic density prediction ✅ AI-based energy optimization ✅ Cloud monitoring dashboard ✅ Telegram alerts with voice notification ✅ Google Sheets data logging ✅ ThingSpeak live analytics ✅ n8n automation workflow ✅ Real-time sensor monitoring ✅ ESP32 WiFi IoT control 3. System Architecture +----------------+ | LDR Sensor | +----------------+ | v +----------------+ | ESP32 | | AI Prediction | +----------------+ | | | | | | v v v PIR1 PIR2 Relay Module | | | v | Street Lights | v WiFi Internet | v +----------------------+ | n8n | | Automation Workflow | +----------------------+ | | | | | | v v v Telegram Google ThingSpeak Alerts Sheets Dashboard 4. Components List Component Quantity Purpose ESP32 Dev Board 1 Main controller PIR Motion Sensor 2 Vehicle detection LDR Sensor 1 Day/Night sensing Relay Module 1 Street light control LEDs / Street Lamp Model 4 Demonstration 220Ω Resistors 4 LED protection Breadboard 1 Prototyping Jumper Wires Several Connections 5V Adapter 1 Power supply WiFi Network 1 Cloud communication Telegram Bot 1 Notifications Google Sheet 1 Data storage ThingSpeak Channel 1 Dashboard 5. Circuit Schematic Diagram +------------------+ | ESP32 | | | LDR -------->| GPIO34 | PIR1 ------->| GPIO26 | PIR2 ------->| GPIO27 | Relay ------>| GPIO25 | | | +------------------+ Relay Module: COM -> AC Supply NO -> Street Light GND -> Common Ground LED Street Lights connected through relay 6. Working Principle Daytime LDR detects sunlight Street lights remain OFF Nighttime LDR senses darkness ESP32 activates monitoring mode Traffic Detection PIR sensors detect vehicle movement AI logic estimates traffic intensity AI Prediction Predicts: Peak traffic hours Energy consumption Lighting duration Automation Data sent to: Telegram Google Sheets ThingSpeak 7. Flowchart START | Initialize ESP32 | Read LDR Value | Is it Dark? / \ NO YES | | Lights Read PIR Sensors OFF | | Vehicle Detected? / \ NO YES | | Dim Lights Full Brightness | Send Data to Cloud | AI Prediction | Telegram Voice Alert | Repeat 8. ESP32 Source Code (Arduino IDE) #include #include const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASSWORD"; #define LDR_PIN 34 #define PIR1 26 #define PIR2 27 #define RELAY 25 String webhook = "YOUR_N8N_WEBHOOK"; void setup() { Serial.begin(115200); pinMode(PIR1, INPUT); pinMode(PIR2, INPUT); pinMode(RELAY, OUTPUT); WiFi.begin(ssid, password); while(WiFi.status() != WL_CONNECTED){ delay(500); Serial.print("."); } Serial.println("WiFi Connected"); } void loop() { int ldr = analogRead(LDR_PIN); int pir1 = digitalRead(PIR1); int pir2 = digitalRead(PIR2); bool dark = ldr < 2000; bool traffic = pir1 || pir2; if(dark && traffic){ digitalWrite(RELAY, HIGH); } else{ digitalWrite(RELAY, LOW); } if(WiFi.status() == WL_CONNECTED){ HTTPClient http; http.begin(webhook); http.addHeader("Content-Type", "application/json"); String jsonData = "{"; jsonData += "\"ldr\":" + String(ldr) + ","; jsonData += "\"traffic\":" + String(traffic) + ","; jsonData += "\"light\":" + String(dark); jsonData += "}"; int response = http.POST(jsonData); Serial.println(response); http.end(); } delay(5000); } 9. AI Traffic & Power Prediction Logic Prediction Parameters The AI engine predicts: Vehicle density Energy usage Peak traffic periods Lighting duration Future electricity demand Simple AI Formula Traffic score: Traffic Score= 2 PIR1+PIR2 ​ Power consumption estimation: Power Consumption=Light_ON_Time×Wattage Prediction model: IF traffic high: Increase brightness ELSE: Dim lights Advanced AI Enhancements Future upgrades may use: TensorFlow Lite Edge AI Historical analytics Reinforcement learning 10. n8n Automation Workflow Using n8n automation platform. Workflow Steps Webhook Trigger | v Receive ESP32 JSON | +----> Google Sheets | +----> ThingSpeak Update | +----> Telegram Alert | +----> Voice Message 11. n8n Workflow JSON { "nodes": [ { "parameters": { "path": "street-light" }, "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "parameters": { "operation": "append" }, "name": "Google Sheets", "type": "n8n-nodes-base.googleSheets" }, { "parameters": { "chatId": "YOUR_CHAT_ID", "text": "Traffic detected. Street lights activated." }, "name": "Telegram", "type": "n8n-nodes-base.telegram" } ] } 12. Telegram Bot Setup Using Telegram BotFather Steps Open Telegram Search: @BotFather Create new bot: /newbot Copy Bot Token Add token into n8n Telegram node 13. Telegram Voice Notification Automation Voice Alert Example "Warning! Heavy traffic detected. Street lights switched to high brightness mode." n8n Voice Flow Webhook | Text-to-Speech API | Telegram Send Audio Recommended TTS APIs: Google Cloud Text-to-Speech ElevenLabs 14. Google Sheets Integration Using Google Sheets Logged Parameters Time LDR Traffic Light Status 10:30 PM 1800 HIGH ON Steps Create Google Sheet Enable Google Sheets API Connect credentials in n8n Append rows automatically 15. ThingSpeak Cloud Dashboard Setup Using ThingSpeak Create Channel Fields Field Description Field 1 LDR Value Field 2 Traffic Count Field 3 Light Status Dashboard Widgets Real-time graphs Traffic trends Power analytics AI prediction charts 16. AI Agentic IoT Concept This project becomes an Agentic AI IoT System because: ESP32 senses environment AI predicts conditions n8n automates decisions Telegram communicates alerts Cloud stores intelligence The system acts autonomously with minimal human intervention. 17. Future Enhancements AI Improvements TensorFlow Lite Micro Edge AI on ESP32 Camera-based traffic detection YOLO object detection Smart City Features Automatic fault detection Solar-powered operation Smart energy billing Adaptive brightness Cloud Expansion Firebase integration AWS IoT Core MQTT broker Grafana dashboards Security HTTPS encryption Secure MQTT Device authentication 18. Deployment Guide Hardware Deployment Install poles with PIR sensors Waterproof ESP32 enclosure Connect relay to street lamps Software Deployment Upload ESP32 code Configure WiFi Setup n8n server Connect Telegram API Create ThingSpeak dashboard Testing Simulate darkness Trigger PIR motion Verify cloud updates Check Telegram alerts 19. Applications Smart cities Highway lighting Parking areas Industrial zones Campus roads Smart villages 20. Advantages ✅ Energy saving ✅ Reduced maintenance ✅ AI-based automation ✅ Real-time monitoring ✅ Low operational cost ✅ Remote accessibility ✅ Scalable architecture 21. Conclusion This project demonstrates a complete AI-powered Agentic IoT Smart Street Lighting System integrating: ESP32 AI prediction n8n automation Telegram voice alerts Google Sheets ThingSpeak analytics The system intelligently manages street lights using environmental sensing and predictive analytics, making it suitable for future smart city infrastructure.

AI-Based Automatic Number Plate Recognition with Crime Database Matching

AI-Based Automatic Number Plate Recognition (ANPR) with Crime Database Matching AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Dashboard
AI-Based Automatic Number Plate Recognition (ANPR) with Crime Database Matching AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Dashboard 1. Full Project Description This project is an AI-powered smart surveillance and alert system designed to automatically detect vehicle number plates using computer vision, compare them against a crime/stolen vehicle database, and instantly send alerts through Telegram voice notifications, cloud dashboards, and Google Sheets logging. The system combines: ESP32-CAM for image capture AI-based OCR/ANPR for license plate extraction n8n automation workflows Telegram bot notifications ThingSpeak IoT dashboard Google Sheets cloud logging Agentic AI logic for predictive monitoring Voice notification alerts The solution can be deployed in: Smart cities Toll plazas Police checkpoints Parking systems Campus security Border surveillance Highway monitoring 2. System Architecture ESP32-CAM ↓ WiFi Upload ↓ n8n Webhook ↓ AI OCR Processing ↓ Number Plate Extraction ↓ Crime Database Matching ↓ ┌───────────────┬────────────────┬─────────────────┐ ↓ ↓ ↓ Telegram Alert Google Sheets ThingSpeak Cloud Voice Message Data Logging Live Dashboard 3. Main Features Core Features AI-Based Number Plate Recognition OCR extracts vehicle registration number Supports multiple plate formats Crime Database Matching Compares plate with: stolen vehicle list blacklist database wanted vehicles Telegram Instant Alerts Text notification Voice notification Snapshot image Google Sheets Logging Stores: Vehicle number Date/time Match status GPS location Confidence score ThingSpeak IoT Dashboard Displays: Vehicle count Crime detections Daily trends AI analytics AI Power Consumption Prediction Predicts: Battery usage Camera activity Transmission load 4. Components List Component Quantity ESP32-CAM Module 1 FTDI Programmer 1 OV2640 Camera 1 5V Power Supply 1 Breadboard 1 Jumper Wires Several MicroSD Card 1 WiFi Router 1 USB Cable 1 Buzzer (optional) 1 Relay Module (optional) 1 GPS Module NEO-6M (optional) 1 OLED Display (optional) 1 Solar Panel + Battery (optional) 1 5. Circuit Schematic Diagram ESP32-CAM Basic Wiring FTDI ESP32-CAM -------------------------- 5V → 5V GND → GND TX → U0R RX → U0T GPIO0 → GND (Programming Mode) Optional Buzzer Buzzer + → GPIO12 Buzzer - → GND 6. Flowchart START ↓ ESP32 Captures Image ↓ Send Image to n8n Webhook ↓ AI OCR Extracts Number Plate ↓ Check Crime Database ↓ Is Match Found? ┌───────────────┐ │ YES │ ↓ │ NO Send Telegram │ Voice Alert │ ↓ │ Update Sheets │ ↓ │ Update Dashboard │ ↓ │ END │ ↓ Log Normal Vehicle ↓ END 7. ESP32 Source Code (Arduino IDE) Required Libraries Install: WiFi.h HTTPClient.h esp_camera.h ESP32 Code #include "WiFi.h" #include "HTTPClient.h" #include "esp_camera.h" const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASSWORD"; String serverName = "https://your-n8n-instance/webhook/anpr"; void startCamera(); void setup() { Serial.begin(115200); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println("WiFi Connected"); startCamera(); } void loop() { camera_fb_t * fb = esp_camera_fb_get(); if(!fb) { Serial.println("Camera capture failed"); return; } HTTPClient http; http.begin(serverName); http.addHeader("Content-Type", "image/jpeg"); int response = http.POST(fb->buf, fb->len); Serial.println(response); http.end(); esp_camera_fb_return(fb); delay(10000); } void startCamera() { camera_config_t config; config.ledc_channel = LEDC_CHANNEL_0; config.ledc_timer = LEDC_TIMER_0; config.pin_d0 = 5; config.pin_d1 = 18; config.pin_d2 = 19; config.pin_d3 = 21; config.pin_d4 = 36; config.pin_d5 = 39; config.pin_d6 = 34; config.pin_d7 = 35; config.pin_xclk = 0; config.pin_pclk = 22; config.pin_vsync = 25; config.pin_href = 23; config.pin_sscb_sda = 26; config.pin_sscb_scl = 27; config.pin_pwdn = 32; config.pin_reset = -1; config.xclk_freq_hz = 20000000; config.pixel_format = PIXFORMAT_JPEG; esp_camera_init(&config); } 8. n8n Workflow Overview Workflow Nodes Webhook Trigger ↓ Image OCR API ↓ Extract Plate Number ↓ IF Node (Crime Match?) ┌──────────────┬──────────────┐ ↓ YES ↓ NO Telegram Alert Store Data ↓ Google Sheets ↓ ThingSpeak Update 9. Sample n8n Workflow JSON Structure { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "name": "OCR API", "type": "n8n-nodes-base.httpRequest" }, { "name": "Check Database", "type": "n8n-nodes-base.if" }, { "name": "Telegram", "type": "n8n-nodes-base.telegram" } ] } 10. Telegram Bot Setup Step 1: Create Bot Open Telegram and search: Telegram Use: BotFather Commands: /newbot Copy: Bot Token Step 2: Get Chat ID Send a message to your bot. Open: Telegram API GetUpdates Example: https://api.telegram.org/botTOKEN/getUpdates Find: chat.id 11. Telegram Voice Notification Automation Text-to-Speech Flow Detected Plate ↓ Generate Alert Text ↓ Google TTS API ↓ MP3 Audio File ↓ Telegram Voice Message Example Alert Warning! Blacklisted vehicle detected. Vehicle Number AP09AB1234 Location: Highway Gate 2 12. Google Sheets Integration Required Setup Open: Google Sheets Columns: Time Vehicle No Match Confidence Location Use: Google Sheets node in n8n Authentication: Google OAuth2 13. ThingSpeak Cloud Dashboard Setup Create account at: ThingSpeak Create Fields Field Purpose Field 1 Vehicle Count Field 2 Crime Matches Field 3 AI Confidence Field 4 Power Usage API Example https://api.thingspeak.com/update?api_key=XXXX&field1=20 14. AI Power Consumption Prediction Logic AI Logic Inputs Camera ON time WiFi transmission frequency CPU load Night/day mode Alert frequency Prediction Formula Power Usage = (Camera Active Time × Current Draw) + (WiFi Transmission × Power Cost) Smart Optimization AI Agent: reduces image frequency during low traffic enters deep sleep mode activates high alert mode during suspicious activity 15. AI Agentic IoT Features Agent Behavior Autonomous Decisions Detect unusual activity Increase capture frequency Trigger emergency alerts Smart Learning Identify repeated suspicious vehicles Analyze peak crime hours Optimize bandwidth usage Predictive Analytics Vehicle traffic trends Crime hotspot prediction Battery health forecasting 16. Cloud Dashboard Features Dashboard Includes Live camera activity Detected vehicles Crime alerts GPS tracking AI confidence graph Battery status Daily statistics 17. Security Features Recommended Security API Security HTTPS webhook Token authentication Device Security Secure WiFi OTA firmware update Cloud Security Encrypted database Restricted dashboard access 18. Future Enhancements AI Improvements Deep learning vehicle recognition Face recognition integration Helmet detection Speed detection Hardware Expansion Solar-powered deployment Edge TPU acceleration 4G LTE connectivity Smart City Integration Police control room integration Traffic analytics Automatic barrier control 19. Deployment Guide Step-by-Step Deployment Hardware Assemble ESP32-CAM Upload firmware Connect to WiFi Cloud Configure n8n webhook Setup OCR API Connect Telegram bot Configure Google Sheets Setup ThingSpeak dashboard Testing Capture vehicle image Verify OCR accuracy Check alert system Validate database matching 20. Recommended OCR APIs API Accuracy OpenALPR High Plate Recognizer Very High Google Vision API High EasyOCR Medium Tesseract OCR Basic 21. Suggested AI Stack Technology Purpose ESP32-CAM Edge Device n8n Automation OpenCV Image Processing OCR AI Plate Recognition Telegram Bot Alerts Google Sheets Logging ThingSpeak IoT Dashboard MQTT Communication 22. Expected Output Example Vehicle Detected Plate Number: TS09AB1234 Status: BLACKLISTED Confidence: 96% Location: Checkpost 4 Alert Sent Successfully 23. Conclusion This project demonstrates a complete AI-powered smart surveillance ecosystem combining: Embedded IoT AI-based ANPR Cloud automation Agentic intelligence Real-time voice alerts Predictive analytics It is highly scalable for: smart cities law enforcement intelligent transportation systems automated security monitoring

AI-Based Animal Intrusion Detection for Agriculture Fields

AI-Based Animal Intrusion Detection for Agriculture Fields AI-Powered Agentic IoT System using ESP32 + n8n + Telegram Voice Alerts + Google Sheets + ThingSpeak
1. Project Overview This project is an intelligent agriculture security system that detects animal intrusion in farm fields using AI-enabled IoT automation. The system uses an ESP32 microcontroller connected to motion and distance sensors. When an animal enters the protected area: ESP32 captures intrusion data Sends alerts to cloud services Triggers AI-based automation using n8n Sends Telegram notifications with voice alerts Stores logs in Google Sheets Displays live analytics on ThingSpeak dashboard Predicts future power consumption using AI logic This system helps farmers: Prevent crop damage Monitor fields remotely Receive instant warnings Analyze intrusion patterns Reduce manual surveillance 2. System Architecture ┌────────────────────┐ │ Animal Movement │ └─────────┬──────────┘ │ ┌─────────▼──────────┐ │ PIR / Ultrasonic │ │ Sensors │ └─────────┬──────────┘ │ ┌─────────▼──────────┐ │ ESP32 │ │ WiFi + AI Logic │ └─────────┬──────────┘ │ HTTP/MQTT ┌─────────────────┼─────────────────┐ │ │ │ ▼ ▼ ▼ ┌────────────┐ ┌─────────────┐ ┌──────────────┐ │ ThingSpeak │ │ n8n Server │ │ Google Sheet │ └────────────┘ └──────┬──────┘ └──────────────┘ │ ┌──────────▼───────────┐ │ Telegram Bot Alerts │ │ Voice + Text Message │ └──────────────────────┘ 3. Features Core Features Animal intrusion detection Real-time Telegram alerts AI-based intrusion classification Voice warning notifications Cloud dashboard monitoring Google Sheets logging Automated workflows using n8n AI Features Power usage prediction Intrusion frequency analysis Smart alert prioritization Future threat prediction IoT Features WiFi connectivity Cloud synchronization Remote monitoring Edge-device automation 4. Required Components List Component Quantity Purpose ESP32 Dev Board 1 Main controller PIR Motion Sensor 1 Motion detection Ultrasonic Sensor HC-SR04 1 Distance sensing Buzzer 1 Local alarm LED Indicators 2 Status display Jumper Wires Several Connections Breadboard 1 Prototyping Power Supply 5V 1 System power WiFi Network 1 Internet connectivity Telegram Bot 1 Notifications ThingSpeak Account 1 Cloud dashboard Google Account 1 Sheets integration n8n Server 1 Automation workflows 5. Circuit Schematic Diagram ESP32 PIN CONNECTIONS PIR Sensor ----------- VCC -> 3.3V GND -> GND OUT -> GPIO 13 Ultrasonic Sensor HC-SR04 ------------------------- VCC -> 5V GND -> GND TRIG -> GPIO 12 ECHO -> GPIO 14 Buzzer ------- + -> GPIO 27 - -> GND LED --- + -> GPIO 26 - -> GND 6. Working Principle PIR sensor detects motion. Ultrasonic sensor measures object distance. ESP32 validates intrusion. Data uploaded to ThingSpeak. ESP32 triggers webhook to n8n. n8n: Sends Telegram text alert Generates voice notification Stores records in Google Sheets AI logic predicts power usage trends. Dashboard visualizes all activities. 7. Flowchart START │ Initialize ESP32 │ Connect WiFi │ Read PIR Sensor │ Motion Detected? ┌─No─────────────┐ │ │ │ Wait │ │ └────Yes─────────┘ │ Measure Distance │ Animal Detected? ┌─No─────────────┐ │ │ │ Continue │ │ └────Yes─────────┘ │ Activate Buzzer │ Send Data to ThingSpeak │ Trigger n8n Webhook │ Telegram Alert + Voice │ Store Data in Sheets │ Repeat 8. ESP32 Source Code (Arduino IDE) #include #include const char* ssid = "YOUR_WIFI_NAME"; const char* password = "YOUR_WIFI_PASSWORD"; String webhookURL = "YOUR_N8N_WEBHOOK_URL"; #define PIR_PIN 13 #define TRIG_PIN 12 #define ECHO_PIN 14 #define BUZZER 27 #define LED 26 long duration; float distance; void setup() { Serial.begin(115200); pinMode(PIR_PIN, INPUT); pinMode(TRIG_PIN, OUTPUT); pinMode(ECHO_PIN, INPUT); pinMode(BUZZER, OUTPUT); pinMode(LED, OUTPUT); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting..."); } Serial.println("WiFi Connected"); } float getDistance() { digitalWrite(TRIG_PIN, LOW); delayMicroseconds(2); digitalWrite(TRIG_PIN, HIGH); delayMicroseconds(10); digitalWrite(TRIG_PIN, LOW); duration = pulseIn(ECHO_PIN, HIGH); distance = duration * 0.034 / 2; return distance; } void loop() { int motion = digitalRead(PIR_PIN); if (motion == HIGH) { distance = getDistance(); if (distance < 150) { digitalWrite(BUZZER, HIGH); digitalWrite(LED, HIGH); sendAlert(distance); delay(5000); digitalWrite(BUZZER, LOW); digitalWrite(LED, LOW); } } delay(1000); } void sendAlert(float dist) { if(WiFi.status()== WL_CONNECTED){ HTTPClient http; String url = webhookURL + "?distance=" + String(dist); http.begin(url); int httpCode = http.GET(); Serial.println(httpCode); http.end(); } } 9. n8n Workflow Logic Workflow Steps Webhook Trigger │ ▼ AI Decision Node │ ▼ Telegram Message Node │ ▼ Google Sheets Node │ ▼ ThingSpeak Update Node │ ▼ Text-to-Speech Node │ ▼ Telegram Voice Send 10. Sample n8n Workflow JSON { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook", "parameters": { "path": "animal-alert" } }, { "name": "Telegram Alert", "type": "n8n-nodes-base.telegram", "parameters": { "text": "Animal detected in field!" } } ] } 11. Telegram Bot Setup Step 1: Create Bot Open Telegram and search: Telegram Then search for: BotFather Commands: /newbot Provide: Bot Name Username Copy generated API token. Step 2: Get Chat ID Send message to your bot. Open: https://api.telegram.org/botYOUR_BOT_TOKEN/getUpdates Copy: chat.id 12. Google Sheets Integration Steps Create new Google Sheet Add columns: | Timestamp | Distance | Alert Type | Power Usage | In n8n: Add Google Sheets node Authenticate Google account Select spreadsheet Append rows automatically Recommended columns: Timestamp Animal Type Distance Battery Voltage Alert Status 13. ThingSpeak Cloud Dashboard Setup Create account on: ThingSpeak Create Channel Fields Field Purpose Field 1 Distance Field 2 Motion Field 3 Battery Field 4 Intrusion Count Dashboard Widgets Live intrusion graph Daily activity chart Battery monitor AI prediction chart 14. AI Power Consumption Prediction Logic Objective Predict battery drain and optimize power usage. Inputs Sensor active time Alert frequency WiFi transmission count Buzzer usage duration Simple Prediction Formula The estimated power model: P daily ​ =P idle ​ +n(P wifi ​ +P sensor ​ +P buzzer ​ ) Where: P daily ​ = total daily consumption n = number of intrusion events AI Enhancement Use: Moving average prediction Linear regression Intrusion trend analysis Future AI models: TinyML on ESP32 Edge AI classification Animal species prediction 15. Voice Notification Automation Workflow Intrusion Detected │ ▼ n8n Receives Webhook │ ▼ Text-to-Speech API │ ▼ Generate MP3 Voice │ ▼ Send Telegram Voice Message Example Voice Message Warning! Animal detected in agricultural field sector 3. 16. AI Agentic Automation Concept The system behaves like an AI agent: AI Agent Capability Function Observe Sensor monitoring Analyze Intrusion validation Decide Threat classification Act Send alerts Learn Analyze intrusion history 17. Future Enhancements AI Improvements YOLO animal detection camera TinyML animal classification AI-based crop damage prediction Hardware Enhancements Solar-powered system GSM backup connectivity LoRa communication Cloud Enhancements Mobile app dashboard Firebase integration AWS IoT integration Security Improvements Multi-factor authentication Encrypted communication Edge anomaly detection 18. Deployment Guide Farm Installation Tips Mount sensors 2–3 feet above ground Use waterproof enclosure Install solar charging Ensure stable WiFi coverage Power Optimization Deep sleep mode on ESP32 Send alerts only on confirmed detection Reduce WiFi transmission intervals 19. Advantages Low-cost smart agriculture solution Real-time remote monitoring AI-assisted automation Easy cloud integration Scalable architecture Energy efficient 20. Applications Agricultural farms Forest boundary monitoring Smart villages Wildlife intrusion prevention Crop protection systems 21. Conclusion This AI-powered Agentic IoT system combines: ESP32 AI automation Cloud dashboards Telegram voice alerts n8n workflows Google Sheets analytics to create a complete smart agriculture protection platform capable of intelligent monitoring, automation, and predictive analytics. The project is highly scalable and can evolve into: AI wildlife monitoring Smart farm automation Precision agriculture systems Edge AI surveillance platforms

AI Smart Wheelchair with Voice and Eye Control

AI Smart Wheelchair with Voice and Eye Control AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Dashboard
AI Smart Wheelchair with Voice and Eye Control AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Dashboard 1. Project Overview This project is an AI-enabled Smart Wheelchair designed for elderly and disabled individuals. The wheelchair can be controlled using: 👁️ Eye movement tracking 🎙️ Voice commands 📱 Mobile IoT dashboard 🤖 AI-based automation The system uses an ESP32 microcontroller integrated with: Sensors Motor drivers Cloud platforms AI analytics n8n workflow automation Telegram voice alert system The wheelchair also sends: Battery health alerts Emergency notifications Usage analytics Power consumption predictions 2. Key Features Smart Control Features Voice-controlled navigation Eye-controlled movement Obstacle detection Automatic braking AI-assisted movement prediction IoT Features Real-time monitoring Cloud dashboard Telegram alerts Google Sheets logging Remote tracking AI Features Battery prediction Usage pattern learning Intelligent alert generation Power optimization 3. System Architecture +----------------------+ | User Voice | +----------+-----------+ | v Voice Recognition | v +-------------+ +-------------+ +--------------+ | Eye Sensor | --> | ESP32 | --> | Motor Driver | +-------------+ +-------------+ +--------------+ | ---------------------------------------- | | | v v v ThingSpeak Google Sheets Telegram Bot | | | -------------------------------------- | v n8n AI Automation 4. Components List Component Quantity Purpose ESP32 Dev Board 1 Main controller L298N Motor Driver 1 Motor control DC Geared Motors 2 Wheelchair movement IR Eye Blink Sensor 1 Eye movement detection Ultrasonic Sensor HC-SR04 2 Obstacle detection Microphone Module 1 Voice command input Battery Pack 12V 1 Power supply Buck Converter 1 Voltage regulation Relay Module 1 Safety shutdown Buzzer 1 Alert system WiFi Router/Hotspot 1 Internet connectivity Jumper Wires Multiple Connections Wheelchair Chassis 1 Base frame 5. Circuit Schematic Diagram +----------------+ | ESP32 | | | | GPIO 18 -----> Motor IN1 | GPIO 19 -----> Motor IN2 | GPIO 21 -----> Motor IN3 | GPIO 22 -----> Motor IN4 | GPIO 5 <---- Eye Sensor | GPIO 13 <---- Echo | GPIO 12 ----> Trigger | GPIO 34 <---- Mic Module | GPIO 25 ----> Buzzer +----------------+ | v WiFi Connection | ------------------------ | | | v v v Telegram n8n ThingSpeak 6. Flowchart START | v Initialize ESP32 | v Connect to WiFi | v Read Sensors Data | ------------------- | | | v v v Voice Eye Obstacle Command Movement Detection | | | ---------- | | | v | Control Motors <--- | v Upload Data to Cloud | v Trigger n8n Workflow | v Send Telegram Alerts | v LOOP 7. ESP32 Source Code (Arduino IDE) #include #include const char* ssid = "YOUR_WIFI_NAME"; const char* password = "YOUR_WIFI_PASSWORD"; String apiKey = "THINGSPEAK_API_KEY"; #define IN1 18 #define IN2 19 #define IN3 21 #define IN4 22 #define trigPin 12 #define echoPin 13 #define eyeSensor 5 #define buzzer 25 long duration; int distance; void setup() { Serial.begin(115200); pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); pinMode(eyeSensor, INPUT); pinMode(buzzer, OUTPUT); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println("WiFi Connected"); } void loop() { // Ultrasonic Distance digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = duration * 0.034 / 2; // Eye Sensor int eyeState = digitalRead(eyeSensor); if(distance < 20) { stopWheelchair(); digitalWrite(buzzer, HIGH); } else { digitalWrite(buzzer, LOW); if(eyeState == HIGH) { moveForward(); } else { stopWheelchair(); } } uploadThingSpeak(distance, eyeState); delay(3000); } void moveForward() { digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); } void stopWheelchair() { digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); digitalWrite(IN3, LOW); digitalWrite(IN4, LOW); } void uploadThingSpeak(int distance, int eye) { if(WiFi.status()== WL_CONNECTED){ HTTPClient http; String url = "http://api.thingspeak.com/update?api_key=" + apiKey + "&field1=" + String(distance) + "&field2=" + String(eye); http.begin(url); int httpCode = http.GET(); Serial.println(httpCode); http.end(); } } 8. n8n Workflow Logic Workflow Functions Receive ESP32 webhook data Analyze sensor values Generate AI decisions Send Telegram alerts Store logs in Google Sheets Trigger voice notifications n8n Workflow Steps Webhook Trigger | v HTTP Request (ESP32 Data) | v IF Node (distance < 20?) | YES/NO | v Telegram Alert | v Google Sheets Logging | v AI Processing Node | v Voice Notification 9. Example n8n Workflow JSON { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook", "parameters": { "path": "wheelchair-data" } }, { "name": "Telegram", "type": "n8n-nodes-base.telegram", "parameters": { "chatId": "YOUR_CHAT_ID", "text": "Obstacle detected!" } } ] } 10. Telegram Bot Setup Step 1: Create Bot Open Telegram and search: Telegram Then message: @BotFather Commands: /newbot BotFather provides: Bot Token API access Step 2: Get Chat ID Send message to your bot. Open: https://api.telegram.org/bot/getUpdates Find: "chat":{"id":123456789} Step 3: Send Notifications Example API: https://api.telegram.org/bot/sendMessage?chat_id=&text=ObstacleDetected 11. Google Sheets Integration Create Sheet Columns Time Distance Eye State Battery Status n8n Google Sheets Node Connect Google account Select Spreadsheet Append Rows automatically Data stored: Sensor logs Alerts Battery prediction User activity 12. ThingSpeak Dashboard Setup Create Channel Use: ThingSpeak Create Fields: Distance Eye Sensor Battery Temperature Dashboard Widgets Live graph Gauge meter Alert chart Battery analytics 13. AI Power Consumption Prediction Logic Goal Predict battery drain and optimize wheelchair runtime. Inputs Motor usage time Obstacle frequency Distance traveled Battery voltage Speed AI Formula Battery Consumption: P=V×I Remaining Battery Estimate: Battery Remaining=Battery total ​ −Consumption Prediction Logic IF battery < 20% Send Alert Reduce Motor Speed Enable Power Saving 14. Voice Notification Automation Telegram Voice Alerts n8n converts text to speech: “Obstacle detected” “Battery low” “Emergency assistance required” Workflow ESP32 Event | v n8n Webhook | v AI Decision | v Text-to-Speech | v Telegram Voice Message 15. AI Agentic Features Intelligent Behaviors Learns user movement patterns Predicts battery usage Detects abnormal activity Sends autonomous alerts Example AI Actions Situation AI Response Low battery Reduce speed Obstacle nearby Stop wheelchair Emergency detected Notify caregiver Long inactivity Trigger wellness alert 16. Future Enhancements Advanced AI Features Face recognition Emotion detection Health monitoring Fall detection IoT Upgrades GPS tracking Mobile app Cloud AI dashboard Remote driving Hardware Upgrades Li-ion smart BMS Brushless motors Solar charging Autonomous navigation 17. Deployment Guide Hardware Assembly Mount motors Install ESP32 Connect sensors Attach battery Configure wiring Software Installation Arduino IDE Install: ESP32 board package WiFi library HTTPClient library Cloud Setup Configure ThingSpeak API Configure n8n workflow Setup Telegram bot Connect Google Sheets 18. Applications Disabled assistance Elderly mobility Smart hospitals Rehabilitation centers AI healthcare systems 19. Advantages Hands-free control Low-cost AI system Real-time monitoring Emergency automation Cloud analytics 20. Conclusion This project combines: ESP32 IoT AI automation Voice control Eye tracking Cloud analytics Agentic workflows to create a modern AI Smart Wheelchair System capable of improving mobility, safety, and independence for users with physical disabilities.

AI-Powered Home Automation Using Voice and Face Recognition

🏠 AI-Powered Home Automation Using Voice & Face Recognition (ESP32 + Agentic IoT + n8n + Telegram + Google Sheets + ThingSpeak) 🏠 AI-...