Saturday, 10 October 2026

AI Renewable Hybrid Power Generation Monitoring System

AI Renewable Hybrid Power Generation Monitoring System

Full project report, hardware schematic, ESP32 firmware, n8n workflows, AI agent, IoT webpage, Telegram voice alerts, Google Sheets and ThingSpeak

This project is designed as a complete renewable-energy IoT monitoring and automation system using an ESP32 microcontroller, solar PV panel, wind turbine, electrical sensors, n8n automation, an AI agent, Telegram notifications, Google Sheets and ThingSpeak.

The goal is to monitor power generation, display live readings on a webpage, store historical measurements, detect abnormal operating conditions, and automatically send intelligent text and voice notifications to the operator.

The following documentation is structured as an engineering project report and implementation guide. It includes the system architecture, component list, electrical wiring, firmware, cloud configuration, workflow diagrams, AI prompt, dashboard design, testing, and safety requirements.

Fundamental Design of Small Scale Solar Wind Hybrid System
Problem esp32 "INA219 not connected" - Page 2 - Sensors - Arduino Forum
IIoT Solutions in Renewable Energy: 5 Ways to Sustainability

1. Project overview

Renewable energy generation

Solar PV and wind generation measurements, with optional battery and load monitoring.

ESP32 intelligent edge device

Sensor acquisition, power calculations, telemetry validation, Wi-Fi communication and fault reporting.

n8n automation and AI

Data routing, alert rules, AI-generated diagnostics, logging and notification workflows.

IoT cloud and notifications

Custom webpage, ThingSpeak charts, Google Sheets history, Telegram text and voice alerts.

1.1 Abstract

The AI Renewable Hybrid Power Generation Monitoring System is an IoT-based platform for observing the electrical performance of a hybrid renewable-energy installation. Solar panels and a wind turbine produce electrical energy, while suitable sensors measure voltage and current at selected electrical points. An ESP32 collects the measurements, computes instantaneous power, adds device information, and transmits the data to a cloud-connected automation system.

The n8n workflow validates the incoming telemetry, stores measurements in Google Sheets, updates ThingSpeak, and evaluates configurable alarm conditions. An AI agent analyzes validated readings and recent history to produce explanations and recommended diagnostic actions. Telegram delivers immediate text notifications and, when configured with a text-to-speech service, audio or voice-message alerts. A web dashboard displays the latest readings, generation trends, device connectivity, and event history.

The design combines conventional rule-based automation with AI-assisted interpretation. The AI agent supports diagnosis but does not replace electrical protection, battery-management systems, charge controllers, or deterministic safety controls.

1.2 Objectives

  • Monitor solar and wind generation separately.

  • Calculate voltage, current, instantaneous power and accumulated energy.

  • Monitor battery voltage, battery current, load power and state of charge when suitable sensors are installed.

  • Display readings on an IoT webpage.

  • Store historical data in Google Sheets and ThingSpeak.

  • Detect abnormal readings, low generation, low battery voltage and communication failures.

  • Use an AI agent to explain possible causes and recommend safe checks.

  • Send Telegram text alerts and generated audio notifications.

  • Provide a scalable foundation for maintenance analytics and intelligent energy management.

1.3 Applications

  • Solar-wind hybrid systems.

  • Renewable-energy laboratory projects.

  • Educational microgrid demonstrations.

  • Remote monitoring of small off-grid systems.

  • Energy-generation performance studies.

  • Battery and load monitoring prototypes.

2. System block diagram

Renewable power sources

Solar PV + wind turbine

Electrical power stage

Charge controllers, rectification where required, battery, load and protection

Voltage and current sensors

Independent measurements for solar, wind, battery and load branches as required

ESP32 controller

Read → validate → calculate → timestamp → transmit JSON over Wi-Fi

n8n cloud automation

Webhook → validation → rules → storage → AI agent → notification

ThingSpeak

Time-series visualization

Google Sheets

Telemetry and event history

IoT webpage

Live status and charts

Telegram

Text and voice alerts

2.1 Working principle

  1. Solar panels generate electricity from sunlight.

  2. A wind turbine generates electricity when wind conditions permit.

  3. Appropriate controllers regulate the energy supplied to the battery and load.

  4. Electrical sensors measure voltage and current at defined measurement points.

  5. The ESP32 calculates power and sends validated readings to an n8n webhook.

  6. n8n stores readings in Google Sheets and sends channel updates to ThingSpeak.

  7. Rule-based logic detects conditions requiring attention.

  8. The AI agent analyzes the event and produces a short diagnostic summary.

  9. Telegram sends the text alert and, optionally, a generated audio notification.

  10. The webpage displays the latest validated telemetry and historical trends.

