Having trouble finding the pin assignment for my ESP32 Cam

Hey all,

I recently got an ESP32 from here and am using the example code offered by the ESP32 library by Espressif. The issue that I ran into was that I did not know which model pin assignment I needed to use out of these:

#if defined(CAMERA_MODEL_WROVER_KIT)
#define PWDN_GPIO_NUM    -1
#define RESET_GPIO_NUM   -1
#define XCLK_GPIO_NUM    21
#define SIOD_GPIO_NUM    26
#define SIOC_GPIO_NUM    27

#define Y9_GPIO_NUM      35
#define Y8_GPIO_NUM      34
#define Y7_GPIO_NUM      39
#define Y6_GPIO_NUM      36
#define Y5_GPIO_NUM      19
#define Y4_GPIO_NUM      18
#define Y3_GPIO_NUM       5
#define Y2_GPIO_NUM       4
#define VSYNC_GPIO_NUM   25
#define HREF_GPIO_NUM    23
#define PCLK_GPIO_NUM    22

#elif defined(CAMERA_MODEL_ESP_EYE)
#define PWDN_GPIO_NUM    -1
#define RESET_GPIO_NUM   -1
#define XCLK_GPIO_NUM    4
#define SIOD_GPIO_NUM    18
#define SIOC_GPIO_NUM    23

#define Y9_GPIO_NUM      36
#define Y8_GPIO_NUM      37
#define Y7_GPIO_NUM      38
#define Y6_GPIO_NUM      39
#define Y5_GPIO_NUM      35
#define Y4_GPIO_NUM      14
#define Y3_GPIO_NUM      13
#define Y2_GPIO_NUM      34
#define VSYNC_GPIO_NUM   5
#define HREF_GPIO_NUM    27
#define PCLK_GPIO_NUM    25

#elif defined(CAMERA_MODEL_M5STACK_PSRAM)
#define PWDN_GPIO_NUM     -1
#define RESET_GPIO_NUM    15
#define XCLK_GPIO_NUM     27
#define SIOD_GPIO_NUM     25
#define SIOC_GPIO_NUM     23

#define Y9_GPIO_NUM       19
#define Y8_GPIO_NUM       36
#define Y7_GPIO_NUM       18
#define Y6_GPIO_NUM       39
#define Y5_GPIO_NUM        5
#define Y4_GPIO_NUM       34
#define Y3_GPIO_NUM       35
#define Y2_GPIO_NUM       32
#define VSYNC_GPIO_NUM    22
#define HREF_GPIO_NUM     26
#define PCLK_GPIO_NUM     21

#elif defined(CAMERA_MODEL_M5STACK_V2_PSRAM)
#define PWDN_GPIO_NUM     -1
#define RESET_GPIO_NUM    15
#define XCLK_GPIO_NUM     27
#define SIOD_GPIO_NUM     22
#define SIOC_GPIO_NUM     23

#define Y9_GPIO_NUM       19
#define Y8_GPIO_NUM       36
#define Y7_GPIO_NUM       18
#define Y6_GPIO_NUM       39
#define Y5_GPIO_NUM        5
#define Y4_GPIO_NUM       34
#define Y3_GPIO_NUM       35
#define Y2_GPIO_NUM       32
#define VSYNC_GPIO_NUM    25
#define HREF_GPIO_NUM     26
#define PCLK_GPIO_NUM     21

#elif defined(CAMERA_MODEL_M5STACK_WIDE)
#define PWDN_GPIO_NUM     -1
#define RESET_GPIO_NUM    15
#define XCLK_GPIO_NUM     27
#define SIOD_GPIO_NUM     22
#define SIOC_GPIO_NUM     23

#define Y9_GPIO_NUM       19
#define Y8_GPIO_NUM       36
#define Y7_GPIO_NUM       18
#define Y6_GPIO_NUM       39
#define Y5_GPIO_NUM        5
#define Y4_GPIO_NUM       34
#define Y3_GPIO_NUM       35
#define Y2_GPIO_NUM       32
#define VSYNC_GPIO_NUM    25
#define HREF_GPIO_NUM     26
#define PCLK_GPIO_NUM     21

#elif defined(CAMERA_MODEL_M5STACK_ESP32CAM)
#define PWDN_GPIO_NUM     -1
#define RESET_GPIO_NUM    15
#define XCLK_GPIO_NUM     27
#define SIOD_GPIO_NUM     25
#define SIOC_GPIO_NUM     23

#define Y9_GPIO_NUM       19
#define Y8_GPIO_NUM       36
#define Y7_GPIO_NUM       18
#define Y6_GPIO_NUM       39
#define Y5_GPIO_NUM        5
#define Y4_GPIO_NUM       34
#define Y3_GPIO_NUM       35
#define Y2_GPIO_NUM       17
#define VSYNC_GPIO_NUM    22
#define HREF_GPIO_NUM     26
#define PCLK_GPIO_NUM     21

