ESP32-CAM Pinout: Complete GPIO Reference Guide
The ESP32-CAM is one of the most popular ESP32 development boards, combining an ESP32-S chip with a camera module (OV2640), PSRAM, and an SD card slot in a compact, low-cost package. However, its pinout differs significantly from standard ESP32 dev boards — many GPIOs are reserved for the camera interface.
ESP32-CAM Full Pinout Table
| Pin # | Function | Notes |
|---|---|---|
| GPIO0 | Camera XCLK / Boot mode select | Strapping — LOW for flash mode |
| GPIO1 | U0TXD (Serial TX) | Used for programming and debug |
| GPIO2 | Camera output / SD card CS | Shared between camera and SD card |
| GPIO3 | U0RXD (Serial RX) | Used for programming and debug |
| GPIO4 | Camera VSYNC | Vertical sync signal from camera |
| GPIO5 | Camera HREF | Horizontal reference signal |
| GPIO12 | Camera D7 (Data bit 7) | MSB of 8-bit camera data bus |
| GPIO13 | Camera D6 (Data bit 6) | |
| GPIO14 | Camera D5 (Data bit 5) | |
| GPIO15 | Camera D4 (Data bit 4) | |
| GPIO16 | Camera D3 (Data bit 3) | |
| GPIO17 | Camera D2 (Data bit 2) | |
| GPIO18 | Camera D1 (Data bit 1) | |
| GPIO19 | Camera D0 (Data bit 0) | LSB of 8-bit camera data bus |
| GPIO21 | Camera SCCB_SDA (I2C data) | Camera configuration bus |
| GPIO22 | Camera SCCB_SCL (I2C clock) | Camera configuration bus |
| GPIO23 | Camera PCLK (Pixel clock) | Pixel clock output from camera |
| GPIO25 | Camera XCLK (Master clock) | Or use GPIO0 — configurable |
| GPIO26 | Camera PWDN (Power down) | LOW = camera active |
| GPIO27 | Camera RESET | Camera reset signal |
| GPIO32 | Flash LED control | Active HIGH — drives bright white LED |
| GPIO33 | SD card CS (Chip Select) | Or leave floating if not using SD |
Camera Interface (OV2640) — Pin Mapping
The OV2640 camera module connects to the ESP32 via an 8-bit parallel data bus and SCCB (similar to I2C) for configuration:
| Signal | ESP32-CAM Pin | Description |
|---|---|---|
| SCCB_SDA (SIOD) | GPIO21 | Camera configuration data |
| SCCB_SCL (SIOC) | GPIO22 | Camera configuration clock |
| VSYNC | GPIO4 | Vertical sync (frame start) |
| HREF | GPIO5 | Horizontal reference (line start) |
| PCLK | GPIO23 | Pixel clock (~12 MHz) |
| XCLK | GPIO0 or GPIO25 | Master clock (10–20 MHz) |
| D0–D7 | GPIO19,18,17,16,15,14,13,12 | 8-bit parallel data bus |
| PWDN | GPIO26 | Power down (LOW = active) |
| RESET | GPIO27 | Camera reset |
SD Card Interface
| SD Card Pin | ESP32-CAM Pin |
|---|---|
| CS (Chip Select) | GPIO33 |
| MOSI | GPIO14 |
| MISO | GPIO2 |
| SCK | GPIO15 |
#define.
Power Requirements
| Component | Voltage | Current (Typical) |
|---|---|---|
| ESP32-CAM (idle) | 5V input via VCC | ~80 mA |
| With camera streaming | 5V input | ~200–300 mA |
| With flash LED on | 5V input | ~350–500 mA peak |
| Deep Sleep | 3.3V (battery) | ~6 mA (higher than standard ESP32) |
#define FLASH_LED_GPIO -1).
Programming the ESP32-CAM
Since the ESP32-CAM lacks a USB-to-Serial chip, follow these steps:
- Connect FTDI adapter:
FTDI TX → ESP32-CAM U0RXD (GPIO3)
FTDI RX → ESP32-CAM U0TXD (GPIO1)
FTDI GND → ESP32-CAM GND
FTDI 5V → ESP32-CAM VCC (or 5V input) - Set GPIO0 to GND during power-up to enter flash/download mode
- Select board: In Arduino IDE, choose "AI Thinker ESP32-CAM"
- Press RESET (if your board has a button) after the upload starts
- Remove GPIO0→GND jumper after flashing, then reset to run
ESP32-CAM Schematic Block
The ESP32-CAM board layout differs from standard dev boards. Key components:
- ESP32-S — A variation of ESP32 with 4 MB PSRAM and 4 MB flash
- OV2640 camera — 2 MP camera, UXGA (1600×1200) max resolution
- PSRAM — 4 MB external RAM for camera frame buffers
- MicroSD card slot — 1-bit or 4-bit SD mode for image storage
- Flash LED — Bright white LED on GPIO32 for low-light photography
- Voltage regulator — 5V→3.3V LDO (AMS1117-3.3)
Free GPIO Pins (for your own use)
Almost every GPIO on the ESP32-CAM is tied to the camera or SD card. The truly free pins are limited:
| Free GPIO | Notes |
|---|---|
| GPIO12 (D7) | Only free if camera data bus width is reduced to 4-bit |
| GPIO13 (D6) | Same restriction as GPIO12 |
| GPIO14 (D5) | Shared with SD SCK — free if SD is disabled |
| GPIO15 (D4) | Shared with SD SCK — strapping pin, must be HIGH |
| GPIO32 | Flash LED — can be repurposed if not needed |
| GPIO33 | SD CS — free if SD is disabled |
Common ESP32-CAM Issues & Fixes
| Problem | Solution |
|---|---|
| "Camera probe failed" | Check PWDN (GPIO26) is LOW; check SCCB connections; try different XCLK frequency |
| Brownout / reset loop | Use 5V/1A+ supply; disable flash LED; add 100 µF capacitor on VCC |
| Garbled/fuzzy image | Reduce XCLK to 10 MHz; check PCLK polarity; improve power supply |
| Wi-Fi disconnects | Camera streaming uses CPU heavily — lower camera resolution or use Wi-Fi only when needed |
| SD card not detected | Check CS (GPIO33); ensure 4-bit SD not 1-bit; look for cold solder joints |
| Can't upload sketch | Hold GPIO0 LOW during power-up and press RESET at "Connecting..." phase |
🔧 Check ESP32-CAM Pin Compatibility
Our interactive pinout tool covers ESP32-CAM pin assignments. Use it to plan your next camera project.
Open Interactive Pinout