The reference implementation below uses a webhook-first architecture: the ESP32 sends data to n8n, which routes the data to cloud storage, charts, and notification services.

3. Hardware requirements and bill of materials

The following components are suitable for a low-voltage educational prototype. Select actual ratings after deciding the solar panel, wind generator, battery and load.

GitHub - TronixLab/DOIT_ESP32_DevKit-v1_30P · GitHub

1. ESP32 DevKit V1

Main controller with Wi-Fi and I²C. Quantity: 1.

Adafruit INA219 High Side DC Spannungs Sensor Breakout, 26V ±3.2A Max

2. INA219 voltage/current sensor

Measures DC bus voltage, current and power. Quantity: 2 for independent solar and wind measurements, subject to sensor ratings.

5V 160mA solar panel (90 x 70mm) – SMARTQAT

3. Solar panel

Primary renewable source. Select voltage and power appropriate to the project.

2026 Dc Mini Wind Generator Wind Turbine 12cm Wind Turbine Led Diy Teaching Model Kit | Fruugo UK

4. Wind turbine and wind controller

Optional second source. Depending on the turbine, a rectifier, diversion controller and overspeed protection may be necessary.

How to Charge a Battery from Solar Panels    – Jackery United Kingdom

5. Battery and protection equipment

Compatible battery, charge controller, DC disconnects, fuses and correctly rated DC converters.

Other required items:

  • USB power supply and USB cable for ESP32.

  • Breadboard or screw terminals, jumper wires and suitable electrical connectors.

  • Optional battery monitor, load-current sensor and temperature sensor.

  • Computer with Arduino IDE and internet access.

  • n8n instance, Telegram bot, Google account and ThingSpeak account.

  • AI API access and a text-to-speech service for voice alerts.

3.1 Measurement-point selection

Parameter

Sensor location

Solar voltage and current

Solar output, at a defined DC measurement point

Wind voltage and current

Suitable DC output of the wind controller

Battery voltage and current

Battery monitor or battery-side measurement point

Load power

Load branch, if load monitoring is required

Battery temperature

Appropriate battery or enclosure sensor

A sensor reading is only meaningful when its electrical location is known. Solar power and wind power can be added to estimate total generation when the readings represent separate generation branches. Do not add battery charging power to those generation readings if it would count the same energy twice.

4. Electrical schematic and ESP32 pin connections

The diagram below shows the functional connection arrangement, rather than a construction-ready power circuit.

Solar panel

Protection → compatible solar charge controller

Solar measurement

INA219 #1 → solar DC voltage and current

Protected DC bus and battery

Battery-compatible charging system and protected load connection

Wind turbine branch

Wind-rated controller/rectifier as required → INA219 #2 at an appropriate DC point

ESP32 low-voltage I²C circuit

GPIO 21

SDA

GPIO 22

SCL

Connect both INA219 modules to the shared I²C bus with distinct addresses. Connect logic ground and a compatible sensor supply.

4.1 Wiring table

ESP32

INA219

3V3

VCC, if supported by the breakout

GND

GND

GPIO 21

SDA

GPIO 22

SCL

Configure the two INA219 modules at distinct I²C addresses, for example 0x40 and 0x41, using the address jumpers or pads provided by the particular boards.

Electrical safety: Do not connect solar panels, wind turbines, batteries, inverter outputs or mains voltage directly to ESP32 GPIO pins. Verify the sensor's common-mode voltage, current rating, shunt rating and board layout. Use correctly rated protection and isolation equipment. An INA219 breakout is not a general-purpose mains meter.

5. Software requirements and official resources

Software

Purpose

Arduino IDE and ESP32 Arduino core

Firmware development

Adafruit INA219 library

Electrical measurements

ArduinoJson

JSON serialization

n8n

Workflow automation

ThingSpeak

Time-series telemetry

Google Sheets

Historical data and event logs

Telegram Bot API

Text and audio notifications

AI model/API

Contextual diagnostics

Text-to-speech service

Speech generation

HTML, CSS and JavaScript

Custom dashboard

Official references:

6. Step-by-step implementation

