ESP32-CAM AI-Thinker Board – All about GPIO Pins

This tutorial is a guide to AI thinker ESP32-CAM development board. We will discuss pinout, features, specifications and see how to get started with ESP32- CAM development board.

ESP32-CAM AI-Thinker Introduction

The world has been revolving around IoTs i.e., Internet of Things for quite a while now. From the hobbyists to the innovators, everyone is interested in Smart technology, designing different prototypes and products, and launching them in the market. ESP32 Series chips are one of the popular intelligent modules for IoTs. ESP32-CAM AI-Thinker is the advanced version of ESP8266-01 launched by Espressif with many features. The ultra-small, low-power module comes with two high-performance 32-bit LX6 CPUs with a 7-stage pipeline architecture.


ESP32-CAM has integrated with Wi-Fi, Bluetooth and can be used with OV2640 or OV7670 cameras. The ESP32 IC has high-resolution ADCs, SPI, I2C, and UART protocols for information communication. The module has an inbuilt Hall sensor, temperature sensor, and touch sensors, and watchdog timers. RTC can be operated in different modes. The module has a maximum clock frequency of 160 MHz that means the computing power up to 600 DMPIS. Furthermore, it is quite durable and reliable when it comes to internet connectivity.


ESP32-CAM AI-Thinker module has a never-ending list of applications like home automation, intelligent devices, positioning systems, security systems and perfect for IoT applications.

ESP32-CAM AI-Thinker Components

This development board is a 27*40.5*4.5 DIP style PCB Board. The following figure shows the components of the ESP32-CAM board from both top and bottom side.

AI thinker ESP32 components

ESP32-CAM AI-Thinker module consists of different parts. These areas described below:

ESP32-S Chip: The module is a main chip contains two high-performance 32-bit LX6 CPUs with a 7-stage pipeline architecture and used for all the processing and functioning.

IPEX block output: The printed IPEX connects GSM antennas to transmit signals.

Tantalum capacitor: The tantalum capacitor is majorly used on small size modules. They are durable and provide power supply filtering for fine signal quantity.

Reset button: When pressed, the reset button restarts the code executed on the module.

Voltage regulator chip: The voltage regulator chip on the module maintains the output voltage despite the fluctuations in the input supply. It regulates the voltage to 3.3 volts.

PSRAM: A low-power Pseudo-Random Access Memory of 4MB is incorporated in the module for fast processing of the instructions. It helps the camera to run smoothly.

TF Card Holder: ESP32 series are embedded with a micro-SD card holder to store the data. All the transmission takes place through the Serial Peripheral Interface.

FPC connector: To mount the camera, the ESP32 module contains a flexible printed circuit connector. Their fine pitch is responsible for signal reliability.

Flash Light: The flash lamp produces electric pulses which work as a flash for the camera so that it can capture clear images.

Schematic Diagram

ESP32 CAM AI thinker schematic diagram
Image Credit

ESP32-CAM AI-Thinker Pinout

The following diagram shows the pinout of the ESP32-CAM AI-Thinker Module:

ESP32 CAM Pinout AI thinker

This section describes the pinout of the ESP32-CAM AI-Thinker Module. The ESP32-S chip has a total of 34 pins but only 16 pins are exposed to the pinout headers.

Power pins

The module has three ground pins and two positive power supply pins such as 5V and 3.3V pins. These pins can be used to power the ESP32-CAM AI-Thinker module. But it is recommended not to power this development bord with 3.3V pin, it does not provide stable power to board.

ESP32 CAM power supply pins

Power Output Pin

ESP32-CAM also provide one power output pin as shown in yellow color in the pinout diagram above. This is a VCC pin that can output either 5V or 3.3V. According to Jumper connection on ESP32-CAM, VCC pin provides 3.3V output.

GPIO33 – Built-in Red LED

AI-Thinker board also has one onboard RED LED. You can find this LED next to the reset button. This built-in red LED is connected with GPIO 33 in logic low active state. That means if we want to turn on LED, we drive GPIO 33 to logic low level. Similarly, to turn off LED, we drive GPIO 33 to active high state.

ESP32 CAM built-in LED

UART pins

Almost all the GPIO pins of ESP32-CAM are multi-purpose pins. GPIO1 and GPIO3 has alternate functions for the serial transmission and reception of the data for UART port, respectively. AI-Thinker board does not come with onboard programmer. Therefore, these UART pins are used to program and communicate with the PC to upload the code.

Pin NameFunction
GPIO1U0TXD (UART Transmission pin)
GPIO3UORXD (UART Reception pin)

We can use an FTDI cable to flash code to ESP32-CAM by using UART pins. You can read this article on how to use USB to serial FTDI cable:

