Monday, 1 June 2026

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 Integrated Emergency Response System for Women Protection Using ESP32, n8n, Telegram, Google Sheets & ThingSpeak 1. Project Overview Project Title AI-Powered Women Safety Emergency Response System using ESP32, Agentic IoT, n8n Automation, Telegram Voice Alerts, Google Sheets, and ThingSpeak Cloud Dashboard Objective Develop an intelligent women protection device that can: Detect emergency situations through a panic button. Send instant SOS alerts. Track GPS location. Notify family members and authorities. Generate AI-based threat analysis. Store incident records in Google Sheets. Display real-time data on ThingSpeak. Send Telegram voice notifications automatically. Predict battery/power consumption using AI logic. 2. System Architecture +---------------------+ | Emergency Button | +----------+----------+ | v +---------------------+ | ESP32 Controller | +----------+----------+ | v +---------------------+ | GPS Module | +----------+----------+ | v +---------------------+ | WiFi Internet | +----------+----------+ | +-------------------+ | | v v +----------------+ +----------------+ | ThingSpeak | | n8n Workflow | | Dashboard | | Automation | +----------------+ +--------+-------+ | +-----------+-----------+ | | v v +---------------+ +---------------+ | Telegram Bot | | Google Sheets | +-------+-------+ +---------------+ | v +---------------+ | Voice Alerts | +---------------+ | v +---------------+ | AI Analysis | +---------------+ 3. Components Required Component Quantity ESP32 Dev Board 1 GPS Module NEO-6M 1 Push Button (SOS) 1 Buzzer 1 LED 1 220Ω Resistor 1 Power Bank (5V) 1 Jumper Wires Several Breadboard 1 Smartphone with Telegram 1 WiFi Network 1 Optional: Component Purpose SIM800L GSM Backup communication MPU6050 Fall detection MAX9814 Mic Voice distress detection 4. Working Principle When the woman presses the emergency button: ESP32 detects SOS signal. Reads GPS coordinates. Sends data to ThingSpeak. Sends HTTP request to n8n webhook. n8n triggers: Telegram alert Voice notification Google Sheet logging AI analysis Guardian receives: SOS message Location link Voice call alert 5. Circuit Diagram Connections SOS Button Button Pin1 → GPIO 18 Pin2 → GND Buzzer Buzzer + GPIO 19 Buzzer - GND LED LED Anode GPIO 2 LED Cathode 220Ω GND GPS NEO6M GPS TX → ESP32 GPIO16 GPS RX → ESP32 GPIO17 GPS VCC → 3.3V GPS GND → GND 6. Flowchart START | Initialize ESP32 | Connect WiFi | Read GPS | Wait for SOS Button | Button Pressed? | YES | Activate Buzzer | Get Location | Send Data to n8n | Update ThingSpeak | Telegram Alert | Voice Alert | Save to Google Sheet | AI Risk Analysis | END 7. ESP32 Source Code Libraries #include #include #include #include WiFi Credentials const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASSWORD"; n8n Webhook String webhook = "https://your-n8n-domain/webhook/sos"; Pins #define BUTTON_PIN 18 #define BUZZER_PIN 19 #define LED_PIN 2 Main Logic void loop() { if(digitalRead(BUTTON_PIN)==LOW) { digitalWrite(BUZZER_PIN,HIGH); digitalWrite(LED_PIN,HIGH); String latitude="17.3850"; String longitude="78.4867"; HTTPClient http; http.begin(webhook); http.addHeader("Content-Type","application/json"); String payload = "{\"latitude\":\""+latitude+ "\",\"longitude\":\""+longitude+ "\"}"; http.POST(payload); http.end(); delay(5000); digitalWrite(BUZZER_PIN,LOW); digitalWrite(LED_PIN,LOW); } } 8. n8n Workflow Design Node 1: Webhook Receives SOS request. Input: { "latitude":"17.3850", "longitude":"78.4867" } Node 2: AI Agent Prompt: Analyze emergency alert. Location: {{$json.latitude}}, {{$json.longitude}} Generate threat level: Low Medium High Generate response advice. Node 3: Telegram Message Message: 🚨 WOMAN SAFETY ALERT Emergency Triggered Location: https://maps.google.com/?q={{$json.latitude}},{{$json.longitude}} Threat: {{$json.threat}} Node 4: Telegram Voice Alert Use Telegram API. Text: Emergency Alert. Immediate assistance required. Location received. Convert to speech using TTS node. Node 5: Google Sheets Columns: Timestamp Latitude Longitude Threat Level Status Append row automatically. Node 6: ThingSpeak Update API URL https://api.thingspeak.com/update Fields: field1 = latitude field2 = longitude field3 = threat level field4 = battery % 9. n8n Workflow JSON (Basic) { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "name": "AI Agent", "type": "n8n-nodes-base.openAi" }, { "name": "Telegram", "type": "n8n-nodes-base.telegram" }, { "name": "Google Sheets", "type": "n8n-nodes-base.googleSheets" } ] } 10. Telegram Bot Setup Step 1 Open Telegram Search: @BotFather Step 2 Create Bot /newbot Example: WomenSafetyBot Step 3 Get Token 123456:ABCDEF... Save token. Step 4 Get Chat ID Send: /start Use: https://api.telegram.org/botTOKEN/getUpdates Get Chat ID. 11. Google Sheets Integration Create Sheet: Women_Safety_Logs Columns: Date Time Latitude Longitude Threat Status Battery Connect n8n Credentials: Google OAuth2 Action: Append Row 12. ThingSpeak Dashboard Setup Create Account Use: ThingSpeak New Channel Fields: Field1 → Latitude Field2 → Longitude Field3 → Threat Level Field4 → Battery Obtain Write API Key Read API Key Dashboard Widgets Location Monitoring Map Widget Emergency Count Gauge Widget Battery Status Chart Widget Threat Trend Line Chart 13. AI Power Consumption Prediction Inputs Battery Voltage WiFi Usage GPS Usage Alert Frequency Formula Energy: E=V×I×t Remaining Battery: Remaining = Current Battery - Estimated Consumption AI Logic Example: If GPS active continuously AND WiFi active Then battery drain = HIGH Suggest: Enable Deep Sleep Prediction Levels Battery Prediction >80% Excellent 50-80% Good 20-50% Moderate <20% Critical 14. Voice Notification Automation Workflow SOS Trigger | Generate Text | Google TTS | MP3 Audio | Telegram Send Voice Message: Attention. Emergency alert received. Please respond immediately. Location shared. 15. AI Agent Features The AI agent can: Risk Assessment Low Risk Medium Risk High Risk Critical Pattern Analysis Detect: Repeated alerts Unsafe locations Night-time emergencies Battery anomalies Smart Suggestions Example: Nearest police station Nearest hospital Fastest route 16. Future Enhancements Computer Vision ESP32-CAM Detect: Stalking Physical aggression Suspicious movement Voice Recognition Commands: HELP ME SOS SAVE ME Fall Detection MPU6050 Detect: Sudden impact Unconscious state GSM Backup SIM800L Works without WiFi. Mobile App Flutter App Features: Live tracking Alert history Guardian management AI recommendations 17. Deployment Guide Hardware Assembly Connect ESP32. Connect GPS. Connect SOS button. Connect LED and buzzer. Verify wiring. Software Setup Install Arduino IDE. Install ESP32 Board Package. Install required libraries. Upload code. Cloud Setup Create Telegram bot. Configure n8n workflow. Connect Google Sheets. Create ThingSpeak channel. Test webhook. Testing Test Case 1 Press SOS button. Expected: Buzzer ON Telegram alert received Sheet updated ThingSpeak updated Test Case 2 Battery low. Expected: AI predicts low battery. Notification generated. 18. Expected Output When SOS is pressed: 🚨 WOMEN SAFETY ALERT 🚨 Emergency Triggered Latitude: 17.3850 Longitude: 78.4867 Google Maps: https://maps.google.com/?q=17.3850,78.4867 Threat Level: HIGH Battery: 72% Timestamp: 2026-06-01 10:15:20 Project Outcomes Real-time emergency response. Cloud-connected IoT safety device. AI-assisted threat assessment. Automated voice alerts. Incident logging and analytics. Scalable smart-city safety solution. This architecture is suitable for a final-year B.Tech/M.Tech engineering project, research prototype, startup MVP, or smart safety deployment with AI + IoT + Agentic Automation integration.

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...