Esp32 timer+RTC_IO+WiFi draw too much current in sleep mode

Hi,
I am using an esp32 module, when using wifi(connecting and going to sleep) and wake up trigger by RTC_IO and timer, I get a consumption of 70uA during sleep mode.
When using only WiFi and timer or only timer and RTC wake up, current draw during sleep is ~5uA.
What could cause this diffrence and how can I fix it?

#include <WiFiClientSecure.h>
#define EXTERNAL_BUTTON_PIN 25
#define TIME_TO_SLEEP_SEC 10

const char* ssid = "";                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
const char* password = "";

String deviceID;

void setup() {

  powerSetup();

  connectToWifi();

}

void loop() {

  sleepLauncher();

}

void connectToWifi() {
  WiFi.begin(ssid, password);
  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("Connected to WiFi");
}

void sleepLauncher() {
  #define GOTOSLEEPTIME 5 * 1000
  static unsigned long goToSleepTime = 0;
  if ( millis() - goToSleepTime > GOTOSLEEPTIME ) {
    goToSleep();
  }
}

void powerSetup() {
  #define uS_TO_S_FACTOR 1000000ULL
  pinMode(EXTERNAL_BUTTON_PIN,OUTPUT);
  Serial.begin(115200);
  Serial.println("Wake up test");

  //esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP_SEC * uS_TO_S_FACTOR);

  esp_sleep_enable_ext0_wakeup(GPIO_NUM_25, LOW);
  
  wakeUpHandler();

}

void goToSleep() {
  digitalWrite(EXTERNAL_BUTTON_PIN,HIGH);
  gpio_hold_en(GPIO_NUM_25);
  Serial.println("Going to sleep now");
  Serial.flush();
  esp_deep_sleep_start();
}

void wakeUpHandler(){
	esp_sleep_wakeup_cause_t wakeup_reason;
	wakeup_reason = esp_sleep_get_wakeup_cause();
	switch(wakeup_reason)
	{
		case 1: Serial.println("Wakeup caused by external signal using RTC_IO"); break;
		case 2: 
      Serial.println("Wakeup caused by external signal using RTC_CNTL");
      break;
		case 3:
      break;
		case 4:
      Serial.println("Wakeup caused by timer");
      break;
		case 5:
      Serial.println("Wakeup caused by touch trigger"); 
      break;
		default:
      Serial.println("Wakeup was not caused by deep sleep");
      break;
	}
}

I made a data collector with DS3231 and the minimum consumption at rest of just the DS3231 was something around 400uA, maybe your project with 70uA is not that far from satisfactory, as long as it has a good clock accuracy. The DS3231 consumes a lot, but it's worth it due to the stability of the time count over the months.

Hi,
I need the board to work on 5-10uA, these are the requirements, that was fulfilled until now.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.