The AI-Thinker ESP32-CAM packs an ESP32-S and OV2640 camera into a footprint that costs around $6, but its 16 usable GPIOs are heavily restricted by the camera bus, PSRAM, and boot strapping requirements. Before you solder headers or wire up external relays, you need to know exactly which pins will boot the board and which will cause a silent brownout. Here is the definitive hardware map.
The Complete ESP32-CAM Pinout Reference Table
The standard AI-Thinker ESP32-CAM features two rows of 8 pins. The table below maps the physical header position to the internal ESP32-S GPIO, noting the critical boot constraints defined in the Espressif Hardware Design Guidelines.
| Header Position | GPIO | Primary Function | Boot / Strapping Constraint | Safe for General I/O? |
|---|---|---|---|---|
| Left 1 (Top) | 5V | Power Input (USB/Ext) | N/A | Power only |
| Left 2 | GND | System Ground | N/A | Ground only |
| Left 3 | GPIO 12 | General I/O / Touch 5 | Must be LOW at boot (Selects 3.3V flash) | Use with caution |
| Left 4 | GPIO 13 | General I/O / Touch 4 | None | Yes |
| Left 5 | GPIO 15 | General I/O / Touch 3 | Must be HIGH at boot (Enables boot logs) | Yes (with pull-up) |
| Left 6 | GPIO 14 | General I/O / Touch 6 | None | Yes |
| Left 7 | GPIO 2 | General I/O / Touch 2 | Must be LOW or Float at boot | Yes |
| Left 8 (Bot) | GPIO 4 | Camera / Flash LED | None | Yes (shares with flash) |
| Right 1 (Top) | 3V3 | 3.3V LDO Output | N/A | Power out (Max 500mA) |
| Right 2 | GND | System Ground | N/A | Ground only |
| Right 3 | GPIO 0 | Boot Mode Select | LOW = Bootloader, HIGH = Normal Boot | No (Use for flash only) |
| Right 4 | GPIO 16 | PSRAM Chip Select | Tied to 4MB PSRAM | No (Will crash camera) |
| Right 5 | GPIO 3 (RX) | UART0 RX | None | Yes (Avoid during serial) |
| Right 6 | GPIO 1 (TX) | UART0 TX | None | Yes (Avoid during serial) |
| Right 7 | GND | System Ground | N/A | Ground only |
| Right 8 (Bot) | EN (RST) | Chip Enable / Reset | Must be HIGH to run | Reset only |
Rows Makers Get Wrong (And How to Avoid Bricking Your Board)
The ESP32-CAM is notorious for silent failures when strapping pins are violated or power rails are overloaded. Based on the AI-Thinker official schematics, here are the most common hardware traps.
- GPIO 16 (The PSRAM Trap): Makers often see GPIO 16 available on the header and wire a PIR sensor to it. Because GPIO 16 and 17 are hardwired to the 4MB PSRAM chip select and clock lines, toggling this pin will instantly corrupt camera memory allocations, causing the ESP32 to throw a
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). - GPIO 0 (The Bootloader Lock): If you wire a relay module to GPIO 0 and the relay defaults to a LOW state on power-up, the ESP32-CAM will boot into the UART bootloader instead of running your firmware. Always use GPIO 13 or 14 for relays.
- GPIO 12 (The Flash Voltage Killer): This is a critical strapping pin. If GPIO 12 is pulled HIGH during boot, the ESP32 switches its internal flash voltage regulator from 3.3V to 1.8V. Because the AI-Thinker board uses a 3.3V SPI flash chip, this will cause immediate brownouts and boot loops.
- The 5V Rail Current Limit: The onboard AMS1117-3.3 LDO can theoretically pass 800mA, but it lacks adequate heatsinking on this tiny PCB. During 802.11b WiFi transmission, the ESP32 draws up to 450mA. If you power a 5V servo from the 5V header pin while the camera and WiFi are active, the LDO will overheat and trigger thermal shutdown.
External Wiring Standards: IEC vs NEC Color Codes for Peripherals
While the ESP32-CAM silicon is universal, the external DC power supplies, relay modules, and AC-DC buck converters you wire to its GPIOs must follow regional electrical color standards. Standardizing your Dupont and JST wire colors prevents catastrophic 12V-to-3.3V logic shorts. Below is the regional breakdown for peripheral wiring based on All About Circuits standard references.
| Wire Function | IEC 60446 (EU / Global) | NEC (US / Canada) | Old UK (Pre-2006) |
|---|---|---|---|
| DC Positive (+5V / +12V) | Brown (or Red) | Red | Red |
| DC Negative / GND | Blue (or Black) | Black | Black |
| AC Line (Hot) to Buck Converter | Brown | Black (or Red) | Red |
| AC Neutral to Buck Converter | Blue | White (or Gray) | Black |
| Earth Ground (Chassis) | Green/Yellow Stripe | Green (or Bare) | Green/Yellow |
| Signal / GPIO Logic | Yellow or Orange | Yellow or Orange | Yellow |
Note: When wiring a 12V relay module to the ESP32-CAM's GPIO 14, use Yellow/Orange for the logic signal wire, Red for the relay VCC (tied to the external 5V rail, not the ESP32 3V3 pin), and Black for GND.
Reading Faded Silkscreen: Identifying Pins Without Markings
The white silkscreen on budget ESP32-CAM clones frequently rubs off after a few breadboard insertions. If your markings are gone, do not guess. Use these physical landmarks and multimeter tests to safely map the board:
- Establish Orientation: Hold the board so the metal RF shield and the U.FL antenna connector are pointing up, and the camera ribbon connector is pointing down. The left row is your 5V/GND bank; the right row is your 3V3/UART bank.
- Find the Grounds via Continuity: Set your multimeter to continuity mode. Place the black probe on the large metal RF shield can (which is tied to system ground). Touch the red probe to the header pins. The pins that beep are your GND pins (Left-2, Right-2, and Right-7).
- Identify the 5V Pin: The top-left pin (closest to the antenna hinge) is always 5V. The top-right pin is always 3V3. You can verify this by powering the board via USB and measuring DC voltage from the known GND pins to the top corners.
ESP32-CAM Pinout FAQ
Can I use GPIO 16 for a standard sensor on the ESP32-CAM?
No. On the AI-Thinker ESP32-CAM, GPIO 16 and GPIO 17 are permanently routed to the 4MB PSRAM chip. If you initialize a sensor on GPIO 16, you will interfere with the PSRAM chip select line. When the camera driver attempts to allocate frame buffers in PSRAM, the bus will collide, resulting in a hard crash or corrupted JPEG output. Use GPIO 13 or 14 for external digital sensors instead.
Why does my ESP32-CAM brownout when using the 5V pin?
The ESP32-CAM does not have a dedicated 5V regulator; it relies on the external 5V you feed it to power the onboard AMS1117-3.3 LDO. If your USB cable has high resistance (common with cheap, thin-gauge micro-USB cables), the voltage at the board's 5V pin can drop below 4.5V during WiFi transmission spikes. The AMS1117 then drops out of regulation, the 3.3V rail sags to ~2.8V, and the ESP32 triggers a brownout reset. Always use a short, 20 AWG or thicker USB cable, or feed 5V directly to the header pins from a high-quality bench supply.
Which pins are strictly safe for I2C and PWM on the ESP32-CAM?
For I2C, the safest pins are GPIO 14 (SDA) and GPIO 15 (SCL). Neither of these pins has conflicting strapping requirements that interfere with I2C pull-up resistors, provided GPIO 15 has a stable HIGH state at boot. For PWM (like driving a dimmable LED or servo), GPIO 2 and GPIO 13 are excellent choices. Avoid using GPIO 4 for PWM, as it is hardwired to the onboard high-intensity flash LED and will cause your external PWM signal to strobe the camera flash.






