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
Saturday, 30 May 2026
AI Smart Solar Panel Tracking System with Weather Optimization
AI Smart Solar Panel Tracking System with Weather Optimization
ESP32 + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Solar Panel Tracking System with Weather Optimization
ESP32 + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
1. Project Overview
Project Title
AI-Powered Smart Solar Panel Tracking and Energy Optimization System
Objective
Develop an intelligent solar tracking system that:
Tracks the sun automatically using ESP32.
Adjusts panel position based on weather conditions.
Predicts solar power generation using AI.
Stores data in cloud platforms.
Sends Telegram notifications and voice alerts.
Maintains historical logs in Google Sheets.
Provides a real-time dashboard through ThingSpeak.
Uses n8n as the automation and AI orchestration platform.
2. System Architecture
Sunlight Sensors
│
▼
┌─────────────┐
│ ESP32 │
└──────┬──────┘
│
Sensor Data + GPS
│
▼
ThingSpeak Cloud
│
▼
n8n
┌────────┼─────────┐
▼ ▼ ▼
Telegram AI Agent Google Sheet
Alerts Analysis Data Logging
│
▼
Voice Notification
3. Features
Smart Solar Tracking
Dual-axis solar tracking
Maximum sunlight capture
Servo motor control
Weather Optimization
Rain detection
Wind protection mode
Cloud cover prediction
AI Agent
Predict power generation
Detect abnormal conditions
Recommend maintenance
Notifications
Telegram messages
Telegram voice alerts
Daily reports
Cloud Monitoring
ThingSpeak Dashboard
Google Sheets Logging
Historical analytics
4. Components List
Controller
Component Quantity
ESP32 Dev Board 1
Sensors
Sensor Purpose
LDR Sensor x4 Sunlight direction
DHT22 Temperature & Humidity
Rain Sensor Rain detection
INA219 Voltage & Current
BH1750 Lux measurement
Optional GPS NEO-6M Location
Actuators
Component Quantity
MG996R Servo 2
Servo Driver PCA9685 1
Power
Component Quantity
Solar Panel 1
Li-ion Battery 1
TP4056 Charging Module 1
Buck Converter 1
Cloud & Software
ESP32 Arduino IDE
ThingSpeak
Telegram Bot
Google Sheets
n8n
OpenAI API
Web Dashboard
5. Hardware Connections
LDR Connections
Four LDRs arranged as:
LDR1 LDR2
Solar Panel
LDR3 LDR4
ESP32 Pins
Sensor ESP32 Pin
LDR1 GPIO34
LDR2 GPIO35
LDR3 GPIO32
LDR4 GPIO33
Rain Sensor GPIO27
DHT22 GPIO4
Servo Horizontal GPIO18
Servo Vertical GPIO19
INA219
INA219 ESP32
SDA GPIO21
SCL GPIO22
BH1750
Shared I2C Bus:
SDA → GPIO21
SCL → GPIO22
6. Circuit Schematic
+----------------+
| Solar Panel |
+-------+--------+
|
INA219
|
▼
+--------------------------------+
| ESP32 |
| |
| GPIO34 ← LDR1 |
| GPIO35 ← LDR2 |
| GPIO32 ← LDR3 |
| GPIO33 ← LDR4 |
| GPIO27 ← Rain Sensor |
| GPIO4 ← DHT22 |
| GPIO18 → Servo X |
| GPIO19 → Servo Y |
+--------------------------------+
│
▼
WiFi Network
│
▼
ThingSpeak
│
▼
n8n
/ | \
Telegram AI Google Sheet
7. Working Principle
Step 1
LDR sensors detect sunlight intensity.
Step 2
ESP32 compares:
Left = LDR1 + LDR3
Right = LDR2 + LDR4
If:
Left > Right
Rotate left.
Else rotate right.
Step 3
Vertical Adjustment
Top = LDR1 + LDR2
Bottom = LDR3 + LDR4
Move panel accordingly.
Step 4
Measure:
Temperature
Humidity
Solar voltage
Solar current
Lux level
Step 5
Upload to ThingSpeak.
Step 6
n8n fetches data.
Step 7
AI Agent analyzes trends.
Step 8
Notifications sent via Telegram.
8. Flowchart
START
|
Initialize ESP32
|
Read Sensors
|
Track Sun
|
Weather Check
|
Measure Power
|
Upload Cloud
|
Run AI Analysis
|
Send Alerts
|
Wait 60 sec
|
Repeat
9. ESP32 Source Code (Core Logic)
#include
#include
#include
Servo servoX;
Servo servoY;
int ldr1=34;
int ldr2=35;
int ldr3=32;
int ldr4=33;
int posX=90;
int posY=90;
void setup()
{
Serial.begin(115200);
servoX.attach(18);
servoY.attach(19);
WiFi.begin("SSID","PASSWORD");
while(WiFi.status()!=WL_CONNECTED)
{
delay(500);
}
}
void loop()
{
int a=analogRead(ldr1);
int b=analogRead(ldr2);
int c=analogRead(ldr3);
int d=analogRead(ldr4);
int left=a+c;
int right=b+d;
int top=a+b;
int bottom=c+d;
if(left-right>50)
posX--;
if(right-left>50)
posX++;
if(top-bottom>50)
posY++;
if(bottom-top>50)
posY--;
posX=constrain(posX,0,180);
posY=constrain(posY,0,180);
servoX.write(posX);
servoY.write(posY);
delay(1000);
}
10. ThingSpeak Setup
Create account:
ThingSpeak
Create Channel:
Fields:
Field Purpose
Field1 Voltage
Field2 Current
Field3 Power
Field4 Lux
Field5 Temperature
Field6 Humidity
Field7 Rain
Field8 Tracker Angle
Get:
Channel ID
Write API Key
Read API Key
ESP32 uploads:
ThingSpeak.writeField(channelID,1,voltage,key);
11. Google Sheets Integration
Create Sheet
Columns:
Timestamp
Voltage
Current
Power
Lux
Temperature
Humidity
Rain
Prediction
Status
Google Apps Script
function doPost(e)
{
var sheet =
SpreadsheetApp.getActiveSpreadsheet()
.getSheetByName("SolarData");
var data = JSON.parse(e.postData.contents);
sheet.appendRow([
new Date(),
data.voltage,
data.current,
data.power,
data.lux,
data.temp
]);
return ContentService
.createTextOutput("OK");
}
Deploy as:
Web App
Anyone Access
12. Telegram Bot Setup
Open Telegram.
Search:
BotFather
Create Bot:
/newbot
Receive:
BOT TOKEN
Get Chat ID:
https://api.telegram.org/botTOKEN/getUpdates
Message API
https://api.telegram.org/botTOKEN/sendMessage
13. Voice Notification Automation
n8n workflow:
Sensor Data
|
IF Condition
|
Generate TTS
|
Telegram Send Voice
Examples:
Warning.
Rain detected.
Solar panel moved to safe position.
Voice generation options:
OpenAI TTS
Google TTS
Edge TTS
14. AI Power Prediction Logic
Input Features:
Lux
Temperature
Humidity
Time
Weather
Historical Power
Simple Formula
Predicted Power =
0.6 × Lux
+ 0.2 × Temp
+ 0.2 × Historical Average
Advanced AI Model
Use:
Random Forest
XGBoost
LSTM
Training Dataset:
Date
Lux
Temp
Humidity
Current
Voltage
Power Output
Prediction Output
{
"expected_power":145,
"confidence":92
}
15. n8n Workflow Design
Workflow Structure
Schedule Trigger
|
ThingSpeak API
|
Function Node
|
OpenAI Agent
|
IF Node
|
┌────┴─────┐
▼ ▼
Telegram Google Sheet
Alert Log Data
AI Agent Prompt
You are a solar energy monitoring assistant.
Analyze:
Voltage
Current
Power
Temperature
Humidity
Rain
Predict future power generation.
Detect anomalies.
Recommend actions.
16. Example n8n Workflow JSON Structure
{
"nodes":[
{
"name":"Schedule Trigger"
},
{
"name":"ThingSpeak"
},
{
"name":"OpenAI"
},
{
"name":"Telegram"
}
]
}
In n8n:
Cron Node
HTTP Request
OpenAI Node
IF Node
Telegram Node
Google Sheets Node
17. Weather Optimization Logic
Rain
Rain = TRUE
Action:
Tilt panel to 0°
Strong Wind
Action:
Horizontal safe mode
Cloudy
Action:
Optimize angle using AI prediction
18. Cloud Dashboard
ThingSpeak Widgets
Gauge
Power Chart
Voltage Chart
Lux Graph
Temperature Graph
Tracker Position
Dashboard shows:
Live Solar Output
Today's Energy
Predicted Energy
Weather Status
Servo Angles
19. Future Enhancements
Computer Vision
Use:
ESP32-CAM
Sky image analysis
Machine Learning
Energy forecasting
Cloud movement prediction
Edge AI
Run TinyML directly on ESP32.
Digital Twin
Virtual solar farm simulation.
Predictive Maintenance
Detect:
Dust accumulation
Servo failure
Panel degradation
20. Deployment Guide
Phase 1
Hardware Assembly
Connect sensors
Mount servos
Install panel
Phase 2
ESP32 Firmware Upload
Configure WiFi
Add API keys
Upload code
Phase 3
Cloud Configuration
ThingSpeak channel
Google Sheet
Telegram Bot
Phase 4
n8n Deployment
You can self-host using:
n8n Official Website
or deploy on:
Docker
VPS
Cloud VM
Phase 5
AI Agent Integration
Connect:
ThingSpeak
OpenAI API
Telegram
Google Sheets
Final Outcome
The completed system continuously:
Tracks the sun using dual-axis control.
Measures environmental and electrical parameters.
Uploads telemetry to ThingSpeak.
Logs data into Google Sheets.
Uses an AI agent to predict energy production.
Sends Telegram text and voice alerts.
Optimizes panel positioning based on weather.
Provides a real-time cloud dashboard with analytics and forecasting.
AI Smart Road Pothole Detection and Mapping System
AI Smart Road Pothole Detection and Mapping System
AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Road Pothole Detection and Mapping System
AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
1. Project Overview
Project Title
AI Smart Road Pothole Detection and Mapping System using ESP32, Agentic IoT, n8n Automation, Telegram Voice Alerts, Google Sheets, and ThingSpeak Cloud Dashboard
Objective
The objective of this project is to:
Detect road potholes automatically using sensors connected to ESP32.
Collect pothole location data using GPS.
Send real-time data to cloud platforms.
Store pothole records in Google Sheets.
Display pothole statistics on ThingSpeak Dashboard.
Trigger AI-based notifications through Telegram.
Generate voice alerts using AI automation.
Predict power consumption and battery health using AI logic.
Create a scalable smart-city road monitoring solution.
2. System Architecture
Road Pothole
│
▼
MPU6050 Accelerometer
│
▼
ESP32
│
├────────► ThingSpeak Dashboard
│
├────────► n8n Webhook
│ │
│ ▼
│ AI Decision Agent
│ │
│ ┌────────┼─────────┐
│ ▼ ▼
│ Google Sheets Telegram Bot
│ │
│ ▼
│ Voice Notification
│
▼
GPS Location Data
3. Working Principle
The accelerometer continuously monitors road vibrations.
When:
Acceleration > Threshold
The system identifies a pothole event.
ESP32 then:
Reads GPS coordinates.
Measures vibration intensity.
Calculates pothole severity.
Uploads data to:
ThingSpeak
n8n Webhook
n8n performs:
AI classification
Data logging
Voice generation
Telegram notification
Google Sheet storage
4. Components List
Component Quantity
ESP32 Dev Board 1
MPU6050 Accelerometer & Gyroscope 1
NEO-6M GPS Module 1
SIM800L GSM Module (Optional) 1
Buzzer 1
LED Indicator 1
Li-Ion Battery 1
TP4056 Charging Module 1
Voltage Regulator 1
Jumper Wires As required
Breadboard / PCB 1
5. Hardware Connections
MPU6050 → ESP32
MPU6050 ESP32
VCC 3.3V
GND GND
SDA GPIO21
SCL GPIO22
GPS NEO-6M → ESP32
GPS ESP32
VCC 3.3V
GND GND
TX GPIO16
RX GPIO17
Buzzer
Buzzer ESP32
+ GPIO25
- GND
LED
LED ESP32
Anode GPIO26
Cathode GND
6. Circuit Schematic Diagram
MPU6050
+----------+
| SDA SCL |
+----|--|--+
| |
| |
GPIO21 GPIO22
ESP32
+-------------+
| |
GPS TX -->| GPIO16 |
GPS RX <--| GPIO17 |
BUZZER -->| GPIO25 |
LED ----->| GPIO26 |
| |
+-------------+
|
|
WiFi Internet
|
▼
ThingSpeak + n8n
7. Flowchart
START
│
▼
Initialize ESP32
│
▼
Connect WiFi
│
▼
Read MPU6050 Data
│
▼
Acceleration > Threshold?
│
┌┴────────────┐
│ │
NO YES
│ │
▼ ▼
Continue Read GPS
Monitoring │
▼
Calculate Severity
│
▼
Send Data to Cloud
│
▼
Trigger n8n
│
▼
AI Agent Analysis
│
▼
Telegram Voice Alert
│
▼
Store Google Sheet
│
▼
END
8. Pothole Severity Classification
Severity Acceleration Value
Low 1.0g – 1.5g
Medium 1.5g – 2.5g
High > 2.5g
9. ESP32 Source Code
#include
#include
#include
#include
MPU6050 mpu;
const char* ssid = "YOUR_WIFI";
const char* password = "YOUR_PASSWORD";
String webhookURL =
"https://your-n8n-server/webhook/pothole";
float threshold = 1.5;
void setup()
{
Serial.begin(115200);
WiFi.begin(ssid,password);
while(WiFi.status()!=WL_CONNECTED)
{
delay(500);
}
Wire.begin();
mpu.initialize();
}
void loop()
{
int16_t ax, ay, az;
mpu.getAcceleration(&ax,&ay,&az);
float vibration =
sqrt(ax*ax+ay*ay+az*az)/16384.0;
if(vibration > threshold)
{
sendData(vibration);
}
delay(1000);
}
void sendData(float value)
{
HTTPClient http;
http.begin(webhookURL);
http.addHeader("Content-Type",
"application/json");
String payload =
"{\"severity\":" + String(value) + "}";
http.POST(payload);
http.end();
}
10. n8n Workflow Architecture
Webhook
│
▼
AI Agent
│
├────► Google Sheets
│
├────► ThingSpeak Update
│
├────► OpenAI Analysis
│
└────► Telegram Alert
11. n8n Workflow Steps
Node 1: Webhook
Method:
POST
Receive:
{
"severity": 2.8,
"latitude": 17.3850,
"longitude": 78.4867
}
Node 2: AI Agent
Prompt:
Analyze pothole severity.
If severity > 2.5
Category = Critical
If severity > 1.5
Category = Medium
Else
Category = Low
Node 3: Google Sheets
Columns:
Date
Time
Latitude
Longitude
Severity
Category
Status
Node 4: Telegram Notification
Message:
⚠️ Pothole Detected
Location:
17.3850,78.4867
Severity:
Critical
Immediate inspection required.
12. Example n8n Workflow JSON
{
"nodes": [
{
"name": "Webhook"
},
{
"name": "AI Agent"
},
{
"name": "Google Sheets"
},
{
"name": "Telegram"
}
]
}
13. Telegram Bot Setup
Step 1
Open Telegram
Search:
@BotFather
Create bot:
/newbot
Step 2
Copy Bot Token.
Example:
123456:ABCDEF
Step 3
Add token in n8n Telegram node.
14. Voice Notification Automation
AI Voice Message
Message generated:
Warning.
Critical pothole detected.
Location latitude 17.3850
longitude 78.4867.
Municipal inspection required.
Workflow
AI Agent
│
▼
Text to Speech
│
▼
MP3 File
│
▼
Telegram Send Audio
15. Google Sheets Integration
Create Sheet:
Pothole_Database
Columns:
Timestamp
Latitude
Longitude
Severity
Category
Action
Connect Google Account in n8n.
Use:
Append Row
Node.
16. ThingSpeak Dashboard Setup
Create channel on:
ThingSpeak
Fields:
Field Purpose
Field1 Severity
Field2 Latitude
Field3 Longitude
Field4 Power Consumption
Field5 Pothole Count
Visualization
Charts:
Severity Trend
GPS Heatmap
Daily Pothole Count
Power Usage Trend
17. AI Power Consumption Prediction Logic
Inputs
Battery Voltage
WiFi Usage
Sensor Sampling Rate
GPS Activity
Formula
P=V×I
Where:
P = Power
V = Voltage
I = Current
AI Rule Engine
IF Battery < 20%
Reduce Sampling Rate
Disable GPS Continuous Mode
Send Battery Alert
Predicted States
Battery Status
>80% Healthy
50-80% Normal
20-50% Warning
<20% Critical
18. AI Agent Decision Logic
Input:
Severity + Location + Historical Data
AI Agent evaluates:
1. Repeated pothole?
2. High traffic area?
3. Severity level?
4. Repair priority?
Priority Score
Priority =
(Severity × 50%)
+
(Traffic Density × 30%)
+
(Repeat Count × 20%)
19. ThingSpeak Data Format
Example:
field1=2.8
field2=17.3850
field3=78.4867
field4=1.2
field5=45
HTTP Request:
https://api.thingspeak.com/update?api_key=YOURKEY&field1=2.8
20. Advanced Future Enhancements
Computer Vision Pothole Detection
Add:
ESP32-CAM
Edge AI
Models:
YOLOv8 Nano
MobileNet SSD
GIS Mapping
Integrate:
OpenStreetMap
Google Maps API
Display:
Pothole clusters
Maintenance zones
Smart City Dashboard
Features:
Heatmaps
AI Analytics
Municipal Alerts
Maintenance Scheduling
Predictive Maintenance
Use:
Historical pothole data
Rainfall data
Traffic data
Predict:
Road Failure Probability
before pothole formation.
21. Deployment Guide
Phase 1: Prototype
ESP32
MPU6050
GPS
WiFi
Phase 2: Pilot
Install on:
Municipal vehicles
Buses
Garbage trucks
Phase 3: Smart City Scale
Deploy:
100+ Nodes
Central Cloud Dashboard
AI Maintenance Management
22. Expected Outputs
✅ Real-time pothole detection
✅ GPS-based pothole mapping
✅ AI severity classification
✅ Telegram text alerts
✅ Telegram voice alerts
✅ Google Sheets logging
✅ ThingSpeak cloud visualization
✅ AI power management
✅ Smart-city ready deployment
✅ Fully scalable Agentic IoT architecture
This architecture is suitable for final-year engineering projects, smart-city research, municipal road monitoring, and AIoT deployments with ESP32, n8n, Telegram automation, Google Sheets, and cloud analytics.
AI Smart Refrigerator Monitoring and Food Expiry Detection
AI Smart Refrigerator Monitoring & Food Expiry Detection System
ESP32 + Agentic AI + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Refrigerator Monitoring & Food Expiry Detection System
ESP32 + Agentic AI + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
1. Project Overview
This project creates an intelligent refrigerator monitoring system that:
✅ Monitors refrigerator temperature and humidity
✅ Detects food expiry dates
✅ Predicts future power consumption using AI logic
✅ Stores data in Google Sheets
✅ Visualizes data in ThingSpeak Dashboard
✅ Sends Telegram alerts
✅ Generates Voice Notifications through Telegram
✅ Uses n8n automation as the workflow engine
✅ Uses ESP32 as the IoT edge device
✅ Can be extended into a fully Agentic AI Refrigerator Assistant
2. System Architecture
+----------------+
| Refrigerator |
+-------+--------+
|
v
+----------------+
| ESP32 |
| DHT22 Sensor |
| RFID/Manual |
| Entry System |
+-------+--------+
|
WiFi MQTT/HTTP
|
v
+----------------+
| ThingSpeak |
| Cloud Dashboard|
+-------+--------+
|
v
+----------------+
| n8n Workflow |
+-------+--------+
|
+----------------+
| |
v v
+--------------+ +--------------+
| Telegram Bot | | Google Sheet |
+--------------+ +--------------+
|
v
+----------------+
| Voice Alerts |
+----------------+
|
v
+----------------+
| AI Prediction |
+----------------+
3. Features
Monitoring
Refrigerator Temperature
Humidity
Door Open Duration
Power Consumption
Food Management
Food Name
Added Date
Expiry Date
Days Remaining
Alerts
High Temperature
Food Expiry
Power Consumption Anomaly
Door Left Open
Cloud Features
Historical Data
Dashboard
Analytics
AI Prediction
4. Hardware Components List
Component Quantity
ESP32 Dev Board 1
DHT22 Temperature Humidity Sensor 1
Reed Switch Door Sensor 1
RFID RC522 (optional) 1
RFID Tags 5
OLED Display 0.96" 1
Buzzer 1
Relay Module 1
ACS712 Current Sensor 1
Jumper Wires Several
Breadboard 1
5V Adapter 1
5. Pin Connections
DHT22
DHT22 ESP32
VCC 3.3V
GND GND
DATA GPIO4
Reed Switch
Reed Switch ESP32
One Side GPIO15
Other Side GND
Buzzer
Buzzer ESP32
+ GPIO18
- GND
ACS712 Current Sensor
ACS712 ESP32
OUT GPIO34
VCC 5V
GND GND
6. Working Principle
Step 1
ESP32 reads:
Temperature
Humidity
Door Status
Current Consumption
every 30 seconds.
Step 2
ESP32 sends data to:
ThingSpeak
n8n Webhook
using HTTP requests.
Step 3
n8n processes incoming data.
Checks:
Temperature > Threshold?
Door Open Too Long?
Power Consumption High?
Food Expiry Near?
Step 4
If abnormal:
Telegram Message
Telegram Voice Alert
Google Sheets Entry
generated automatically.
7. Flowchart
START
|
v
Initialize ESP32
|
Connect WiFi
|
Read Sensors
|
Send to ThingSpeak
|
Send to n8n
|
Check Rules
|
+----No----+
| |
| Continue
|
Yes
|
Send Telegram Alert
|
Generate Voice Alert
|
Store in Google Sheet
|
Repeat
8. ESP32 Source Code
#include
#include
#include "DHT.h"
#define DHTPIN 4
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
const char* ssid = "YOUR_WIFI";
const char* password = "YOUR_PASSWORD";
String webhookURL =
"https://your-n8n-domain/webhook/fridge";
String thingSpeakAPI =
"YOUR_THINGSPEAK_WRITE_KEY";
void setup()
{
Serial.begin(115200);
WiFi.begin(ssid,password);
while(WiFi.status()!=WL_CONNECTED)
{
delay(1000);
}
dht.begin();
}
void loop()
{
float temp = dht.readTemperature();
float hum = dht.readHumidity();
if(WiFi.status()==WL_CONNECTED)
{
HTTPClient http;
String url =
"https://api.thingspeak.com/update?api_key="
+ thingSpeakAPI +
"&field1=" + String(temp) +
"&field2=" + String(hum);
http.begin(url);
http.GET();
http.end();
HTTPClient webhook;
webhook.begin(webhookURL);
webhook.addHeader(
"Content-Type",
"application/json");
String payload =
"{\"temp\":" + String(temp) +
",\"humidity\":" +
String(hum) + "}";
webhook.POST(payload);
webhook.end();
}
delay(30000);
}
9. ThingSpeak Setup
Create Account
Create ThingSpeak account.
Create new channel.
Fields:
Field1 Temperature
Field2 Humidity
Field3 Door Status
Field4 Power
Copy Write API Key
Channels
→ API Keys
→ Write API Key
Paste into ESP32 code.
10. Google Sheets Setup
Create Sheet:
Date
Time
Temperature
Humidity
Power
Door
Food Item
Expiry Date
Status
Example:
Date Temp Food Expiry
12-05-2026 4°C Milk 15-05-2026
11. Telegram Bot Setup
Step 1
Open Telegram
Search:
BotFather
Create Bot:
/ newbot
Get:
BOT TOKEN
Step 2
Get Chat ID
Open:
https://api.telegram.org/botTOKEN/getUpdates
Save Chat ID.
12. n8n Workflow Design
Node 1
Webhook
POST
/fridge
Node 2
IF Node
Condition:
{{$json.temp > 8}}
Node 3
Telegram Node
Message:
⚠ Refrigerator Temperature High
Current:
{{$json.temp}} °C
Node 4
Google Sheets Node
Append Row
Date
Time
Temperature
Humidity
Node 5
Text-To-Speech Node
Input:
Warning.
Refrigerator temperature is high.
Please check immediately.
Generate MP3.
Node 6
Telegram Send Voice
Attach generated MP3.
13. n8n Workflow JSON Structure
{
"nodes":[
{
"name":"Webhook"
},
{
"name":"IF"
},
{
"name":"Telegram"
},
{
"name":"Google Sheets"
}
]
}
Import and customize.
14. Food Expiry Detection Logic
Google Sheet Example:
Food Expiry Date
Milk 15-May
Eggs 20-May
Yogurt 18-May
n8n Daily Scheduler:
Every Day 8AM
Formula:
daysRemaining =
expiryDate - currentDate
Conditions
<=3 days
Send Alert.
Telegram:
Milk expires in 2 days.
15. AI Food Expiry Prediction
Advanced model considers:
Temperature variation
Humidity
Storage duration
Food category
Door opening frequency
Prediction:
Expected Remaining Shelf Life
Example:
Milk
Original:
7 days
Predicted:
5 days
because of frequent temperature spikes.
16. AI Power Consumption Prediction
Input Features
Temperature
Compressor Runtime
Door Open Count
Humidity
Historical Power Usage
Model
Linear Regression
y = a + bx
Where
y = predicted power
x = usage factors
or
Random Forest
More accurate
Training Dataset
Date
Power
Temperature
Door Count
Prediction Output
Tomorrow Expected Usage:
1.8 kWh
17. Voice Notification Automation
Workflow:
ESP32
↓
n8n
↓
OpenAI/TTS Engine
↓
Generate Voice
↓
Telegram Voice Message
Example Voice:
Attention.
Milk will expire in 2 days.
Please consume it soon.
18. AI Agent Features
The AI Agent can answer:
What food expires today?
How much power did fridge consume?
Why is temperature rising?
Suggest grocery items.
Agent accesses:
ThingSpeak
Google Sheets
Historical Records
through APIs.
19. Future Enhancements
Computer Vision
ESP32-CAM
Detect:
Milk
Eggs
Fruits
Vegetables
using object detection.
QR Code Inventory
Each food item has QR code.
Scan when inserted.
Automatic inventory update.
Voice Assistant
Voice Commands:
What expires today?
How much milk is left?
Mobile App
Flutter App
Features:
Dashboard
Notifications
Analytics
Inventory
20. Deployment Guide
Local Testing
Connect sensors.
Upload ESP32 code.
Verify serial monitor.
Test ThingSpeak updates.
Test n8n webhook.
Cloud Deployment
Deploy n8n on:
Raspberry Pi
Docker
VPS
Cloud VM
Recommended:
2 CPU
4GB RAM
Security
Use:
HTTPS
Webhook Authentication
Encrypted Tokens
Firewall Rules
21. Expected Outputs
Dashboard
Temperature: 4.2°C
Humidity: 68%
Power: 1.5 kWh
Door: Closed
Telegram Alert
⚠ Warning
Milk expires tomorrow.
Voice Alert
Attention.
Milk expires tomorrow.
AI Prediction
Power tomorrow:
1.8 kWh
Confidence:
92%
22. Project Outcome
This system combines:
ESP32 Edge Computing
IoT Sensor Monitoring
Agentic AI Decision Making
n8n Workflow Automation
Telegram Messaging & Voice Alerts
Google Sheets Data Logging
ThingSpeak Analytics
Food Expiry Intelligence
Predictive Maintenance
The result is a complete Industry 4.0 smart refrigerator solution suitable for academic projects, final-year engineering projects, smart-home deployments, and IoT/AI portfolio demonstrations.
AI Smart Power Factor Correction with Load Prediction
AI Smart Power Factor Correction with Load Prediction
ESP32 + Agentic AI + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Power Factor Correction with Load Prediction
ESP32 + Agentic AI + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
1. Project Overview
Project Title
AI-Powered Smart Power Factor Correction System with Load Prediction using ESP32, n8n Automation, Telegram Voice Alerts, Google Sheets Logging, and ThingSpeak Cloud Dashboard
Project Objective
Develop an intelligent energy monitoring and power factor correction system that:
Measures Voltage, Current, Power, Energy, and Power Factor.
Automatically switches capacitor banks for power factor correction.
Uses AI-based prediction to forecast future power consumption.
Sends voice alerts through Telegram.
Stores historical data in Google Sheets.
Visualizes real-time data on ThingSpeak.
Uses n8n as the automation and AI orchestration platform.
Supports future Agentic AI decision-making.
2. System Architecture
┌────────────────────┐
│ Electrical Load │
└──────────┬─────────┘
│
Voltage & Current
│
┌─────────▼────────┐
│ PZEM004T │
│ Energy Meter │
└─────────┬────────┘
│ UART
┌─────────▼────────┐
│ ESP32 │
│ Data Collection │
└─────────┬────────┘
│ WiFi
┌──────────────────┼─────────────────┐
│ │ │
▼ ▼ ▼
ThingSpeak n8n Workflow Google Sheets
│
▼
AI Prediction Engine
│
▼
Telegram Bot
│
Voice Alerts
▼
Power Factor Control
Relay Bank
3. Features
Monitoring
Voltage
Current
Active Power
Apparent Power
Reactive Power
Power Factor
Energy Consumption
Automation
Automatic capacitor switching
AI load forecasting
Telegram alerts
Voice notifications
Cloud
ThingSpeak Dashboard
Google Sheets Storage
Historical Analytics
AI Features
Consumption Prediction
Anomaly Detection
Peak Demand Forecasting
Future Agentic Actions
4. Components Required
Component Quantity
ESP32 Dev Board 1
PZEM-004T v3 Energy Meter 1
ZMPT101B Voltage Sensor (optional) 1
SCT013 Current Sensor (optional) 1
5V Relay Module 4
Capacitor Banks 4
Capacitors (2µF,4µF,8µF,16µF) As required
Power Supply 5V 1
WiFi Router 1
Breadboard/PCB 1
Jumper Wires Multiple
Telegram Bot 1
ThingSpeak Account 1
Google Account 1
n8n Server 1
5. Power Factor Correction Theory
Power Factor:
PF=
Apparent Power
Real Power
Ideal PF:
0.95 to 1.00
If PF drops:
PF < 0.90
Capacitor bank is switched ON.
Example:
PF = 0.72
Relay 1 ON
PF = 0.65
Relay 1 + Relay 2 ON
PF = 0.55
Relay 1 + Relay 2 + Relay 3 ON
6. Circuit Connections
ESP32 ↔ PZEM004T
PZEM ESP32
TX GPIO16
RX GPIO17
VCC 5V
GND GND
Relay Module
Relay ESP32
Relay1 GPIO25
Relay2 GPIO26
Relay3 GPIO27
Relay4 GPIO14
Capacitor Banks
Relay1 → 2uF
Relay2 → 4uF
Relay3 → 8uF
Relay4 →16uF
Connected parallel to load.
7. Circuit Schematic
AC LOAD
│
┌──▼──┐
│PZEM │
└──┬──┘
│
▼
ESP32
│
┌──┼───────────────┐
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
R1 R2 R3 R4 WiFi
│ │ │ │
▼ ▼ ▼ ▼
Capacitor Bank
8. Flowchart
START
│
▼
Connect WiFi
│
▼
Read PZEM Data
│
▼
Calculate PF
│
▼
PF < 0.90 ?
┌──Yes──┐
▼ ▼
Enable No Action
Capacitor
│
▼
Send Data
│
▼
ThingSpeak
│
▼
n8n Webhook
│
▼
AI Prediction
│
▼
Store in Sheets
│
▼
Send Telegram Alert
│
▼
Repeat
9. ESP32 Source Code
Libraries
Install:
PZEM004Tv30
WiFi
HTTPClient
ArduinoJson
Main Code
#include
#include
#include
PZEM004Tv30 pzem(Serial2,16,17);
const char* ssid="YOUR_WIFI";
const char* pass="PASSWORD";
String webhookURL =
"https://n8n-server/webhook/power";
#define RELAY1 25
#define RELAY2 26
#define RELAY3 27
#define RELAY4 14
void setup()
{
Serial.begin(115200);
pinMode(RELAY1,OUTPUT);
pinMode(RELAY2,OUTPUT);
pinMode(RELAY3,OUTPUT);
pinMode(RELAY4,OUTPUT);
WiFi.begin(ssid,pass);
while(WiFi.status()!=WL_CONNECTED)
{
delay(500);
}
}
void loop()
{
float voltage=pzem.voltage();
float current=pzem.current();
float power=pzem.power();
float pf=pzem.pf();
if(pf<0.90)
{
digitalWrite(RELAY1,HIGH);
}
if(pf<0.80)
{
digitalWrite(RELAY2,HIGH);
}
if(pf<0.70)
{
digitalWrite(RELAY3,HIGH);
}
if(pf<0.60)
{
digitalWrite(RELAY4,HIGH);
}
HTTPClient http;
http.begin(webhookURL);
http.addHeader("Content-Type",
"application/json");
String payload="{\"voltage\":"
+String(voltage)+
",\"current\":"
+String(current)+
",\"power\":"
+String(power)+
",\"pf\":"
+String(pf)+"}";
http.POST(payload);
http.end();
delay(30000);
}
10. ThingSpeak Setup
Create channel.
Fields:
Field1 Voltage
Field2 Current
Field3 Power
Field4 PF
Field5 Energy
Field6 Predicted Load
Get:
Write API Key
Channel ID
ESP32 sends data every 30 seconds.
Example URL:
https://api.thingspeak.com/update
Parameters:
api_key=XXXX
field1=230
field2=5
field3=1100
field4=0.92
11. Google Sheets Integration
Create Sheet:
Timestamp
Voltage
Current
Power
PF
Energy
Prediction
Status
n8n Google Sheet Node
Action:
Append Row
Every incoming ESP32 record gets stored.
12. Telegram Bot Setup
Open Telegram.
Search:
BotFather
Create bot:
/ newbot
Receive:
BOT TOKEN
Get Chat ID.
Save both.
13. Voice Alert System
Telegram supports voice files.
n8n workflow:
Incoming Data
│
▼
Function Node
│
▼
Text-to-Speech
│
▼
Telegram Send Audio
Example message:
Warning.
Power factor has dropped to
0.68
Capacitor bank activated.
Predicted load increase
within 30 minutes.
14. AI Load Prediction Logic
Dataset
Historical records:
Time
Voltage
Current
Power
Energy
PF
Prediction Inputs
Last 24 Hours
Features:
Hour
Day
Power
Current
Energy
Prediction Output
Next 30 min load
Next 1 hour load
Next 24 hour load
Simple AI Model
Linear Regression
Predicted_Load =
a+b(power)+c(current)+d(hour)
Advanced AI
Use:
XGBoost
Random Forest
LSTM
Prophet
15. n8n Workflow Design
Webhook Trigger
│
▼
Data Processing
│
▼
AI Agent Node
│
├─────────► ThingSpeak
│
├─────────► Google Sheets
│
├─────────► Telegram Text
│
└─────────► Telegram Voice
16. Example n8n Workflow JSON Structure
{
"nodes":[
{
"name":"Webhook"
},
{
"name":"Function"
},
{
"name":"Google Sheets"
},
{
"name":"Telegram"
}
]
}
In actual deployment export the workflow from n8n after configuration.
17. Agentic AI Extension
AI Agent receives:
PF
Voltage
Current
Historical Trends
Weather
Time
Agent decides:
Increase Capacitor
Decrease Capacitor
Peak Warning
Maintenance Alert
Example:
Predicted PF drop in 20 min
Activate 8uF capacitor now.
18. Telegram Alert Examples
Normal
System Healthy
PF = 0.97
Load = 1.1 kW
Warning
PF Low
PF = 0.75
Capacitor Activated
Critical
PF = 0.52
Maximum Capacitor Bank Active
Immediate inspection required
19. Future Enhancements
AI
LSTM Forecasting
Reinforcement Learning
Predictive Maintenance
Load Classification
Cloud
MQTT Broker
AWS IoT
Azure IoT Hub
Google Cloud IoT
Hardware
3-Phase Monitoring
Automatic Capacitor Bank Panel
Industrial PLC Integration
Mobile App
Flutter Dashboard
React Native Dashboard
AI Chat Assistant
20. Deployment Guide
Phase 1
Build hardware.
Verify:
Voltage readings
Current readings
PF readings
Phase 2
Configure:
WiFi
ThingSpeak
Telegram
Phase 3
Deploy n8n.
Recommended options:
Docker
VPS
Raspberry Pi
Phase 4
Connect:
ESP32 → n8n
n8n → Sheets
n8n → Telegram
n8n → ThingSpeak
Phase 5
Train AI Model
Collect:
1–4 weeks data
Train prediction model and integrate it into n8n or a Python microservice.
Final Outcome
This project becomes a complete Industry 4.0 Smart Energy Management System capable of:
Real-time electrical monitoring
Automatic power factor correction
AI-based load forecasting
Agentic decision-making
Cloud analytics
Google Sheets logging
ThingSpeak visualization
Telegram text and voice alerts
Scalable industrial deployment using ESP32 and n8n automation.
AI Smart Electric Vehicle Charging Station Management System
AI Smart Electric Vehicle Charging Station Management System
AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Electric Vehicle Charging Station Management System
AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
1. Project Overview
Project Title
AI Smart Electric Vehicle Charging Station Management System using ESP32, Agentic IoT, n8n Automation, Telegram Voice Alerts, Google Sheets, and ThingSpeak
Objective
Develop an intelligent EV charging station monitoring and management system that:
Monitors charging voltage, current, power, and energy consumption.
Predicts future power demand using AI.
Sends real-time alerts through Telegram.
Generates voice notifications automatically.
Stores charging logs in Google Sheets.
Visualizes data on ThingSpeak cloud dashboards.
Uses n8n as an automation and AI orchestration platform.
Supports future expansion into multiple charging stations.
2. System Architecture
EV Charger
│
▼
Current & Voltage Sensors
│
▼
ESP32 Controller
│
├────────► ThingSpeak Dashboard
│
├────────► n8n Webhook
│ │
│ ▼
│ AI Agent Logic
│ │
│ ┌─────────┴─────────┐
│ ▼ ▼
│ Google Sheets Telegram Bot
│ │
│ ▼
│ Voice Notification
│
▼
Cloud Monitoring
3. Features
Real-Time Monitoring
Voltage Monitoring
Current Monitoring
Power Calculation
Energy Consumption Tracking
AI Agent Features
Charging load prediction
Peak demand forecasting
Anomaly detection
Usage pattern analysis
Automation
Data logging
Alert generation
Voice message generation
Cloud dashboard updates
4. Components List
Component Quantity
ESP32 Dev Board 1
ACS712 Current Sensor 1
ZMPT101B Voltage Sensor 1
Relay Module 1
OLED Display 0.96" 1
EV Charging Socket 1
5V Power Supply 1
Jumper Wires Several
Breadboard/PCB 1
WiFi Router 1
5. Circuit Connections
ACS712 Current Sensor
ACS712 ESP32
VCC 5V
GND GND
OUT GPIO34
ZMPT101B Voltage Sensor
ZMPT101B ESP32
VCC 5V
GND GND
OUT GPIO35
Relay Module
Relay ESP32
IN GPIO26
VCC 5V
GND GND
OLED Display (I2C)
OLED ESP32
SDA GPIO21
SCL GPIO22
VCC 3.3V
GND GND
6. Circuit Schematic Diagram
+----------------+
| ESP32 |
| |
Voltage Sensor--| GPIO35 |
Current Sensor--| GPIO34 |
Relay ----------| GPIO26 |
OLED SDA -------| GPIO21 |
OLED SCL -------| GPIO22 |
+----------------+
|
WiFi
|
+-------------+-------------+
| |
ThingSpeak n8n Server
|
+----------------+----------------+
| | |
Telegram Bot Google Sheets AI Agent
7. Flowchart
Start
│
▼
Initialize ESP32
│
Connect WiFi
│
Read Sensors
│
Calculate Power
│
Upload ThingSpeak
│
Send Data to n8n
│
AI Analysis
│
Store in Sheets
│
Alert Required?
│
┌──Yes───┐
▼ ▼
Telegram Continue
Voice
Alert
│
▼
Loop
8. Working Principle
Step 1
ESP32 reads:
Voltage from ZMPT101B
Current from ACS712
Step 2
Calculate power:
P=V×I
Example:
Voltage = 230V
Current = 10A
Power = 230 × 10
= 2300 W
Step 3
Calculate Energy
E=P×t
Example:
2300W × 2h
= 4.6 kWh
Step 4
ESP32 sends data to:
ThingSpeak
n8n Webhook
Step 5
n8n processes data
Save logs
Trigger AI analysis
Send notifications
9. ESP32 Source Code
#include
#include
const char* ssid = "YOUR_WIFI";
const char* password = "YOUR_PASSWORD";
String webhookURL =
"https://your-n8n-server/webhook/evstation";
int voltagePin = 35;
int currentPin = 34;
void setup()
{
Serial.begin(115200);
WiFi.begin(ssid,password);
while(WiFi.status()!=WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
}
void loop()
{
float voltage =
analogRead(voltagePin)*(3.3/4095.0)*100;
float current =
analogRead(currentPin)*(3.3/4095.0)*30;
float power = voltage*current;
if(WiFi.status()==WL_CONNECTED)
{
HTTPClient http;
http.begin(webhookURL);
http.addHeader("Content-Type",
"application/json");
String payload="{";
payload+="\"voltage\":"+String(voltage)+",";
payload+="\"current\":"+String(current)+",";
payload+="\"power\":"+String(power);
payload+="}";
http.POST(payload);
http.end();
}
delay(15000);
}
10. ThingSpeak Setup
Create Channel
Sign up at ThingSpeak.
Create New Channel.
Add Fields:
Field1 = Voltage
Field2 = Current
Field3 = Power
Field4 = Energy
Save Channel.
Copy Write API Key.
ESP32 Upload URL
https://api.thingspeak.com/update
Example:
field1=230
field2=10
field3=2300
field4=4.5
11. Google Sheets Integration
Create columns:
Timestamp Voltage Current Power Energy Prediction
Example:
2026-05-30 10:15
230
10
2300
4.6
2500
12. Telegram Bot Setup
Create Bot
Open Telegram.
Search for:
Telegram
Open:
BotFather
Send:
/newbot
Enter Bot Name.
Copy Token.
Example:
123456:ABCDEFxxxx
Get Chat ID
Send message to your bot.
Open:
https://api.telegram.org/botTOKEN/getUpdates
Copy Chat ID.
13. n8n Workflow Architecture
Webhook
│
▼
Code Node
│
▼
AI Agent
│
┌─┴────────────┐
▼ ▼
Google Sheet Telegram
Alert
14. n8n Workflow Detailed Steps
Node 1
Webhook Node
POST
/webhook/evstation
Receives:
{
"voltage":230,
"current":10,
"power":2300
}
Node 2
Function Node
const power = $json.power;
let status = "Normal";
if(power > 2500)
{
status = "High Load";
}
return [{
json:{
power:power,
status:status
}
}]
Node 3
Google Sheets Node
Append Row.
Map:
Timestamp
Voltage
Current
Power
Status
Node 4
Telegram Node
Message:
⚡ EV Charging Alert
Power: {{$json.power}}
Status:
{{$json.status}}
15. n8n Workflow JSON
{
"name":"EV Station Workflow",
"nodes":[
{
"name":"Webhook"
},
{
"name":"AI Analysis"
},
{
"name":"Google Sheets"
},
{
"name":"Telegram"
}
]
}
This is a simplified structure. In production, export the workflow directly from n8n after configuration.
16. AI Power Consumption Prediction Logic
Dataset
Stored in Google Sheets:
Date
Time
Power
Energy
Temperature
Prediction Features
Current Power
Historical Power
Time of Day
Charging Duration
Simple Prediction Formula
Moving Average:
Prediction=
5
P
1
+P
2
+P
3
+P
4
+P
5
Example:
2200
2300
2400
2500
2600
Prediction:
2400W
Advanced AI
Use:
Linear Regression
Random Forest
XGBoost
LSTM Neural Networks
via Python or AI APIs connected through n8n.
17. Voice Notification Automation
Trigger Condition
Power > 2500W
n8n Flow
IF Node
│
▼
Generate Speech
│
▼
Telegram Send Voice
Voice Message
Warning.
Electric vehicle charging load
has exceeded the safe limit.
Current load is
2600 watts.
18. AI Agent Responsibilities
The AI agent can:
Monitor
Power
Voltage
Current
Energy
Decide
Overload detection
Peak demand prediction
Charger fault detection
Act
Notify user
Log event
Disable relay if dangerous
19. Automatic Relay Protection
If Power > 3000W
Relay OFF
Send Alert
Store Incident
Pseudo-code:
if(power > 3000)
{
digitalWrite(RELAY,LOW);
}
20. Cloud Dashboard Design
Dashboard Widgets
Gauge 1
Voltage
0–250V
Gauge 2
Current
0–32A
Gauge 3
Power
0–7000W
Chart
Daily Consumption
Chart
Weekly Consumption
21. Database Structure
ChargingLogs
------------
id
timestamp
voltage
current
power
energy
status
prediction
22. Future Enhancements
AI Features
Dynamic charging optimization
Peak tariff avoidance
Smart load balancing
Vehicle identification
Battery health estimation
IoT Features
RFID authentication
QR-code charging access
Solar integration
OCPP protocol support
Multi-station management
Mobile App
Flutter dashboard
Real-time monitoring
Push notifications
Usage analytics
23. Deployment Guide
Local Deployment
ESP32 connected to Wi-Fi
n8n running on PC or Raspberry Pi
Google Sheets cloud logging
ThingSpeak dashboard active
Cloud Deployment
Deploy n8n on:
n8n Cloud
AWS
Google Cloud
Microsoft Azure
24. Expected Output
Voltage : 228V
Current : 11A
Power : 2508W
Energy : 5.2kWh
AI Prediction:
2700W in next 30 minutes
Status:
High Load
Action:
Telegram Voice Alert Sent
Google Sheet Updated
ThingSpeak Updated
25. Project Outcome
This project demonstrates a complete Industry 4.0 and Smart EV Infrastructure solution combining:
ESP32 Edge Computing
IoT Cloud Monitoring
AI Agent Decision-Making
n8n Workflow Automation
Telegram Voice Notifications
Google Sheets Analytics
ThingSpeak Visualization
Predictive Energy Management
The architecture is scalable from a single charging point to a city-wide EV charging network with centralized AI monitoring and automated control.
AI Smart Door Lock System Using Face and Fingerprint Recognition
AI Smart Door Lock System Using Face & Fingerprint Recognition
AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
AI Smart Door Lock System Using Face & Fingerprint Recognition
AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Dashboard
1. Project Overview
Project Title
AI Smart Door Lock System Using Face and Fingerprint Recognition with ESP32, n8n Automation, Telegram Voice Alerts, Google Sheets, and ThingSpeak Cloud Dashboard
Objective
Design and develop an intelligent smart door security system capable of:
Face Recognition Authentication
Fingerprint Authentication
Smart Lock Control
AI-based Access Decision Making
Real-time Cloud Monitoring
Telegram Voice Notifications
Automated Logging
AI Power Consumption Prediction
Agentic IoT Automation using n8n
2. System Architecture
+-------------------+
| Face Recognition |
| ESP32-CAM |
+---------+---------+
|
v
+-------------------+
| Authentication |
| Decision Engine |
+---------+---------+
|
v
+-------------------+
| Fingerprint |
| Sensor R307 |
+---------+---------+
|
v
+-------------------+
| ESP32 Controller |
+---------+---------+
|
+----------------------+
| |
v v
+----------------+ +----------------+
| Door Lock | | Cloud Services |
| Relay + Solenoid| +----------------+
+-------+--------+ |
| |
v v
Door Opens ThingSpeak
Google Sheets
Telegram Bot
n8n AI Agent
3. Features
Security Features
Multi-Factor Authentication
User must pass:
Face Recognition
Fingerprint Verification
before door unlocks.
Intruder Detection
If:
Unknown Face
Invalid Fingerprint
then:
Capture image
Send Telegram Alert
Store evidence in cloud
Voice Alert
Telegram receives:
"Warning! Unauthorized access attempt detected at Main Door."
4. Hardware Components List
Component Quantity
ESP32 Dev Board 1
ESP32-CAM 1
R307 Fingerprint Sensor 1
Relay Module 5V 1
Solenoid Door Lock 1
Buzzer 1
OLED Display (Optional) 1
PIR Motion Sensor 1
12V Adapter 1
LM2596 Buck Converter 1
Jumper Wires As Required
Breadboard/PCB 1
Magnetic Door Sensor 1
5. Circuit Connections
Fingerprint Sensor
R307 ESP32
VCC ---------> 5V
GND ---------> GND
TX ----------> GPIO16
RX ----------> GPIO17
Relay Module
Relay IN -----> GPIO26
Relay VCC ----> 5V
Relay GND ----> GND
Buzzer
Buzzer + ----> GPIO25
Buzzer - ----> GND
PIR Sensor
OUT ----------> GPIO27
VCC ----------> 5V
GND ----------> GND
ESP32-CAM
ESP32-CAM
|
WiFi
|
Cloud
Face recognition runs on ESP32-CAM.
6. Complete Flowchart
START
|
v
Initialize WiFi
|
v
Connect Cloud Services
|
v
Wait for Person
|
v
Capture Face
|
v
Face Match?
|
YES ---------------- NO
| |
v v
Scan Fingerprint Alert Intruder
| |
v |
Fingerprint Match? |
| |
YES ----- NO |
| | |
v v |
Unlock Alert |
Door User |
| | |
v v |
Log Data Log Data |
| | |
+--------+----------+
|
v
ThingSpeak
|
v
Google Sheet
|
v
Telegram
|
v
END
7. ESP32 Source Code Structure
Required Libraries
WiFi.h
HTTPClient.h
ArduinoJson.h
Adafruit_Fingerprint.h
ESP32Servo.h
WiFi Setup
const char* ssid = "YOUR_WIFI";
const char* password = "PASSWORD";
Telegram Configuration
String botToken="BOT_TOKEN";
String chatID="CHAT_ID";
ThingSpeak Configuration
String apiKey="THINGSPEAK_WRITE_KEY";
Door Lock Pin
#define LOCK_PIN 26
Unlock Function
void unlockDoor()
{
digitalWrite(LOCK_PIN,HIGH);
delay(5000);
digitalWrite(LOCK_PIN,LOW);
}
Fingerprint Verification
bool verifyFingerprint()
{
int id = finger.getImage();
if(id == FINGERPRINT_OK)
{
return true;
}
return false;
}
Send Telegram Alert
void sendTelegram(String msg)
{
HTTPClient http;
String url =
"https://api.telegram.org/bot"+
botToken+
"/sendMessage?chat_id="+
chatID+
"&text="+msg;
http.begin(url);
http.GET();
http.end();
}
Update ThingSpeak
void updateThingSpeak(
String status)
{
HTTPClient http;
String url=
"https://api.thingspeak.com/update?api_key="+
apiKey+
"&field1="+status;
http.begin(url);
http.GET();
http.end();
}
8. Face Recognition System
ESP32-CAM Operation
Step 1
Capture image.
Step 2
Run face detection.
Step 3
Compare with enrolled faces.
Step 4
Send result to ESP32.
KNOWN FACE
|
v
ESP32 Unlock Request
UNKNOWN FACE
|
v
Telegram Alert
9. AI Agent Using n8n
Purpose
AI Agent analyzes:
Entry patterns
Intruder attempts
Power consumption
Door usage frequency
n8n Workflow
ESP32 Webhook
|
v
Google Sheets
|
v
OpenAI Node
|
v
Decision Analysis
|
v
Telegram Alert
|
v
ThingSpeak Update
10. n8n Workflow Nodes
Node 1: Webhook
Receives data:
{
"user":"John",
"status":"Authorized",
"time":"2026-05-30 08:20"
}
Node 2: Google Sheets
Store:
Date
Time
User
Status
Node 3: AI Agent
Prompt:
Analyze today's door access records.
Detect suspicious behavior.
Predict energy consumption.
Generate summary.
Node 4: Telegram
Send report.
11. Example n8n Workflow JSON
{
"nodes": [
{
"name": "Webhook",
"type": "n8n-nodes-base.webhook"
},
{
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets"
},
{
"name": "OpenAI",
"type": "@n8n/n8n-nodes-langchain.openAi"
},
{
"name": "Telegram",
"type": "n8n-nodes-base.telegram"
}
]
}
This is a simplified template; in deployment you would configure credentials, mappings, and error handling.
12. Telegram Bot Setup
Step 1
Open Telegram.
Search:
Telegram
Step 2
Search:
BotFather
Step 3
Create Bot
/newbot
Step 4
Copy Bot Token.
Example:
123456:ABCxyz
Step 5
Get Chat ID
https://api.telegram.org/botTOKEN/getUpdates
13. Voice Notification Automation
Event Trigger
Unauthorized Access
↓
n8n
↓
Text-to-Speech
↓
Telegram Voice Message
Voice Message Script
Alert!
Unknown person detected at the main entrance.
Please check immediately.
n8n Flow
Webhook
|
v
AI Agent
|
v
Google TTS
|
v
Telegram Voice
14. Google Sheets Integration
Columns:
Timestamp User Face Status Fingerprint Result
08:30 John Match Match Granted
ESP32 sends:
{
"user":"John",
"face":"match",
"finger":"match",
"access":"granted"
}
to n8n webhook.
n8n appends row automatically.
15. ThingSpeak Dashboard Setup
Create Channel
In ThingSpeak
Create fields:
Field1 = Door Status
Field2 = Authorized Access
Field3 = Unauthorized Access
Field4 = Power Consumption
Field5 = AI Risk Score
Dashboard Widgets
Gauge
Door Status
Line Chart
Power Usage
Counter
Access Count
Trend Graph
Unauthorized Attempts
16. AI Power Consumption Prediction
Data Inputs
Lock Activations
Camera Usage Time
WiFi Uptime
Fingerprint Scans
Formula
E=P×t
Where:
E = Energy (Wh)
P = Power (W)
t = Time (hours)
Sample Dataset
Day Power
1 5.2W
2 5.4W
3 5.8W
4 6.0W
AI predicts future usage and detects abnormal spikes.
17. AI Risk Scoring Logic
Known Face = 40 points
Known Fingerprint = 40 points
Normal Time Access = 20 points
Total:
100 = Safe
Risk Levels
Score Status
80-100 Safe
50-79 Warning
0-49 Threat
18. Database Design
Access Log Table
Field
ID
Timestamp
Face_ID
Finger_ID
Status
Power
RiskScore
19. Deployment Procedure
Phase 1
Hardware Assembly
Phase 2
Upload ESP32 Firmware
Phase 3
Enroll Faces
Phase 4
Enroll Fingerprints
Phase 5
Configure Wi-Fi
Phase 6
Create Telegram Bot
Phase 7
Deploy n8n Workflow
Phase 8
Connect Google Sheets
Phase 9
Connect ThingSpeak
Phase 10
Field Testing
20. Testing Scenarios
Test 1
Known Face + Known Fingerprint
Expected:
Door Opens
Telegram Log
Cloud Update
Test 2
Known Face + Wrong Fingerprint
Expected:
Access Denied
Alert Sent
Test 3
Unknown Face
Expected:
Buzzer ON
Image Capture
Telegram Voice Alert
21. Future Enhancements
Face recognition using Edge AI models (TensorFlow Lite Micro)
Liveness detection against photo spoofing
Visitor QR-code access
Mobile app control
Cloud-based user management
Voice assistant integration
Battery backup and solar charging
Multi-door enterprise deployment
Predictive maintenance analytics
AI anomaly detection using historical access logs
22. Expected Outcome
The final system provides:
✅ Face Recognition Security
✅ Fingerprint Authentication
✅ Smart Door Unlocking
✅ ESP32-Based IoT Control
✅ n8n Agentic Automation
✅ Telegram Text & Voice Alerts
✅ Google Sheets Logging
✅ ThingSpeak Dashboard Monitoring
✅ AI Risk Assessment
✅ Power Consumption Prediction
✅ Cloud-Based Smart Access Management
This architecture is suitable for academic projects, smart homes, offices, laboratories, hostels, and industrial access-control systems, while remaining low-cost and scalable.
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.
Subscribe to:
Posts (Atom)
AI Smart Solar Panel Tracking System with Weather Optimization
AI Smart Solar Panel Tracking System with Weather Optimization ESP32 + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + T...
-
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...