Step 1 — Assemble and test the hardware

  1. Install the ESP32 board package in Arduino IDE.

  2. Install the Adafruit INA219 and ArduinoJson libraries.

  3. Wire the I²C bus using GPIO 21 for SDA and GPIO 22 for SCL.

  4. Configure the two sensor addresses.

  5. Power the ESP32 over USB.

  6. Test the sensors with a safe, low-voltage DC source.

  7. Compare sensor measurements with a suitable reference meter.

Step 2 — Configure ThingSpeak

  1. Create a ThingSpeak account.

  2. Create a channel named Hybrid Renewable Energy Monitor.

  3. Configure the following fields.

Field

Name

Unit

1

Solar voltage

V

2

Solar current

A

3

Solar power

W

4

Wind power

W

5

Battery voltage

V

6

Load power

W

7

Total generation

W

8

Battery state of charge

%

  1. Save the channel ID and write API key securely.

  2. Use the channel's charts to inspect historical readings.

This is an example channel schema. If battery or load sensors are not installed, leave those values unavailable instead of generating fictional measurements. Check the current account's update restrictions before choosing the telemetry interval.

Step 3 — Create Google Sheets

Create a spreadsheet named Renewable_Energy_Monitor.

Use a Telemetry worksheet with these column headings:

text
timestamp,device_id,solar_voltage_v,solar_current_a,
solar_power_w,wind_voltage_v,wind_current_a,wind_power_w,
battery_voltage_v,load_power_w,total_generation_w,alert_level

Create a second worksheet called Events:

text
timestamp,event_type,severity,measurements,
ai_summary,recommended_action,notification_status

Connect Google Sheets to n8n through its supported authentication mechanism. Use an append-row operation for each validated telemetry record and another append operation for alert events.

Step 4 — Create the Telegram bot

  1. Open Telegram and find the verified @BotFather account.

  2. Send /newbot and follow its instructions.

  3. Store the bot token in secure n8n credentials.

  4. Open the new bot and send it a message.

  5. Retrieve the chat ID using a Telegram update or n8n operation.

  6. Configure Telegram credentials in n8n.

  7. Test a simple text message.

Never publish your bot token or include it in a public GitHub repository.

Step 5 — Set up n8n

Deploy n8n on a supported hosted service or your own server. If the ESP32 must reach the service over the internet, configure a publicly accessible HTTPS webhook with authentication.

Create the following workflows:

  • Workflow A: Telemetry ingestion and validation.

  • Workflow B: Threshold checks and AI diagnostics.

  • Workflow C: Telegram text and voice notifications.

  • Workflow D: Scheduled summaries and maintenance reports.

A small prototype can combine these functions in a single workflow. Separating them makes maintenance and error handling easier as the system grows.

7. ESP32 firmware — sensor monitoring and n8n webhook

This firmware reads solar and wind measurements from two INA219 sensors, calculates power, and sends JSON telemetry to n8n every 30 seconds.

7.1 Arduino code

Before uploading, replace the Wi-Fi credentials and webhook URL. Install the Adafruit INA219 and ArduinoJson libraries from the Arduino IDE Library Manager.

cpp

#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <HTTPClient.h>
#include <Wire.h>
#include <Adafruit_INA219.h>
#include <ArduinoJson.h>
#include <math.h>

// ---------- CONFIGURATION ----------
const char* WIFI_SSID = "YOUR_WIFI_NAME";
const char* WIFI_PASSWORD = "YOUR_WIFI_PASSWORD";

const char* WEBHOOK_URL =
  "https://YOUR_N8N_DOMAIN/webhook/renewable-telemetry";

const char* DEVICE_ID = "HYBRID-ESP32-01";

Adafruit_INA219 solarSensor(0x40);
Adafruit_INA219 windSensor(0x41);

const unsigned long SEND_INTERVAL_MS = 30000;
unsigned long lastSend = 0;

// -----------------------------------

bool connectWiFi() {
  if (WiFi.status() == WL_CONNECTED) return true;

  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

  unsigned long start = millis();

  while (WiFi.status() != WL_CONNECTED &&
         millis() - start < 20000) {
    delay(500);
    Serial.print(".");
  }

  Serial.println();

  if (WiFi.status() == WL_CONNECTED) {
    Serial.println("Wi-Fi connected");
    return true;
  }

  Serial.println("Wi-Fi connection failed");
  return false;
}

bool sendTelemetry(float solarV, float solarA,
                   float solarW, float windV,
                   float windA, float windW) {
  if (!connectWiFi()) return false;

  WiFiClientSecure client;

  // DEVELOPMENT ONLY: skips certificate verification.
  // Replace with CA certificate verification for deployment.
  client.setInsecure();

  HTTPClient http;
  http.setConnectTimeout(5000);
  http.setTimeout(8000);

  if (!http.begin(client, WEBHOOK_URL)) {
    Serial.println("HTTPS initialization failed");
    return false;
  }

  http.addHeader("Content-Type", "application/json");

  JsonDocument doc;
  doc["device_id"] = DEVICE_ID;
  doc["uptime_ms"] = millis();
  doc["solar_voltage_v"] = solarV;
  doc["solar_current_a"] = solarA;
  doc["solar_power_w"] = solarW;
  doc["wind_voltage_v"] = windV;
  doc["wind_current_a"] = windA;
  doc["wind_power_w"] = windW;
  doc["total_generation_w"] = solarW + windW;

  String payload;
  serializeJson(doc, payload);

  int status = http.POST(payload);

  Serial.printf("HTTP status: %d\n", status);

  if (status > 0) {
    Serial.println(http.getString());
  }

  http.end();

  return status >= 200 && status < 300;
}

void setup() {
  Serial.begin(115200);
  Wire.begin(21, 22);

  if (!solarSensor.begin()) {
    Serial.println("Solar INA219 not detected");
    while (true) delay(1000);
  }

  if (!windSensor.begin()) {
    Serial.println("Wind INA219 not detected");
    while (true) delay(1000);
  }

  connectWiFi();
  Serial.println("Hybrid monitor initialized");
}

void loop() {
  if (millis() - lastSend < SEND_INTERVAL_MS) {
    delay(20);
    return;
  }

  lastSend = millis();

  float solarV = solarSensor.getBusVoltage_V();
  float solarA = solarSensor.getCurrent_mA() / 1000.0f;
  float solarW = solarV * solarA;

  float windV = windSensor.getBusVoltage_V();
  float windA = windSensor.getCurrent_mA() / 1000.0f;
  float windW = windV * windA;

  bool valid =
    isfinite(solarV) && isfinite(solarA) &&
    isfinite(windV) && isfinite(windA) &&
    solarV >= 0 && windV >= 0;

  if (!valid) {
    Serial.println("Invalid reading; transmission skipped");
    return;
  }

  Serial.printf("Solar: %.2f V, %.3f A, %.2f W\n",
                solarV, solarA, solarW);
  Serial.printf("Wind: %.2f V, %.3f A, %.2f W\n",
                windV, windA, windW);

  bool ok = sendTelemetry(
    solarV, solarA, solarW,
    windV, windA, windW
  );

  if (!ok) {
    Serial.println("Telemetry failed");
  }
}

7.2 Expected JSON output

json
{
  "device_id": "HYBRID-ESP32-01",
  "uptime_ms": 120000,
  "solar_voltage_v": 18.0,
  "solar_current_a": 2.0,
  "solar_power_w": 36.0,
  "wind_voltage_v": 12.0,
  "wind_current_a": 1.0,
  "wind_power_w": 12.0,
  "total_generation_w": 48.0
}

These values are sample data, not actual measurements.

7.3 Important firmware limitations

  • The example uses setInsecure() only to simplify initial testing. Production firmware must validate the server certificate.

  • The example does not implement device authentication. Add a secret header or another suitable authentication mechanism.

  • The INA219 calibration must match the actual module and shunt.

  • The example calculates power using bus voltage multiplied by current. Validate current direction and the selected measurement point before relying on the result.

  • Battery state of charge and load power are not measured by this firmware.

  • The example stops if a sensor is missing. A production implementation should report sensor faults and recover without treating stale readings as current data.

8. n8n automation workflow — complete node design

mermaid

flowchart TD
    A["ESP32 HTTPS POST"] --> B["Webhook"]
    B --> C["Validate device and JSON"]
    C --> D{"Valid payload?"}
    D -->|No| E["Reject request / log error"]
    D -->|Yes| F["Normalize measurements"]
    F --> G["Google Sheets: append telemetry"]
    F --> H["HTTP Request: ThingSpeak"]
    F --> I["IF: threshold evaluation"]
    I -->|Normal| J["Return success"]
    I -->|Warning or fault| K["Build alert context"]
    K --> L["AI Agent"]
    L --> M["Telegram Send Message"]
    L --> N["Text-to-speech API"]
    N --> O["Telegram Send Audio"]
    M --> P["Google Sheets: append event"]
    O --> P

Node 1 — Webhook

