I'm getting weird power consumption in deep sleep mode on a project using ESP32-C3 (it's a MakerGo clone).
Everything works as expected except for the battery life.
So I produced a test case.
Arduino IDE Version: 2.3.6
Date: 2025-04-09T11:26:55.498Z
CLI Version: 1.2.0
the code below is used to measure the power draw with a Nordic Power Profiler 2
I started with only the lines marked // 1 and for each consecutive test I un-commented the // 2, //3, ... up to // 7
//#include "WiFi.h" // 7
RTC_DATA_ATTR bool firstboot = true; // 1
void setup() {
// if (firstboot) { // 2
// gpio_deep_sleep_hold_en(); // 2
// firstboot = false; // 2
// }
// esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); // 3
// esp_deep_sleep_enable_gpio_wakeup((1ULL << 1), ESP_GPIO_WAKEUP_GPIO_LOW); // 3
Serial.begin(115200); // 1
Serial.println(F("\n Start")); // 1
// int gpio_pins[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 21}; // 4
// for (int i = 0; i < sizeof(gpio_pins) / sizeof(gpio_pins[0]); i++) { // 4
// gpio_pullup_dis((gpio_num_t)gpio_pins[i]); // 4
// gpio_pulldown_dis((gpio_num_t)gpio_pins[i]); // 4
// pinMode((gpio_num_t)gpio_pins[i], INPUT); // 4
// } // 4
// pinMode(1, INPUT_PULLUP); // 5
// pinMode(2, INPUT_PULLUP); // 5
// pinMode(4, INPUT); // ADC // 5
// WiFi.mode(WIFI_STA); // 7
// WiFi.disconnect(); // 7
}
void loop() {
// int gpio_pins[] = {1, 2, 4}; // 6
// for (int i = 0; i < sizeof(gpio_pins) / sizeof(gpio_pins[0]); i++) { // 6
// gpio_pullup_dis((gpio_num_t)gpio_pins[i]); // 6
// gpio_pulldown_dis((gpio_num_t)gpio_pins[i]); // 6
// pinMode((gpio_num_t)gpio_pins[i], INPUT); // 6
// } // 6
Serial.println(F("going to sleep")); // 1
Serial.flush(); // 1
esp_deep_sleep_start(); // 1
}
It should all be straight forward, shouldn't it be?
The deep sleep power draw should only be dictated by the pins and peripherals.
My test board is bare-bones MakerGo clone, with the LEDs and LDO removed. No peripherals. It is powered at the 3.3V pin.
the results for the sketch with only the // 1 uncommented
an impressive 7.27μA
// 2 uncommented goes up to 98μA. I have no idea why.
// 3 jumps to mA with quite a spread (avg 15mA max 36mA)
// 4 is my attempt to float the GPIO. 1.38mA is still high for doing nothing.
// 5 configure the pins I need. 3mA? why?
// 6 float the pins I intend to use just before sleep. Better but not ideal. I would like 60μA or less.

// 7 brings in the WiFi code that should not change the deep sleep power draw because the WiFi hardware should be switched off. Yet it does.

I'm lost.



