Saturday, 30 May 2026

AI Smart Baby Monitoring System with Cry and Motion Detection

AI Smart Baby Monitoring System with Cry and Motion Detection ESP32 + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Baby Monitoring System with Cry and Motion Detection ESP32 + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard 1. Project Overview This project is an AI-powered baby monitoring system that continuously monitors a baby's: Crying sounds Body movements Environmental conditions Sleep patterns The system uses: ESP32 as IoT Controller Sound Sensor for Cry Detection PIR Sensor for Motion Detection ThingSpeak Cloud Dashboard n8n Automation Workflow Telegram Bot Notifications Google Sheets Data Logging AI Agent Logic for Smart Decision Making Telegram Voice Alerts using Text-to-Speech The system can: ✅ Detect crying baby ✅ Detect excessive movement ✅ Send instant Telegram alerts ✅ Send voice notifications ✅ Log all events into Google Sheets ✅ Visualize live data on ThingSpeak ✅ Predict baby discomfort trends using AI logic 2. System Architecture +----------------------+ | Baby Room | +----------------------+ | | +----------------------+ | Sensors | |----------------------| | Sound Sensor | | PIR Motion Sensor | | Temperature Sensor | +----------------------+ | | +----------------------+ | ESP32 | +----------------------+ | WiFi | V +----------------------+ | ThingSpeak Cloud | +----------------------+ | | V +----------------------+ | n8n Server | +----------------------+ | | | | | | Telegram Google AI Agent Alert Sheets 3. Hardware Components List Component Quantity ESP32 Dev Board 1 Sound Sensor KY-037 1 PIR Motion Sensor HC-SR501 1 DHT22 Temperature Sensor 1 Buzzer 1 LED Indicator 1 Breadboard 1 Jumper Wires Several 5V Adapter 1 WiFi Network 1 4. Working Principle Cry Detection Sound sensor continuously monitors sound level. If Sound > Threshold | V Cry Detected ESP32 sends: { "event":"cry", "sound":92 } to ThingSpeak. Motion Detection PIR sensor detects movement. Motion = HIGH ESP32 sends: { "event":"motion", "movement":"active" } AI Agent Analysis n8n receives data. Rules: Cry + Motion = Baby Awake Cry + No Motion = Possible Discomfort No Cry + Motion = Restless Sleep No Cry + No Motion = Sleeping 5. Circuit Schematic Sound Sensor Sound Sensor -> ESP32 VCC -> 3.3V GND -> GND AO -> GPIO34 PIR Sensor PIR -> ESP32 VCC -> 5V GND -> GND OUT -> GPIO27 DHT22 DHT22 -> ESP32 VCC -> 3.3V DATA -> GPIO4 GND -> GND Buzzer Buzzer -> GPIO18 LED LED -> GPIO2 6. Pin Configuration #define SOUND_PIN 34 #define PIR_PIN 27 #define DHT_PIN 4 #define BUZZER_PIN 18 #define LED_PIN 2 7. Flowchart START | Initialize ESP32 | Connect WiFi | Read Sound Sensor | Read Motion Sensor | Read Temperature | Sound > Threshold ? | | YES NO | | Cry Event Continue | Send Data | Motion Detected ? | | YES NO | | Motion Continue | Upload ThingSpeak | Trigger n8n | Send Telegram Alert | Log Google Sheet | Repeat 8. ESP32 Source Code Install Libraries: WiFi.h HTTPClient.h DHT.h ThingSpeak.h Main Code #include #include #include #include char* ssid="YOUR_WIFI"; char* password="YOUR_PASSWORD"; unsigned long channelID = YOUR_CHANNEL_ID; const char* writeAPIKey="YOUR_API_KEY"; WiFiClient client; #define SOUND_PIN 34 #define PIR_PIN 27 #define DHT_PIN 4 DHT dht(DHT_PIN,DHT22); void setup() { Serial.begin(115200); pinMode(PIR_PIN,INPUT); WiFi.begin(ssid,password); while(WiFi.status()!=WL_CONNECTED) { delay(500); } ThingSpeak.begin(client); dht.begin(); } void loop() { int soundLevel=analogRead(SOUND_PIN); int motion=digitalRead(PIR_PIN); float temp=dht.readTemperature(); ThingSpeak.setField(1,soundLevel); ThingSpeak.setField(2,motion); ThingSpeak.setField(3,temp); ThingSpeak.writeFields(channelID,writeAPIKey); delay(15000); } 9. ThingSpeak Setup Create account: ThingSpeak Official Platform Create Channel Fields: Field1 = Sound Level Field2 = Motion Status Field3 = Temperature Field4 = AI Risk Score Dashboard Widgets Add: Gauge Line Chart Motion Indicator Temperature Chart Risk Score Chart 10. Telegram Bot Setup Open Telegram Search: BotFather Telegram Bot Creation Guide Commands: /start /newbot Example: BabyMonitorBot Receive: BOT_TOKEN Get Chat ID: https://api.telegram.org/botTOKEN/getUpdates Save: CHAT_ID 11. n8n Setup Install n8n n8n Official Website Docker: docker run -it --rm \ -p 5678:5678 \ -v ~/.n8n:/home/node/.n8n \ docker.n8n.io/n8nio/n8n Open: http://localhost:5678 12. n8n Workflow Logic Webhook Trigger | V Read Sensor Data | IF Cry? | YES | Telegram Alert | Google Sheet | ThingSpeak Update | AI Analysis | Voice Alert 13. n8n Workflow JSON Structure { "nodes":[ { "name":"Webhook", "type":"n8n-nodes-base.webhook" }, { "name":"IF Cry", "type":"n8n-nodes-base.if" }, { "name":"Telegram", "type":"n8n-nodes-base.telegram" }, { "name":"Google Sheets", "type":"n8n-nodes-base.googleSheets" } ] } Import this structure and configure credentials in n8n. 14. Google Sheets Integration Create Sheet: Baby Monitoring Log Columns: Timestamp Sound Motion Temperature Status Connect using: Google OAuth Credentials in n8n. Documentation: Google Sheets API Documentation 15. AI Agent Decision Engine Example rule engine: if sound > 80 and motion == 1: status = "Awake" elif sound > 80 and motion == 0: status = "Discomfort" elif sound < 30 and motion == 1: status = "Restless" else: status = "Sleeping" 16. AI Power Consumption Prediction Logic Track: Voltage Current Operating Hours WiFi Usage Formula: Power = Voltage × Current P=VI Prediction: daily_power = average_hourly_power * 24 monthly_power = daily_power * 30 AI Agent can estimate: Battery remaining Daily energy usage Maintenance interval 17. Voice Notification Automation Workflow: Cry Detected | V n8n | Google TTS | Generate MP3 | Telegram Send Voice Example message: Attention. Baby crying detected. Immediate check recommended. Useful services: Google Text-to-Speech API Telegram Send Voice Node Documentation: Google Cloud Text-to-Speech 18. AI Agent Enhancements You can integrate: OpenAI Platform Ollama Local AI Models LangChain Framework Advanced analysis: Analyze last 24 hours Detect: - Frequent crying - Sleep interruptions - Temperature abnormalities Generate daily report Example AI report: Baby Sleep Score: 82% Cry Events: 7 Motion Events: 24 Recommendation: Check room temperature. 19. Deployment Guide Stage 1 Build hardware. Stage 2 Upload ESP32 code. Stage 3 Verify WiFi connection. Stage 4 Create ThingSpeak Channel. Stage 5 Create Telegram Bot. Stage 6 Install n8n. Stage 7 Connect: ESP32 ↓ ThingSpeak ↓ n8n ↓ Telegram ↓ Google Sheets Stage 8 Test Events Clap near sensor → Cry event Move in front of PIR → Motion event Verify: Telegram notification Google Sheets entry ThingSpeak graph update 20. Future Enhancements AI Features Real cry classification using TinyML Baby face recognition Sleep quality prediction Fever prediction Abnormal behavior detection Hardware Upgrades ESP32-CAM MLX90614 IR thermometer Microphone array Battery backup OLED display Cloud Enhancements Mobile app Firebase integration AWS IoT integration Voice assistant support Multi-room monitoring Expected Project Outcome The final system becomes a complete Agentic AI Baby Monitoring Platform capable of: Real-time cry detection Motion monitoring Cloud analytics AI decision making Telegram text alerts Telegram voice alerts Google Sheets logging ThingSpeak dashboard visualization Power usage prediction Daily baby activity reporting This architecture is suitable for final-year engineering projects, IoT research prototypes, smart nursery deployments, and AI-enabled healthcare monitoring demonstrations.

