I am using an esp32-cam to stream video. As it is steaming I want to take a picture and save it to a micro SD card when motion is detected.

Hardware: ESP8266-12e, ESP32-CAM,
EKMC2604112K panasonic PIR motion sensor

I am powering the 12e and PIR with a 3.3v regulator with a 10uf smoothing cap.
I am getting the signal from the PIR on pin 13 (INPUT)on the 12e. I have a 10k ohm pull down resistor on this pin.
When pin 13 goes HIGH it sends a signal to an MQTT server to send a notification of the movement. Also when pin 13 goes HIGH it triggers Pin 5 (OUTPUT) on the 12e to go HIGH. When I do a multimeter reading of Pin 5 it reads 3.3v.

I am powering the ESP32 with a 6v regulator with 10uf smoothing cap. which outputs about 5.7v. I connect Pin 5 of the 12e to Pin 13 (INPUT) of the esp32. When Pin 5 goes high it should activate Pin 13 which then tells the camera to take a picture and save it to the MicroSD card.

When I power the whole thing up, if I don't have Pin 13 of esp32 connected, the camera streams and takes a picture about every 2 seconds and saves it to the microSD card.
If I then connect Pin 5 (12e OUTPUT) to Pin 13 (esp32 INPUT) when there is movement detected on the PIR the flash on the ESP32 lights up slightly about 500msec apart but when I check no pictures are saved to the MicroSD card.

If I power the whole thing up and I have Pin 5 connected to Pin 13 the MicroSD card is activated but there is no flash of any kind when there is movement and no pictures are taken.

I have tried an pull down resister of 10k and 20k ohms but there is no change in the outcome.

If I power the ESP32 with a FTDI 5v source with Pin 5 to Pin 13 picture is taken every 500msec. connecting to pull down pin doesn't do anything and disconnecting the pins doesn't have an effect either.

I have attached a drawing of the connections.

connections drawing

I hope this helps. I am at my wits end as what to do. If anyone can help me I would greatly appreciate it.

  • \$\begingroup\$ what is the actual problem? ... your description is somewhat unuclear ... do pictures get saved sometimes, and not saved at other times? \$\endgroup\$
    – jsotola
    Commented May 11, 2021 at 22:15
  • \$\begingroup\$ When Pin 13 on ESP32-CAM is not connected to anything camera takes pictures about every 500msec and saved to the MicroSD card. However if Pin 13 on ESP32-CAM is connected to Pin 5 on ESP8266-12e no pictures are saved, even though there is a 3.3v signal sent when motion is detected. There are slight flashes of light on camera flash on motion but no pictures are taken or saved. \$\endgroup\$ Commented May 11, 2021 at 23:27
  • \$\begingroup\$ What is the reason you're using an ESP8266-12E for what the ESP32-Cam should easily be able to handle itself? Are you using customized code or one of the ESP32-Cam examples? \$\endgroup\$
    – StarCat
    Commented May 12, 2021 at 7:22

1 Answer 1


I changed the INPUT Pin on the ESP32 from 13 to 16 and put a 33ohm pull down resistor on it and now it works great. Apparently Pin 16 is better for INPUT than Pin 13.

  • 1
    \$\begingroup\$ Why a 33 Ohm pull down? \$\endgroup\$
    – StarCat
    Commented May 12, 2021 at 7:23

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.