Configure:

  • HTTP method: POST

  • Path: renewable-telemetry

  • Authentication: use the supported authentication options for your n8n deployment.

  • Response: return a success response after the request has been accepted and validated.

During testing, inspect the actual webhook output. Depending on the node settings, incoming data may be nested under body.

Node 2 — Edit Fields

Map these normalized values from the received JSON:

  • device_id

  • solar_voltage_v

  • solar_current_a

  • solar_power_w

  • wind_voltage_v

  • wind_current_a

  • wind_power_w

  • total_generation_w

Validate that all required fields are present, numeric and within the permitted ranges of the hardware. Reject malformed requests rather than forwarding them to the AI agent.

Node 3 — Google Sheets

  • Select the Renewable_Energy_Monitor spreadsheet.

  • Choose the Telemetry worksheet.

  • Select the append-row operation.

  • Map the device ID, timestamp, voltage, current, power and alert level to the matching columns.

Use a consistent timestamp format, preferably ISO 8601 with an explicit timezone.

Node 4 — HTTP Request for ThingSpeak

Configure the request:

  • Method: POST

  • URL: https://api.thingspeak.com/update

  • Body type: form URL encoded.

Map the parameters as follows:

Parameter

Value

api_key

ThingSpeak write API key

field1

Solar voltage

field2

Solar current

field3

Solar power

field4

Wind power

field7

Total generation

Add the remaining fields when their sensors are available. Check the response from ThingSpeak and log unsuccessful writes. Follow the update interval and account restrictions for your channel.

Node 5 — IF: threshold evaluation

Start with configurable rules:

  • Battery voltage is below a battery-specific warning limit.

  • Generation remains below the expected level for a sustained period.

  • The sensor reading is outside its permitted operating range.

  • Telemetry is missing beyond the expected interval.

  • Measured load demand exceeds available generation for a defined duration, if load monitoring is installed.

Use hysteresis, persistence and cooldown timers to prevent repeated alerts during normal fluctuations.

Node 6 — AI Agent

Pass the validated measurements and event context to the AI agent. The agent should return a concise summary, possible causes, recommended action and severity. Keep all alert-triggering and protection decisions in the deterministic rule engine.

Node 7 — Telegram notifications

Use the Telegram node to send the AI summary together with the original measured values. If the AI provider fails, send the rule-engine warning anyway.

9. AI agent prompt

The following prompt can be used in an n8n AI Agent or an equivalent model node.

text

You are an AI assistant for a renewable hybrid power monitoring system.

Analyze validated solar, wind, battery and load measurements
provided in the current event.

Return:
1. A concise system-status summary.
2. The exact threshold violation detected by the rule engine.
3. Possible causes, clearly identified as hypotheses.
4. Safe diagnostic actions.
5. Severity: INFO, WARNING, or CRITICAL.

Requirements:
- Use only supplied readings and historical data.
- Never invent missing measurements or battery state of charge.
- Do not claim a component is faulty without sufficient evidence.
- Never recommend bypassing fuses, protection systems, or grounding.
- Do not directly control electrical hardware.
- Do not override deterministic safety rules.
- Keep the response concise and suitable for Telegram.
- Return structured JSON with summary, possible_causes,
  recommended_action, and severity.

Example AI input

json
{
  "device_id": "HYBRID-ESP32-01",
  "solar_power_w": 18.4,
  "wind_power_w": 4.2,
  "battery_voltage_v": 11.7,
  "load_power_w": 35.0,
  "alert_level": "WARNING",
  "event": "battery_voltage_low"
}

Example AI output

json
{
  "summary": "Battery voltage is below the configured warning limit.",
  "possible_causes": [
    "Load demand exceeds available generation",
    "Battery is partially discharged",
    "Sensor or wiring readings require verification"
  ],
  "recommended_action": "Verify the voltage with a suitable meter and inspect the charging system.",
  "severity": "WARNING"
}

These readings are illustrative. The threshold must be configured for the battery chemistry and system design.

10. Telegram text and voice notifications

Telegram text alerts are sent directly by n8n. Voice alerts require a text-to-speech service that converts the alert into an audio file.

mermaid

flowchart TD
    A["Rule engine detects abnormal condition"] --> B["AI generates alert summary"]
    B --> C["Telegram Send Message"]
    B --> D["Text-to-speech API"]
    D --> E["Receive audio binary"]
    E --> F["Telegram Send Audio or Send Voice"]
    F --> G["Operator receives audio notification"]

10.1 Example Telegram alert

Hybrid Energy Monitor

⚠️ Battery voltage warning

