Page 1 of 1

Deep Sleep issue

Posted: Fri Feb 01, 2019 3:41 pm
by jagpreetw
Hi

Can someone check my code for deep sleep. I am unable to get it below 9mA. Please help

#define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP 3 /* Time ESP32 will go to sleep (in seconds) */

RTC_DATA_ATTR int bootCount = 0;

int GREEN_LED_PIN = 25;
int YELLOW_LED_PIN = 26;

void setup(){

pinMode(GREEN_LED_PIN,OUTPUT);
pinMode(YELLOW_LED_PIN,OUTPUT);
delay(500);

if(bootCount == 0) //Run this only the first time
{
digitalWrite(YELLOW_LED_PIN,HIGH);
bootCount = bootCount+1;
}else
{
digitalWrite(GREEN_LED_PIN,HIGH);
}

delay(3000);

digitalWrite(GREEN_LED_PIN,LOW);
digitalWrite(YELLOW_LED_PIN,LOW);

esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
esp_deep_sleep_start();
}

void loop(){

}

Re: Deep Sleep issue

Posted: Sun Feb 03, 2019 4:04 pm
by jubueche
What board do you have? Here: https://github.com/espressif/esp-idf/bl ... ple_main.c it states that you need to isolate the pin GPIO12 from the circuit in order to minimize current consumption. This applies to eg Wrover kit.
Quite often the current is high on dev boards (eg Adadfruit Huzzah) since there are other components on there consuming constant current like eg the UART bridge.