Author Topic: ESP32 deep sleep.  (Read 1658 times)

0 Members and 1 Guest are viewing this topic.

Offline hamster_nzTopic starter

  • Super Contributor
  • ***
  • Posts: 2803
  • Country: nz
ESP32 deep sleep.
« on: November 15, 2017, 09:16:08 am »
After a tweet from John at Expressif, I finally got to prove to myself that ESP32 can sleep at <7 uA - on a WeMos LoLin32 board I was getting 890uA.

After downloading my test code to the flash, I lifted the (not that great) 3V3 regulator and powered it from a bench supply.



about 28mA when awake, and < 0.1mA when asleep.

I had rigged up a toggle switch so I could switch in a uA meter while it was asleep, and the results are in - 6.22uA while asleep, and waking up like clockwork.

Code as used (sorry, it still has some debugging of the power registers in there)

Code: [Select]
... header files ...
#define MHZ (1000000)
const static char *TAG = "deepsleep";

void app_main(void)
{
    ESP_ERROR_CHECK( nvs_flash_init() );

while(1) {
ESP_LOGI(TAG, "Awake\n");
WRITE_PERI_REG(RTC_CNTL_PWC_REG, 0x00120240);
ESP_LOGI(TAG, "RTC_CNTL_OPTIONS0_REG       0x%08x", READ_PERI_REG(RTC_CNTL_OPTIONS0_REG));
ESP_LOGI(TAG, "RTC_CNTL_ANA_CONF_REG       0x%08x", READ_PERI_REG(RTC_CNTL_ANA_CONF_REG));
ESP_LOGI(TAG, "RTC_CNTL_PWC_REG            0x%08x", READ_PERI_REG(RTC_CNTL_PWC_REG));
ESP_LOGI(TAG, "RTC_CNTL_DIG_PWC_REG        0x%08x", READ_PERI_REG(RTC_CNTL_DIG_PWC_REG));
sleep(2);
ESP_LOGI(TAG, "Entering deep sleep\n");
sleep(1);
esp_deep_sleep(15*MHZ);
ESP_LOGI(TAG, "Sleep failed\n");
sleep(1);
}
}


« Last Edit: November 15, 2017, 09:21:52 am by hamster_nz »
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 
The following users thanked this post: lucazader


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf