Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use ESP32-CAM: Examples, Pinouts, and Specs

Image of ESP32-CAM
Cirkit Designer LogoDesign with ESP32-CAM in Cirkit Designer

Introduction

The ESP32-CAM, manufactured by Aman Yadav, is a low-cost, low-power system on a chip (SoC) that integrates Wi-Fi and Bluetooth capabilities. It features a built-in camera module, making it ideal for image and video capture. This versatile module is widely used in IoT projects and applications requiring remote monitoring, such as home automation, surveillance systems, and smart agriculture.

Explore Projects Built with ESP32-CAM

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
ESP32 CAM Wi-Fi Controlled Camera with FTDI Programmer
Image of R: A project utilizing ESP32-CAM in a practical application
This circuit consists of an ESP32 CAM module connected to an FTDI Programmer for power and serial communication. The ESP32 CAM is programmed to capture images and stream them over WiFi, acting as a web server to provide live video feed.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32 CAM Wi-Fi Controlled Camera with FTDI Programmer
Image of ESP32 CAM: A project utilizing ESP32-CAM in a practical application
This circuit consists of an ESP32 CAM module connected to an FTDI Programmer for power and serial communication. The ESP32 CAM is programmed to capture images and stream them over WiFi, acting as a web server to provide a live video feed.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32 CAM Wi-Fi Controlled Live Video Streamer with FTDI Programmer
Image of amen: A project utilizing ESP32-CAM in a practical application
This circuit consists of an ESP32 CAM module connected to an FTDI Programmer for power and serial communication. The ESP32 CAM is programmed to capture images and stream them over WiFi, acting as a web server to provide a live video feed.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32 CAM Wi-Fi Controlled Camera with FTDI Programmer
Image of EventCAM: A project utilizing ESP32-CAM in a practical application
This circuit connects an ESP32 CAM module to an FTDI Programmer for power and serial communication. The ESP32 CAM is programmed to capture images and stream them over WiFi, acting as a web server to provide a live video feed.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with ESP32-CAM

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of R: A project utilizing ESP32-CAM in a practical application
ESP32 CAM Wi-Fi Controlled Camera with FTDI Programmer
This circuit consists of an ESP32 CAM module connected to an FTDI Programmer for power and serial communication. The ESP32 CAM is programmed to capture images and stream them over WiFi, acting as a web server to provide live video feed.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of ESP32 CAM: A project utilizing ESP32-CAM in a practical application
ESP32 CAM Wi-Fi Controlled Camera with FTDI Programmer
This circuit consists of an ESP32 CAM module connected to an FTDI Programmer for power and serial communication. The ESP32 CAM is programmed to capture images and stream them over WiFi, acting as a web server to provide a live video feed.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of amen: A project utilizing ESP32-CAM in a practical application
ESP32 CAM Wi-Fi Controlled Live Video Streamer with FTDI Programmer
This circuit consists of an ESP32 CAM module connected to an FTDI Programmer for power and serial communication. The ESP32 CAM is programmed to capture images and stream them over WiFi, acting as a web server to provide a live video feed.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of EventCAM: A project utilizing ESP32-CAM in a practical application
ESP32 CAM Wi-Fi Controlled Camera with FTDI Programmer
This circuit connects an ESP32 CAM module to an FTDI Programmer for power and serial communication. The ESP32 CAM is programmed to capture images and stream them over WiFi, acting as a web server to provide a live video feed.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications

  • Wireless surveillance cameras
  • Smart home devices
  • IoT-based image processing
  • Remote monitoring systems
  • Face recognition and object detection projects

Technical Specifications

The ESP32-CAM is a powerful module with the following key specifications:

Parameter Value
Microcontroller ESP32-D0WDQ6 SoC
Wireless Connectivity Wi-Fi 802.11 b/g/n, Bluetooth 4.2 (BLE and Classic)
Camera Module OV2640 (2MP resolution)
Flash Memory 4 MB (PSRAM)
Storage MicroSD card slot (up to 4 GB)
Operating Voltage 3.3V
Power Consumption Deep sleep: ~6mA, Active: ~160mA
GPIO Pins 9 GPIO pins (configurable for various functions)
Interfaces UART, SPI, I2C, PWM, ADC, DAC
Dimensions 27mm x 40.5mm

Pin Configuration and Descriptions

The ESP32-CAM has a total of 16 pins. Below is the pinout and description:

Pin Name Type Description
3.3V Power Power input (3.3V DC)
GND Ground Ground connection
GPIO0 I/O General-purpose I/O pin; used for boot mode selection
GPIO1 (U0TXD) UART TX UART transmit pin
GPIO3 (U0RXD) UART RX UART receive pin
GPIO4 I/O General-purpose I/O pin
GPIO12 I/O General-purpose I/O pin
GPIO13 I/O General-purpose I/O pin
GPIO14 I/O General-purpose I/O pin
GPIO15 I/O General-purpose I/O pin
GPIO16 I/O General-purpose I/O pin
GPIO33 I/O General-purpose I/O pin
RESET Input Reset pin; active low
SD_CMD SD Interface Command pin for MicroSD card
SD_CLK SD Interface Clock pin for MicroSD card
SD_DATA0 SD Interface Data pin for MicroSD card

