

The ESP-CAM, manufactured by ESP32 (Part ID: ESPCAM), is a low-cost, compact camera module that integrates an ESP32 microcontroller with a camera. This module is designed for wireless image capture and streaming, making it an excellent choice for IoT projects requiring surveillance, remote monitoring, or image processing capabilities. Its built-in Wi-Fi and Bluetooth functionality, combined with its small form factor, make it a versatile solution for a wide range of applications.
| Parameter | Specification |
|---|---|
| Microcontroller | ESP32 |
| Camera Sensor | OV2640 (2MP) |
| Wireless Connectivity | Wi-Fi 802.11 b/g/n, Bluetooth 4.2 |
| Flash Memory | 4 MB (PSRAM) |
| Operating Voltage | 3.3V |
| Power Consumption | ~160 mA (active), ~10 µA (deep sleep) |
| Image Resolution | Up to 1600x1200 (UXGA) |
| Interfaces | UART, SPI, I2C, PWM |
| Dimensions | 27mm x 40.5mm |
The ESP-CAM module has a total of 16 pins. Below is the pinout and description:
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | GND | Ground connection |
| 2 | 3.3V | Power supply input (3.3V) |
| 3 | IO0 | GPIO0, used for boot mode selection (connect to GND for programming mode) |
| 4 | IO2 | GPIO2, used for general-purpose I/O or camera reset |
| 5 | IO4 | GPIO4, general-purpose I/O |
| 6 | IO5 | GPIO5, general-purpose I/O |
| 7 | IO12 | GPIO12, general-purpose I/O |
| 8 | IO13 | GPIO13, general-purpose I/O |
| 9 | IO14 | GPIO14, general-purpose I/O |
| 10 | IO15 | GPIO15, general-purpose I/O |
| 11 | IO16 | GPIO16, general-purpose I/O |
| 12 | IO17 | GPIO17, general-purpose I/O |
| 13 | RXD | UART RX (serial communication input) |
| 14 | TXD | UART TX (serial communication output) |
| 15 | RST | Reset pin |
| 16 | EN | Enable pin (active high, used to enable the module) |
Below is an example of how to use the ESP-CAM to capture and stream video over Wi-Fi:
#include <WiFi.h>
#include <esp_camera.h>
// Replace with your Wi-Fi credentials
const char* ssid = "Your_SSID";
const char* password = "Your_PASSWORD";
void startCameraServer();
void setup() {
Serial.begin(115200);
// Initialize Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("\nWi-Fi connected");
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
// Initialize the camera
camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = 5;
config.pin_d1 = 18;
config.pin_d2 = 19;
config.pin_d3 = 21;
config.pin_d4 = 36;
config.pin_d5 = 39;
config.pin_d6 = 34;
config.pin_d7 = 35;
config.pin_xclk = 0;
config.pin_pclk = 22;
config.pin_vsync = 25;
config.pin_href = 23;
config.pin_sscb_sda = 26;
config.pin_sscb_scl = 27;
config.pin_pwdn = -1;
config.pin_reset = -1;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_JPEG;
if (!esp_camera_init(&config)) {
Serial.println("Camera initialized successfully");
} else {
Serial.println("Camera initialization failed");
return;
}
// Start the camera server
startCameraServer();
}
void loop() {
// Main loop does nothing; camera server handles requests
}
Wi-Fi Connection Fails:
Camera Initialization Fails:
Module Overheats:
No Serial Output:
Q: Can the ESP-CAM be powered with 5V?
A: No, the ESP-CAM requires a 3.3V power supply. Using 5V can damage the module.
Q: How do I reset the ESP-CAM?
A: Press the RST pin or momentarily disconnect the power supply to reset the module.
Q: Can I use the ESP-CAM without Wi-Fi?
A: Yes, the ESP-CAM can operate in standalone mode for image processing or local storage, but Wi-Fi is required for streaming.
Q: What is the maximum image resolution?
A: The ESP-CAM supports resolutions up to 1600x1200 (UXGA).