I'm trying to trigger a picture using the GPIO13 of an esp32-cam, AI Thinker model. I'm using that example as a base: https://randomnerdtutorials.com/esp32-cam-pir-motion-detector-photo-capture/ but instead of the PIR/Transistor combination, I'm using a press button with a pull-up resistor that pulls the GPIO13 pin down when pressed, simulating the PIR signal. I'm feeding the esp-32 cam with a 5V power supply and the button circuit with the 3.3v pin of the esp32, all grounded. All hardware, SD card and so on is tested ok, I got the right voltages and I can see the GPIO13 Pin going to ground on my scope, but I just doesn't work. Any ideas? Edit 1: I'm using the ESP32-CAM-MB USB Board

  • What is it printing on the serial output?
    – timemage
    Oct 27, 2023 at 15:59
  • I cannot watch the serial port while running this, as the board doesn't have a USB port.
    – brunobhr
    Oct 27, 2023 at 16:06
  • @brunobhr Then use your programmer board to see the serial output. The same that you're using for flashing the chip.
    – orithena
    Oct 27, 2023 at 16:20
  • You cannot run the board in flashing configuration.
    – brunobhr
    Oct 27, 2023 at 16:21
  • I don't seem to have any problem running an ESP32-CAM while looking at its serial connection. I don't understand why you are. However, you can at least make a function that blinks an LED call that from places where error messages are also printed. You can add to the question what you find out.
    – timemage
    Oct 27, 2023 at 18:56

1 Answer 1


Checking the specs of the cam board, I see that GPIO13 has the function HS2_DATA3, suggesting that the SD card is using that pin (which is also corroborated by this article.)

This may or may not be a problem, as the state of GPIO13 is only relevant for sleep/wakeup when the chip is sleeping, and only relevant for SD card access when the chip is running; but there is an external addon: your pullup resistor on the button is still there when the chip is running. The PIR module from the tutorial that you're trying to replace probably has an open collector output (floating when inactive, pulled LOW when active).

My best hunch is to get rid of the pullup resistor on your button, so that the pin is floating during SD card access.

There still is the possibility that you then interfere with the SD card data when you keep the button pressed. If that is the case, you may need to put a resistor in series with the button, so that the wake-up signal is weaker than the SD card data signal (start at 100KOhm and reduce until wake-up works).

If that isn't it, the question is lacking details. As you did not even post a description of what exactly "just does not work", first thing would be to produce a minimal sketch just to test sleep/wakeup via GPIO13 and post that here.

  • Thank you, but how does the code provided in the link deals with that? I'm just replacing a signal by another..
    – brunobhr
    Oct 27, 2023 at 14:31
  • Also, getting rid of the pullup resistor and adding any value in series doesn't change anything.
    – brunobhr
    Oct 27, 2023 at 14:34
  • And doesn't work means it's not acting as intended eg. no picture on the SD Card.
    – brunobhr
    Oct 27, 2023 at 14:35
  • The code in the example link is doing wakeup through GPIO13
    – brunobhr
    Oct 27, 2023 at 14:37
  • @brunobhr Yes, you're replacing one signal with another, but we don't know what type of signal you're replacing. The PIR from the tutorial probably provides a weak open collector output to ground, but your button originally is a strong push-pull output.
    – orithena
    Oct 27, 2023 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.