Changing ESP32 CPU clock frequency

I’m speculating that if I reduce the CPU clock frequency on an ESP32 board, it will reduce the power draw. Am I right about that?

I can see that ESPHome has a way to pass an option to platformio to give a different clock frequency, but there is a clear warning there that it only affects how the firmware is built. It doesn’t actually change the hardware clock. I’m pretty sure I know how to do this (actually change the clock frequency) with the native Espressif IDF, but I’m not sure how to do it when using ESPHome. I know I can do an onboot lambda to make native calls, but I don’t know if there are any “gotchas”. Can someone clue me in?

Hi Bill, wondering if you had made any progress in changing the clock freq within ESPHome?
As you indicate, I am hoping to set the ESP32 to 80Mhz to save battery on a remote sensor, but don’t know how to do that within ESPHome…
Were you able to make it work? can you explain the on boot lambda solution?

Thanks in advance,
ET

No, I never figured it out. (And I’ve also kind of forgotten what I was trying to do when I asked the question.:frowning: )

I used the board_build.f_cpu property in platformio_options described here: Slowing down an ESP32 with ESPHome
When I flash to the device, it tells me it’s running at 80mhz, so I think it’s working.

1 Like

Yes, I’m using this too.

Seems to work.

  board: wemos_d1_mini32
  platformio_options:
    board_build.f_cpu: 80000000L # Reduce CPU speed to match HX711 sample rate