Solar powered ESPHome sensor

I’m experimenting with a long life, solar powered ESPHome based device. The original idea was for outside, low update rate sensors such as a tank water level sensor. Looks like the power consumption is too high, but it’s been interesting.

THe components are:

All of the componets are roughly the same size and fit together in a small IP66 box.

ESP32-C6 and ESPHome

ESPHome currently doesn’t support the C6, as the C6 requires ESP IDF 5 while ESPHome targets IDF 4. However, except for the ADC componet, it’s pretty close.

To target the C6 with ESPHome 2024.4, fetch componets/adc from my tree and try the following:

external_components:
  - source:
      type: local
      path: components
  # Remove post 2024.04?
  - source: github://esphome/esphome@dev
    components:
      - logger

esp32:
  board: esp32-c6-devkitm-1
  variant: esp32c6
  flash_size: 4MB
  framework:
    type: esp-idf
    version: 5.2.1
    platform_version: 6.6.0
    sdkconfig_options:
      CONFIG_ESPTOOLPY_FLASHSIZE_4MB: y

Power budget

The FireBeetle claims that it draws 16 uA in deep sleep. The ESP32-C6 power documentation suggests 70 mA at startup and 24 mA active.

The LiPo self discharge is about 1 % per month, or 30 mAh/month, or 42 uA.

The panel generates 0.33 W at 5 V, or 66 mA.

The board uses a linear regulator and the charge controller is constant current, so the math should be done in amps.

So, assuming a overcast day (1/3 power) with 4 hours of sun, mA/day = 66 mA * 1/3 * 4 = 88 mAh.

Connecting to the Wifi and Home Assistant takes ~10 s. Taking 70 mA gives 1.25 h of operation/day, or 450 10 s cycles, or one cycle every 3.2 minutes.

Rounding the cycle up to 5 minutes gives 700 mAs every 5 minutes, or 201600 mAs/day, or 56 mAh/day, so the battery could last 53 days.

Tests

Due to a bug, the board stayed on overnight one evening and dropped from 3.91 V to 3.72 V over 13 h, or ~65 % to ~20 %, or 1350 mAh/13h, or 103 mA. This assumes the battery is healthy.

Last night it went from 33 % to 30 % over 13 h, or 166 mAh/day on a 5 minute cycle. The measurement is noisy and poobably +/- 1 %, so the range is 2 % to 4 %, or 110 mAh/day to 221 mAh/day.

Deep sleep, sensors, and OTA

To minimise the time spent awake, my approach is to:

  • Start the Wifi
  • Wait until Home Assistant connects to the API
  • Force the sensors to update
  • Delay to ensure the updates go out
  • Calculate the time until the next multiple of 5 minutes
  • Enter deep sleep until then

I’m not sure if the ‘force update’ is needed, as ESPHome might send the most recent value on connect.

Except for the ‘delay to hope that the values have been propagated’, everything else is event driven which minimises the on time.

To allow OTA updates, I:

  • Added a custom toggle helper in Home Assistant
  • Added that binary sensor in ESPHome
  • If the toggle is set then prevent deep sleep
Avatar
Michael Hope
Software Engineer