Tuesday, 26 May 2026

AI Smart Energy Meter with Power Consumption Prediction

AI Smart Energy Meter with Power Consumption Prediction ESP32 + Agentic AI IoT + n8n Automation + Telegram Voice Alerts + Google Sheets + ThingSpeak
1. Project Overview The AI Smart Energy Meter is an advanced IoT-based electricity monitoring system that measures real-time power consumption using an ESP32 microcontroller and uploads the data to cloud platforms for monitoring, analytics, and AI-based prediction. The system integrates: ESP32 Wi-Fi microcontroller Current & voltage sensing Cloud IoT dashboard AI power usage prediction n8n workflow automation Telegram voice alert notifications Google Sheets logging ThingSpeak cloud analytics This project demonstrates a complete Agentic AI IoT architecture, where the system can: Monitor electricity usage Predict future consumption Detect overload conditions Send smart alerts automatically Store historical data Trigger automation workflows 2. Objectives The main objectives are: Measure voltage, current, power, and energy consumption Upload live data to cloud platforms Predict future energy usage using AI logic Send Telegram notifications and voice alerts Store records in Google Sheets Automate workflows using n8n Create a scalable smart energy monitoring solution 3. Features Real-Time Monitoring Voltage monitoring Current monitoring Power calculation Energy consumption tracking IoT Cloud Dashboard Live cloud updates Graphical visualization Remote monitoring AI Prediction Predict next-hour/day consumption Detect abnormal energy usage Intelligent recommendations Telegram Alerts Instant notifications Voice warning messages Overload alerts Device status alerts Google Sheets Logging Automatic data storage Historical analytics Exportable records n8n Automation Workflow automation Event-based triggers Smart decision engine 4. Hardware Components Component Quantity ESP32 Dev Board 1 ACS712 Current Sensor 1 ZMPT101B Voltage Sensor 1 OLED Display (Optional) 1 Relay Module 1 Breadboard 1 Jumper Wires Several Power Supply 5V Wi-Fi Router 1 5. Software Requirements Software Purpose Arduino IDE ESP32 Programming n8n Workflow Automation Telegram Bot API Alerts ThingSpeak Cloud Dashboard Google Sheets API Data Logging Python/AI Logic Prediction Model 6. System Architecture Voltage/Current Sensors ↓ ESP32 ↓ Wi-Fi Internet ↓ ThingSpeak ↓ n8n ↙ ↓ ↘ Telegram AI Google Sheets Alerts Prediction Storage 7. Working Principle Step 1: Sensor Reading The ESP32 reads: Voltage from ZMPT101B Current from ACS712 Step 2: Power Calculation P=V×I Where: P = Power (Watts) V = Voltage I = Current Step 3: Energy Consumption E=P×t Where: E = Energy (Wh) t = Time Step 4: Upload to Cloud ESP32 sends data to: ThingSpeak n8n Webhook Step 5: AI Analysis n8n processes: Average usage Peak load Future prediction Abnormal pattern detection Step 6: Alerts If consumption exceeds threshold: Telegram message sent Voice alert generated Google Sheets updated 8. Circuit Connections ACS712 to ESP32 ACS712 ESP32 VCC 5V GND GND OUT GPIO34 ZMPT101B to ESP32 ZMPT101B ESP32 VCC 5V GND GND OUT GPIO35 Relay Module Relay ESP32 IN GPIO26 VCC 5V GND GND 9. Schematic Diagram (Text Format) AC Load | Current Sensor | Voltage Sensor | ESP32 / | \ WiFi Relay OLED | Internet | ThingSpeak | n8n / | \ Telegram AI GoogleSheet 10. ESP32 Arduino Code #include #include const char* ssid = "YOUR_WIFI"; const char* password = "YOUR_PASSWORD"; String apiKey = "THINGSPEAK_API_KEY"; float voltage = 230.0; float current = 0.5; float power; void setup() { Serial.begin(115200); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting..."); } Serial.println("WiFi Connected"); } void loop() { current = analogRead(34) * (5.0 / 4095.0); power = voltage * current; if(WiFi.status()== WL_CONNECTED){ HTTPClient http; String url = "http://api.thingspeak.com/update?api_key=" + apiKey + "&field1=" + String(voltage) + "&field2=" + String(current) + "&field3=" + String(power); http.begin(url); int httpCode = http.GET(); Serial.println(httpCode); http.end(); } Serial.print("Voltage: "); Serial.println(voltage); Serial.print("Current: "); Serial.println(current); Serial.print("Power: "); Serial.println(power); delay(15000); } 11. n8n Workflow Workflow Logic Webhook Trigger ↓ Receive ESP32 Data ↓ Check Power Threshold ↓ IF High Usage? ↙ ↘ YES NO ↓ ↓ Telegram Store Data Voice Alert Google Sheets 12. Telegram Bot Setup Steps Open Telegram Search BotFather Create bot using: /newbot Copy Bot Token Use token in n8n Telegram node 13. Voice Alert Message Example: ⚠ Warning! High electricity consumption detected. Current power usage is 1200 Watts. Please check connected appliances. 14. ThingSpeak Dashboard Fields Field Data Field 1 Voltage Field 2 Current Field 3 Power Graphs: Real-time power graph Daily consumption Peak usage trends 15. Google Sheets Integration Data stored automatically: Time Voltage Current Power 10:00 230 0.5 115 10:05 231 0.7 161 16. AI Prediction Module Prediction uses: Historical averages Peak-hour analysis Trend calculation Simple prediction formula: Prediction= 2 Previous Usage+Current Usage ​ Advanced versions can use: Linear Regression TensorFlow Lite TinyML on ESP32 17. Automation Scenarios Scenario 1 High power usage: Send Telegram alert Activate relay cutoff Scenario 2 Low power factor: Notify maintenance team Scenario 3 Abnormal spike: Store emergency event 18. Advantages Low-cost smart meter Remote monitoring Cloud-based analytics AI-enabled predictions Automation-ready Energy-saving system 19. Applications Smart homes Industries Energy management Hostels Offices Solar monitoring systems 20. Future Enhancements Mobile app MQTT communication Firebase integration Voice assistant support TinyML forecasting Solar energy optimization Multi-room monitoring 21. Conclusion This project demonstrates a modern AI-powered Agentic IoT energy monitoring system using ESP32, cloud computing, AI prediction, and workflow automation. By integrating: ESP32 n8n Telegram alerts Google Sheets ThingSpeak AI analytics the system becomes a scalable smart energy solution suitable for future smart cities and Industry 4.0 applications.

No comments:

Post a Comment

AI Smart Health Monitoring System with Disease Prediction

AI Smart Health Monitoring System with Disease Prediction AI-Powered ESP32 + Agentic IoT + n8n Automation + Telegram Voice Alerts + Google S...