GPIO0 pin – Flash Mode Selection

This pin determines the mode of the module such as flash or normal mode. In flashing mode, GPIO0 is pulled low which means it should be connected to the ground. When GPIO0 is connected to ground, ESP32-CAM goes into flashing mode and we can flash the code. After flashing the code to board, we should disconnect the GPIO0 from the ground to run the module normally or we say it enters the normal mode.

  • GPIO0 connected to ground à ESP32-CAM in Flash Mode
  • GPIO0 not connected to ground à ESP32-CAM in normal program execution mode

SD Card pins

As discussed in the previous section, ES32-CAM board has built-in SD card connector which can used to connect an SD card. These GPIO pins use for connections with micro SD cards while reading and writing data to SD card. These GPIO pins can be used as typical I/O pins if the SD card is not in use.

Pin NameSD Card Connection
GPIO2Data0 pin(RTC & ADC supported)
GPIO4/Flash lampData1 pin(RTC & ADC supported)
GPIO12Data2 pin(RTC & ADC supported)
GPIO13Data3 pin(RTC & ADC supported)
GPIO14CLK(RTC & ADC supported)
GPIO15CMD(RTC & ADC supported)

Note: If you are not using SD card in your ESP32-CAM project, you can use these GPIO pins for other functions such as digital input, digital output, ADC, and RTC.

You can find more features of these pins in the following article:

Flash LED pin  

ESP32-CAM also has built-in high brightness flashlight. This flashlight can be used with a Camera while taking picture in darkness. GPIO4 is connected to an embedded flash lamp which (if programmed so) flashes when the camera captures the pictures. GPIO4 is also connected to the SD card, so it might cause difficulty accessing both at the same time. That means flashlight may glow unwanted while using SD card.

ESP32 CAM Flash light

If you want to stop the flashlight from lighting up when using SD card, you can instruct the program to do not use GPIO4 as a data line for SD card by using this line:

SD_MMC.begin("/sdcard", true)

Camera Connector Pins

The following table lists the GPIO pins connections with OV2640 Camera and their respective variable names that we will use in our program.

OV2640 CAMERAESP32Variable name in code

ESP32-CAM Features and Specifications

The technical details and specifications of this extremely handy module are listed below:

ModuleESP32-CAM AI-Thinker
Processor32-bit LX6
Architecture7-stage pipeline
SPI Flash32-bit
Operating Temperature-200C – 850C
Operating Voltage5 Volts
UART Baud Rate115200 bps
Wi-fi802.11 b/g/n
Power Transmission802.11 b: 17±2 dBm at 11Mbps 802.11 g: 14±2 dBm at 54Mbps 802.11 n: 13±2 dBm at MCS7
BluetoothBluetooth 4.2 BR/EDR with BLE standards
Support TF Card4G Maximum Support
Output Image FormatBMP, GRAYSCALE, JPEG(OV2640 support only)
Spectrum Range2412 MHz – 2484 MHz
On Board PCB Antenna Gain2dBi
Input/Output port9
Reception SensitivityCCK, 1 Mbps: -90dBm CCK, 11 Mbps: -85dBm 6 Mbps (1/2 BPSK): -88dBm 54 Mbps (3/4 64-QAM): -70dBm MCS7 (65 Mbps, 72.2 Mbps): -67dBm 
Power DissipationTurn off the flash: 180mA at 5V Turn on the flash with maximum brightness: 310mA      at 5V Deep-sleep mode: the lowest power consumption can reach 6mA@5V Modem-sleep mode: < 20mA at 5V Light-sleep mode: <6.7mA at 5V
Clock Frequency240 MHz (max)
Package TypeDIP-16
Package Size27*40.5*4.5(±0.2)mm

Detailed Features

Some the additional prominent features of this amazing module are described as under:

  • Supports Smart Config/AirKiss Technology and has capacitive GPIO pins.
  • 18 high-resolution analog-to-digital converters.
  • 2 digital-to-analog converters with a resolution power of 8-bits.
  • Consumes power up to 600 DMIPS at 160 MHz of clock frequency.
  • The module has high-speed WiFi with a speed of 2.4 GHz.
  • ESP32 module contains 2 I2C, 3 SPI, and 3 UART for fast serial transmission.
  • It also has 16 PWM channels to output pulse-width modulated signals.
  • It has a TF holder and supports WiFi image upload.
  • ESP32 supports 4 different operating modes i.e s STA/AP/STA+AP
  • Embedded Lwip and FreeRTOS. 
  • RTC supported to wake up the module from Deep-sleep mode.
  • A built-in flashlight is provided in the module to produce flashes to capture bright clear images.
  • A CMOS technology IC has an adjustable output power amplifier
  • ESP32 has a low duty cycle to reduce power consumption making it power efficient.