Device: HYBRID-ESP32-01

Solar power: 18.4 W

Wind power: 4.2 W

Battery voltage: 11.7 V (example only)

Action: Verify the battery voltage and inspect the charging system. Check the battery manufacturer's limits before taking corrective action.

10.2 Configure the voice alert

  1. Choose a text-to-speech service that supports an API, or run a compatible service on your server.

  2. Send the AI-generated summary or a fixed warning template to the TTS endpoint.

  3. Request MP3 or a supported Telegram voice format.

  4. Configure the n8n HTTP Request node to retrieve the audio as binary data.

  5. Connect it to Telegram's Send Audio or Send Voice operation.

  6. Select the correct binary property and recipient chat ID.

  7. Test with a simulated warning.

Send Audio is appropriate for an audio file such as MP3. Send Voice is intended for Telegram voice messages and requires a supported format. The exact TTS node configuration depends on the provider you choose.

11. IoT webpage and cloud dashboard

You can use ThingSpeak charts for a quick implementation, or create a custom webpage for more control.

Windora Renewable Energy Dashboard by Ofspace UX/UI on Dribbble
From research to application: aimpera creates AI for intelligent energy management
Renewable Energy Monitoring & Control

11.1 Recommended webpage features

  • Solar power and wind power cards.

  • Total generation in watts.

  • Daily generated energy in Wh or kWh.

  • Battery voltage and state of charge when measured.

  • Load power when a load sensor is installed.

  • Historical power charts.

  • Latest alert and recommended action.

  • ESP32 online/offline status.

  • Last successful telemetry timestamp.

11.2 Simple HTML webpage

Save the following code as index.html. It is a standalone dashboard prototype that uses demonstration values. It does not connect to live sensor data until you integrate it with a backend.

