

The ESP32-CAM is a low-cost, low-power system on a chip (SoC) that integrates Wi-Fi and Bluetooth capabilities, along with a camera module for image and video capture. It is based on the ESP32 microcontroller and is widely used in IoT projects, smart home systems, and applications requiring remote monitoring or image processing. Its compact size and powerful features make it an excellent choice for developers looking to implement wireless video streaming, facial recognition, or surveillance systems.








| Specification | Value |
|---|---|
| Microcontroller | ESP32 Dual-Core Processor |
| Wireless Connectivity | Wi-Fi 802.11 b/g/n, Bluetooth 4.2 |
| Camera Module | OV2640 (2MP) |
| Flash Memory | 4 MB (PSRAM optional) |
| Operating Voltage | 3.3V |
| Input Voltage Range | 5V (via external power supply or USB) |
| GPIO Pins | 9 (configurable for various peripherals) |
| Image Resolution | Up to 1600x1200 (UXGA) |
| Interfaces | UART, SPI, I2C, PWM, ADC, DAC |
| Dimensions | 27mm x 40.5mm |
| Pin Name | Pin Number | Description |
|---|---|---|
| GND | 1 | Ground |
| 3.3V | 2 | 3.3V Power Supply Output |
| 5V | 3 | 5V Power Supply Input |
| GPIO0 | 4 | Boot Mode Selection (connect to GND for flash) |
| GPIO1 | 5 | UART TX (Serial Communication) |
| GPIO3 | 6 | UART RX (Serial Communication) |
| GPIO12 | 7 | Configurable GPIO Pin |
| GPIO13 | 8 | Configurable GPIO Pin |
| GPIO14 | 9 | Configurable GPIO Pin |
| GPIO15 | 10 | Configurable GPIO Pin |
| GPIO16 | 11 | Configurable GPIO Pin |
| GPIO17 | 12 | Configurable GPIO Pin |
| RESET | 13 | Reset Pin |
Below is an example of how to use the ESP32-CAM for basic video streaming. This code sets up the ESP32-CAM as a web server to stream video.
#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);
Serial.println();
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
// Camera initialization
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;
// Initialize the camera
if (esp_camera_init(&config) != ESP_OK) {
Serial.println("Camera init failed");
return;
}
// Start the camera server
startCameraServer();
Serial.println("Camera ready! Use 'http://' + IP + '/stream' to view.");
}
void loop() {
// Nothing to do here
}
By following this documentation, you can effectively integrate and troubleshoot the ESP32-CAM in your projects.