AI Smart Baby Monitoring System with Cry and Motion Detection

AI Smart Baby Monitoring System with Cry and Motion Detection AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Baby Monitoring System with Cry and Motion Detection AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard 1. Project Overview This project is an intelligent baby monitoring system that continuously monitors: Baby crying sounds Baby movement/motion Room temperature and humidity Activity patterns The system uses: ESP32 for edge sensing AI logic for event detection and prediction n8n for workflow automation Telegram Bot for instant voice alerts Google Sheets for data logging ThingSpeak for IoT dashboard visualization AI Agent for decision making and prediction 2. Objectives The system should: ✅ Detect baby crying ✅ Detect baby movement ✅ Send Telegram notifications ✅ Generate voice alerts ✅ Store historical data ✅ Visualize data on dashboard ✅ Predict high-activity periods ✅ Provide remote monitoring 3. System Architecture +------------------+ | Baby Room | +------------------+ | -------------------------------- | | Sound Sensor PIR Sensor (Cry Detection) (Motion Detection) | | ---------- ESP32 -------------- | | WiFi Internet | ----------------------------------- | | | | ThingSpeak n8n Server Google Sheet AI Agent | | | | ----------------------------------- | Telegram Bot | Voice Notification | Parent 4. Components List Main Controller Component Quantity ESP32 Dev Board 1 Sensors Component Quantity KY-038 Sound Sensor 1 PIR Motion Sensor HC-SR501 1 DHT22 Temperature Sensor 1 Output Devices Component Quantity LED Indicator 1 Buzzer 1 Communication Component Quantity WiFi Router 1 Software Arduino IDE n8n Telegram Bot Google Sheets ThingSpeak OpenAI API (optional AI agent) Google TTS API 5. Working Principle Cry Detection Sound sensor measures sound intensity. Sound > Threshold If: Sound Level > 2000 then: Baby Cry Event generated. Motion Detection PIR sensor detects movement. Motion = HIGH means baby movement detected. AI Decision Layer If: Cry + Motion occur together: Severity = HIGH If: Cry only Severity = MEDIUM If: Motion only Severity = LOW 6. Circuit Schematic Diagram ESP32 -------------------- GPIO34 <-- Sound Sensor AO GPIO27 <-- PIR OUT GPIO4 <-- DHT22 DATA GPIO2 --> LED GPIO15 --> Buzzer 3.3V --> DHT22 VCC 5V --> PIR VCC GND --> All GND 7. Pin Configuration ESP32 Pin Device GPIO34 Sound Sensor GPIO27 PIR Sensor GPIO4 DHT22 GPIO2 LED GPIO15 Buzzer 8. Flowchart START | Initialize ESP32 | Connect WiFi | Read Sensors | +----------------+ | Cry Detected ? | +----------------+ | YES | Send Alert | +------------------+ | Motion Detected? | +------------------+ | YES | High Priority Alert | Upload Data | Store in Sheet | Update Dashboard | AI Prediction | Repeat 9. ESP32 Source Code #include #include #include #define SOUND_PIN 34 #define PIR_PIN 27 #define DHTPIN 4 #define DHTTYPE DHT22 #define LED_PIN 2 #define BUZZER_PIN 15 const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASSWORD"; String webhookURL = "https://your-n8n-server/webhook/baby-monitor"; DHT dht(DHTPIN, DHTTYPE); void setup() { Serial.begin(115200); pinMode(PIR_PIN, INPUT); pinMode(LED_PIN, OUTPUT); pinMode(BUZZER_PIN, OUTPUT); WiFi.begin(ssid,password); while(WiFi.status()!=WL_CONNECTED) { delay(500); } dht.begin(); } void loop() { int soundLevel = analogRead(SOUND_PIN); int motion = digitalRead(PIR_PIN); float temp = dht.readTemperature(); float hum = dht.readHumidity(); String eventType="NORMAL"; if(soundLevel > 2000) { eventType="CRY"; } if(motion==HIGH) { eventType="MOTION"; } if(soundLevel > 2000 && motion==HIGH) { eventType="CRY_MOTION"; } if(eventType!="NORMAL") { digitalWrite(LED_PIN,HIGH); tone(BUZZER_PIN,1000); sendData(eventType,soundLevel,motion,temp,hum); delay(5000); } digitalWrite(LED_PIN,LOW); delay(1000); } void sendData(String eventType, int sound, int motion, float temp, float hum) { if(WiFi.status()==WL_CONNECTED) { HTTPClient http; http.begin(webhookURL); http.addHeader( "Content-Type", "application/json"); String payload = "{"; payload += "\"event\":\""+eventType+"\","; payload += "\"sound\":"+String(sound)+","; payload += "\"motion\":"+String(motion)+","; payload += "\"temp\":"+String(temp)+","; payload += "\"humidity\":"+String(hum); payload += "}"; http.POST(payload); http.end(); } } 10. Telegram Bot Setup Step 1 Open Telegram Search: @BotFather Create Bot: /newbot Example: BabyMonitorBot Get: BOT TOKEN Save token. Step 2 Get Chat ID Send message to bot. Visit: https://api.telegram.org/botTOKEN/getUpdates Copy: chat_id 11. n8n Workflow Design Workflow: Webhook | Function | IF Node | Telegram | Google Sheets | ThingSpeak | AI Agent 12. n8n Step-by-Step Node 1: Webhook Method: POST Path: baby-monitor Receives ESP32 data. Node 2: Function Node return [{ json:{ event:$json.event, severity: $json.event=="CRY_MOTION"? "HIGH": "MEDIUM" } }] Node 3: IF Node Condition: severity = HIGH Node 4: Telegram Node Message: 🚨 Baby Crying and Moving! Immediate attention required. 13. Voice Notification Automation Method 1 Google Text-To-Speech API Generate: Attention. Baby is crying and moving. Please check immediately. MP3 generated. n8n Telegram Send Audio Node: Telegram → Send Audio Audio File: generated_voice.mp3 Parent receives voice alert. 14. Google Sheets Integration Create Sheet: Baby Monitoring Logs Columns: | Timestamp | | Event | | Sound | | Motion | | Temp | | Humidity | | Severity | Google Sheets Node Operation: Append Row Mapping: Date Event Sound Motion Temp Humidity Severity 15. ThingSpeak Setup Create account: ThingSpeak Official Website Create Channel Fields: Field1 = Sound Field2 = Motion Field3 = Temperature Field4 = Humidity Get: WRITE API KEY Upload Example https://api.thingspeak.com/update? api_key=XXXX &field1=1500 &field2=1 &field3=30 &field4=60 16. AI Power Consumption Prediction Logic Purpose: Estimate future power usage. Features: Sensor Activity Count WiFi Usage Alert Frequency Operating Hours Dataset Example Activity Alerts Power 10 2 0.5Wh 50 10 1.2Wh 100 20 2.5Wh AI Formula Linear Regression: y=a+bx a b Where: y = Predicted Power x = Activity Count Prediction Example: Current Activity = 80 Predicted: 2.0 Wh 17. AI Agentic Layer The AI agent receives: { "event":"CRY_MOTION", "sound":2450, "motion":1, "temp":31, "humidity":58 } AI analyzes: Severity Frequency Trend Repeated crying pattern Response: Baby has cried 5 times in the last hour. Activity level is increasing. Recommend immediate check. 18. Advanced AI Features Pattern Analysis Detect: Frequent Crying Night Disturbances Abnormal Activity Predictive Alerts Example: Baby usually cries around 2 AM. AI sends early warning. Anomaly Detection If: No motion for long time or Continuous crying Generate emergency notification. 19. Complete n8n Workflow JSON Structure { "nodes":[ { "name":"Webhook" }, { "name":"Function" }, { "name":"Telegram" }, { "name":"GoogleSheets" }, { "name":"ThingSpeak" } ] } In a real deployment, export the workflow from n8n after configuring credentials and node IDs. 20. Testing Procedure Test 1 Clap near microphone. Expected: Cry Alert Test 2 Move in front of PIR. Expected: Motion Alert Test 3 Cry + Motion Expected: High Priority Alert Voice Notification 21. Future Enhancements Computer Vision Add: ESP32-CAM Face Detection Sleep Monitoring Edge AI Use: TinyML TensorFlow Lite Micro For actual cry classification instead of simple sound threshold detection. Health Monitoring Add: Heart rate sensor Oxygen sensor Breathing sensor Mobile App Develop: Flutter App Android App iOS App 22. Deployment Guide Hardware Deployment Mount sensors near crib (not within baby's reach). Place microphone 1–2 meters away. Install PIR sensor with full crib coverage. Use a stable 5V/2A power supply. Connect ESP32 to a reliable Wi-Fi network. Software Deployment Upload ESP32 firmware. Configure Telegram Bot token. Configure n8n webhook URL. Connect Google Sheets credentials. Configure ThingSpeak API key. Test all alert paths. Enable automatic backups of logs. 23. Expected Outputs Telegram Alert 🚨 HIGH PRIORITY Baby Crying Detected Motion Detected Temperature: 30°C Humidity: 60% Please check immediately. Voice Alert Attention. Baby is crying and moving. Please check the baby immediately. Dashboard Live sound level graph Motion activity graph Temperature trend Humidity trend Alert history AI prediction chart 24. Project Outcomes This solution combines: ESP32 IoT Edge Computing Cry Detection Motion Detection Agentic AI Decision Making n8n Automation Telegram Voice Notifications Google Sheets Logging ThingSpeak Analytics Predictive AI Monitoring The result is a low-cost, scalable, cloud-connected smart baby monitoring platform suitable for homes, daycare centers, hospitals, and research environments.

