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 2: Preparing Components with the Right Specs

Choose the ESP32, panel, charge controller, storage battery, INA219, buck converter, relay/MOSFET, and voltage divider correctly within the low-voltage DC scope.

Updated 31/08/2026

Part 2: Preparing Components with the Right Specs

Before wiring the circuit, you need to choose components matching the correct voltage range, current, and battery type. This step matters a great deal because a solar energy system has a storage battery — choosing the wrong charge controller or reversing polarity can overheat wires, damage a module, or create a hazard.

Recommended Components List

ComponentTechnical RequirementSafety Note
ESP32 DevKitWiFi-enabled, 3.3V logicNever feed battery voltage directly into 3V3 or a GPIO pin.
Solar panel6V, 9V, or 12V for a learning modelDo not use a high-voltage PV string in this lesson.
Solar charge controllerMatched to the battery type and voltageNever charge a lithium battery directly from a panel without a matching charge circuit.
Storage batteryWith a BMS or protection circuitDo not use an unprotected bare battery for beginners.
INA219I2C interface, bus voltage within the module's limitCheck the maximum current per the actual module's shunt.
5V buck converterOutput current sufficient for the ESP32Measure the 5V output before plugging in the ESP32.
Relay or MOSFET moduleCurrent rating higher than the load currentNever drive the load directly from a GPIO.
100kΩ and 22kΩ resistorsUsed as the battery-measurement voltage dividerThe voltage at GPIO34 must stay below 3.3V.

Choosing the DC Load

The DC load should be a small DC LED light, a small DC fan, or a low-current test module. For a load like a motor, pump, or fan, check the startup current, since inrush current can exceed the steady-state running current.

⚠️ The relay or MOSFET module's current rating must exceed the actual load current. Add a DC fuse on the load-supply line to reduce risk in case of a short circuit.

Why a Buck Converter Is Needed

The ESP32 needs a stable power source. If the storage battery is 6V, 9V, or 12V, step it down to 5V with a buck converter before feeding it to the ESP32's 5V pin or USB port. Never feed 12V directly into the 5V, 3V3, or a GPIO pin.

Why a Voltage Divider Is Needed

The ESP32's ADC only reads a low voltage range. So, the battery voltage must be divided down before reaching GPIO34. With R1 = 100kΩ and R2 = 22kΩ, the divider ratio is approximately 5.545.

Battery Voltage = ADC Voltage × (R1 + R2) / R2
Battery Voltage ≈ ADC Voltage × 5.545