Solar Energy Monitoring and Control System with ESP32
Intermediate11/6/2026- Author: IoTSpark Maker

Solar Energy Monitoring and Control System with ESP32

Build a low-voltage DC model using an ESP32 to measure solar voltage, current, and power, monitor a battery, and control a DC load over MQTT.

ESP32Solar EnergyMQTTINA219IoTDC PowerEnergy Monitoring
6 steps9 components
← Back to project
Detailed guide

Part 6: Testing, Calibrating, and Finalizing the System

Check the power supply, calibrate battery voltage, test MQTT, troubleshoot common issues, and finalize the ESP32 solar energy monitoring model.

Updated 31/08/2026

Part 6: Testing, Calibrating, and Finalizing the System

After finishing the hardware and firmware, test in order to avoid powering things up wrong or misreading data. Don't skip the multimeter-measurement steps, since both the ESP32's ADC and the current-sensing module need to be verified against reality.

Checks Before Powering On the ESP32

ItemHow to CheckPass Condition
Battery polarityMeasure with a multimeter at the battery terminal and the buck's inputPositive/negative are correct, not reversed.
Buck outputMeasure OUT+ and OUT-Stable around 5V before plugging in the ESP32.
GPIO34 voltageMeasure the voltage divider's midpointAlways below 3.3V.
Load lineTest continuity and check the fuseNo short, correct load voltage.
INA219 I2CCheck SDA, SCL, VCC, GNDPower and ground aren't swapped.

Calibrating Battery Voltage

Read the battery voltage via the ESP32, then compare it against a multimeter. If there's an error, compute the correction coefficient and update BATTERY_CALIBRATION.

BATTERY_CALIBRATION = multimeter reading / voltage the ESP32 reads

For example, if the multimeter reads 12.40V and the ESP32 reads 12.10V, the correction coefficient is 12.40 divided by 12.10, approximately 1.024.

Testing MQTT

StepActionExpected Result
Subscribe to telemetryWatch iotlabs/solar01/telemetryReceives JSON on a regular interval.
Send OFFPublish OFF to iotlabs/solar01/cmd/loadThe load turns off.
Send AUTOPublish AUTO to the control topicThe ESP32 returns to automatic mode.
Send ON while the battery is lowSimulate it, or set a high threshold to testThe ESP32 doesn't turn on the load and sends an alert.

Common Issues

IssueCommon CauseFix
The ESP32 keeps resettingA weak buck converter, thin power wires, or the load causing a voltage sagUse a buck converter with enough current, add a filter capacitor, and separate the load's power supply if needed.
The ADC reads incorrectlyA wrong divider, noise, or missing calibrationRemeasure the resistors, average multiple samples, and calibrate against a multimeter.
The INA219 current is negativeVIN+ and VIN- are reversedRecheck the current direction through the shunt.
The relay keeps chatteringThe on/off thresholds are too close together, or the battery sags when the load turns onWiden the gap between thresholds and check the load current.
MQTT won't connectA wrong host, port, username, password, or networkCheck the broker configuration and WiFi.

Finishing the Model

Once the circuit runs reliably, mount the modules in an enclosure, use a terminal block for the power wires, mark polarity clearly, add a DC fuse on the load line, and label the connection ports.

✅ A complete system should read stable data, control the load with correct logic, alert on a low battery, and be able to safely cut the load — all within the scope of the low-voltage DC model.