Friday, 29 May 2026

AI Smart Autonomous Delivery Robot with Obstacle Avoidance

AI Smart Autonomous Delivery Robot with Obstacle Avoidance AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Autonomous Delivery Robot with Obstacle Avoidance AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard 1. Project Overview This project combines: Autonomous delivery robot Obstacle avoidance navigation ESP32 Wi-Fi connectivity AI-powered decision making Agentic IoT architecture n8n workflow automation Telegram voice notification alerts Google Sheets data logging ThingSpeak cloud dashboard AI power consumption prediction Remote monitoring through web dashboard The robot can: ✅ Navigate autonomously ✅ Detect and avoid obstacles ✅ Monitor battery level ✅ Send live telemetry to cloud ✅ Log data into Google Sheets ✅ Generate AI-based battery usage predictions ✅ Send Telegram text and voice notifications ✅ Trigger automation workflows using n8n 2. System Architecture ┌─────────────────┐ │ Autonomous Robot │ │ ESP32 │ └────────┬────────┘ │ ┌────────────────┼─────────────────┐ │ │ │ ▼ ▼ ▼ HC-SR04 Battery Sensor Motor Driver Obstacle Monitoring L298N │ ▼ WiFi Connection │ ▼ n8n Automation │ ┌───────────┬───────┼──────────┐ ▼ ▼ ▼ ▼ Telegram AI Agent Google ThingSpeak Voice Alerts Sheets Dashboard 3. Components List Controller ESP32 DevKit V1 Navigation HC-SR04 Ultrasonic Sensor Servo Motor SG90 Motor Section L298N Motor Driver 2 DC Geared Motors Robot Chassis Wheels Power 18650 Battery Pack Battery Holder TP4056 Charging Module Sensors Voltage Divider Battery Sensor Optional: IR Sensors MPU6050 IMU Communication WiFi (ESP32 Built-in) Cloud Services Telegram Bot Google Sheets ThingSpeak n8n Server OpenAI API (optional) 4. Pin Connections HC-SR04 VCC → 5V GND → GND TRIG → GPIO5 ECHO → GPIO18 Servo Signal → GPIO19 VCC → 5V GND → GND L298N IN1 → GPIO26 IN2 → GPIO27 IN3 → GPIO14 IN4 → GPIO12 Battery Sensor Voltage Divider Output → GPIO34 5. Circuit Schematic Diagram HC-SR04 ┌─────────┐ Trig│ GPIO5 │ Echo│ GPIO18 │ └─────────┘ ESP32 ┌────────────────┐ │ │ │ GPIO26 ─ IN1 │ │ GPIO27 ─ IN2 │ │ GPIO14 ─ IN3 │ │ GPIO12 ─ IN4 │ │ GPIO19 ─ Servo │ │ GPIO34 ← Batt │ └────────────────┘ │ ▼ L298N ┌────────────┐ MotorA│ │MotorB └────────────┘ 6. Working Principle Step 1 Robot moves forward. Step 2 HC-SR04 continuously measures distance. Step 3 If obstacle detected: Distance < 20 cm Robot stops. Step 4 Servo rotates ultrasonic sensor. Left Scan Right Scan Step 5 Robot chooses best path. Step 6 Status uploaded to: ThingSpeak n8n webhook Step 7 n8n workflow: Stores data Runs AI analysis Sends Telegram alerts 7. Flowchart START │ ▼ Connect WiFi │ ▼ Read Sensors │ ▼ Obstacle? │ │ NO YES │ │ ▼ ▼ Move Stop Forward │ ▼ Scan Left │ ▼ Scan Right │ ▼ Best Direction │ ▼ Move │ ▼ Upload Data │ ▼ Repeat 8. ESP32 Source Code Required Libraries WiFi.h HTTPClient.h ESP32Servo.h WiFi Setup const char* ssid="YOUR_WIFI"; const char* password="YOUR_PASSWORD"; ThingSpeak String apiKey="THINGSPEAK_API_KEY"; n8n Webhook String webhook = "https://your-n8n-instance/webhook/robot"; Main Functions void moveForward() { digitalWrite(IN1,HIGH); digitalWrite(IN2,LOW); digitalWrite(IN3,HIGH); digitalWrite(IN4,LOW); } void stopRobot() { digitalWrite(IN1,LOW); digitalWrite(IN2,LOW); digitalWrite(IN3,LOW); digitalWrite(IN4,LOW); } Distance Measurement long readDistance() { digitalWrite(TRIG,LOW); delayMicroseconds(2); digitalWrite(TRIG,HIGH); delayMicroseconds(10); digitalWrite(TRIG,LOW); long duration=pulseIn(ECHO,HIGH); return duration*0.034/2; } Upload Data void sendData() { HTTPClient http; String url= webhook+ "?distance="+String(distance)+ "&battery="+String(battery); http.begin(url); http.GET(); http.end(); } 9. n8n Workflow Design Workflow Nodes Webhook │ ▼ Function │ ▼ OpenAI │ ▼ Google Sheets │ ▼ Telegram Workflow Logic Webhook receives: { "distance": 35, "battery": 72, "status": "MOVING" } Function Node: return [{ battery:$json.battery, distance:$json.distance, status:$json.status }] 10. AI Agent Logic AI Agent receives: Battery = 72% Distance = 35cm Current State = Moving Prompt: Analyze robot health. Predict battery life. Suggest maintenance action. Output: Battery healthy. Estimated operation: 2.8 Hours Remaining. No maintenance required. 11. n8n Workflow JSON Template { "nodes":[ { "name":"Webhook" }, { "name":"OpenAI" }, { "name":"Google Sheets" }, { "name":"Telegram" } ] } Import this JSON into n8n and configure credentials. 12. Telegram Bot Setup Create Bot Open Telegram. Search: @BotFather Commands: /newbot Provide: Robot Delivery Bot Receive: BOT TOKEN Get Chat ID Send message to bot. Open: Telegram Bot API Documentation Retrieve: chat_id 13. Telegram Voice Alert Automation n8n Telegram Node Message: Warning! Obstacle detected. Battery below 20%. Voice Conversion Use: Google Cloud Text-to-Speech or ElevenLabs Workflow: Webhook │ ▼ AI Analysis │ ▼ Text-to-Speech │ ▼ Telegram Send Audio Voice Alert Example: Attention. Delivery robot battery is low. Please recharge soon. 14. Google Sheets Integration Create Sheet: RobotData Columns: Timestamp Distance Battery Status Prediction Example: Time Distance Battery Status Prediction 10:00 45 75 Moving 3 hrs n8n Configuration Add: Google Sheets Node Authentication: OAuth2 Operations: Append Row 15. ThingSpeak Cloud Dashboard Setup Create account: ThingSpeak Official Website Create Channel: Fields: Field1 Distance Field2 Battery Field3 Status Field4 AI Prediction Upload API https://api.thingspeak.com/update Example: field1=35 field2=78 field3=1 16. AI Power Consumption Prediction Inputs Battery Voltage Motor Speed Distance Travelled Obstacle Count Operating Time Formula Basic estimation: Remaining Time = Battery Capacity / Current Consumption Example: 2200mAh / 750mA = 2.93 Hours For visualization: t= I C ​ Where: t = operating time C = battery capacity I = current consumption Advanced AI Model Features: Battery Voltage Motor PWM Obstacle Frequency Average Speed Temperature Model: Linear Regression or Random Forest Prediction: Remaining Battery % Expected Runtime Maintenance Alert 17. Web Dashboard Recommended stack: ESP32 ThingSpeak n8n Telegram Google Sheets Advanced dashboard: React Node.js MQTT Broker AI Analytics Useful platforms: Node-RED Grafana MQTT HiveMQ Cloud 18. Future Enhancements AI Navigation Computer Vision Object Classification Dynamic Route Planning Use: OpenCV YOLO Object Detection Mapping SLAM Indoor Navigation GPS Delivery Modules: NEO-6M GPS Voice Assistant Commands: Start Delivery Return Home Battery Status Emergency Stop Edge AI Models: TinyML TensorFlow Lite Micro Use: TensorFlow Lite for Microcontrollers 19. Deployment Guide Phase 1 Hardware Assembly Assemble chassis Install motors Connect ESP32 Connect sensors Phase 2 Firmware Upload ESP32 code Verify sensor readings Phase 3 Cloud Setup Configure ThingSpeak Configure Telegram Configure Google Sheets Phase 4 Automation Deploy n8n workflow Connect OpenAI API Test alerts Phase 5 Field Testing Obstacle avoidance test Battery monitoring test Cloud connectivity test Telegram voice alert test Phase 6 Production Deployment Waterproof enclosure High-capacity battery OTA firmware updates Secure API keys Fleet monitoring dashboard Final Deliverable Features ✅ Autonomous obstacle avoidance robot ✅ ESP32 Wi-Fi enabled ✅ Agentic AI decision layer ✅ n8n automation workflows ✅ Telegram text and voice alerts ✅ Google Sheets logging ✅ ThingSpeak real-time dashboard ✅ AI battery prediction ✅ Cloud monitoring ✅ Future-ready for computer vision, SLAM, GPS, and multi-robot fleet management This architecture is suitable as a complete final-year engineering project, IoT research prototype, smart campus delivery robot, hospital medicine delivery robot, or warehouse autonomous delivery system.

