ESP32-CAM esp_sleep_enable_ext0_wakeup doesn't work on transition to low

On an ESP32-CAM I have a 10K resistor from Vcc to GPIO13 and push button switch to a GND pin. Wiring all ok. However the wakeup doesn't work when the button is pressed. Is this because GPIO13 is used by the sd card, which is also used in the sketch? It seems every pin on the ESP32-CAM is used by something internal.

rtc_gpio_pullup_en(GPIO_NUM_13);
rtc_gpio_pulldown_dis(GPIO_NUM_13);
rtc_gpio_hold_en(GPIO_NUM_13);
esp_sleep_enable_ext0_wakeup(GPIO_NUM_13, 0);
delay(1000);
esp_deep_sleep_start();

The camera and sdcard work when it starts but I can't even blink an LED in setup on GPIO4 which is also used by the sdcard.

I tried enabling one bit mode on the sd:

SD_MMC.begin("/sdcard", true)

but it stops the camera flash from working and doesn't fix the wakeup issue.

It actually seems to work if the button goes to the negative of the USB supply rather than GND of the ESP32-CAM. However, the flash doesn't work when the sd card is in one bit mode.

Hi, I think I have had this issue myself with the flash (was a long time ago now), I think it turned out to be that I had to set the gpio pin as output after the sd card was configured.

I changed a lot of things at the same time and it's now working.

Putting the sdcard into 1 bit mode freed up a lot of pins so I used:

VCC -> 10K resistor -> GPIO13 -> button -> GND

but it wouldn't wake on button press. I'm powering the board from a USB breakout board and it will only wake up if the button is connected to USB GND and not ESP32-CAM GND.

As for the flash, I think that was a red herring as the sdcard uses pin 4 when in 4 bit mode. In 1 bit mode it doesn't. I think the flash was actually the result of the SD_MMC module writing the photo to disk and not the camera taking the photo. That's why it no longer flashes when the sdcard is in 1 bit mode.

It's all the result of taking a tutorial at face value and it not working as it got more complex. Led to a lot of interesting research but at least I know a lot more about the ESP32-CAM now.

Just have to understand why it won't wake if the button is connected to ESP32-CAM GND. It does if it's connected to USB GND on the breakout board.

Maybe the ESP32-CAM GND is not connected as you think it is.

thanks for that. I did some more research based on your tip and it appears to be a problem with some ESP32-CAM boards:

Strange behavior with ground

if GND3 is connected to ground it will not boot

That's the problem I had. If GND3 (in the schematic in the discussion) is connected to USB GND the board won't boot so it won't wake on button press. I didn't use GND2 but I think it will work. GND1 works as that's where the USB GND is connected.

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