How to program ESP32-CAM AI-Thinker?

Unlike an ESP32 dev kit or other ESP32 development boards, the ESP32-CAM AI-Thinker board does not have any built-in programmer to burn the code to the ESP32-S chip. Therefore, to upload the code, we must use an external USB to UART Converter or an FTDI Programmer.

The following diagram shows the connection between ESP32-CAM and an FTDI cable. We use UART pins of ESP32-CAM to connect with an FTDI cable.

ESP32 CAM connections with FTDI cable
5VVCC (5V)

In next tutorial, we will see how to install ESP32-CAM add-on in Arduino IDE and how to upload sample example code to AI-Thinker board using FTDI cable.

In Summary, in this tutorial, we learned the followings:

  • ESP32-CAM AI-Thinker Introduction, peripherals and applications
  • Pinout Diagram
  • Power pins and Power Output Pin
  • GPIO33 – Built-in Red LED
  • UART pins
  • GPIO0 pin – Flash Mode Selection
  • SD Card pins
  • Flash LED pin  
  • Camera Connector Pins
  • How to program ESP32-CAM AI-Thinker?

In the coming tutorial, we will see how to create a web server with ESP32-CAM with live video streaming.

Related ESP32 Tutorials:

9 thoughts on “ESP32-CAM AI-Thinker Board – All about GPIO Pins”

  1. Following on from this, does this mean that if a sd card AND external rtc is present, I could get away with using the rtc lines as long as I’m not actively reading /writing to the card at the time…..? In other words I want to use an external rtc to periodically wake up the esp32-cam, which will then do various things including access the card….. is that doable?

  2. Gostaria de saber se é possível usar o Wifimanager ou o Autoconnect com o esp32-cam e se há já, algum código para isto? Obrigado

  3. HI!
    Thanks you this clear tutorial.
    I want take photos and save in SD card withou flash.
    You said: SD_MMC.begin(“/sdcard”, true)
    Can you explain more or link to an example?
    Thanks you very much.

  4. I will use this camera in a place where I can’t reach it easy.
    So, I added some watchdogs:
    * Check if WiFi is still active
    * Check if ping is lower than 400ms
    * Check if ping is higher than 0.1ms
    When they fails I restart : ESP.restart();

    But very often the camera was not found after the restart.
    My first idea was to trigger a reset of the camera, but the ping CAM_RST is just connected to an power on reset circuit.
    But the camera had a second internal power on reset check. The external PWDN (power down) will check if the power supply (CSI_2.8V and CSI1.2V) are high enough.
    This pin is also not reachable from GIOP. But this can be triggered when the power supply (CSI_xx) went down.
    The GIOP32 drives Q2 which powers the CSI voltage regulators.
    To switch off the CSI voltage, just set the GOIP32 to High: digitalWrite(32,HIGH);
    After doing this the ESP.restart(); will done.
    Since using this, the camera module always come back.

    Comments are welcome.
    See below the code.


    float last_time_ms=0;
    float avg_time_ms=0;
    int WifiCount=0;
    bool ret;

    void setup() {
    pinMode(33, OUTPUT); //Rote LED
    pinMode(4, OUTPUT); //Blitzlicht
    pinMode(32, OUTPUT); //Camera Power

    void loop() {

    if (WiFi.status()!= WL_CONNECTED){
    Serial.println(“Reboot because of lost WiFi”);

    ret =;
    avg_time_ms = Ping.averageTime();
    if ((avg_time_ms+last_time_ms)>400) {
    Serial.println(“Reboot because of high Ping”);

    if (avg_time_ms>last_time_ms) {
    last_time_ms = avg_time_ms;

    if (avg_time_ms <=0.10) {
    Serial.println("Reboot because of low Ping");

  5. I make a face recognition system using the esp32-cam web server. Each enrolled faces will be have their own face id which are consist of 1,2,3,4 and so on. I save the face id in a variable called FACE_ID. Is it possible for me to send the variable value to esp8266 via serial communication or wifi server?

  6. I notice in your wiring diagram, the FTDI has ground connected to the pin beside GPIO1. On new model ESP32 CAM this pin is NOT ground. It is connected to the ESP EN pin for ‘reset’ function. Best to use one of the other ‘GND’ pins.

  7. The GPIO 12 and 13 can be used simultaneously with the SD card, it is simply necessary that the sd card must be used on 1 bits so just D0 and not from D0 to D3, the transfer times are also quite correct in this mode. If you want to make it an effective motion detector that sends you a smartphone notification there is the pycameresp project, which works perfectly well and is very reliable.


Leave a Comment