AI Smart Anti-Sleep Alarm System for Drivers Using CNN

AI Smart Anti-Sleep Alarm System for Drivers Using CNN + ESP32 + Agentic IoT + n8n + Telegram Voice Alerts + Google Sheets + ThingSpeak
<?php echo $title; ?>

AI Smart Anti-Sleep Alarm System for Drivers

CNN + ESP32 + n8n + Telegram + Google Sheets + ThingSpeak

1. Project Description

This project detects driver drowsiness using a CNN-based AI model. When drowsiness is detected, ESP32 activates a buzzer and sends data to an n8n workflow. n8n automatically triggers Telegram alerts, voice notifications, Google Sheets logging, and ThingSpeak dashboard updates.

2. Components List

Component Quantity
ESP32 Dev Board1
ESP32-CAM1
OV2640 Camera1
OLED SSD13061
Active Buzzer1
LED2
Push Button1
Battery Pack1
Jumper WiresAs Required

3. System Architecture

Camera
   |
CNN Drowsiness Detection
   |
ESP32 Controller
   |
   +--> Buzzer
   +--> OLED Display
   +--> n8n Webhook
   +--> Telegram
   +--> Google Sheets
   +--> ThingSpeak

4. Circuit Connections

OLED SSD1306

VCC -> 3.3V
GND -> GND
SCL -> GPIO22
SDA -> GPIO21

Buzzer

+ -> GPIO15
- -> GND

LED

+ -> GPIO2
- -> 220 Ohm -> GND

Button

GPIO4

5. Flowchart

START
 |
Initialize ESP32
 |
Connect WiFi
 |
Capture Face
 |
CNN Detection
 |
Drowsy?
 |
 +----NO----> Continue Monitoring
 |
 YES
 |
Activate Alarm
 |
Send Data to n8n
 |
Telegram Alert
 |
Google Sheets
 |
ThingSpeak
 |
END

6. ESP32 Source Code

#include <WiFi.h>
#include <HTTPClient.h>

const char* ssid="YOUR_WIFI";
const char* password="PASSWORD";

String webhookURL =
"https://your-n8n-server/webhook/drowsy";

int buzzer = 15;
int led = 2;

void setup()
{
 pinMode(buzzer,OUTPUT);
 pinMode(led,OUTPUT);

 WiFi.begin(ssid,password);

 while(WiFi.status()!=WL_CONNECTED)
 {
   delay(500);
 }
}

void loop()
{
 int drowsyFlag = 1;

 if(drowsyFlag)
 {
   digitalWrite(buzzer,HIGH);
   digitalWrite(led,HIGH);

   sendToN8N();
 }

 delay(5000);
}

7. CNN Training Code (Python)

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import Flatten

model = Sequential()

model.add(Conv2D(32,(3,3),
activation='relu',
input_shape=(64,64,3)))

model.add(Flatten())

model.add(Dense(128,
activation='relu'))

model.add(Dense(1,
activation='sigmoid'))

model.compile(
optimizer='adam',
loss='binary_crossentropy',
metrics=['accuracy'])

model.save("drowsiness_model.h5")

8. n8n Workflow

Webhook
   |
AI Agent
   |
   +--> Telegram Alert
   +--> Voice Notification
   +--> Google Sheets
   +--> ThingSpeak

9. Telegram Bot Setup

  1. Open Telegram
  2. Search @BotFather
  3. Create new bot using /newbot
  4. Copy API Token
  5. Add token in n8n Telegram node

