DFRobot FireBeetle ESP32 and Deep Sleep. Turning off onboard LED and other peripherals

Hi

I'm using the standard ESP32/DeepSleep/TimerWakeUp sketch to play around with the Firebeetle ESP32 board. I've turned off the onbaord LED when awake (driven pin LOW), but when I enter deepsleep, the onboard LED is pulled high. Can someone please advise on the best method of ensuring all pins are pulled low (Or completely disabled) to ensure minimal power consumption and/or leakage when the board is in deep sleep.

I have tried using;
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
But clearly this command doesn't control the state of pins and has no effect.

I read in the Espressif docs, that GPIOs can be explicitly isolated as per this snippet from the docs available here.

=== Quote from docs ===
For example, on ESP32-WROVER module, GPIO12 is pulled up externally, and it also has an internal pulldown in the ESP32 chip. This means that in Deep-sleep, some current will flow through these external and internal resistors, increasing Deep-sleep current above the minimal possible value.

Add the following code before esp_deep_sleep_start() to remove such extra current:

rtc_gpio_isolate(GPIO_NUM_12);

=== End Quote from docs ===

I have tried to use this command for GPIO2 which on the FireBeetle is D9/Onboard LED but I'm getting a scope error.. Can anyone advise what header I need to include for these additional ESP32 commands?

rtc_gpio_isolate(GPIO_NUM_2);
yields the error
TimerWakeUp:80:3: error: 'rtc_gpio_isolate' was not declared in this scope
rtc_gpio_isolate(GPIO_NUM_2);
^~~~~~~~~~~~~~~~
C:\Users\Mat\AppData\Local\Temp\arduino_modified_sketch_369418\TimerWakeUp.ino:80:3: note: suggested alternative: 'gpio_isr_t'
rtc_gpio_isolate(GPIO_NUM_2);
^~~~~~~~~~~~~~~~
gpio_isr_t
exit status 1
'rtc_gpio_isolate' was not declared in this scope

If anyone can clarify for me I'd really apreciate the help.

Thanks,

I've managed to figure out I had to explicitly include <driver/rtc_io.h>. Not sure why as I would have thought this would have been built into all the esspressif libraries in the Arduino IDE. :man_shrugging:

Anyway, I can now hold the LED low/off during deep sleep using the following;

  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);

  gpio_hold_en(GPIO_NUM_2);
  gpio_deep_sleep_hold_en();

The LED does flash briefly at the time of wakeup. Not sure how to prevent that, but the draw will be negligable so in the absence of a suggested solution, I'll just live with it :slight_smile:

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