HTML
Wrap linesCopy codePreview

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Hybrid Renewable Energy Monitor</title>
  <style>
    body {
      margin: 0;
      padding: 24px;
      background: #f1f5f9;
      color: #172033;
      font-family: Arial, sans-serif;
    }
    main { max-width: 960px; margin: auto; }
    .cards {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 16px;
    }
    .card {
      background: white;
      padding: 20px;
      border-radius: 14px;
      box-shadow: 0 2px 8px #0001;
    }
    .label { color: #64748b; margin-bottom: 10px; }
    .value { font-size: 28px; font-weight: bold; }
    footer { margin-top: 20px; color: #64748b; }
  </style>
</head>
<body>
<main>
  <h1>Renewable Hybrid Energy Monitor</h1>
  <p>ESP32 · Solar PV · Wind generation</p>

  <section class="cards">
    <article class="card">
      <div class="label">Solar power</div>
      <div class="value" id="solar">-- W</div>
    </article>
    <article class="card">
      <div class="label">Wind power</div>
      <div class="value" id="wind">-- W</div>
    </article>
    <article class="card">
      <div class="label">Total generation</div>
      <div class="value" id="total">-- W</div>
    </article>
    <article class="card">
      <div class="label">Connection status</div>
      <div class="value" id="status">Demo</div>
    </article>
  </section>

  <footer id="updated">
    Demo data only — not live electrical measurements.
  </footer>
</main>

<script>
  // Demonstration values only.
  // Replace these with data from an authenticated backend API.
  const telemetry = {
    solar_power_w: 18.4,
    wind_power_w: 4.2
  };

  document.getElementById("solar").textContent =
    telemetry.solar_power_w.toFixed(1) + " W";

  document.getElementById("wind").textContent =
    telemetry.wind_power_w.toFixed(1) + " W";

  document.getElementById("total").textContent =
    (telemetry.solar_power_w + telemetry.wind_power_w)
      .toFixed(1) + " W";

  document.getElementById("updated").textContent =
    "DEMO DATA — connect a live telemetry API for real measurements.";
</script>
</body>
</html>

11.3 Connecting real telemetry

For production, expose an authenticated backend endpoint such as /api/latest. The backend should retrieve the latest validated telemetry and return JSON. The webpage can periodically request that endpoint and update its cards and charts.

Do not place ThingSpeak write keys, Google credentials, Telegram tokens or AI API keys in browser JavaScript. The webpage should only access data through a suitably secured API.

12. Power calculations and energy analysis

12.1 Instantaneous power

For a DC source:

P=V×IP=V\times I

Where PP is watts, VV is volts, and II is amperes.

Example:

Psolar=18×2=36 WP_{\text{solar}}=18\times2=36\text{ W}

12.2 Total generation

If solar and wind power are measured independently at compatible points:

Ptotal=Psolar+PwindP_{\text{total}}=P_{\text{solar}}+P_{\text{wind}}

For 36 W solar and 12 W wind, the combined generation is 48 W.

12.3 Generated energy

For a series of measurements taken at known time intervals:

EWh≈∑iPiΔti3600E_{\text{Wh}}\approx \sum_i P_i\frac{\Delta t_i}{3600}

Here, Δti\Delta t_i is the elapsed time in seconds for interval ii.

For example, a 48 W output sustained for 30 minutes produces approximately 24 Wh.

12.4 Energy balance

When load and battery measurements are available:

Pnet=Pgeneration−PloadP_{\text{net}}=P_{\text{generation}}-P_{\text{load}}

This is a simplified system-level calculation. Actual battery charging and discharging also depend on converter losses, battery current, controller behavior and other loads.

Voltage alone should not be treated as an accurate universal measurement of battery state of charge.

13. Google Sheets data analysis

Keep raw telemetry separate from calculated summaries and events.

Worksheet

Contents

Telemetry

Timestamped sensor readings and device ID

Daily_Summary

Daily energy generation, averages, maximum output and event counts

Events

Alert type, severity, measurements, AI summary and notification status

Example spreadsheet formulas, assuming solar power is in column E and wind power is in column H:

  • Total generation in watts: =E2+H2

  • Energy in Wh for a 30-second interval: =(E2+H2)*30/3600

Use actual elapsed time in production. If the ESP32 loses connectivity, do not assume that every measurement interval is exactly 30 seconds. Record missing readings and handle time gaps explicitly.

14. Testing and troubleshooting

14.1 End-to-end testing sequence

1

Hardware

Both INA219 sensors are detected and agree with suitable reference measurements.

2

ESP32

Wi-Fi connects, telemetry is sent, and communication failures are reported.

3

n8n

Webhook validates incoming JSON and rejects malformed requests.

4

ThingSpeak

Correct channel fields update and charts show expected values.

5

Google Sheets

Telemetry and event rows are stored in the correct worksheets.

6

AI agent

The generated summary uses only supplied measurements and does not invent missing values.

7

Telegram text

The intended recipient receives the correct warning.

8

Telegram voice

The TTS response is valid audio and Telegram delivers it.

9

Dashboard

The latest data is displayed, and stale readings are identified.

10

Recovery and safety

Network and AI failures do not disable local electrical protection.

14.2 Common problems

Problem

Likely cause or check

INA219 not detected

Check wiring and I²C addresses with a scanner.

Negative current

Verify current direction and shunt orientation.

HTTP authentication error

Check webhook authentication and endpoint configuration.

ThingSpeak not updating

Check write key, field mapping and rate limits.

Google Sheets failure

Verify account authorization, spreadsheet and worksheet name.

Telegram message failure

Verify bot token, chat ID and recipient permissions.

Voice notification contains no audio

Check the TTS response type and n8n binary property.

Too many alerts

Add hysteresis, persistence and cooldown logic.

AI diagnosis is unreliable

Validate measurements and constrain the prompt.

Dashboard shows old values

Check last-seen time and network connectivity.

15. Safety and security requirements

  • Use HTTPS certificate validation for production communication.

  • Authenticate the ESP32 webhook and validate every payload.

  • Store credentials securely rather than in public source code.

  • Apply sensible retry limits, rate limits and alert cooldowns.

  • Use a local buffer if telemetry must survive internet outages.

  • Distinguish missing or stale telemetry from a genuine electrical fault.

  • Keep charge controllers, battery-management systems, fuses and hardware interlocks independent of cloud AI.

  • Select the battery-specific warning and shutdown limits using the manufacturer's specifications.

  • Design wind-turbine protection for overspeed, electrical faults and the applicable controller requirements.

The system should remain a monitoring and advisory platform unless a separate, professionally designed control and protection system is implemented.

16. Expected project results

After the hardware and software are configured and tested, the system should demonstrate the following functions.

Function

Expected result

Renewable monitoring

Separate solar and wind measurements

ESP32 telemetry

JSON data transmitted over Wi-Fi

Cloud visualization

ThingSpeak charts and webpage dashboard

Data logging

Timestamped Google Sheets records

Fault detection

Configurable rule-based warnings

AI diagnostics

Contextual explanations and recommended checks

Telegram alerts

Automated text messages

Voice notifications

Generated audio delivered through Telegram

Historical analysis

Daily energy estimates and event records

17. Suggested project report structure

For a final-year engineering project, use this chapter arrangement:

  1. Chapter 1 — Introduction: Background, problem statement, objectives, scope and applications.

  2. Chapter 2 — Literature Review: Renewable hybrid generation, ESP32 IoT monitoring, cloud platforms and AI-assisted diagnostics.

  3. Chapter 3 — System Design: Block diagram, architecture, circuit schematic and component selection.

  4. Chapter 4 — Hardware Implementation: Sensor wiring, measurement points, power electronics and safety.

  5. Chapter 5 — Software Implementation: ESP32 firmware, n8n workflow, AI agent, Telegram, Google Sheets and ThingSpeak.

  6. Chapter 6 — Web Dashboard: Interface design, live data integration, charts and event history.

  7. Chapter 7 — Testing and Results: Sensor calibration, telemetry tests, alert tests, screenshots and measured results.

  8. Chapter 8 — Conclusion and Future Scope: Predictive maintenance, energy forecasting, anomaly detection and scalable multi-device monitoring.

Include actual experimental readings, screenshots and measured results when available. Do not present simulated values as experimental results.

18. Final system summary

The proposed project combines five main layers:

  • Energy layer: Solar PV, wind generation, battery and electrical load.

  • Embedded layer: ESP32 and electrical sensors.

  • IoT layer: Wi-Fi, webhook communication and ThingSpeak.

  • Automation layer: n8n, Google Sheets, AI analysis and Telegram notifications.

  • User interface layer: Custom web dashboard, historical charts and voice alerts.

The central advantage is that the ESP32 continuously gathers the measurements, n8n coordinates the cloud services, and the AI agent explains events in a human-readable way. The result is a renewable-energy monitoring system that is easier to observe, troubleshoot and extend than a standalone sensor display.

One important implementation detail: the code and diagrams above are a starter reference design, not yet a fully hardware-matched deployment. A final schematic and production firmware must reflect the actual sensor modules, electrical ratings, battery chemistry, and selected TTS provider.

 

Project Summary: AI Renewable Hybrid Power Generation Monitoring System

The project is an IoT-based monitoring and automation system that uses an ESP32, solar panel, wind turbine, n8n automation, an AI agent, Telegram voice alerts, Google Sheets, ThingSpeak, and a web dashboard to monitor renewable-energy generation.

Main components

  • ESP32: Reads sensor measurements and transmits data over Wi-Fi.

  • INA219 sensors: Measure DC voltage and current for solar and wind branches.

  • n8n: Automates data processing, cloud logging, alert rules, and notifications.

  • AI Agent: Analyzes validated measurements and recommends diagnostic actions.

  • Telegram: Sends automatic text messages and generated voice alerts.

  • Google Sheets: Stores historical measurements and alert records.

  • ThingSpeak: Displays time-series measurements and generation trends.

  • IoT webpage: Shows power generation, device status, charts, and alerts.

System workflow

mermaid

flowchart TD
    A["Solar Panel + Wind Turbine"] --> B["Voltage / Current Sensors"]
    B --> C["ESP32"]
    C --> D["n8n Webhook"]
    D --> E["Validate and Calculate"]
    E --> F["Google Sheets"]
    E --> G["ThingSpeak"]
    E --> H["Rule-Based Alert Detection"]
    H --> I["AI Agent"]
    I --> J["Telegram Text Alert"]
    I --> K["Text-to-Speech"]
    K --> L["Telegram Voice Alert"]
    G --> M["IoT Web Dashboard"]
    F --> M

Main implementation steps

  1. Assemble the ESP32 and sensors.

  2. Connect the sensors using the I²C interface.

  3. Upload the Arduino firmware.

  4. Configure ThingSpeak and Google Sheets.

  5. Create a Telegram bot.

  6. Configure the n8n webhook and automation workflows.

  7. Integrate the AI agent and text-to-speech service.

  8. Build the webpage and connect it to authenticated telemetry.

  9. Test measurements, notifications, cloud storage, and recovery.

Expected results

  • Real-time solar and wind power monitoring.

  • Automatic data logging and visualization.

  • Rule-based fault and low-generation alerts.

  • AI-generated diagnostic recommendations.

  • Telegram text and voice notifications.

  • Historical generation analysis and energy estimates.

Important: The reference firmware and webpage require configuration before deployment. Battery monitoring requires appropriate additional sensors, and electrical protection must remain independent of AI and cloud connectivity.