Usage Instructions

The ESP32-CAM is a versatile module that can be used in a variety of projects. Below are the steps to get started:

1. Powering the Module

  • The ESP32-CAM requires a stable 3.3V power supply. Ensure the power source can provide sufficient current (at least 500mA).
  • Connect the 3.3V pin to the power source and the GND pin to ground.

2. Programming the ESP32-CAM

  • The ESP32-CAM does not have a built-in USB interface. Use an external USB-to-Serial adapter (e.g., FTDI module) for programming.
  • Connect the USB-to-Serial adapter as follows:
    • TX (adapter)U0RXD (ESP32-CAM)
    • RX (adapter)U0TXD (ESP32-CAM)
    • GND (adapter)GND (ESP32-CAM)
    • 3.3V (adapter)3.3V (ESP32-CAM)
  • To enter programming mode, connect GPIO0 to GND and press the RESET button.

3. Uploading Code

  • Install the Arduino IDE and add the ESP32 board package via the Board Manager.
  • Select AI-Thinker ESP32-CAM as the board in the Arduino IDE.
  • Use the following example code to capture an image and serve it via a web interface:
#include <WiFi.h>
#include <esp_camera.h>

// Replace with your network credentials
const char* ssid = "Your_SSID";
const char* password = "Your_PASSWORD";

// Camera configuration
#define PWDN_GPIO_NUM    -1
#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

void startCameraServer();

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);

  // Wait for Wi-Fi connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("\nWiFi connected");

  // Initialize the camera
  camera_config_t config;
  config.ledc_channel = LEDC_CHANNEL_0;
  config.ledc_timer = LEDC_TIMER_0;
  config.pin_d0 = Y2_GPIO_NUM;
  config.pin_d1 = Y3_GPIO_NUM;
  config.pin_d2 = Y4_GPIO_NUM;
  config.pin_d3 = Y5_GPIO_NUM;
  config.pin_d4 = Y6_GPIO_NUM;
  config.pin_d5 = Y7_GPIO_NUM;
  config.pin_d6 = Y8_GPIO_NUM;
  config.pin_d7 = Y9_GPIO_NUM;
  config.pin_xclk = XCLK_GPIO_NUM;
  config.pin_pclk = PCLK_GPIO_NUM;
  config.pin_vsync = VSYNC_GPIO_NUM;
  config.pin_href = HREF_GPIO_NUM;
  config.pin_sscb_sda = SIOD_GPIO_NUM;
  config.pin_sscb_scl = SIOC_GPIO_NUM;
  config.pin_pwdn = PWDN_GPIO_NUM;
  config.pin_reset = RESET_GPIO_NUM;
  config.xclk_freq_hz = 20000000;
  config.pixel_format = PIXFORMAT_JPEG;

  if (psramFound()) {
    config.frame_size = FRAMESIZE_UXGA;
    config.jpeg_quality = 10;
    config.fb_count = 2;
  } else {
    config.frame_size = FRAMESIZE_SVGA;
    config.jpeg_quality = 12;
    config.fb_count = 1;
  }

  // Initialize the camera
  esp_err_t err = esp_camera_init(&config);
  if (err != ESP_OK) {
    Serial.printf("Camera init failed with error 0x%x", err);
    return;
  }

  // Start the camera server
  startCameraServer();
  Serial.println("Camera ready! Use the IP address to connect.");
  Serial.println(WiFi.localIP());
}

void loop() {
  delay(10000);
}

4. Accessing the Camera

  • After uploading the code, open the Serial Monitor to find the ESP32-CAM's IP address.
  • Enter the IP address in a web browser to view the camera feed.

Important Considerations

  • Ensure the power supply is stable to avoid unexpected resets.
  • Use a heat sink if the module becomes too hot during operation.
  • Avoid connecting GPIO pins directly to 5V logic devices, as the ESP32-CAM operates at 3.3V.

Troubleshooting and FAQs

Common Issues

  1. Camera Initialization Failed

    • Ensure the camera module is properly connected to the ESP32-CAM.
    • Verify the camera configuration in the code matches the hardware.
  2. Wi-Fi Connection Fails

    • Double-check the SSID and password in the code.
    • Ensure the Wi-Fi network is within range.
  3. Module Overheating

    • Use a heat sink or improve ventilation around the module.
  4. Serial Communication Errors

    • Verify the connections between the USB-to-Serial adapter and the ESP32-CAM.
    • Ensure the correct COM port and baud rate (115200) are selected in the Arduino IDE.

FAQs

Q: Can the ESP32-CAM be powered via USB?
A: No, the ESP32-CAM does not have a USB port. Use a 3.3V power source or a USB-to-Serial adapter.

Q: What is the maximum resolution of the camera?
A: The OV2640 camera supports a maximum resolution of 1600x1200 (UXGA).

Q: Can I use the ESP32-CAM for face recognition?
A: Yes