10. Google Sheets Integration

Date Time Driver Status Battery
12-06-2026 10:30 AM John Drowsy 78%

11. ThingSpeak Dashboard

Field1 = Drowsiness
Field2 = Battery
Field3 = Eye Score
Field4 = Alert Count

12. AI Power Consumption Prediction

Inputs

Battery Voltage
WiFi Usage
Camera Runtime
Alert Frequency

Output

Remaining Battery Life
Power Consumption Forecast

13. Voice Notification Automation

Webhook
   |
Text To Speech
   |
Generate MP3
   |
Telegram Send Audio

Voice Message:

Warning!
Driver drowsiness detected.
Please stop and rest.

14. Future Enhancements

  • YOLOv8 Face Detection
  • TinyML on ESP32
  • GPS Tracking
  • Emergency SMS
  • Accident Detection
  • Fleet Monitoring Dashboard
  • Predictive Fatigue Analytics

15. Deployment Steps

  1. Train CNN model
  2. Deploy model on PC/Raspberry Pi
  3. Connect ESP32
  4. Configure WiFi
  5. Setup n8n workflow
  6. Create Telegram Bot
  7. Connect Google Sheets
  8. Create ThingSpeak Dashboard
  9. Perform testing
  10. Deploy in vehicle
Project Folder Structure AI_Driver_Drowsiness_System/ │ ├── index.php ├── assets/ │ ├── css/ │ ├── images/ │ └── js/ │ ├── esp32/ │ └── esp32_code.ino │ ├── ai_model/ │ ├── train.py │ └── drowsiness_model.h5 │ ├── n8n/ │ └── workflow.json │ └── docs/ └── project_report.pdf This gives you a complete PHP-based project documentation webpage. For a final-year project, I would recommend expanding it into a multi-page professional PHP website with: Home About Project Architecture Diagram Components Circuit Diagram ESP32 Code CNN Model n8n Workflow Telegram Integration Google Sheets Dashboard ThingSpeak Analytics AI Agent Module Power Prediction Module Future Enhancements Download Report (PDF) which looks suitable for project submission and viva presentation. This architecture is suitable for a final-year B.Tech/M.Tech engineering project, research prototype, startup MVP, or commercial fleet-monitoring system, and can be extended with GPS, GSM, TinyML, and advanced Agentic AI workflows.

Thursday, 28 May 2026

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-Powered Home Automation Using Voice & Face Recognition (ESP32 + Agentic IoT + n8n + Telegram + Google Sheets + ThingSpeak) 1. 📌 Project Overview This project builds a smart home automation system using: ESP32 AI-based decision layer (agentic IoT logic) Workflow automation using n8n Real-time alerts via Telegram Cloud logging in Google Sheets IoT visualization in ThingSpeak Voice + Face recognition (AI layer on mobile/cloud/edge) 🎯 Core Idea: Your home devices (lights, fans, door lock, sensors) are controlled by ESP32, while AI + n8n + Telegram act as the brain for automation, alerts, and analytics. 2. 🧩 System Architecture 🔄 Flow: Sensors → ESP32 collects data ESP32 → sends data to ThingSpeak / Webhook n8n workflow → processes data AI Agent → makes decisions Telegram → sends voice/text alerts Google Sheets → logs all activity User → controls system via voice/face commands 3. 🧰 Components List Hardware: ESP32 Dev Board Relay Module (2/4 channel) PIR Motion Sensor DHT11/DHT22 (Temperature & Humidity) LDR (Light Sensor) Camera module (for face recognition) Buzzer / LED indicators Power supply (5V) Software: ESP32 firmware (Arduino IDE / PlatformIO) n8n ThingSpeak Google Sheets Telegram bot Python (AI voice + face recognition) OpenCV / Face Recognition library Google Text-to-Speech (for voice alerts) 4. ⚡ Circuit Schematic (Explanation) ESP32 connections: Component ESP32 Pin Relay IN1 GPIO 26 Relay IN2 GPIO 27 PIR Sensor GPIO 14 DHT11 GPIO 4 LDR (Analog) GPIO 34 Buzzer GPIO 25 Camera Module: Connected via ESP32-CAM or external AI module 5. 🔁 System Flowchart Start ↓ ESP32 reads sensors ↓ Send data to ThingSpeak / Webhook ↓ n8n workflow triggered ↓ AI Agent processes data ↓ Decision: ├── Normal → Log to Google Sheets ├── Alert → Send Telegram message ├── Critical → Voice alert + automation ON/OFF ↓ User feedback received ↓ Action executed on ESP32 6. 💻 ESP32 Source Code (Basic Example) #include #include #include "DHT.h" #define DHTPIN 4 #define DHTTYPE DHT11 DHT dht(DHTPIN, DHTTYPE); const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASS"; void setup() { Serial.begin(115200); WiFi.begin(ssid, password); dht.begin(); pinMode(26, OUTPUT); // Relay } void loop() { float temp = dht.readTemperature(); float hum = dht.readHumidity(); Serial.println(temp); if (WiFi.status() == WL_CONNECTED) { HTTPClient http; String url = "https://api.thingspeak.com/update?api_key=YOUR_KEY&field1=" + String(temp); http.begin(url); http.GET(); http.end(); } delay(5000); } 7. ⚙️ n8n Workflow Setup Steps: Open n8n Create new workflow Nodes: 1. Webhook Node Receives ESP32 / ThingSpeak data 2. Function Node (AI Logic) if (items[0].json.temp > 35) { return [{ alert: "HIGH TEMP" }]; } return [{ alert: "NORMAL" }]; 3. Telegram Node Send alert message 4. Google Sheets Node Append row (logs data) 5. HTTP Request Node Send command back to ESP32 8. 🤖 Telegram Bot Setup Steps: Open Telegram Search BotFather Create bot Get API token Use in n8n: Connect bot token Configure chat ID Enable: Text alerts Voice messages (TTS) 9. 📊 Google Sheets Integration Structure: Time Temperature Humidity Status Action n8n does: Append row every event Maintain historical analytics 10. ☁️ ThingSpeak Setup Steps: Create channel Add fields: Temperature Humidity Motion Copy API key ESP32 sends data every 10 sec 11. 🧠 AI Power Consumption Prediction Logic Logic idea: if temp > 30 and motion == 1: power_usage = "HIGH" elif temp < 25: power_usage = "LOW" else: power_usage = "MEDIUM" Advanced AI upgrade: Use regression model: Input: temperature, motion, time Output: predicted energy usage 12. 🔊 Voice Notification System Workflow: Event triggers in n8n Text converted to speech Sent via Telegram voice message Example: “Warning! High temperature detected in living room.” 13. 📷 Face Recognition System Process: ESP32-CAM captures image Python/OpenCV processes face Compare with stored dataset Decision: Known user → Unlock door Unknown → Alert sent 14. 🚨 Automation Logic Examples Condition Action Motion detected Turn ON light Temp > 35°C Fan ON Unknown face Send Telegram alert No motion Turn OFF devices 15. 🔌 ESP32 ↔ n8n Communication Two methods: Method 1: Webhook (Recommended) ESP32 sends HTTP POST to n8n Method 2: ThingSpeak polling n8n fetches data periodically 16. 📈 Dashboard Setup In ThingSpeak: Live graphs: Temperature Humidity Motion Historical trends Export CSV 17. 🚀 Future Enhancements AI upgrades: Full edge AI on ESP32-S3 Voice assistant integration Emotion detection via camera Predictive maintenance AI IoT upgrades: Smart energy billing Solar energy integration MQTT-based scalable architecture Automation upgrades: Multi-room smart control Mobile app dashboard AI chatbot control system 18. 📦 Final Deployment Guide Flash ESP32 code Setup WiFi connection Deploy n8n workflow Connect Telegram bot Configure ThingSpeak API Link Google Sheets Test sensor triggers Enable AI logic Deploy face recognition system 🎯 Final Output You will get: Real-time smart home control AI-based decision automation Telegram alerts (text + voice) Cloud logging dashboard Face + voice recognition security Predictive energy monitoring

