I am experimenting with minimizing light sleep current using a mostly unmodified Arduino Nano ESP32 board. I haven't been able to get closer than ~3x the expected values. Below are details for anyone interested. I'd like to know if anyone has done better and if so, how. If anyone has suggestions to reduce the light sleep current, please advise.
The board is powered from a benchtop supply set at 5.0V DC connected across the VIN & GND pins on the board. 3.3V supply current at SJ1 (jumper cut) is measured using a Fluke 87 DMM. The only other modification is removal of the always-on green power LED (DL3). BT & WiFi modules are never enabled.
I've written a very simple sketch that configures all available pins as GPI with either pullup or pulldown resistors before going into light sleep mode. See code section below.
After some experimentation setting various GPIO pins as inputs with either pullup or pulldown resistors enabled, the lowest 3.3V current I've been able to achieve in light sleep is 1.27 mA. The ESP32-S3 datasheet claims 380uA (typ) current after adding the expected current for the internal 8M PSRAM. The GD25B128E SPI FLASH IC (U3) lists 14uA (typ), 50uA (max) ICC1 current - assuming the light-sleep function doesn't put the FLASH into deep power-down mode. This brings the total expected 3.3V current for the board to around 400uA which is ~3x lower than what I'm able to achieve.
Datasheet
See Table 4-9 Current Consumption in Low-Power Modes and Note 1 for Light-sleep.
I've measured the voltage of all available pins on the board using a DMM looking specifically for pins not at either 0.0V or 3.3V, but can't find anything suspicious.
/* Simple Light Sleep Test for the Ardunino Nano ESP32 board */
/* This sketch uses ESP32 GPIO pin numbering as opposed to Arduino pin numbering */
/* Set Tools->Pin Numbering: "By GPIO number (legacy)" in Arduino IDE before compiling */
/* Function to initialize all available GPIOs as inputs with either pullup or pulldown resistors */
void initGPIO()
{
pinMode(0, INPUT_PULLUP); // External green LED with pull-up
pinMode(1, INPUT_PULLDOWN);
pinMode(2, INPUT_PULLDOWN);
pinMode(3, INPUT_PULLDOWN);
pinMode(4, INPUT_PULLDOWN);
pinMode(5, INPUT_PULLDOWN);
pinMode(6, INPUT_PULLDOWN);
pinMode(7, INPUT_PULLDOWN);
pinMode(8, INPUT_PULLDOWN);
pinMode(9, INPUT_PULLDOWN);
pinMode(10, INPUT_PULLDOWN);
pinMode(11, INPUT_PULLDOWN);
pinMode(12, INPUT_PULLDOWN);
pinMode(13, INPUT_PULLDOWN);
pinMode(14, INPUT_PULLDOWN); // For unknown reasons, GPIO14 floats at a half-level if configured as input with pullup, so configure with pulldown.
// GPIO15 & GPIO16 are connected to 32kHz xtal on Nano board, we'll skip configuring them for now.
pinMode(17, INPUT_PULLDOWN);
pinMode(18, INPUT_PULLDOWN);
pinMode(19, INPUT_PULLDOWN);
pinMode(20, INPUT_PULLUP); // USB_DP
pinMode(21, INPUT_PULLDOWN); // USB_DN
// GPIO22 through GPIO25 are not present on ESP32-S3R8 SoC, so we'll skip configuring them.
// GPIO26 through GPIO37 used as octal SPI interface to internal SPI PSRAM on ESP32-S3R8 SoC and external SPI FLASH on Nano ESP32 board, so we'll skip configuring them for now.
pinMode(38, INPUT_PULLDOWN);
pinMode(39, INPUT_PULLDOWN);
pinMode(40, INPUT_PULLDOWN);
pinMode(41, INPUT_PULLDOWN);
pinMode(42, INPUT_PULLDOWN);
pinMode(43, INPUT_PULLDOWN);
pinMode(44, INPUT_PULLDOWN);
pinMode(45, INPUT_PULLUP); // External blue LED with pull-up
pinMode(46, INPUT_PULLUP); // External red LED with pull-up
pinMode(47, INPUT_PULLDOWN);
pinMode(48, INPUT_PULLDOWN); // External NFET gate for yellow LED drive with pull-down.
}
/* Simple function to blink built-in LED num_blink times with blink_delay_ms delay */
void blinkBuiltInLED(int num_blinks, uint32_t blink_delay_ms)
{
int i;
for (i=0; i<num_blinks; i++)
{
digitalWrite(LED_BUILTIN,1);
delay (blink_delay_ms);
digitalWrite(LED_BUILTIN,0);
delay (blink_delay_ms);
}
}
/**********************************************************************************************************************************/
/* Turn on the built-in LED for 10s, turn it off for 10s, flash it 3 times quickly and then enter light sleep. */
/* The system will be in light sleep for 1 minute to allow measurment of sleep current and various signal levels if needed. */
/* After 1 minute, the system will exit light sleep and the LED will flash 5 times quickly to indicate exit from light sleep. */
/* The LED will then flash slowly until reset. */
/**********************************************************************************************************************************/
void setup()
{
int i;
initGPIO(); //Initialize all availabe GPIO as input with pull-up
pinMode(LED_BUILTIN, OUTPUT); //Set pin controlling built-in LED as an output
blinkBuiltInLED(1, 10000); //Blink built-in LED at 10s delay to give time to upload new code if needed
blinkBuiltInLED(3, 250); //Blink the built-in LED 3 times at fast rate prior to initiation of light sleep
esp_sleep_enable_timer_wakeup(1 * 60 * 1000000); //Set sleep wakeup timer for 1 minute
esp_light_sleep_start(); //enter light sleep. Should stay here for 1 minute.
blinkBuiltInLED(5, 250); //Blink the built-in LED 5 times at fast rate upon exit of light sleep
while(1) // Blink built-in LED at a slow rate forever after light sleep test completed
{
blinkBuiltInLED(1, 1000);
}
}
void loop()
{
}