Contents
System Overview
Monitor your solar installation to maximize efficiency and detect issues early. Track production, consumption, and battery health in real-time.
Monitored Parameters:
- Solar panel voltage & current
- Battery voltage, current, SOC
- Load consumption
- Grid import/export
- Energy yield (daily/monthly)
- Panel temperature
Sensors Required
- INA219: Voltage/current (0-26V, 0-3.2A)
- INA3221: 3-channel power monitor
- Voltage Divider: For higher voltages
- Current Transformer: AC current sensing
- DS18B20: Panel temperature
Hardware Setup
ESP32 → INA219 (Solar Input)
VCC → 3.3V, GND → GND
SDA → GPIO21, SCL → GPIO22
ESP32 → INA219 (Battery)
VCC → 3.3V, GND → GND
SDA → GPIO21, SCL → GPIO22 (shared I2C)
ESP32 → Voltage Divider (Panel)
Panel+ → 10k resistor → GPIO35 → 10k resistor → GND
ESP32 Firmware
#include
#include
#include
#include
Adafruit_INA219 solar_ina;
Adafruit_INA219 battery_ina;
void setup() {
solar_ina.begin();
battery_ina.begin();
WiFi.begin(ssid, password);
client.setServer(mqtt_server, 1883);
}
void loop() {
// Solar production
float solar_voltage = solar_ina.getBusVoltage_V();
float solar_current = solar_ina.getCurrent_mA();
float solar_power = solar_voltage * solar_current / 1000;
// Battery status
float battery_voltage = battery_ina.getBusVoltage_V();
float battery_current = battery_ina.getCurrent_mA();
int battery_soc = map(battery_voltage * 10, 110, 127, 0, 100);
// Publish
publishSolarData(solar_voltage, solar_current, solar_power,
battery_voltage, battery_current, battery_soc);
delay(5000);
}
Dashboard Setup
Key metrics to display:
- Real-time power flow diagram
- Daily energy production graph
- Battery SOC gauge
- Self-consumption ratio
- Savings calculation
Next Steps
- Add weather forecast integration
- Implement load shedding
- Add grid-tie monitoring
- Create mobile alerts
Related: Factory Energy Monitoring | Home Energy Monitor