Skip to main content

Deep sleep

Using deep sleep on the Inkplate 4TEMPERA is key to creating a sketch that maximizes battery efficiency. Since e-Paper does not require any power to retain an image, the Inkplate 4TEMPERA draws little to no current while in deep sleep mode, allowing a sketch to run for months on battery power.

ℹ️
If all peripherals are in sleep mode, deep sleep current will be around 18µA

Simple deep sleep​

Check how deep sleep works with the example below:

#define uS_TO_S_FACTOR 1000000 // Conversion factor for micro seconds to seconds
#define TIME_TO_SLEEP 20 // How long ESP32 will be in deep sleep (in seconds)
void setup(){
// your code
///...
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); // Activate wake-up timer -- wake up after 20s here
esp_deep_sleep_start(); // Put ESP32 into deep sleep. Program stops here.
}

esp_sleep_enable_timer_wakeup()

This function enables wakeup by timer.

Returns type: int

Returns value: Returns ESP error code

Function parameters:

TypeNameDescription
uint64_ttime_in_usWakeup time in microseconds.

esp_deep_sleep_start()

This function enters deep sleep with the configured wakeup options.

Returns type: None


Wake on button press​

To wake the device using the Wake button, use the ESP32 function esp_sleep_enable_ext0_wakeup() before putting it to sleep.

// Go to sleep for TIME_TO_SLEEP seconds
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);

// Enable wakeup from deep sleep on GPIO 36 (wake button)
esp_sleep_enable_ext0_wakeup(GPIO_NUM_36, LOW);

// Go to sleep
esp_deep_sleep_start();

esp_sleep_enable_ext0_wakeup()

This function utilizes the external wakeup feature of the RTC_IO peripheral.

Returns type: int

Returns value: Returns ESP error constant

Function parameters:

TypeNameDescription
gpio_num_tgpio_numGPIO number used as wakeup source. Only GPIOs that have RTC functionality can be used.
intlevelInput level which will trigger wakeup.

Full examples​

Check out the full examples on this page and discover many more usage options below:

Inkplate4TEMPERA_Simple_Deep_Sleep

This example will show you how you can use the low power functionality of the Inkplate board.