SVSEMBEDDED , 9491535690, 7842358459
SVSEmbedded will do new innovative thoughts. Any latest idea will comes we will take that idea & implement that idea in a few days. We always encourage the students to take good ideas/projects. SVSEmbedded providing latest innovative electronics projects to B.E/B.Tech/M.E/M.Tech students. We developed thousands of projects for engineering student to develop their skills in electrical and electronics
Sunday, 31 May 2026
AI-Based Real-Time Air Pollution Monitoring and Prediction
AI-Based Real-Time Air Pollution Monitoring and Prediction System
ESP32 + AI Agent + IoT Cloud + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Dashboard
AI-Based Real-Time Air Pollution Monitoring and Prediction System
Project Overview
This project develops an AI-Powered Real-Time Air Pollution Monitoring and Prediction System using ESP32, environmental sensors, Agentic AI Analytics, n8n Automation, Telegram Voice Alerts, Google Sheets Logging, and ThingSpeak Cloud Dashboard.
The system continuously monitors air quality parameters, predicts future pollution trends using AI models, and automatically sends intelligent alerts when pollution levels exceed safe limits.
Main Features
Real-Time Monitoring
Air Quality Index (AQI)
PM2.5 Concentration
PM10 Concentration
Carbon Monoxide (CO)
Carbon Dioxide (CO₂)
Smoke Detection
Temperature
Humidity
AI Analytics
AQI Prediction
Pollution Trend Analysis
Risk Classification
Anomaly Detection
Power Consumption Forecasting
Cloud Integration
ThingSpeak Dashboard
Google Sheets Database
Telegram Notifications
AI Agent Monitoring Interface
Automation
n8n Workflow
Voice Alerts
Automatic Data Logging
AI Recommendations
System Architecture
Air Sensors
│
▼
ESP32 Controller
│
WiFi Internet
│
▼
ThingSpeak Cloud
│
▼
n8n Workflow Engine
│
┌───┼─────────────┐
▼ ▼ ▼
AI Agent Google Sheets
Analysis Database
│
▼
Telegram Bot
(Text + Voice Alerts)
Components Required
Component Quantity
ESP32 Dev Board 1
MQ135 Air Quality Sensor 1
PMS5003 PM2.5 Sensor 1
DHT22 Temperature Sensor 1
OLED Display 0.96" 1
Buzzer Module 1
LED Indicators 3
Breadboard 1
Jumper Wires As Required
5V Power Supply 1
WiFi Internet Connection 1
Sensor Functions
MQ135
Measures:
CO₂
Smoke
Air Quality
Output
Clean Air : < 200
Moderate Air : 200-400
Poor Air : > 400
PMS5003
Measures:
PM1.0
PM2.5
PM10
Used for AQI calculation.
DHT22
Measures:
Temperature
Humidity
Environmental compensation.
Circuit Connections
MQ135
MQ135 → ESP32
VCC → 5V
GND → GND
AO → GPIO34
DHT22
DHT22 → ESP32
VCC → 3.3V
GND → GND
DATA → GPIO4
PMS5003
PMS5003 → ESP32
VCC → 5V
GND → GND
TX → GPIO16 (RX2)
RX → GPIO17 (TX2)
OLED Display
OLED → ESP32
VCC → 3.3V
GND → GND
SDA → GPIO21
SCL → GPIO22
Buzzer
Positive → GPIO27
Negative → GND
Circuit Schematic
+-------------------+
| ESP32 |
| |
MQ135 --->| GPIO34 |
DHT22 --->| GPIO4 |
PMS TX -->| GPIO16 |
PMS RX -->| GPIO17 |
OLED SDA->| GPIO21 |
OLED SCL->| GPIO22 |
BUZZER -->| GPIO27 |
+-------------------+
Flowchart
Start
│
Initialize Sensors
│
Connect WiFi
│
Read Sensor Values
│
Calculate AQI
│
Upload ThingSpeak
│
Store Google Sheets
│
AI Prediction
│
Check Threshold
│
Send Telegram Alert
│
Generate Voice Message
│
Repeat
AQI Prediction Logic
Inputs
PM2.5
PM10
CO2
Temperature
Humidity
AI Formula
Predicted AQI
AQI Future =
0.5 × PM2.5
+
0.3 × PM10
+
0.1 × CO2
+
0.1 × Temperature
Classification
AQI Status
0-50 Good
51-100 Moderate
101-150 Unhealthy
151-200 Very Unhealthy
>200 Hazardous
ESP32 Source Code Structure
Required Libraries
WiFi.h
HTTPClient.h
DHT.h
ThingSpeak.h
ArduinoJson.h
WiFi Setup
const char* ssid = "YOUR_WIFI";
const char* password = "PASSWORD";
ThingSpeak Setup
unsigned long channelID = XXXXX;
const char* writeAPIKey = "WRITE_KEY";
Sensor Reading Function
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
int mq135 = analogRead(34);
float pm25 = getPM25();
float pm10 = getPM10();
AQI Calculation
float AQI =
(pm25*0.5)
+
(pm10*0.3)
+
(mq135*0.2);
Upload to ThingSpeak
ThingSpeak.setField(1, pm25);
ThingSpeak.setField(2, pm10);
ThingSpeak.setField(3, AQI);
ThingSpeak.writeFields(
channelID,
writeAPIKey
);
ThingSpeak Dashboard Setup
Create Channel
Fields:
Field1 = PM2.5
Field2 = PM10
Field3 = AQI
Field4 = CO2
Field5 = Temperature
Field6 = Humidity
Dashboard Widgets
AQI Gauge
PM2.5 Graph
PM10 Graph
Temperature Graph
Humidity Graph
Pollution Heatmap
Google Sheets Integration
Create Sheet
Timestamp
PM2.5
PM10
AQI
Temperature
Humidity
Status
n8n Webhook Receives
{
"pm25": 35,
"pm10": 55,
"aqi": 92,
"temp": 30,
"humidity": 70
}
Append Row Node
Automatically stores every reading.
n8n Workflow
Workflow Steps
Webhook Trigger
│
▼
Data Validation
│
▼
AI Agent Analysis
│
▼
Google Sheets
│
▼
Threshold Check
│
▼
Telegram Message
│
▼
Telegram Voice Alert
Sample n8n Workflow JSON Structure
{
"nodes":[
{
"name":"Webhook"
},
{
"name":"Google Sheets"
},
{
"name":"Telegram"
}
]
}
Telegram Bot Setup
Step 1
Open Telegram
Search:
@BotFather
Step 2
Create Bot
/newbot
Step 3
Copy Token
123456:ABCDEF
Step 4
Get Chat ID
https://api.telegram.org/botTOKEN/getUpdates
Telegram Alert Message
🚨 Air Pollution Alert
AQI: 175
Status: Very Unhealthy
PM2.5: 120
PM10: 180
Recommendation:
Wear mask and avoid outdoor activities.
Voice Notification Automation
n8n Process
AQI > 150
│
Generate Text
│
Text-to-Speech
│
Telegram Voice Message
Voice Message Example
Warning. Air quality is unhealthy.
AQI has reached one hundred seventy five.
Avoid outdoor activities.
AI Agent Analytics
The AI Agent continuously evaluates:
Pollution Trend
Increasing
Stable
Decreasing
Health Risk
Low Risk
Medium Risk
High Risk
Prediction Horizon
1 Hour
6 Hours
24 Hours
Recommendations
Wear Mask
Close Windows
Avoid Outdoor Exercise
Use Air Purifier
Power Consumption Prediction
Data Used
WiFi Usage
Sensor Sampling Rate
OLED ON Time
Cloud Upload Frequency
Simple Model
Power =
ESP32 Current
+
Sensor Current
+
Display Current
Predicted Daily Usage
0.8 to 1.5 Wh/day
IoT Web Dashboard Features
Live Monitoring
Current AQI
PM2.5
PM10
CO2
Temperature
Humidity
AI Panel
Future AQI
Pollution Forecast
Risk Level
Recommendations
Alert Panel
Last Alert
Voice Alert History
Telegram Logs
Future Enhancements
Machine Learning
Random Forest AQI Prediction
LSTM Time-Series Forecasting
XGBoost Prediction Models
Advanced Sensors
SDS011
BME680
CCS811
SGP30
Mobile App
Flutter Dashboard
Push Notifications
Live Maps
Smart City Integration
Multiple ESP32 Nodes
Central Cloud Server
GIS Pollution Mapping
Deployment Guide
Indoor Installation
Schools
Hospitals
Offices
Laboratories
Outdoor Installation
Traffic Junctions
Industrial Zones
Smart Cities
Construction Sites
Final Outcome
This project creates a complete Industry 4.0 AI-Powered Air Pollution Monitoring Platform combining:
✅ ESP32 IoT Monitoring
✅ Real-Time AQI Calculation
✅ AI Agent Analytics
✅ n8n Workflow Automation
✅ Google Sheets Database
✅ Telegram Text Alerts
✅ Telegram Voice Notifications
✅ ThingSpeak Cloud Dashboard
✅ Pollution Forecasting
✅ Power Consumption Prediction
✅ Cloud-Based Monitoring
✅ Smart City Ready Architecture
✅ Environmental Safety Intelligence System
The result is a scalable, low-cost, AI-enabled environmental monitoring solution capable of detecting pollution in real time, predicting future air-quality conditions, and automatically notifying users through cloud dashboards and voice alerts.
AI-Based Intelligent Fire Fighting Robot with Vision Navigation
AI-Based Intelligent Fire Fighting Robot with Vision Navigation
ESP32 + AI Agent + IoT Cloud + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Dashboard
AI-Based Intelligent Fire Fighting Robot with Vision Navigation
ESP32 + AI Agent + IoT Cloud + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Dashboard
1. Project Overview
The AI-Based Intelligent Fire Fighting Robot is an autonomous robot capable of:
Detecting fire using flame sensors
Navigating toward fire sources
Avoiding obstacles automatically
Activating a water pump to extinguish fire
Sending real-time alerts through Telegram
Uploading sensor data to ThingSpeak
Storing logs in Google Sheets
Using AI Agent analytics for predictive monitoring
Generating voice notifications via Telegram
Providing cloud-based remote monitoring
This project combines:
ESP32 IoT Controller
Computer Vision Navigation
AI Agent Analytics
n8n Workflow Automation
Google Sheets Cloud Logging
ThingSpeak IoT Dashboard
Telegram Alert System
2. System Architecture
Flame Sensor
|
|
Ultrasonic Sensor
|
|
ESP32 Controller
|
--------------------------------
| | |
| | |
ThingSpeak Telegram Bot Google Sheets
| | |
--------------------------------
|
n8n Server
|
AI Agent
|
Voice Notifications
3. Major Features
Fire Detection
Flame Sensor detects fire
Multiple detection zones
Vision Navigation
ESP32-CAM identifies fire location
Robot rotates toward fire source
Obstacle Avoidance
Ultrasonic sensor detects objects
Robot changes path automatically
Fire Extinguishing
Water pump activated automatically
Cloud Monitoring
Real-time dashboard
AI Prediction
Predicts:
Battery usage
Water consumption
Fire occurrence patterns
4. Hardware Components List
Component Quantity
ESP32 Dev Board 1
ESP32-CAM Module 1
Flame Sensor 3
Ultrasonic Sensor HC-SR04 1
L298N Motor Driver 1
DC Gear Motors 2
Water Pump 5V 1
Relay Module 1
Servo Motor SG90 1
Li-ion Battery Pack 1
Robot Chassis 1
Jumper Wires As required
Water Tank 1
Buzzer 1
LED Indicators 2
5. Working Principle
Step 1
Robot continuously scans surroundings.
Step 2
Flame sensors detect fire.
Step 3
ESP32 receives fire coordinates.
Step 4
Robot moves toward flame.
Step 5
Obstacle avoidance activates if necessary.
Step 6
Water pump turns ON.
Step 7
Fire extinguished.
Step 8
Alert sent to:
Telegram
Google Sheets
ThingSpeak
Step 9
AI Agent analyzes event.
6. Pin Connections
Flame Sensors
Flame Sensor ESP32
OUT1 GPIO34
OUT2 GPIO35
OUT3 GPIO32
Ultrasonic Sensor
HC-SR04 ESP32
Trig GPIO5
Echo GPIO18
Motor Driver
L298N ESP32
IN1 GPIO12
IN2 GPIO13
IN3 GPIO14
IN4 GPIO27
Relay Module
Relay ESP32
IN GPIO26
Servo Motor
Servo ESP32
Signal GPIO25
7. Circuit Schematic
Flame Sensors
|
|
ESP32 Board
/ | \
/ | \
Motor WiFi Relay
Driver |
| |
Motors Water Pump
|
Fire Control
ESP32 ----> ThingSpeak
ESP32 ----> Telegram
ESP32 ----> n8n
ESP32 ----> Google Sheets
8. Flowchart
Start
|
Initialize ESP32
|
Connect WiFi
|
Read Sensors
|
Fire Detected?
|
Yes
|
Move Toward Fire
|
Obstacle Present?
|
Yes --> Avoid Obstacle
|
No
|
Activate Pump
|
Fire Extinguished?
|
Yes
|
Send Alert
|
Update Cloud
|
Store Data
|
Repeat
9. ESP32 Source Code Structure
Required Libraries
WiFi.h
HTTPClient.h
ThingSpeak.h
ESP32Servo.h
Variables
const char* ssid="WiFi_Name";
const char* password="WiFi_Password";
long channelID = 123456;
const char* apiKey = "THINGSPEAK_KEY";
Flame Detection
int flame1=digitalRead(34);
int flame2=digitalRead(35);
int flame3=digitalRead(32);
if(flame1==0 || flame2==0 || flame3==0)
{
fireDetected();
}
Pump Activation
digitalWrite(RELAY,HIGH);
delay(5000);
digitalWrite(RELAY,LOW);
Upload Data
ThingSpeak.setField(1,temperature);
ThingSpeak.setField(2,fireStatus);
ThingSpeak.writeFields(channelID,apiKey);
10. ThingSpeak Dashboard Setup
Create Account
Register at:
ThingSpeak
Create Channel
Fields:
Fire Status
Temperature
Distance
Battery Voltage
Water Level
Motor Status
Copy
Channel ID
Write API Key
Insert into ESP32 code.
11. Telegram Bot Setup
Step 1
Open:
Telegram BotFather
Step 2
Create new bot.
/newbot
Step 3
Get:
BOT TOKEN
Step 4
Find Chat ID.
Send Alert Example
https://api.telegram.org/botTOKEN/sendMessage
Message:
🔥 FIRE DETECTED
Robot Activated
Pump Running
Location Protected
12. Google Sheets Integration
Create Sheet
Columns:
Date
Time
Fire Status
Distance
Battery
Water Level
Pump Status
Create Google Apps Script
function doPost(e)
{
var sheet=
SpreadsheetApp.getActiveSpreadsheet()
.getSheetByName("Data");
sheet.appendRow([
new Date(),
e.parameter.fire,
e.parameter.distance,
e.parameter.battery
]);
return ContentService
.createTextOutput("Success");
}
Deploy as:
Web App
Anyone Access
13. n8n Automation Workflow
Install n8n
Official website:
n8n Automation Platform
Workflow
Webhook
|
ESP32 Data
|
IF Fire Detected
|
Telegram Node
|
Google Sheets Node
|
AI Agent Node
|
Voice Alert Node
14. n8n Workflow JSON Structure
{
"nodes":[
{
"name":"Webhook"
},
{
"name":"IF Fire"
},
{
"name":"Telegram"
},
{
"name":"Google Sheets"
},
{
"name":"AI Agent"
}
]
}
15. AI Agent Analytics
AI Agent continuously analyzes:
Fire frequency
Battery consumption
Water tank usage
Motor runtime
Sensor health
Outputs:
Normal
Warning
Critical
16. AI Power Consumption Prediction Logic
Inputs
Motor Runtime
Pump Runtime
Battery Voltage
WiFi Usage
Formula
Daily Power:
P=V×I
Energy:
E=P×t
Example
Battery = 12V
Motor = 1A
Pump = 2A
Total Current = 3A
Power = 36W
2 Hours Usage
Energy = 72Wh
AI predicts:
Remaining Battery
Recharge Time
Future Consumption
17. Telegram Voice Notification Automation
Event Trigger
Fire detected.
n8n Process
Fire Event
|
Generate Voice
|
Convert Text-to-Speech
|
Send Telegram Audio
Voice Message:
Warning.
Fire detected.
Robot has started extinguishing operation.
18. AI Agent Prompt Example
Analyze incoming fire robot data.
Check:
- Fire frequency
- Battery status
- Water tank level
- Motor health
Generate:
- Risk level
- Maintenance suggestions
- Prediction report
19. Future Enhancements
Computer Vision AI
Smoke recognition
Human detection
Fire localization
GPS Tracking
Outdoor firefighting robots
Edge AI
On-device fire classification
Drone Integration
Fire surveillance
Multi-Robot Collaboration
Swarm firefighting system
20. Deployment Guide
Phase 1
Hardware Assembly
Phase 2
ESP32 Programming
Phase 3
Sensor Calibration
Phase 4
ThingSpeak Dashboard
Phase 5
Google Sheets Logging
Phase 6
Telegram Bot Integration
Phase 7
n8n Workflow Deployment
Phase 8
AI Agent Analytics
Phase 9
Field Testing
Phase 10
Production Deployment
Final Outcome
This project delivers a complete Industry 4.0 Intelligent Fire Fighting Robot platform featuring:
✅ ESP32 IoT Monitoring
✅ Vision-Based Fire Navigation
✅ Autonomous Fire Extinguishing
✅ AI Agent Analytics
✅ n8n Workflow Automation
✅ Google Sheets Database Logging
✅ Telegram Text & Voice Alerts
✅ ThingSpeak Cloud Dashboard
✅ AI Power Consumption Prediction
✅ Cloud-Based Monitoring & Reporting
✅ Predictive Maintenance Analytics
✅ Real-Time Emergency Notifications
✅ Scalable Smart Safety Infrastructure
AI-Based Industrial Fault Prediction and Monitoring System
AI-Based Industrial Fault Prediction and Monitoring System
AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI-Based Industrial Fault Prediction and Monitoring System
AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
1. Project Overview
Project Title
AI-Based Industrial Fault Prediction and Monitoring System Using ESP32, AI Agent, n8n Automation, Telegram Voice Alerts, Google Sheets, and ThingSpeak Cloud
Objective
Develop an Industry 4.0 smart industrial monitoring platform capable of:
Monitoring machine temperature
Monitoring vibration levels
Monitoring current consumption
Monitoring humidity
Predicting machine faults using AI
Sending instant alerts
Logging data to cloud
Providing dashboard visualization
Generating voice notifications
Predicting power consumption trends
The system continuously monitors machine health and predicts failures before breakdowns occur.
2. System Architecture
Industrial Machine
│
▼
Sensors Layer
┌─────────────────┐
│ DHT22 │
│ Vibration SW420 │
│ ACS712 Current │
│ LM35 Temperature│
└─────────────────┘
│
▼
ESP32
│
▼
WiFi Network
│
┌──────┼───────────┐
▼ ▼ ▼
ThingSpeak
Google Sheets
n8n Automation Server
│
▼
AI Agent Engine
│
┌─────────┴────────┐
▼ ▼
Telegram Alerts Voice Alerts
3. Features
Real-Time Monitoring
Temperature
Humidity
Vibration
Current Consumption
AI Prediction
Fault Prediction
Power Usage Forecast
Machine Health Analysis
Cloud Services
ThingSpeak Dashboard
Google Sheets Storage
Automation
n8n Workflow
Telegram Bot
Voice Notifications
4. Components Required
Component Quantity
ESP32 Dev Board 1
DHT22 Sensor 1
SW420 Vibration Sensor 1
ACS712 Current Sensor 1
LM35 Temperature Sensor 1
Breadboard 1
Jumper Wires Several
5V Power Supply 1
WiFi Router 1
Computer 1
5. Pin Connections
DHT22
DHT22 ESP32
VCC 3.3V
GND GND
DATA GPIO4
SW420
SW420 ESP32
VCC 3.3V
GND GND
OUT GPIO27
ACS712
ACS712 ESP32
VCC 5V
GND GND
OUT GPIO34
LM35
LM35 ESP32
VCC 5V
GND GND
OUT GPIO35
6. Circuit Schematic Diagram
+----------------+
| ESP32 |
| |
GPIO4 <---- DHT22 DATA
GPIO27 <---- SW420 OUT
GPIO34 <---- ACS712 OUT
GPIO35 <---- LM35 OUT
|
| WiFi
▼
Cloud Services
7. Flowchart
Start
│
▼
Initialize ESP32
│
▼
Connect WiFi
│
▼
Read Sensors
│
▼
Calculate Parameters
│
▼
AI Prediction
│
▼
Fault Detected?
│
┌───────┴─────────┐
│ │
Yes No
│ │
▼ ▼
Send Alerts Store Data
│ │
▼ ▼
Update Cloud Dashboard
│
▼
Repeat
8. ESP32 Source Code
#include
#include
#include
#define DHTPIN 4
#define DHTTYPE DHT22
DHT dht(DHTPIN,DHTTYPE);
const char* ssid="YOUR_WIFI";
const char* password="YOUR_PASSWORD";
String apiKey="THINGSPEAK_API_KEY";
void setup()
{
Serial.begin(115200);
dht.begin();
WiFi.begin(ssid,password);
while(WiFi.status()!=WL_CONNECTED)
{
delay(500);
}
}
void loop()
{
float humidity=dht.readHumidity();
float temperature=dht.readTemperature();
int vibration=digitalRead(27);
int currentRaw=analogRead(34);
float current=currentRaw*0.026;
int lm35=analogRead(35);
float machineTemp=(lm35*3.3*100)/4095;
String health="Normal";
if(machineTemp>60 || vibration==1)
{
health="Fault Predicted";
}
if(WiFi.status()==WL_CONNECTED)
{
HTTPClient http;
String url=
"http://api.thingspeak.com/update?api_key="
+apiKey+
"&field1="+String(temperature)+
"&field2="+String(humidity)+
"&field3="+String(machineTemp)+
"&field4="+String(current)+
"&field5="+String(vibration);
http.begin(url);
http.GET();
http.end();
}
delay(15000);
}
9. AI Fault Prediction Logic
Input Parameters
Temperature
Humidity
Current
Vibration
AI Rules
Critical Fault
Temp > 70°C
AND
Current > 15A
AND
Vibration = HIGH
Result:
Machine Failure Likely
Warning
Temp > 60°C
OR
Current > 10A
Result:
Maintenance Required
Normal
All parameters within limits
Result:
Healthy Machine
10. Power Consumption Prediction
Formula:
P=V×I
Example:
Voltage = 230V
Current = 5A
Power = 1150W
AI Agent stores historical data and predicts:
Next hour power usage
Daily energy usage
Monthly energy consumption
11. ThingSpeak Dashboard Setup
Create Channel
Fields:
Field 1:
Temperature
Field 2:
Humidity
Field 3:
Machine Temperature
Field 4:
Current
Field 5:
Vibration
Field 6:
Fault Status
Dashboard Widgets
Gauge
Line Chart
Fault Indicator
Energy Consumption Graph
12. Google Sheets Integration
Create Sheet:
Timestamp
Temperature
Humidity
Current
Vibration
MachineTemp
Status
Prediction
13. n8n Workflow
Workflow Logic
Webhook
│
▼
Receive ESP32 Data
│
▼
AI Analysis Node
│
▼
IF Fault?
│
┌─┴───────────┐
▼ ▼
Telegram Google Sheet
Alert Update
n8n Workflow JSON Structure
{
"nodes":[
{
"name":"Webhook"
},
{
"name":"AI Agent"
},
{
"name":"IF Fault"
},
{
"name":"Telegram"
},
{
"name":"Google Sheets"
}
]
}
14. Telegram Bot Setup
Step 1
Open Telegram
Search:
@BotFather
Create bot:
/newbot
Step 2
Get:
BOT TOKEN
Step 3
Get Chat ID
Send:
/start
Use chat ID API.
15. Telegram Alert Messages
Text Alert
⚠ INDUSTRIAL ALERT
Machine Temperature : 75°C
Current : 12A
Vibration : HIGH
Prediction :
Bearing Failure Expected
Immediate Inspection Required.
16. Voice Notification Automation
n8n uses:
Text
Warning.
Machine Number 3.
Abnormal vibration detected.
Maintenance required.
Convert To Speech
Using:
Telegram Voice
Google TTS
OpenAI TTS
Edge TTS
Send Voice Message
Telegram Voice Notification
🎤 Voice Alert Sent
17. AI Agent Analytics
The AI Agent performs:
Root Cause Analysis
Example:
High Temperature
+
High Current
Cause:
Motor Overloading
Predictive Maintenance
Example:
Bearing Wear
Motor Failure
Cooling Fan Fault
Power Supply Issues
18. Cloud Dashboard Features
Real-Time
Machine Status
Live Charts
Sensor Monitoring
Historical
Daily Reports
Weekly Reports
Monthly Reports
AI Analytics
Fault Prediction
Energy Forecasting
Maintenance Suggestions
19. Future Enhancements
Machine Learning
Random Forest
XGBoost
LSTM Prediction
Edge AI
Run TinyML directly on ESP32
Computer Vision
Add camera-based fault detection
Digital Twin
Virtual machine monitoring
Multi-Machine Monitoring
100+ industrial machines
Mobile App
Android and iOS app
MQTT
Industrial-grade communication
AWS/Azure Integration
Enterprise deployment
20. Deployment Guide
Small Factory
1 ESP32
1 Machine
ThingSpeak Dashboard
Medium Industry
10 ESP32 Nodes
Central n8n Server
Google Sheets Database
Large Industry
100+ ESP32 Devices
MQTT Broker
AI Analytics Server
Cloud Dashboard
ERP Integration
Final Outcome
This project creates a complete Industry 4.0 AI-Based Industrial Fault Prediction and Monitoring Platform combining:
✅ ESP32 IoT Monitoring
✅ Temperature, Vibration & Current Sensing
✅ AI Agent Fault Prediction Analytics
✅ n8n Workflow Automation
✅ Google Sheets Database Logging
✅ Telegram Text & Voice Alerts
✅ ThingSpeak Cloud Dashboard
✅ Power Consumption Prediction
✅ Predictive Maintenance System
✅ Cloud-Based Industrial Monitoring Solution
✅ Scalable Smart Factory Deployment Architecture
✅ Real-Time Fault Detection and Early Warning System
AI Smart Weather Monitoring Station with Forecast Analytics
AI Smart Weather Monitoring Station with Forecast Analytics
AI-Powered ESP32 🚀 Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Weather Monitoring Station with Forecast Analytics
AI-Powered ESP32 🚀 Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
1. Project Overview
The AI Smart Weather Monitoring Station with Forecast Analytics is an advanced IoT and AI-based environmental monitoring system that continuously measures weather parameters using ESP32 and cloud services.
The system:
Collects real-time weather data
Uploads data to ThingSpeak Cloud
Stores historical records in Google Sheets
Uses n8n automation workflows
Sends Telegram notifications and voice alerts
Uses AI analytics for weather forecasting
Predicts power consumption
Provides a cloud dashboard for remote monitoring
2. Features
Real-Time Monitoring
✔ Temperature
✔ Humidity
✔ Atmospheric Pressure
✔ Rain Detection
✔ Light Intensity
✔ Air Quality
✔ Wind Speed
AI Features
✔ Weather Forecast Prediction
✔ Rain Probability Analysis
✔ Temperature Trend Prediction
✔ Power Consumption Prediction
✔ Anomaly Detection
Automation Features
✔ Telegram Notifications
✔ Telegram Voice Alerts
✔ Google Sheets Logging
✔ ThingSpeak Dashboard
✔ AI Agent Analysis
✔ Cloud Monitoring
3. System Architecture
Weather Sensors
│
▼
ESP32 Controller
│
▼
WiFi Network
│
┌─────────────┬──────────────┐
▼ ▼ ▼
ThingSpeak n8n Workflow Google Sheets
Dashboard │
▼
AI Agent
│
▼
Telegram Alerts
│
▼
Voice Messages
4. Required Components
Component Quantity
ESP32 Dev Board 1
DHT22 Temperature Humidity Sensor 1
BMP280 Pressure Sensor 1
Rain Sensor Module 1
LDR Light Sensor 1
MQ135 Air Quality Sensor 1
Anemometer Wind Speed Sensor 1
OLED Display (Optional) 1
Breadboard 1
Jumper Wires Several
5V Adapter 1
WiFi Connection 1
5. Pin Connections
DHT22
VCC → 3.3V
GND → GND
DATA → GPIO4
BMP280
VCC → 3.3V
GND → GND
SCL → GPIO22
SDA → GPIO21
Rain Sensor
AO → GPIO34
LDR
AO → GPIO35
MQ135
AO → GPIO32
Wind Sensor
Signal → GPIO27
6. Circuit Schematic
WiFi
│
│
┌────────────┐
│ ESP32 │
└────────────┘
│ │ │ │ │
│ │ │ │ └──── Wind Sensor
│ │ │ └────── MQ135
│ │ └──────── LDR
│ └────────── Rain Sensor
└──────────── DHT22
│
▼
BMP280 I2C
7. Project Flowchart
Start
│
▼
Initialize Sensors
│
▼
Read Weather Data
│
▼
Send Data to ThingSpeak
│
▼
Trigger n8n Webhook
│
▼
Store in Google Sheets
│
▼
AI Analysis
│
▼
Generate Forecast
│
▼
Telegram Notification
│
▼
Voice Alert
│
▼
Repeat Every Minute
8. ESP32 Source Code Logic
Required Libraries
WiFi.h
HTTPClient.h
DHT.h
Adafruit_BMP280.h
ArduinoJson.h
Main Tasks
Connect WiFi
WiFi.begin(ssid,password);
Read Sensors
temperature = dht.readTemperature();
humidity = dht.readHumidity();
pressure = bmp.readPressure()/100;
rain = analogRead(34);
light = analogRead(35);
airQuality = analogRead(32);
Upload ThingSpeak
https://api.thingspeak.com/update
Trigger n8n
HTTP POST
JSON Example
{
"temperature": 31.2,
"humidity": 72,
"pressure": 1008,
"rain": 0,
"airQuality": 210,
"light": 850
}
9. ThingSpeak Setup
Create Account
Visit:
ThingSpeak
Create Channel
Fields:
Field1 Temperature
Field2 Humidity
Field3 Pressure
Field4 Rain
Field5 Air Quality
Field6 Light
Field7 Wind Speed
Field8 Forecast Score
Copy API Key
Channel ID
Write API Key
Read API Key
Use in ESP32 code.
10. Google Sheets Setup
Create Sheet:
Date
Time
Temperature
Humidity
Pressure
Rain
AQI
Wind
Forecast
Power
Example:
31-05-2026
12:00
32°C
70%
1009 hPa
No Rain
Good
12 km/h
Sunny
3.4 W
11. Telegram Bot Setup
Step 1
Open Telegram
Search:
BotFather
Step 2
Create Bot
/newbot
Step 3
Receive Token
123456:ABCDEF
Step 4
Get Chat ID
Send message to bot.
Use:
https://api.telegram.org/botTOKEN/getUpdates
12. n8n Automation Workflow
Install n8n
n8n Official Website
Workflow
Webhook
│
▼
Google Sheets
│
▼
AI Agent
│
▼
Decision Node
│
├── Rain Alert
├── High Temperature
├── Poor Air Quality
└── Storm Warning
│
▼
Telegram Alert
│
▼
Voice Notification
13. n8n Workflow JSON Structure
{
"nodes": [
{
"name": "Webhook"
},
{
"name": "Google Sheets"
},
{
"name": "AI Agent"
},
{
"name": "Telegram"
}
]
}
14. AI Forecast Analytics
AI Agent analyzes:
Past Temperature
Humidity Trend
Pressure Variation
Rain History
Wind Conditions
Forecast Output:
Sunny
Cloudy
Rain Expected
Storm Warning
Heatwave Alert
15. AI Power Consumption Prediction
Inputs
ESP32 Active Time
WiFi Usage
Sensor Sampling Rate
Display Usage
Formula
P=V×I
Where:
P = Power
V = Voltage
I = Current
Example:
5V × 0.18A = 0.9 Watts
Daily Prediction:
0.9 × 24
= 21.6 Wh/day
AI predicts monthly consumption trends.
16. Telegram Alert Examples
Temperature Alert
🌡 High Temperature Alert
Temperature: 42°C
Possible Heatwave Detected
Rain Alert
🌧 Rain Expected
Probability: 85%
Carry Umbrella
Air Quality Alert
⚠ Poor Air Quality
AQI: 250
Avoid Outdoor Activities
17. Voice Notification Automation
n8n generates text:
Warning. Heavy rainfall expected within the next two hours.
Convert to speech using:
Google Text-to-Speech
ElevenLabs
Telegram sends generated MP3 voice message automatically.
18. Dashboard Analytics
Display:
Current Temperature
Humidity Graph
Pressure Trend
Rain Detection
Wind Speed
Air Quality Index
AI Forecast
Monthly Energy Usage
Device Status
19. Future Enhancements
Advanced AI
Machine Learning Forecasting
LSTM Weather Prediction
Seasonal Analysis
Storm Prediction
Additional Sensors
UV Sensor
Solar Radiation Sensor
Soil Moisture Sensor
PM2.5 Sensor
Cloud Upgrades
AWS IoT
Microsoft Azure IoT
Google Cloud IoT
Mobile App
Android App
iOS App
Real-Time Push Notifications
20. Deployment Guide
Home Monitoring
Rooftop Installation
Garden Weather Station
Agriculture
Smart Farming
Irrigation Prediction
Industry
Environmental Monitoring
Pollution Tracking
Smart Cities
Public Weather Stations
Disaster Warning Systems
Final Outcome
This project delivers a complete AI-powered weather intelligence platform integrating:
✅ ESP32 IoT Weather Monitoring
✅ Multi-Sensor Environmental Data Collection
✅ AI Agent Forecast Analytics
✅ n8n Workflow Automation
✅ Google Sheets Database Logging
✅ Telegram Notifications & Voice Alerts
✅ ThingSpeak Cloud Dashboard
✅ Power Consumption Prediction
✅ Cloud-Based Remote Monitoring
✅ Smart City & Agriculture Ready Deployment
The result is a fully automated Industry 4.0 and Agentic AI Weather Monitoring System capable of collecting, analyzing, predicting, and reporting weather conditions in real time.
AI Smart Water Quality Monitoring and Prediction System
AI Smart Water Quality Monitoring and Prediction System
AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Water Quality Monitoring and Prediction System
AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
1. Project Overview
The AI Smart Water Quality Monitoring and Prediction System continuously monitors water quality parameters using sensors connected to an ESP32. The collected data is uploaded to cloud platforms and analyzed using AI models to predict water contamination trends and power consumption.
The system provides:
✅ Real-time Water Quality Monitoring
✅ Cloud Data Storage
✅ AI-Based Water Quality Prediction
✅ Automated n8n Workflow Processing
✅ Google Sheets Data Logging
✅ ThingSpeak Dashboard Visualization
✅ Telegram Notifications
✅ Telegram Voice Alerts
✅ AI Agent Analytics
✅ Remote Monitoring Through Web Dashboard
2. Objectives
The system monitors:
Water Temperature
pH Level
Turbidity
TDS (Total Dissolved Solids)
Water Quality Index (WQI)
The AI Agent predicts:
Water contamination risk
Future water quality trend
Sensor anomaly detection
Power consumption forecast
3. System Architecture
Sensors
│
▼
ESP32 Controller
│
WiFi Internet
│
▼
ThingSpeak Cloud
│
├────────► Dashboard
│
▼
n8n Workflow
│
├────────► Google Sheets
│
├────────► AI Agent Analysis
│
└────────► Telegram Bot
│
├── Text Alert
└── Voice Alert
4. Required Components
Component Quantity
ESP32 Dev Board 1
pH Sensor Module 1
Turbidity Sensor 1
TDS Sensor 1
DS18B20 Temperature Sensor 1
Breadboard 1
Jumper Wires As required
4.7kΩ Resistor 1
Power Supply 1
WiFi Network 1
Computer/Laptop 1
5. Sensor Description
pH Sensor
Measures acidity or alkalinity.
Range:
0 - 14
Ideal Drinking Water:
6.5 - 8.5
Turbidity Sensor
Measures water clarity.
Unit:
NTU
Lower value = Cleaner water
TDS Sensor
Measures dissolved solids.
Unit:
PPM
Drinking Water:
50 - 300 PPM
DS18B20
Measures water temperature.
Range:
-55°C to 125°C
6. Circuit Connections
pH Sensor
VCC → 5V
GND → GND
OUT → GPIO34
Turbidity Sensor
VCC → 5V
GND → GND
OUT → GPIO35
TDS Sensor
VCC → 5V
GND → GND
OUT → GPIO32
DS18B20
VCC → 3.3V
GND → GND
DATA → GPIO4
4.7kΩ between DATA and VCC
7. Circuit Schematic
ESP32
GPIO34 ← pH Sensor
GPIO35 ← Turbidity
GPIO32 ← TDS Sensor
GPIO4 ← DS18B20
WiFi
│
▼
ThingSpeak
│
▼
n8n
┌────────┼─────────┐
▼ ▼ ▼
Google Telegram AI Agent
Sheets Bot
8. Flowchart
Start
│
Initialize Sensors
│
Connect WiFi
│
Read Sensor Values
│
Calculate Water Quality
│
Send Data To ThingSpeak
│
Trigger n8n Workflow
│
Store In Google Sheet
│
AI Agent Analysis
│
Generate Alerts
│
Telegram Notification
│
Telegram Voice Alert
│
Repeat Every Minute
9. ESP32 Source Code
#include
#include
const char* ssid = "YOUR_WIFI";
const char* password = "YOUR_PASSWORD";
String apiKey = "YOUR_THINGSPEAK_API_KEY";
#define PH_PIN 34
#define TURB_PIN 35
#define TDS_PIN 32
void setup()
{
Serial.begin(115200);
WiFi.begin(ssid,password);
while(WiFi.status()!=WL_CONNECTED)
{
delay(500);
}
}
void loop()
{
float phValue =
analogRead(PH_PIN) * 14.0 / 4095.0;
float turbidity =
analogRead(TURB_PIN);
float tds =
analogRead(TDS_PIN);
if(WiFi.status()==WL_CONNECTED)
{
HTTPClient http;
String url =
"http://api.thingspeak.com/update?api_key="
+ apiKey +
"&field1=" + String(phValue) +
"&field2=" + String(turbidity) +
"&field3=" + String(tds);
http.begin(url);
http.GET();
http.end();
}
delay(60000);
}
10. ThingSpeak Setup
Step 1
Create account:
ThingSpeak
Step 2
Create New Channel
Fields:
Field1 = pH
Field2 = Turbidity
Field3 = TDS
Field4 = Temperature
Field5 = Water Quality Index
Step 3
Copy Write API Key
Step 4
Paste into ESP32 Code
11. Google Sheets Integration
Create Sheet:
Timestamp
Temperature
pH
TDS
Turbidity
WQI
Status
Prediction
12. n8n Workflow Design
Install:
n8n Official Website
Workflow:
Webhook Trigger
│
▼
Read ThingSpeak Data
│
▼
AI Analysis
│
├── Google Sheets
│
├── Telegram Message
│
│
└── Voice Alert
13. n8n Workflow JSON Structure
{
"nodes": [
{
"name": "Webhook"
},
{
"name": "AI Agent"
},
{
"name": "Google Sheets"
},
{
"name": "Telegram"
}
]
}
14. Telegram Bot Setup
Step 1
Open Telegram.
Search:
BotFather
Step 2
/newbot
Step 3
Create Bot Name.
Step 4
Copy API Token.
15. Telegram Integration in n8n
Add:
Telegram Node
Insert:
Bot Token
Chat ID
Alert Message:
⚠ Water Quality Alert
pH: {{$json.ph}}
TDS: {{$json.tds}}
Turbidity: {{$json.turbidity}}
Risk Level:
{{$json.risk}}
16. Voice Notification Automation
n8n Process:
AI Alert
│
Generate Text
│
Google TTS
│
MP3 Voice
│
Telegram Send Audio
Voice Example:
Warning.
Water contamination level is increasing.
Immediate inspection recommended.
17. AI Agent Analytics
The AI Agent evaluates:
Water Quality Index
Excellent
Good
Moderate
Poor
Unsafe
Contamination Detection
Checks:
High Turbidity
High TDS
Abnormal pH
Sensor Health Monitoring
Detects:
Sensor Failure
Missing Data
Noise Data
18. AI Water Quality Prediction Logic
Example Rule Engine:
IF pH < 6.5
AND Turbidity > 500
THEN
Risk = HIGH
Prediction Model Inputs:
Temperature
pH
TDS
Turbidity
Historical Data
Outputs:
Water Quality Score
Future Risk
Alert Probability
Machine Learning Options:
Linear Regression
Random Forest
XGBoost
LSTM Time Series
19. AI Power Consumption Prediction
Inputs:
ESP32 Runtime
WiFi Usage
Sensor Operating Time
Cloud Upload Frequency
Formula:
Power = Voltage × Current
P=VI
Example:
Voltage = 5V
Current = 0.18A
Power = 0.9 Watts
AI predicts:
Daily Energy Usage
Monthly Energy Usage
Battery Life
20. Dashboard Features
ThingSpeak Dashboard Displays:
Live pH Graph
TDS Graph
Turbidity Graph
Temperature Graph
Water Quality Trend
Prediction Trend
Alert Status
21. Future Enhancements
AI Enhancements
Deep Learning Prediction
Auto Calibration
Edge AI on ESP32
TinyML Deployment
Cloud Enhancements
Multi-location Monitoring
Mobile App
Firebase Integration
AWS IoT Integration
Industrial Enhancements
Water Treatment Plant Monitoring
Smart City Water Management
River Pollution Detection
Industrial Wastewater Monitoring
22. Deployment Guide
Small Scale
Schools
Colleges
Homes
Laboratories
Medium Scale
Apartment Complexes
Water Tanks
Hospitals
Large Scale
Municipal Water Systems
Smart Cities
Industrial Plants
Final Outcome
Complete AI-Powered Water Quality Monitoring Platform
✅ ESP32 IoT Monitoring
✅ Real-Time Water Quality Sensing
✅ AI Agent Analytics
✅ n8n Workflow Automation
✅ Google Sheets Database
✅ Telegram Text Alerts
✅ Telegram Voice Alerts
✅ ThingSpeak Cloud Dashboard
✅ Water Quality Prediction
✅ Power Consumption Prediction
✅ Cloud-Based Monitoring
✅ Scalable Smart Water Management Solution
This project is suitable for final-year engineering projects, IoT research, smart city applications, environmental monitoring systems, and Industry 4.0 deployments.
AI Smart Traffic Violation Detection System Using Computer Vision
AI Smart Traffic Violation Detection System Using Computer Vision
AI Agent + ESP32 + Computer Vision + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Traffic Violation Detection System Using Computer Vision
AI Agent + ESP32 + Computer Vision + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
1. Project Overview
This project is an AI-powered Intelligent Traffic Monitoring System that automatically detects traffic violations using Computer Vision and sends real-time alerts through Telegram, Google Sheets, and IoT Cloud Dashboards.
The system uses:
ESP32 for IoT communication
Camera for vehicle monitoring
AI Computer Vision Model
n8n Workflow Automation
Telegram Voice Notifications
Google Sheets Cloud Database
ThingSpeak IoT Dashboard
AI Analytics Agent
Real-Time Monitoring Web Dashboard
2. Project Objectives
The system automatically detects:
✅ Helmet Violations
✅ Triple Riding
✅ Wrong Side Driving
✅ Red Light Jumping
✅ Over Speeding
✅ Vehicle Counting
✅ Traffic Density Monitoring
✅ Accident Detection
✅ Emergency Vehicle Detection
3. System Architecture
Traffic Camera
│
▼
Computer Vision AI Model
│
▼
Violation Detection Engine
│
▼
ESP32 IoT Gateway
│
▼
n8n Automation Server
├─────────────┐
▼ ▼
ThingSpeak Google Sheets
Dashboard Database
│
▼
Telegram Voice Alerts
│
▼
Traffic Control Authority
4. Hardware Components List
Component Quantity
ESP32 Dev Board 1
ESP32-CAM Module 1
OV2640 Camera 1
Traffic Signal LEDs 3
Buzzer 1
RFID Module (Optional) 1
Ultrasonic Sensor 1
Power Supply 5V 1
Jumper Wires As Required
Breadboard 1
Router/WiFi Network 1
Laptop/PC 1
5. Software Requirements
Programming
Arduino IDE
Python 3.11+
OpenCV
YOLOv8
TensorFlow
Flask
Cloud Platforms
Google Sheets
ThingSpeak
Telegram Bot
n8n
6. Working Principle
Step 1
Camera continuously captures road traffic.
Step 2
Computer Vision model analyzes:
Vehicle
Bike
Truck
Bus
Person
Helmet
Step 3
AI identifies traffic violations.
Example:
Bike detected
Helmet = No
Result:
Helmet Violation
Step 4
Violation data sent to ESP32.
{
"vehicle":"Bike",
"violation":"Helmet Missing",
"time":"10:30AM"
}
Step 5
ESP32 uploads data to:
ThingSpeak
Google Sheets
n8n
Step 6
n8n triggers Telegram Bot.
Telegram sends:
Traffic Alert
Helmet Violation Detected
Vehicle: Bike
Location: Junction-1
Time: 10:30 AM
Step 7
Text converted to voice message.
Telegram Voice Alert:
Attention.
Helmet violation detected
at Junction One.
Please take action.
7. Circuit Diagram Connections
ESP32-CAM
OV2640 Camera
│
▼
ESP32-CAM
Buzzer
Buzzer + → GPIO13
Buzzer - → GND
Traffic LEDs
Red LED → GPIO14
Yellow LED → GPIO15
Green LED → GPIO2
All GND → Common GND
8. Flowchart
START
│
▼
Capture Video Frame
│
▼
Run AI Detection
│
▼
Violation Found?
│
┌─No─┐
│ │
▼ │
Next Frame
│
└────┘
Yes
│
▼
Generate Event
│
▼
Send To ESP32
│
▼
n8n Automation
│
▼
Google Sheets
│
▼
ThingSpeak
│
▼
Telegram Alert
│
▼
Voice Notification
│
▼
END
9. ESP32 Source Code
#include
#include
const char* ssid = "YOUR_WIFI";
const char* password = "YOUR_PASSWORD";
String thingspeakKey="YOUR_API_KEY";
void setup()
{
Serial.begin(115200);
WiFi.begin(ssid,password);
while(WiFi.status()!=WL_CONNECTED)
{
delay(500);
}
}
void loop()
{
float violations = random(0,10);
HTTPClient http;
String url =
"http://api.thingspeak.com/update?api_key="
+ thingspeakKey +
"&field1=" +
String(violations);
http.begin(url);
int code=http.GET();
http.end();
delay(15000);
}
10. Python Computer Vision Code
Install:
pip install ultralytics opencv-python
Code:
from ultralytics import YOLO
import cv2
model = YOLO("yolov8n.pt")
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
results = model(frame)
annotated = results[0].plot()
cv2.imshow("Traffic Monitoring", annotated)
if cv2.waitKey(1)==27:
break
11. Google Sheets Integration
Create Sheet:
Traffic Violations Database
Columns:
Timestamp Vehicle Violation Location
Use:
Google Sheets Node
inside n8n.
Each violation creates a new row automatically.
12. ThingSpeak Dashboard Setup
Create Channel
Fields:
Field 1:
Violation Count
Field 2:
Traffic Density
Field 3:
Accident Alerts
Field 4:
Helmet Violations
Field 5:
Wrong Side Driving
Dashboard shows:
Real-Time Graphs
Daily Reports
Monthly Analytics
13. Telegram Bot Setup
Create Bot
Using:
BotFather on Telegram
Commands:
/newbot
Receive:
BOT TOKEN
Obtain Chat ID
Send:
/start
to bot.
Use chat ID in n8n.
14. n8n Workflow Design
Workflow:
Webhook Trigger
│
▼
IF Violation?
│
▼
Google Sheets Node
│
▼
ThingSpeak Update
│
▼
Telegram Message
│
▼
Text-To-Speech
│
▼
Telegram Voice
15. Sample n8n Workflow JSON Structure
{
"nodes":[
{
"name":"Webhook"
},
{
"name":"Google Sheets"
},
{
"name":"Telegram"
}
]
}
16. AI Agent Analytics Module
The AI Agent performs:
Traffic Analysis
Vehicle Count
Peak Hours
Traffic Density
Violation Trends
Predictive Analysis
Expected Violations
Tomorrow:
120
Next Week:
850
Smart Recommendations
Increase Police Patrol
Optimize Traffic Signals
Deploy Additional Cameras
17. AI Power Consumption Prediction Logic
Parameters:
Camera Runtime
ESP32 Runtime
Network Usage
Cloud Upload Frequency
Prediction Formula:
P=V×I
Energy Consumption:
E=P×t
Example:
Voltage = 5V
Current = 0.5A
Power = 2.5W
24 Hours Usage
Energy = 60Wh
18. Telegram Voice Notification Automation
Voice Generation Flow:
Violation Detected
│
▼
n8n
│
▼
Google TTS
│
▼
MP3 Generation
│
▼
Telegram Voice Message
Sample Voice:
Attention Traffic Control.
Helmet violation detected
at Main Junction.
Vehicle Number
AP09AB1234.
Immediate action required.
19. AI Web Dashboard Features
Live Dashboard
Displays:
Vehicle Count
Active Violations
Traffic Density
AI Predictions
Camera Status
ESP32 Status
Charts
Hourly Violations
Daily Traffic
Monthly Analytics
Peak Congestion Analysis
20. Future Enhancements
Phase 2
Automatic Number Plate Recognition (ANPR)
Face Recognition
Smart Signal Optimization
Emergency Vehicle Priority
Phase 3
Edge AI on ESP32-S3
AI Chatbot Assistant
Mobile Application
Digital Challan Generation
Phase 4
Smart City Integration
Multi-Camera Monitoring
Centralized Command Center
AI Traffic Forecasting
Final Outcome
This project delivers a complete Industry 4.0 AI Traffic Management Platform featuring:
✅ Computer Vision Traffic Violation Detection
✅ ESP32 IoT Monitoring & Connectivity
✅ AI Agent Analytics & Prediction
✅ n8n Workflow Automation
✅ Google Sheets Cloud Database
✅ ThingSpeak Real-Time Dashboard
✅ Telegram Text & Voice Alerts
✅ Cloud-Based Monitoring Dashboard
✅ Traffic Density & Vehicle Analytics
✅ Future-Ready Smart City Deployment Architecture
The result is a scalable AI-powered smart traffic enforcement and monitoring system capable of real-time violation detection, automated reporting, cloud analytics, and intelligent decision support.
12.AI-Based Smart Classroom Monitoring and Attendance System
AI-Based Smart Classroom Monitoring and Attendance System
ESP32 + RFID + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI-Based Smart Classroom Monitoring and Attendance System
ESP32 + RFID + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
1. Project Overview
This project is a complete Smart Classroom Monitoring and Attendance System that automatically:
✅ Records student attendance using RFID cards
✅ Monitors classroom temperature and humidity
✅ Tracks classroom occupancy
✅ Uploads data to cloud
✅ Stores attendance in Google Sheets
✅ Sends Telegram alerts
✅ Generates AI-based insights
✅ Predicts classroom power consumption
✅ Provides voice notifications
✅ Creates a real-time dashboard using ThingSpeak
2. System Architecture
Data Flow
RFID Card
↓
ESP32 Controller
↓
WiFi Connection
↓
ThingSpeak Cloud
↓
n8n Automation
↓
Google Sheets Database
↓
Telegram Bot
↓
Voice Notification
↓
AI Analysis Agent
3. Features
Attendance Monitoring
RFID-based attendance
Automatic student identification
Real-time attendance logging
Classroom Monitoring
Temperature Monitoring
Humidity Monitoring
Occupancy Monitoring
AI Features
Attendance trend analysis
Absentee prediction
Power consumption prediction
Classroom utilization analysis
Cloud Features
ThingSpeak Dashboard
Google Sheets Storage
Telegram Notifications
Voice Alerts
4. Hardware Components
Component Quantity
ESP32 Dev Board 1
RFID RC522 Module 1
RFID Cards/Tags Multiple
DHT11 Sensor 1
IR Occupancy Sensor 1
OLED Display 0.96" 1
Buzzer 1
LEDs 2
Breadboard 1
Jumper Wires As Required
USB Cable 1
Power Supply 5V
5. ESP32 Pin Connections
RFID RC522
RC522 ESP32
SDA GPIO5
SCK GPIO18
MOSI GPIO23
MISO GPIO19
RST GPIO22
3.3V 3.3V
GND GND
DHT11
DHT11 ESP32
VCC 3.3V
GND GND
DATA GPIO4
IR Sensor
IR Sensor ESP32
VCC 3.3V
GND GND
OUT GPIO27
Buzzer
Buzzer ESP32
Positive GPIO26
Negative GND
6. Circuit Schematic
+------------------+
| ESP32 |
| |
RFID RC522 ---> | SPI Interface |
DHT11 -------> | GPIO4 |
IR Sensor ---> | GPIO27 |
Buzzer -----> | GPIO26 |
OLED -------> | I2C |
+------------------+
|
WiFi
|
Internet Cloud
|
--------------------------------
| | |
Google Sheets Telegram ThingSpeak
| | |
--------------------------------
|
AI Agent
7. Flowchart
START
|
Initialize ESP32
|
Connect WiFi
|
Read RFID Card
|
Card Detected?
|
YES
|
Identify Student
|
Read DHT11
|
Read Occupancy Sensor
|
Upload Data
|
Store Attendance
|
Trigger n8n Workflow
|
Send Telegram Alert
|
Generate Voice Message
|
Update Dashboard
|
Repeat
8. Attendance Data Format
{
"student_name":"Rahul",
"student_id":"RF001",
"attendance":"Present",
"temperature":"28",
"humidity":"65",
"occupancy":"Occupied",
"timestamp":"2026-05-31 09:15:00"
}
9. ESP32 Source Code Structure
Required Libraries
WiFi.h
HTTPClient.h
SPI.h
MFRC522.h
DHT.h
ArduinoJson.h
WiFi Configuration
const char* ssid = "YOUR_WIFI";
const char* password = "YOUR_PASSWORD";
ThingSpeak API
String apiKey = "YOUR_THINGSPEAK_KEY";
Student RFID Mapping
String card1 = "D3A12F45";
String student1 = "Rahul";
String card2 = "B4C56789";
String student2 = "Priya";
Main Program Logic
Read RFID
Read DHT11
Read Occupancy
Create JSON
Send to:
ThingSpeak
Webhook
Google Sheets
Wait
10. ThingSpeak Setup
Step 1
Create account on:
https://thingspeak.com
Step 2
Create New Channel
Fields:
Field 1 → Student ID
Field 2 → Temperature
Field 3 → Humidity
Field 4 → Occupancy
Step 3
Copy:
Write API Key
Read API Key
Channel ID
Step 4
Use API in ESP32
https://api.thingspeak.com/update
11. Google Sheets Setup
Create Sheet
Attendance_Log
Columns:
Date
Time
Student Name
Student ID
Temperature
Humidity
Occupancy
Status
12. n8n Workflow Design
Webhook
|
▼
Google Sheets Node
|
▼
AI Agent Node
|
▼
Telegram Node
|
▼
Voice Generator
13. n8n Workflow JSON Structure
{
"nodes":[
{
"name":"Webhook"
},
{
"name":"Google Sheets"
},
{
"name":"AI Agent"
},
{
"name":"Telegram"
}
]
}
14. Telegram Bot Setup
Step 1
Open Telegram
Search:
BotFather
Step 2
/newbot
Step 3
Create Bot
Example:
SmartClassroomBot
Step 4
Copy Bot Token
123456:ABCXYZ
15. Telegram Alert Example
📚 Smart Classroom Alert
Student:
Rahul
RFID:
RF001
Attendance:
Present
Temperature:
28°C
Humidity:
65%
Time:
09:15 AM
16. Voice Notification Automation
Telegram Voice Message
Generated by:
Google TTS
or
OpenAI TTS
or
ElevenLabs
Example:
Student Rahul attendance recorded successfully.
Classroom temperature is 28 degree Celsius.
17. AI Attendance Analysis
The AI Agent analyzes:
Daily Attendance
Present %
Absent %
Late %
Weekly Trends
Most active students
Frequent absentees
Attendance prediction
18. AI Power Consumption Prediction Logic
Inputs
Occupancy
Temperature
Class Duration
Fan Usage
Light Usage
Example Dataset
Students Temp Fan Light Power
10 28 ON ON 300W
25 30 ON ON 500W
40 32 ON ON 800W
Prediction Formula
Power=a(Occupancy)+b(Temperature)+c(FanUsage)+d(LightUsage)
AI estimates future classroom power requirements and identifies energy-saving opportunities.
19. AI Agent Prompts
Example Prompt:
Analyze today's attendance.
Provide:
1. Attendance %
2. Absent Students
3. Classroom Utilization
4. Energy Consumption Forecast
5. Recommendations
20. ThingSpeak Dashboard
Dashboard Widgets:
Attendance Count
Temperature Graph
Humidity Graph
Occupancy Status
Power Consumption Prediction
Attendance Trend Graph
21. Security Features
RFID Authentication
Only registered cards accepted.
Cloud Security
HTTPS APIs
Token Authentication
Telegram Bot Security
Backup
Google Sheets cloud backup.
22. Future Enhancements
AI Face Recognition
Replace RFID with camera attendance.
Classroom Behavior Analysis
Monitor student engagement.
Smart Energy Control
Automatically control:
Lights
Fans
Projectors
Voice Assistant
Classroom AI Assistant.
Mobile App
Android & iOS Application.
23. Real Deployment Guide
Classroom Installation
Mount RFID reader near classroom entrance.
Install ESP32 controller box.
Place DHT11 sensor inside classroom.
Install occupancy sensor at door.
Connect to WiFi network.
Configure ThingSpeak.
Configure n8n workflow.
Connect Telegram Bot.
Test attendance logging.
Enable AI analytics.
Final Outcome
This project creates a complete Industry 4.0 Smart Classroom platform combining:
ESP32 IoT Monitoring
RFID Attendance Tracking
AI Agent Analytics
n8n Workflow Automation
Google Sheets Database
Telegram Voice Alerts
ThingSpeak Dashboard
Power Consumption Prediction
Cloud-Based Monitoring
It is suitable for B.Tech, M.Tech, Diploma, Polytechnic, Final Year Engineering, IoT, AI & Embedded Systems projects and can be expanded into a full smart campus solution.
Subscribe to:
Posts (Atom)
AI-Based Real-Time Air Pollution Monitoring and Prediction
AI-Based Real-Time Air Pollution Monitoring and Prediction System ESP32 + AI Agent + IoT Cloud + n8n Automation + Telegram Voice Alerts + Go...
-
www.svsembedded.com SVSEMBEDDED svsembedded@gmail.com , CONTACT: 9491535690, 7842358459 ------------------------------------------...
-
Watch Video Demonstration Carefully Till End -- Temperature and Humidity Controller For Incubator Temperature and Humidity Controller For ...
-
Electronic KITS: DTDC Courier Proof Of Delivery Receipts - 2024 - 2023 - 2022 - 2021 - 2020 - 2019 - 2018 - 2017 - 2016...












