High energy consumption of ESP32-H2

Greetings to all ZigBee enthusiasts!
I’m exploring ESPHome and have built this device based on the ESP32-H2-supermini:

# Board: Generic ESP32-H2 Board (Generic)
# Definition: definitions/boards/generic-esp32h2/manifest.yaml

esphome:
  name: esp32-h2
  friendly_name: esp32-h2
                
zigbee:
  id: "zbb"
  router: false
  sleepy: true
  model: "Test devs"
  power_source: BATTERY
  
  on_start:
    then:
      - light.turn_on: 
          id: light_neopixelbus_1
          color: 0x0000ff  
  on_join:
    - then: 
        - light.turn_off: 
            id: light_neopixelbus_1
  
deep_sleep:
  sleep_duration: 60s
  
esp32:
  variant: ESP32H2
  toolchain: esp-idf
  framework:
    type: esp-idf

logger:
  level: NONE

switch:
  - platform: gpio
    name: Binary Light
    id: light_binary_1
    pin: GPIO13
    zigbee_switch: sw1
    cluster: on_off
    report: force

binary_sensor:
  - platform: gpio
    id: bs1
    pin:
      number: GPIO9
      mode:
        input: true
        pullup: true
      inverted: true
    cluster: device_class
    device_class: occupancy
    report: force
    use_device_type: true
    filters:
      - delayed_on_off: 50ms

light:
  - platform: esp32_rmt_led_strip
    name: Light
    id: light_neopixelbus_1
    num_leds: 1
    pin: GPIO8
    channel_colors: GRB
    chipset: WS2812

This device connects successfully to the Z2M. However, when powered by 3.3V, the consumption is 24 mA—clearly too much. How can I reduce the consumption to at least a hundred microamps?

Is the zigbee set as a router? If it is see if that can be turned off.

Changing the operating mode changes the consumption by 1.5 mA: in router mode 26 mA, in end device mode 24.5 mA.

Your OP said it was using 24mA (presumably in router mode). Why did it suddenly jump to 26mA 8 hours later?

Unless my calculations are wrong, that’s just 0.0792W. Hardly “too much” . The problem is that is seems you’re attempting to control an led strip using battery power. There’s a reason why off-the-shelf battery zigbee devices don’t do that - the battery will be eaten up quite quickly, which is why most battery zigbee devices only flash the single internal LED briefly when you press a button on the device and cannot be controlled remotely.

Might be time to think of switching to a USB power source if you want it to last a meaningful amount of time & get proper functionality out of that strip.

:face_with_peeking_eye: I must have written this hastily, without realizing what mode I was measuring in… I did a lot of experimenting and probably messed something up. I accurately measured 26 mA in router mode.

Since ZigBee is marketed as a good option for battery power (and in fact, many battery-powered devices exist), 24-26 mA is a bit of an overestimate. This is continuous consumption, not peak load.

No, no, no! The WS2812 is an LED built into the board that only indicates network connection status and then turns off. There are no strips, and none are planned!

Currently, I’m just exploring the capabilities of the ESP32, with no specific plans to develop finished products. While there are plans, they’re off the table for now without a full understanding of the platform.

You may not be able to… dev boards are meant for development, they are rarely designed for low power consumption. The additional components that make them easy to use for that purpose can and do use power:

To get the low-power benefits of the SOCs, commercial devices use minimal components and design specifically for low-power.

In this article, using a board similar to mine and the Espressif SDK, I easily achieved a consumption of less than 1 mA. I don’t think this is solely due to Thread. In other words, I believe the high consumption is due to suboptimal ESPHome code…
I’m willing to admit that additional components consume some power, but on a supermini board, they’re few in number, and the difference between 800 µA (in the article) and 24 mA (on mine) is too large to be explained by the additional components…

I would be happy if I could get the consumption down to 5mA continuously and 25mA peak.

To at least is easy, below is hard. You likely need to modify the board, feel free to post schematic or macro photo of it. Also, esphome is not optimized for ultra low power, so lot of tinkering might be needed.

How are you measuring power and when?

Those ultra low power claims are only when the device is in deep sleep.

Are you sure it is even going to sleep, let alone deep?

I believe your very short deep_sleep duration will be having a significant impact on your results. Also curious that you haven’t specified a run_duration (and ESPHome docs don’t say what the default is). Deep_sleep actually does a full shutdown, pauses, then a full boot - including initiating the communication devices. Deep_sleep is particularly useful for devices which initiate communication (eg sending sensor values to HA every 30 minutes) - but not appropriate if your ESP32 is expecting to receive messages.

