Skip to content

GPIO Pinout

The ESP32-CAM (AI-Thinker) has severe GPIO constraints. The OV2640 camera claims 15 pins, the SD card claims 6, and PSRAM uses GPIO16.

GPIOFunctionNotes
0XCLKAlso BOOT pin — pull LOW to enter flash mode
5VSYNC
18PCLK
19D7
21D6
22D5
23D4
25D3
26D2
27D1
32PWDNCamera power down control
34D0Input only
35HREFInput only
36SIOC (SCL)Input only
39SIOD (SDA)Input only
GPIOFunctionNotes
2DATA0Also affects boot (must be LOW or floating)
4DATA1Also connected to onboard LED flash
12DATA2Must be LOW during boot
13DATA3
14CLK
15CMD
GPIOFunctionNotes
16PSRAM CS#Not available — connected to PSRAM chip select
GPIODefault FunctionAvailability
1U0TXD (Console TX)Available if serial console is sacrificed
3U0RXD (Console RX)Available if serial console is sacrificed
13SD DATA3Available if SD card uses 1-bit mode or is disabled
14SD CLKAvailable if SD card is disabled
Section titled “LoRa UART: Option 1 — GPIO 1/3 (recommended for production)”

Repurpose the programming/console UART for LoRa communication.

#define LORA_UART_NUM UART_NUM_0
#define LORA_UART_TX_PIN GPIO_NUM_1
#define LORA_UART_RX_PIN GPIO_NUM_3

Pros:

  • Pins are already wired and physically accessible
  • Keeps PSRAM and SD card fully available
  • Clean hardware design

Cons:

  • No serial console output for debugging
  • Must disconnect LoRa module to flash via UART
  • Requires OTA for field updates

LoRa UART: Option 2 — GPIO 13/14 (development alternative)

Section titled “LoRa UART: Option 2 — GPIO 13/14 (development alternative)”

Use SD card pins for UART.

#define LORA_UART_NUM UART_NUM_1
#define LORA_UART_TX_PIN GPIO_NUM_13
#define LORA_UART_RX_PIN GPIO_NUM_14

Pros:

  • Keeps serial console for debugging
  • Can still flash normally via UART

Cons:

  • Loses SD card functionality (or must use 1-bit mode, losing GPIO13)
  • GPIO14 shared with SD CLK
ESP32-CAM RYLR896/998
───────── ───────────
GPIO1 (TX) ──────▶ RXD
GPIO3 (RX) ◀────── TXD
3.3V ──────────── VDD
GND ───────────── GND