AI-Powered Driver Drowsiness Detection and Accident Prevention System

🚗 AI-Powered Driver Drowsiness Detection & Accident Prevention System (ESP32 + IoT + n8n + Telegram + Google Sheets + ThingSpeak + AI Agentic Workflow)
Below is a complete, structured, step-by-step documentation for your project: 🚗 AI-Powered Driver Drowsiness Detection & Accident Prevention System (ESP32 + IoT + n8n + Telegram + Google Sheets + ThingSpeak + AI Agentic Workflow) 1. 📌 Project Overview This system detects driver drowsiness in real time using AI and sensors and triggers instant multi-channel alerts using: 📱 Telegram (text + voice alerts) 📊 Google Sheets (logging) ☁️ ThingSpeak (IoT dashboard) 🔄 n8n automation workflows (AI agentic orchestration) 🤖 ESP32 microcontroller (edge device) 🎯 Goal: Prevent road accidents by detecting: Eye closure (PERCLOS method or IR sensor) Head tilt / nodding Sudden inactivity / fatigue patterns 2. 🧰 Components List Hardware ESP32 Dev Board IR Eye Blink Sensor / Camera module (OV2640 optional) MPU6050 (Accelerometer + Gyroscope) Buzzer (Alarm) Vibration motor (optional) OLED Display (optional) Power bank / 5V supply Software / Cloud n8n Automation Server (self-hosted or cloud) Telegram Bot API Google Sheets API ThingSpeak IoT Cloud Python (optional AI processing) Arduino IDE / PlatformIO 3. ⚡ System Architecture Sensors (Eye + Head movement) ↓ ESP32 (Edge Processing) ↓ WiFi n8n Webhook Trigger ↓ ┌───────────────┬────────────────┬─────────────────┐ │ Telegram Bot │ Google Sheets │ ThingSpeak │ │ Voice Alerts │ Data Logging │ Dashboard │ └───────────────┴────────────────┴─────────────────┘ ↓ AI Agent (n8n / Python) ↓ Risk Score + Alert Decision 4. 🔄 Flowchart (System Logic) START ↓ Read Eye Blink + Head Movement ↓ Compute Drowsiness Score ↓ Is Score > Threshold? ├── NO → Continue Monitoring └── YES → ↓ Trigger ESP32 Alarm ↓ Send data to n8n webhook ↓ AI Agent evaluates risk ↓ Send: → Telegram message + voice alert → Google Sheets log entry → ThingSpeak update END LOOP 5. 🔌 Circuit Schematic (Connections) ESP32 Pin Mapping IR Eye Sensor VCC → 3.3V GND → GND OUT → GPIO 34 MPU6050 VCC → 3.3V GND → GND SDA → GPIO 21 SCL → GPIO 22 Buzzer → GPIO 25 → GND Vibration Motor (optional) GPIO 26 → transistor → motor 6. 💻 ESP32 Source Code (Arduino) #include #include #include #define EYE_SENSOR 34 #define BUZZER 25 const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASS"; String n8n_url = "https://your-n8n-webhook-url"; void setup() { Serial.begin(115200); pinMode(EYE_SENSOR, INPUT); pinMode(BUZZER, OUTPUT); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); } } void loop() { int eyeValue = analogRead(EYE_SENSOR); Serial.println(eyeValue); if (eyeValue < 1000) { // drowsy threshold example digitalWrite(BUZZER, HIGH); sendToN8N(eyeValue); } else { digitalWrite(BUZZER, LOW); } delay(500); } void sendToN8N(int value) { if (WiFi.status() == WL_CONNECTED) { HTTPClient http; http.begin(n8n_url); http.addHeader("Content-Type", "application/json"); String payload = "{\"eye_status\":" + String(value) + "}"; http.POST(payload); http.end(); } } 7. 🔄 n8n Workflow (JSON) Workflow Steps: Webhook trigger AI Function node Telegram node Google Sheets node HTTP request to ThingSpeak { "nodes": [ { "name": "Webhook", "type": "n8n-nodes-base.webhook" }, { "name": "AI Risk Analyzer", "type": "n8n-nodes-base.function", "parameters": { "functionCode": "const val = $json.eye_status;\nreturn [{ risk: val < 1000 ? 'HIGH' : 'LOW' }];" } } ] } (Full n8n workflows can be extended with drag-and-drop UI) 8. 🤖 Telegram Bot Setup Step 1: Create Bot Open Telegram → search: BotFather Send: /newbot Get API token Step 2: Get Chat ID Search: @userinfobot Copy chat ID Step 3: n8n Telegram Node Bot Token → paste API key Chat ID → your ID Message Example: 🚨 Drowsiness Alert! Driver fatigue detected. Immediate attention required. 9. 📊 Google Sheets Integration Steps: Open Google Sheets Create columns: Time | Eye Value | Risk Level | Action In Google Cloud: Enable Google Sheets API Create Service Account Share sheet with service email In n8n: Add “Google Sheets Node” Append row on trigger 10. ☁️ ThingSpeak Setup Step 1: Create channel: Field1 → Eye value Field2 → Risk level Step 2: API Key from: Channel → API Keys ESP32 / n8n send: https://api.thingspeak.com/update?api_key=XXXX&field1=value 11. 🧠 AI Drowsiness Detection Logic Method 1 (Simple Threshold) Eye sensor value < threshold → drowsy Method 2 (Better AI Model) Train ML model using: Eye blink rate Eye closure duration Head tilt angle Example Model: Logistic Regression Random Forest Lightweight TensorFlow Lite (ESP32-compatible) 12. 🔊 Voice Notification System Method: Use Telegram voice message or TTS API Option A (n8n + TTS API) Convert text → speech file Send as audio in Telegram Option B: Telegram voice message node 13. ⚙️ Automation Logic (n8n AI Agent Style) IF risk = HIGH: → Send Telegram alert → Trigger buzzer via ESP32 webhook → Log to Google Sheets → Update ThingSpeak → Send voice alert ELSE: → Only log data 14. 🚀 Future Enhancements Advanced AI: CNN-based eye detection (camera module) Real-time face landmark detection (MediaPipe) Vehicle Integration: CAN bus integration Automatic braking system trigger Cloud AI: AWS IoT Core integration Azure Digital Twin model Smart Features: Driver identity recognition Fatigue prediction over time Accident prediction model 15. 📦 Deployment Guide Step 1 Upload ESP32 code Step 2 Deploy n8n server (Docker recommended) Step 3 Connect Telegram bot Step 4 Enable Google Sheets API Step 5 Create ThingSpeak dashboard Step 6 Test full pipeline: Simulate eye closure Check alerts flow 16. 🧪 Testing Checklist ESP32 connects to WiFi ✔ Eye sensor reading changes ✔ Buzzer triggers ✔ n8n receives webhook ✔ Telegram alert sent ✔ Google Sheets logs ✔ ThingSpeak updates ✔ 17. 📊 Final System Summary Feature Technology Edge device ESP32 Detection IR / ML / MPU6050 Automation n8n Messaging Telegram Bot Data logging Google Sheets Cloud IoT ThingSpeak AI logic Rule-based / ML If you want, I can also next provide: ✅ 1. 🧩 Full Circuit Diagram (Text + Image Description) 🔌 Final Hardware Architecture ┌────────────────────┐ │ ESP32 DevKit │ └─────────┬──────────┘ │ ┌────────────────────┼────────────────────┐ │ │ │ ┌────▼────┐ ┌──────▼──────┐ ┌─────▼─────┐ │ IR Eye │ │ MPU6050 │ │ Buzzer │ │ Sensor │ │ Gyro+Accel │ │ Alert │ └────┬────┘ └──────┬──────┘ └─────┬─────┘ │ │ │ GPIO34 GPIO21/22 GPIO25 WiFi (Internet) │ ▼ ┌──────────────────────────┐ │ n8n Server │ └─────────┬────────────────┘ │ ┌──────────────┼───────────────┐ ▼ ▼ ▼ Telegram Bot Google Sheets ThingSpeak (Alert + Voice) Logging Dashboard 🖼️ If you want real diagram image: I can generate a clean PNG/SVG circuit diagram (professional Fritzing style). Just say: 👉 “Make PCB-style diagram” ✅ 2. 🔄 n8n Workflow (READY IMPORT JSON) Save this as: drowsiness_n8n_workflow.json 📥 FULL IMPORTABLE WORKFLOW { "name": "Driver Drowsiness Detection System", "nodes": [ { "parameters": { "path": "drowsiness", "method": "POST" }, "name": "Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 1, "position": [250, 300] }, { "parameters": { "functionCode": "const eye = $json.eye_status;\nconst risk = eye < 1000 ? 'HIGH' : 'LOW';\nreturn [{ eye, risk }];" }, "name": "AI Risk Engine", "type": "n8n-nodes-base.function", "typeVersion": 1, "position": [500, 300] }, { "parameters": { "chatId": "YOUR_CHAT_ID", "text": "🚨 Drowsiness Alert!\nRisk Level: {{$json.risk}}\nEye Value: {{$json.eye}}" }, "name": "Telegram Alert", "type": "n8n-nodes-base.telegram", "typeVersion": 1, "position": [750, 200] }, { "parameters": { "operation": "append", "sheetId": "YOUR_SHEET_ID", "range": "Sheet1!A:D", "data": "={{[$now, $json.eye, $json.risk, 'Alert Sent']}}" }, "name": "Google Sheets Logger", "type": "n8n-nodes-base.googleSheets", "typeVersion": 1, "position": [750, 400] }, { "parameters": { "url": "https://api.thingspeak.com/update", "method": "GET", "queryParametersUi": { "parameter": [ { "name": "api_key", "value": "YOUR_API_KEY" }, { "name": "field1", "value": "={{$json.eye}}" } ] } }, "name": "ThingSpeak Update", "type": "n8n-nodes-base.httpRequest", "typeVersion": 1, "position": [1000, 300] } ], "connections": { "Webhook": { "main": [[{"node": "AI Risk Engine", "type": "main", "index": 0}]] }, "AI Risk Engine": { "main": [ [{"node": "Telegram Alert", "type": "main", "index": 0}], [{"node": "Google Sheets Logger", "type": "main", "index": 0}], [{"node": "ThingSpeak Update", "type": "main", "index": 0}] ] } } } ✅ 3. 🧠 Advanced ML Model (Python + Dataset) 📊 Dataset Structure driver_data.csv eye_closure blink_rate head_tilt drowsy 0.2 18 5 0 0.8 5 25 1 🤖 Training Model (Random Forest) import pandas as pd from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier import joblib # Load dataset data = pd.read_csv("driver_data.csv") X = data[['eye_closure', 'blink_rate', 'head_tilt']] y = data['drowsy'] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2) model = RandomForestClassifier(n_estimators=100) model.fit(X_train, y_train) accuracy = model.score(X_test, y_test) print("Accuracy:", accuracy) joblib.dump(model, "drowsiness_model.pkl") 🔮 Real-time Prediction (ESP32 backend or server) import joblib import numpy as np model = joblib.load("drowsiness_model.pkl") def predict(eye, blink, tilt): data = np.array([[eye, blink, tilt]]) result = model.predict(data) return "DROWSY" if result[0] == 1 else "NORMAL" ✅ 4. 📱 Mobile Dashboard (Flutter Alternative) 🚀 Option A: Flutter App Features: Live drowsiness status Graph (ThingSpeak API) Alert history Driver score 📱 Flutter UI Code (Basic) import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Dashboard(), ); } } class Dashboard extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text("Driver Monitor")), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text("Drowsiness Status: NORMAL", style: TextStyle(fontSize: 20)), SizedBox(height: 20), ElevatedButton( onPressed: () {}, child: Text("Refresh Data"), ) ], ), ), ); } } 🚀 Option B: No-Code Dashboard (Recommended) Use: Blynk IoT ThingSpeak IoT Platform Features: Drag-drop widgets Live graph Mobile alerts Easy ESP32 integration ✅ 5. 🗂️ GitHub-Ready Project Structure driver-drowsiness-ai-iot/ │ ├── esp32/ │ ├── drowsiness.ino │ ├── n8n-workflow/ │ ├── drowsiness_n8n_workflow.json │ ├── ml-model/ │ ├── train_model.py │ ├── predict.py │ ├── driver_data.csv │ ├── drowsiness_model.pkl │ ├── flutter-app/ │ ├── lib/ │ │ ├── main.dart │ ├── docs/ │ ├── circuit_diagram.png │ ├── system_architecture.png │ ├── flowchart.png │ ├── cloud-setup/ │ ├── thingspeak_guide.md │ ├── telegram_setup.md │ ├── google_sheets_setup.md │ ├── README.md └── LICENSE 📄 README.md (Sample) # AI Driver Drowsiness Detection System Tech Stack: - ESP32 - n8n Automation - Telegram Bot - ThingSpeak IoT - Google Sheets - Machine Learning (Random Forest) Features: - Real-time drowsiness detection - AI-powered risk prediction - Multi-channel alerts - Cloud dashboard monitoring Setup: 1. Upload ESP32 code 2. Import n8n workflow 3. Configure Telegram bot 4. Connect Google Sheets 5. Enable ThingSpeak channel

