Giulia Guglielmi logoGiulia Guglielmi
all posts

By 5 min

Powering My Wemos Soil-Moisture Sensor with Solar Energy

How I sized a small solar power system for a Wemos D1 mini soil-moisture sensor, from the energy budget to the battery, charger, and boost converter.

On this page

After building my Wemos soil-moisture sensor, I wanted to make it independent from the laptop and the mains. The idea was to add a rechargeable battery and a small solar panel, then leave the sensor near the plants.

To choose the components I first needed an energy budget. The system wakes up, reads the sensor, connects to Wi-Fi, sends the value to ThingSpeak, and goes back to deep sleep. In my first measurements it did this twice per day.

Estimating the daily consumption

During one active cycle I measured about 70 mA for 5 seconds. The charge used by one cycle is therefore:

70 mA × 5 s / 3600 = 0.097 mAh

Two cycles use about 0.194 mAh per day. In deep sleep I measured roughly 0.15 mA at the 5 V USB input:

0.15 mA × 24 h = 3.6 mAh per day

That gives a first estimate of about 3.8 mAh per day at 5 V.

Hand-drawn calculation that starts with active and deep-sleep current at 5 volts, converts the result to watt-hours, includes boost-converter loss, and reaches about 5.7 milliamp-hours per day from the battery.
The corrected budget keeps the 5 V measurement separate from the 3.7 V battery calculation. The sensor's own consumption still has to be measured.

There is an important detail in that result. The current was measured on the 5 V side, while the battery has a nominal voltage of about 3.7 V. It is better to compare energy, not only milliamp-hours:

3.8 mAh × 5 V / 1000 = 0.019 Wh per day

With an assumed boost-converter efficiency of 90%, the battery must provide approximately:

0.019 Wh / 0.90 / 3.7 V × 1000 = 5.7 mAh per day

This is still an estimate. The real budget must also include the boost converter's idle current, the Wemos voltage regulator, the soil sensor, battery losses, and days with little sun.

Choosing the battery

I considered three characteristics: voltage, capacity, and the maximum current the battery can provide.

The Wemos logic works at 3.3 V, but this does not mean that a lithium-ion cell can be connected directly to the 3V3 pin. A single cell is about 3.7 V nominal and reaches 4.2 V when fully charged. In this design the cell goes through a boost converter that supplies a regulated 5 V to the Wemos 5V pin.

For capacity, the notebook calculation started with one week:

5.7 mAh per day × 7 days ≈ 40 mAh

I wanted a large reserve for winter, battery ageing, cloudy days, and Wi-Fi current peaks. My notes point to a Samsung 3000 mAh 18650 cell. This is much larger than the theoretical minimum, but it gives the prototype a generous safety margin. I still need to confirm the exact part number. The cell must be genuine, rechargeable, suitable for the selected charge current, and used with protection against overcharge, overdischarge, and overcurrent.

Choosing the solar panel

I chose a small 2 W panel in the 5 V to 6 V class. Its ideal energy over seven equivalent full-sun hours would be:

2 W × 7 h = 14 Wh

That is only the panel's rated, ideal output. Real production is lower because of orientation, temperature, clouds, shading, and conversion losses. Even so, it is far above the estimated daily load of about 0.019 Wh.

The panel voltage printed on the label is not enough to select the charger. I also need to check its open-circuit voltage, voltage at maximum power, and available current. Those values must stay inside the charger's limits in both full sun and weak light.

Charger, protection, and boost converter

I initially selected a TP4056 module with USB-C, plus the common DW01A and FS8205A protection circuit. The TP4056 charges one lithium-ion cell with a constant-current and constant-voltage profile, ending at 4.2 V. The protection parts on some modules add overcharge, overdischarge, and overcurrent cut-offs. Not every TP4056 board includes them, so the actual board has to be checked.

The TP4056 is a charger, not a DC-DC converter and not a complete solar power manager. It has no maximum power point tracking. A solar panel is a variable source, so the programmed charge current must not pull its voltage down, and the panel's maximum voltage must remain safe for the module. For a permanent outdoor version I would prefer a charger designed for solar input, with input voltage regulation, battery temperature monitoring, and power-path management.

The battery voltage also changes as it discharges. A separate step-up boost converter takes the protected battery output and produces the stable 5 V used by the Wemos. Its efficiency and, especially, its quiescent current matter because the Wemos spends almost all day asleep.

Detailed hand-drawn wiring diagram showing the solar panel, TP4056 prototype terminals, 18650 battery, 5 volt boost converter, Wemos D1 mini pins, and capacitive soil-moisture sensor.
The complete power path. The battery connects to the charger battery terminals, while the protected output feeds the boost converter and the Wemos.

The wiring logic is:

FromToPurpose
Solar panelCharger inputProvides energy when there is enough light
Charger B+ and B-1S lithium-ion cellCharges the cell to the correct voltage
Protected OUT+ and OUT-Boost VIN+ and VIN-Supplies the load without bypassing protection
Boost 5 V outputWemos 5V and GNDPowers the board through a regulated rail
Wemos 3V3, GND, and A0Sensor VCC, GND, and AOUTPowers and reads the moisture sensor

The panel must never be connected directly to the lithium-ion cell. Charging a cell safely requires the correct voltage and current profile, protection, and a design that respects the cell manufacturer's temperature limits. Before this prototype can stay outside unattended, I still need to verify every module's datasheet, measure the complete system over several days, and place the battery in a suitable weatherproof enclosure away from excessive heat.

Sources and further reading