#elif defined(CAMERA_MODEL_AI_THINKER)
#define PWDN_GPIO_NUM     32
#define RESET_GPIO_NUM    -1
#define XCLK_GPIO_NUM      0
#define SIOD_GPIO_NUM     26
#define SIOC_GPIO_NUM     27

#define Y9_GPIO_NUM       35
#define Y8_GPIO_NUM       34
#define Y7_GPIO_NUM       39
#define Y6_GPIO_NUM       36
#define Y5_GPIO_NUM       21
#define Y4_GPIO_NUM       19
#define Y3_GPIO_NUM       18
#define Y2_GPIO_NUM        5
#define VSYNC_GPIO_NUM    25
#define HREF_GPIO_NUM     23
#define PCLK_GPIO_NUM     22

#elif defined(CAMERA_MODEL_TTGO_T_JOURNAL)
#define PWDN_GPIO_NUM      0
#define RESET_GPIO_NUM    15
#define XCLK_GPIO_NUM     27
#define SIOD_GPIO_NUM     25
#define SIOC_GPIO_NUM     23

#define Y9_GPIO_NUM       19
#define Y8_GPIO_NUM       36
#define Y7_GPIO_NUM       18
#define Y6_GPIO_NUM       39
#define Y5_GPIO_NUM        5
#define Y4_GPIO_NUM       34
#define Y3_GPIO_NUM       35
#define Y2_GPIO_NUM       17
#define VSYNC_GPIO_NUM    22
#define HREF_GPIO_NUM     26
#define PCLK_GPIO_NUM     21

Since the product listed doesn't really mention what model or pin assignment it was using, I am confused on which pin assignment I should pick, or where I could find the pin assignment for the board I was using, so I was wondering if anyone here would know how I could locate this info, or if any of the pre-existing options would suit the board I purchased.

Thanks in advance

Looks like a clone of an AI Thinker... I'd try...

CAMERA_MODEL_AI_THINKER

That was actually my train of thought, but after doing so, I've been running into the error:

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
Upload error: Failed uploading: uploading error: exit status 2

I've been pressing RST like everyone says I need to, and even holding it down but there was no difference in the output.
Would you know how I could remedy this issue?

When uploading you need:

  • a jumper between GPIO0 and GND
  • press the reset button

The upload the sketch.

Once uploaded, remove the jumper and press reset again.

I've done both, but I'm still receiving errors. Is there anything else that it might be?

I presume you are using an FTDI adapter to upload?

Can you show how you have the ESP32-CAM connected?

I am indeed using an FTDI programmer. Here's the orientation that I've connected the cam to the adapter:

Are you able to swap out the cable? I've had issues with some before.

Also.. how are you powering the ESP32-CAM? Is it through the USB 5v, or is there some other power supply?

And release ?

So when you press and release the reset button, but before attempting a program upload, there should be messages displayed in the IDE Serial monitor, what are they ?

Yea, like @srnet wrote in post #10, after pressing the button but before uploading code the monitor should display a message, what is the message?

Compilation complete.
esptool.py v3.0-dev
Serial port COM4
Connecting........

Then, I press down the button, and now after the "Connecting........" message, it starts alternating with periods and underscores:
Connecting........_____....._____....._____....._____....._____....._____....._____

I assumed that I would be powering the ESP32 through the FTDI? Would this not be the case?

That's the wrong message from the ESP32CAM

That message is indicating that the button was not pressed.

Follow instructions: before uploading code.

Repeat, before uploading code.

Repeat, before uploading code.

Repeat, before uploading code.

Got it?

Press the button, what is the message displayed on the serial monitor?

Apologies, I had been pressing it at the wrong time. Problem is, I'm receiving the same error:

--------------------------
Compilation complete.
esptool.py v3.0-dev
Serial port COM4
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
Upload error: Failed uploading: uploading error: exit status 2

This time I had pressed the button before uploading but there seems to be no change in the output.

No, that is not the Serial Monitor output

Top right of the IDE screen is the Serial Monitor button, click that to see the Serial Monitor output. Button looks like a magnifying glass.

Serial Monitor

your ESp32cam is broken.

Ah, sorry, missed that. It doesn't seem to be outputting anything, at least not on the 9600 or 115200 baud options.

Clearly.

If there is no output in the Serial Monitor, when you press and release the reset button and its 115200baud,then;

You have the serial adapter wired incorrectly.
The serial adapter is faulty.
The ESP32CAM is faulty.

Show a clear photo of your setup/connections.