Sunday, 31 May 2026

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.

AI Smart Solar Panel Tracking System with Weather Optimization_agent

AI Smart Solar Panel Tracking System with Weather Optimization Agent AI-Powered ESP32 Agentic IoT Solar Tracker using n8n Automation, Telegram Voice Alerts, Google Sheets & ThingSpeak Cloud Dashboard
AI Smart Solar Panel Tracking System with Weather Optimization Agent AI-Powered ESP32 Agentic IoT Solar Tracker using n8n Automation, Telegram Voice Alerts, Google Sheets & ThingSpeak Cloud Dashboard 1. Project Overview This project automatically tracks the sun using a dual-axis solar panel tracker and uses AI-based weather optimization to maximize solar energy generation. The system uses: ESP32 WiFi Controller LDR Sensors for Sun Tracking Servo Motors for Panel Movement Weather Data Monitoring AI Agent Logic n8n Workflow Automation Telegram Voice Alerts Google Sheets Data Logging ThingSpeak Cloud Dashboard IoT Web Monitoring Page The AI Agent analyzes: Solar intensity Weather conditions Cloud coverage Battery status Power generation trends and automatically optimizes panel positioning. 2. Objectives Main Goals ✅ Maximize solar energy generation ✅ Reduce energy losses during cloudy conditions ✅ Real-time remote monitoring ✅ AI-based power prediction ✅ Telegram Voice Alerts ✅ Cloud Dashboard ✅ Automated Data Logging 3. System Architecture Sunlight ↓ LDR Sensors ↓ ESP32 ↓ Servo Motors ↓ Solar Panel Positioning ↓ Power Generation Data ↓ ThingSpeak Cloud ↓ n8n Workflow ↓ AI Agent Analysis ↓ Google Sheets Storage ↓ Telegram Alerts ↓ Voice Notification 4. Components Required Component Quantity ESP32 Dev Board 1 Solar Panel 6V 1 LDR Sensor 4 10K Resistors 4 SG90 Servo Motor 2 INA219 Current Sensor 1 DHT11 Sensor 1 16x2 LCD I2C 1 Breadboard 1 Jumper Wires Many Li-ion Battery 1 TP4056 Charger Module 1 Voltage Sensor Module 1 5. Working Principle Sun Tracking 4 LDRs are placed: LDR1 LDR2 LDR3 LDR4 ESP32 continuously compares sensor values. Example: LDR1 = 800 LDR2 = 600 Difference = 200 Panel rotates toward higher light intensity. Weather Optimization ESP32 collects: Temperature Humidity Solar Intensity AI Agent predicts: Sunny Partly Cloudy Cloudy Rainy and adjusts tracking strategy. 6. Circuit Connections LDR Connections LDR ESP32 Pin LDR1 GPIO34 LDR2 GPIO35 LDR3 GPIO32 LDR4 GPIO33 DHT11 DHT11 ESP32 DATA GPIO4 VCC 3.3V GND GND Servo Motors Horizontal Servo Signal → GPIO18 Vertical Servo Signal → GPIO19 INA219 INA219 ESP32 SDA GPIO21 SCL GPIO22 LCD LCD ESP32 SDA GPIO21 SCL GPIO22 7. Flowchart START ↓ Read LDR Values ↓ Compare Light Levels ↓ Move Servos ↓ Read DHT11 ↓ Read INA219 ↓ Calculate Power ↓ Upload to ThingSpeak ↓ Trigger n8n ↓ AI Analysis ↓ Store in Google Sheets ↓ Send Telegram Alert ↓ Repeat 8. ESP32 Source Code Required Libraries WiFi.h HTTPClient.h Servo.h DHT.h Wire.h Adafruit_INA219.h ThingSpeak.h WiFi Credentials const char* ssid="YOUR_WIFI"; const char* password="YOUR_PASSWORD"; ThingSpeak Setup unsigned long channelID = YOUR_CHANNEL_ID; const char* writeAPIKey = "YOUR_API_KEY"; Data Upload ThingSpeak.setField(1, temperature); ThingSpeak.setField(2, humidity); ThingSpeak.setField(3, voltage); ThingSpeak.setField(4, current); ThingSpeak.setField(5, power); ThingSpeak.writeFields(channelID, writeAPIKey); 9. ThingSpeak Dashboard Setup Create Account Go to: ThingSpeak Create Channel Fields: Temperature Humidity Voltage Current Power Solar Intensity Tracker Angle Dashboard Widgets Create: Gauge Line Chart Power Trend Graph Weather Prediction Graph 10. Google Sheets Integration Create Sheet: Date Time Temperature Humidity Voltage Current Power Weather Prediction Example: 31-05-2026 12:30 PM 34°C 58% 6.4V 0.95A 6.08W Sunny High Output 11. Telegram Bot Setup Create Bot Open: BotFather on Telegram Commands: /newbot Save: BOT TOKEN Get Chat ID Open: https://api.telegram.org/botTOKEN/getUpdates Copy Chat ID. 12. n8n Workflow Setup Install: n8n Official Website Workflow ThingSpeak Webhook ↓ Data Processing ↓ AI Agent ↓ Weather Prediction ↓ Google Sheets ↓ Telegram Message ↓ Telegram Voice Alert 13. AI Agent Logic Inputs: Temperature Humidity Solar Intensity Voltage Current Example Rules IF Solar > 800 AND Humidity < 60 Prediction: Sunny High Power Generation IF Solar < 300 AND Humidity > 80 Prediction: Cloudy/Rain Low Generation AI Output { "weather":"Sunny", "expected_power":"6.5W", "tracking_mode":"Normal", "confidence":"92%" } 14. Power Consumption Prediction Formula: P=V×I Example: Voltage = 6V Current = 1A Power = 6 Watts Daily Energy: E=P×t Example: 6W × 8 Hours = 48 Wh/day 15. Voice Notification Automation n8n converts AI response into voice. Example Alert: Attention. Solar tracker operating normally. Current Power Output: 6.2 Watts. Weather Prediction: Sunny. Battery Status: Charging Successfully. Telegram sends: 🎤 Voice Message 📱 Text Alert 16. Telegram Notifications Examples: High Generation ☀️ Solar Output High Power: 6.8W Weather: Sunny Efficiency: 95% Cloud Warning ☁️ Weather Alert Cloud Cover Detected Expected Power Drop: 35% Servo Failure Alert ⚠️ Tracker Motor Error Panel Movement Not Detected 17. IoT Web Dashboard Dashboard Cards: Live Values Temperature Humidity Voltage Current Power AI Section Weather Prediction Efficiency Score Energy Forecast Tracking Section Horizontal Angle Vertical Angle Sun Position Analytics Daily Energy Weekly Energy Monthly Energy 18. Future Enhancements AI Improvements Machine Learning Forecasting OpenWeatherMap API Integration Cloud Cover Detection Seasonal Learning Hardware Upgrades MPPT Solar Controller ESP32-CAM Cloud Detection GPS-based Sun Position Tracking Battery Health Monitoring Industry Features Remote Firmware Updates MQTT Cloud Integration AWS IoT Core Azure IoT Hub Predictive Maintenance 19. Expected Output Real-Time Monitoring ✔ Solar Tracking ✔ Weather Prediction ✔ Telegram Voice Alerts ✔ Google Sheets Logging ✔ ThingSpeak Dashboard ✔ AI Decision Making ✔ Power Forecasting ✔ Cloud Monitoring 20. Project Outcome This project combines Solar Energy + ESP32 + IoT + AI Agent + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak Cloud Analytics into a complete smart renewable-energy platform. It demonstrates real-world concepts such as intelligent solar tracking, cloud-based monitoring, predictive analytics, automation workflows, and AI-driven decision making suitable for engineering final-year projects, IoT research, smart energy systems, and renewable energy applications.

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.