ESP32-C3 Deep Sleep Weird Power Draw use-cases

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.
image

// 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.
image

I'm lost.

What makes you say that?

Have you tried the following?

esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);

Espressif docs: "In Deep-sleep and Light-sleep modes, the wireless peripherals are powered down."

now that you brought it up I did and it doesn't compile in Arduino.
ESP_PD_DOMAIN_RTC_PERIPH seems to be a missing

Try to add:

#include "esp_sleep.h"

Is the USB cable connected for your tests ?

It might be interesting to see what a genuine board does.

But the docs go on to say Link to docs

In Deep-sleep and Light-sleep modes, the wireless peripherals are powered down. Before entering Deep-sleep or Light-sleep modes, the application must disable Wi-Fi and Bluetooth using the appropriate calls (i.e., nimble_port_stop() , nimble_port_deinit() , esp_bluedroid_disable(), esp_bluedroid_deinit(), esp_bt_controller_disable(), esp_bt_controller_deinit(), esp_wifi_stop()). Wi-Fi and Bluetooth connections are not maintained in Deep-sleep or Light-sleep mode, even if these functions are not called.

Lot's of detailed info HERE BUT note it is for IDF not IDE !

Check out these guys as well but with a NON CLONE board.
Link

I would do a test but my Current Ranger is not assembled and I am not feeling well enough to go into my messy disorganized shop.

Here is another Link you may find interesting

I found the following Link with a disturbing note as follows

This looks like it is the main document re sleep, BUT note it is for IDF and NOT IDE.
Link

yes it is but it makes no diff if I unplug it because I removed the 5V to 3.3V LDO

here's the new // 7 reading with the USB unplugged

you do have a point sir.
I did some more search and found this: ESP32 - Turn off and turn on the WIFI - #10 by red_car

 WiFi.disconnect(true);
 WiFi.mode(WIFI_OFF);

and the results are in :grinning_face:

late reply but it might help someone: the line below is not needed ;everything works fine without it and the deep sleep current goes down under 10μA

gpio_deep_sleep_hold_en();