It is well known that establishing a wi-fi connection is a significant power drain - so advice is to do it less often. The ESPHome deep_sleep doc has an example of 10 minutes sleep for 10 seconds awake. I understand that zigbee requires less power than wi-fi … but I guess the same applies, albiet with less effect.

It might actually be more power-efficient to keep the ESP32 running for those 60 seconds than to re-establish communications. Alternatively maybe you could investigate the ESP32’s light-sleep mode (which I can’t find mentioned in ESPHome docs).


Like Neel, I would also query whether your 24mA is measured while the ESP32 is in deep-sleep (ie powered off with only the secondary processor timing the sleep-duration), or when it is operating ?

FWIW, I agree with Didgeidrew that “dev boards” are designed to help engineers quickly develop prototypes for their new products and software - ie to operate with USB power on a workbench, and be cheap. It is those engineers who design their new product with low-current components to maximise battery life. My greenhouse has certainly noticed a big improvement swapping from cheap ESP32-S3-DevKit-C board to a FireBeetle 2 ESP32-S3 or Unexpected Maker S3 … which are clearly designed to be powered from a LiPo battery.

I note the Update to Tom McGuinness’s article where he is developing his own H2 devboard to use low quiescent power components … because he considers the components on the supermini board to be significant.

I’m almost certain that not only isn’t deep sleep mode turning on, but even light sleep mode isn’t turning on! I just don’t understand how to enable/activate these modes in Yaml!
There’s just too much I don’t know…

Monitoring the milliammeter’s readings, I see that the board draws an average of 24 mA (roughly), and аpproximately every 10 seconds the current increases by 3-4 mA. The actual readings are likely different, but I simply can’t see it with a multimeter.

As I said, this is the active mode current; I’m not at all sure that any sleep mode is functioning.

How? How can I reduce consumption to at least 5 mA on average? Any recommendations?

I use a board like this:

I don’t see anything on your code that sets esp to deep sleep. 24mA for active mode sounds very reasonable to me.

I’ve been doing a lot of reading here… And I’ve discovered that deep_sleep only terminates with a reset, meaning this mode is absolutely unsuitable for a device that’s always ready to accept a command or send its state. But light_sleep isn’t supported!
Dead end… :grimacing:

That is not a secret.

Low power is hard. Being clear about your requirements is necessary. Leaving a radio on to be constantly available uses a LOT of energy.

Most low power projects (probably all) must spend most of their time in very low power modes. They use timers and interrupts to wake up and then do something.

All battery powered devices are momentarily “non available” because they sleep. Interval can be milliseconds though. Esphome is painfully slow on boot.
You might get better suggestions here if you tell what’s your approach.

I’m just starting to learn ESPHome and haven’t developed any personal approaches yet. I’m willing to follow specific recommendations for entering certain lines into the YAML that will reduce energy consumption. :man_shrugging:
I’m certainly studying the materials, but so far I haven’t been able to find anything reassuring.

For what? What is your approach? If you tell what you are after you might get suggestions both for hardware and code.

This is graphical demonstration why esphome with esp32 is hard bone for “always available approach”. Boot time is looong, here it’s 4s but that’s just random esphome esp32 wifi device , not optimized for battery.


(X-axis is update cycle (0.65ms) count.
Yellow line is from boot to “regular state”.

I’d like to build a device powered by the mains, but with extremely small dimensions, approximately 50 x 20 x 15 mm along the outer edges. These dimensions must accommodate:

  • ESP32-H2
  • mains power supply
  • triac
  • terminals for connecting the input and output wires
  • button
    Since the dimensions of the ESP32 and triac cannot be changed, the main limitation for this project is the power supply. I couldn’t find a commercially available 230AC/3.3DC power supply that would fit. The only option I can think of is a capacitive ballast, in which only the capacitor has significant volume. However, within the specified dimensions, a capacitor no larger than 0.47 μF will not provide the required supply current! By the way, budget is also a factor, so SMD capacitors at $2 each are also not suitable. Maybe I want too much, maybe I just have little experience, but I can’t find a compromise.

O! :hugs:Today’s ESPHome update announced the addition of the power_management domain, which should support light sleep mode! Maybe that will solve my problem… I’ll give it a try.