AI-Based Women Safety Device with Voice Recognition and Emergency Alerts

AI-Based Women Safety Device with Voice Recognition & Emergency Alerts ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak + AI Prediction
AI-Based Women Safety Device with Voice Recognition & Emergency Alerts ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak + AI Prediction This project is a smart women safety wearable/device built using: ESP32 Voice trigger / panic detection GPS location tracking AI-powered risk & battery prediction Emergency automation using: n8n Telegram Bot API Google Sheets ThingSpeak IoT Cloud The system can: Detect emergency situations Trigger SOS alerts Send GPS coordinates Generate voice alerts on Telegram Store incident history in Google Sheets Display live data in ThingSpeak dashboard Predict battery usage using AI logic Enable future AI-agent based decision making 1. PROJECT OVERVIEW Objective Develop an intelligent women safety system capable of: Emergency detection Voice-triggered activation Real-time cloud monitoring Automated alerting AI-based predictive analytics 2. SYSTEM ARCHITECTURE Overall Workflow User in danger ↓ Voice trigger / Panic button pressed ↓ ESP32 collects: - GPS location - Device status - Audio trigger - Battery level ↓ ESP32 sends data to: - n8n webhook - ThingSpeak cloud ↓ n8n automation: - Sends Telegram alert - Converts text to voice - Logs to Google Sheets - Triggers AI workflow ↓ Emergency contacts receive: - Message - Live location - Voice alert 3. COMPONENTS LIST Component Quantity Purpose ESP32 Dev Board 1 Main controller GPS Module NEO-6M 1 Location tracking Microphone Sensor (MAX9814 / KY-038) 1 Voice detection Push Button 1 Panic switch Buzzer 1 Alarm indication OLED Display (Optional) 1 Status display Li-ion Battery 1 Portable power TP4056 Charging Module 1 Battery charging SIM800L (Optional) 1 GSM backup alerts Jumper Wires — Connections Breadboard / PCB — Prototype 4. CIRCUIT SCHEMATIC CONNECTIONS ESP32 Pin Connections Module ESP32 Pin GPS TX GPIO16 (RX2) GPS RX GPIO17 (TX2) Panic Button GPIO4 Buzzer GPIO5 Microphone OUT GPIO34 Battery Voltage GPIO35 OLED SDA GPIO21 OLED SCL GPIO22 5. CIRCUIT WORKING Step-by-Step 1. ESP32 Initialization WiFi connection established Sensors initialized Telegram/n8n endpoints loaded 2. Monitoring State ESP32 continuously checks: Panic button Voice trigger Battery level 3. Emergency Trigger If: Panic button pressed OR Voice keyword detected ("HELP", "SAVE ME") then: GPS fetched Alarm activated Cloud notification sent 4. n8n Workflow Executes n8n: Receives webhook data Sends Telegram alert Generates voice message Logs incident Stores AI analytics 6. FLOWCHART START ↓ Initialize ESP32 ↓ Connect WiFi ↓ Read Sensors ↓ Emergency Detected? ┌─────────────┐ │ NO │ │ Continue │ └─────┬───────┘ ↓ YES ↓ Get GPS Location ↓ Send Data to n8n ↓ n8n Sends: - Telegram Alert - Voice Message - Google Sheets Log ↓ Update ThingSpeak ↓ Activate Buzzer ↓ END 7. ESP32 SOURCE CODE Required Libraries Install from Arduino IDE: WiFi.h HTTPClient.h TinyGPS++ ArduinoJson ESP32 Arduino Code #include #include const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASSWORD"; String webhook = "YOUR_N8N_WEBHOOK"; #define BUTTON_PIN 4 #define BUZZER_PIN 5 void setup() { Serial.begin(115200); pinMode(BUTTON_PIN, INPUT_PULLUP); pinMode(BUZZER_PIN, OUTPUT); WiFi.begin(ssid, password); while(WiFi.status() != WL_CONNECTED){ delay(500); Serial.print("."); } Serial.println("WiFi Connected"); } void loop() { if(digitalRead(BUTTON_PIN)==LOW){ digitalWrite(BUZZER_PIN, HIGH); if(WiFi.status()==WL_CONNECTED){ HTTPClient http; http.begin(webhook); http.addHeader("Content-Type","application/json"); String jsonData = R"({ "status":"EMERGENCY", "latitude":"17.3850", "longitude":"78.4867", "battery":"78" })"; int response = http.POST(jsonData); Serial.println(response); http.end(); } delay(5000); digitalWrite(BUZZER_PIN, LOW); } } 8. n8n AUTOMATION WORKFLOW n8n Workflow Overview Webhook Trigger ↓ Parse JSON ↓ Telegram Message ↓ Text-to-Speech ↓ Telegram Voice Alert ↓ Google Sheets Entry ↓ ThingSpeak Update 9. 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: Open Telegram Search: Telegram Step 2: Open BotFather Search: BotFather Step 3: Create Bot Command: /newbot Provide: Bot Name Username You receive: BOT TOKEN Save this token. Step 4: Get Chat ID Open: https://api.telegram.org/botTOKEN/getUpdates Send message to bot. Find: chat:{ "id":123456 } 11. TELEGRAM ALERT MESSAGE FORMAT Text Alert 🚨 WOMEN SAFETY ALERT 🚨 Emergency Detected! Location: https://maps.google.com/?q=LAT,LON Battery: 78% Immediate assistance required. 12. TELEGRAM VOICE ALERT AUTOMATION Workflow Emergency Text ↓ Google TTS API ↓ MP3 Voice ↓ Telegram Voice Message Voice Message Example Emergency detected. Please help immediately. Location has been shared. 13. GOOGLE SHEETS INTEGRATION Create Google Sheet Example columns: Timestamp Latitude Longitude Battery Status Connect Google Sheets to n8n Steps Create Google Cloud Project Enable Google Sheets API Create OAuth Credentials Add credentials in n8n Select spreadsheet 14. THINGSPEAK CLOUD DASHBOARD SETUP Create Account Open: ThingSpeak Dashboard Create Channel Fields: Emergency Status Battery % Latitude Longitude API Write URL https://api.thingspeak.com/update?api_key=KEY 15. AI POWER CONSUMPTION PREDICTION Objective Predict: Remaining battery life Device active duration Alert frequency Parameters Used Parameter Description WiFi Usage Current draw GPS Usage Tracking load Alerts Sent Communication usage Battery Voltage Power status AI Logic Simple prediction: Battery Remaining = Current Battery - (Average Hourly Consumption × Time) Future AI Enhancement Use: TinyML TensorFlow Lite Edge AI for: Behavior prediction Threat pattern detection Voice emotion analysis 16. VOICE RECOGNITION SYSTEM Basic Method ESP32 microphone listens for: "HELP" "SAVE ME" "EMERGENCY" Advanced AI Method Use: Edge Impulse TinyML Keyword Spotting Platforms: Edge Impulse TensorFlow Lite for Microcontrollers 17. THINGSPEAK DATA VISUALIZATION Dashboard Charts: Battery graph Emergency count GPS mapping Alert timeline 18. AI AGENTIC AUTOMATION IDEAS AI Agent Can: Auto-call nearest police Detect repeated danger zones Analyze user movement Predict unsafe areas 19. SECURITY FEATURES Feature Description HTTPS Secure communication API Tokens Authentication GPS Encryption Privacy Backup Alerts GSM redundancy 20. FUTURE ENHANCEMENTS Hardware Smartwatch integration Hidden wearable design Solar charging AI Emotion recognition Violence sound detection Real-time AI assistant Cloud Firebase integration AWS IoT Real-time dashboards 21. DEPLOYMENT GUIDE Prototype Stage Breadboard testing Serial monitor debugging PCB Design Use: KiCad EasyEDA Mobile Integration Android app Flutter dashboard 22. TESTING PROCEDURE Test Cases Test Expected Result Panic button Telegram alert Voice trigger Emergency activated Internet lost GSM backup Low battery Warning alert 23. PROJECT FOLDER STRUCTURE WomenSafetyAI/ │ ├── ESP32_Code/ ├── n8n_Workflow/ ├── TelegramBot/ ├── GoogleSheets/ ├── ThingSpeak/ ├── AI_Model/ ├── Documentation/ └── CircuitDiagram/ 24. COMPLETE DATA FLOW ESP32 ↓ WiFi ↓ n8n Webhook ↓ Telegram + Google Sheets + ThingSpeak ↓ Emergency Contacts 25. ADVANCED FEATURES YOU CAN ADD AI Features Face recognition Danger sound classification Automatic distress detection IoT Features Live GPS tracking Geofencing Cloud analytics Smart Automation Auto siren activation Nearby hospital notification Emergency call automation 26. REAL-WORLD APPLICATIONS Women safety wearable Child safety tracking Elderly emergency system Smart security device 27. FINAL OUTPUT OF SYSTEM When emergency occurs: ✅ Buzzer activates ✅ GPS captured ✅ Telegram text sent ✅ Voice alert sent ✅ Google Sheets updated ✅ ThingSpeak dashboard updated ✅ AI prediction generated 28. RECOMMENDED SOFTWARE TOOLS Tool Purpose Arduino IDE ESP32 programming n8n Automation Workflow automation ThingSpeak IoT cloud Google Cloud Console API management EasyEDA PCB design 29. ESTIMATED PROJECT COST Item Approx Cost Total:8000/- This project combines: AI IoT Cloud Automation Edge Computing Real-Time Emergency Response to create a powerful intelligent women safety system using: ESP32 n8n Telegram ThingSpeak Google Sheets This can be developed into: Wearable safety band Smart pendant Smart mobile assistant AI-enabled emergency ecosystem

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