guild icon
Toit
#automatic light sleep
Thread channel in help
alex (he/him)
alex (he/him) 10/16/2025 06:48 PM
Hey all, I'm planning to build a battery powered device, but it needs to stay connected to wifi and have low latency reconnects. I saw there is a light sleep which is availabe under power management. Any plan to support that [automatic light sleep](https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/power_management.html) ?

#include "esp_pm.h" // ... other includes and setup void app_main(void) { esp_pm_config_esp32_t config = { .max_freq_mhz = 80, // or 160, depending on your needs .min_freq_mhz = 10, // minimum frequency for the clock .light_sleep_enable = true }; esp_err_t result = esp_pm_configure(&config); if (result == ESP_OK) { // Configuration successful } else { // Handle error } }
alex (he/him)OPalex (he/him)
Hey all, I'm planning to build a battery powered device, but it needs to stay connected to wifi and have low latency reconnects. I saw there is a light sleep which is availabe unde...
floitsch
floitsch 10/20/2025 12:03 PM
It already exists: https://libs.toit.io/esp32/library-summary#pm-configure(3%2C0%2C0%2Cenable-light-sleep%2Cmax-frequency-mhz%2Cmin-frequency-mhz)

However, I think that any battery-based device needs to bring the esp32 into deep-sleep. Light sleep doesn't save that much energy.
floitsch
floitsch 10/20/2025 12:04 PM
Note that light-sleep might need a different sdkconfig (and thus a different envelope).
floitsch
floitsch 10/20/2025 12:04 PM
If it does, please let me know, and I can maybe add such a configuration to our https://github.com/toitlang/envelopes
Toit envelopes for different configurations. Contribute to toitlang/envelopes development by creating an account on GitHub.
floitschfloitsch
alex (he/him)
alex (he/him) 10/26/2025 06:03 PM
Light sleep doesn't save that much energy.

According to sources on the internet, it should get down to 2-5 mA
alex (he/him)OPalex (he/him)
Light sleep doesn't save that much energy. According to sources on the internet, it should get down to 2-5 mA
floitsch
floitsch 10/26/2025 06:06 PM
I'm probably just wrong.
Please go ahead and test what is there. If you are missing things, let me know and I will try to help/fix it.
👍1
6 messages in total