- LED Blink with Button
- Motion Detection Alarm System
- Simple RGB LED Controller
- Blinking LED with WebSocket Control
- Control LED Brightness using PWM
- Web Page with HTML and CSS on ESP32
- Control Multiple LEDs
- ESP32 with Bluetooth Serial Communication
- EEPROM with ESP32
- ESP32 Push Button Input: Reading Digital States
- Interfacing DHT11 Sensor
- Interfacing Ultrasonic Sensor
- Interfacing Flame Sensor
- Interfacing Sound Sensor
- Interfacing Potentiometer
- Interfacing IR Sensor
- Interfacing Servo Motor
- Interfacing Cam Wireless
- Interfacing DC Motor
- Interfacing Shock Sensor
- Interfacing Color Recognition Sensor
- Interfacing RFID Module
- TTGO LoRa32 SX1276 OLED
- Interfacing Keypad
- Interfacing Solenoid Lock
- Interfacing 16x2 LCD
- Interfacing Soil Moisture
- Interfacing MQ-7 Gas Sensor
- Interfacing Light Sleep Mode
- Interfacing Smart Light Control
- Interfacing (IoT) Weather Station
- Interfacing Web Server for Temperature Data Display
- Interfacing Home Automation System with Relay Control
- Interfacing IoT Smart Garden
- Face Recognition-Based Door Unlock System
- Interfacing Wi-Fi Jammer Detector
- Interfacing Health Band with Pulse
- Interfacing Sound Level Logger for Classrooms
- Night Vision Surveillance Camera
- Solar Panel Monitoring System
- Smart Farming Robot for Crop Surveillance
- Smart Water Quality Monitoring System
- Industrial IoT Gateway for Real-Time Monitoring
- Agriculture System with Automated Drone Control
ESP32-CAM: Wireless Camera
What is ESP32-CAM Wireless Camera?
The ESP32-CAM is a low-cost development board with an onboard camera module and Wi-Fi/Bluetooth connectivity. It can stream video over a wireless network, making it suitable for IoT surveillance, smart doorbells, facial recognition, and live monitoring applications.
Working Principle of ESP32-CAM as a Wireless Camera
The ESP32-CAM connects to a Wi-Fi network and hosts a web server that streams live video from its onboard OV2640 camera. Once powered and connected, users can access the video feed from any device on the same network using a web browser. It uses MJPEG streaming and HTTP protocols for camera preview.
- ESP32-CAM connects to the Wi-Fi network using predefined credentials.
- It initializes the camera module (OV2640) and starts a web server.
- Users access the IP address of ESP32-CAM on a browser to view the live camera feed.
- Captured frames are streamed in real-time using MJPEG over HTTP.
Formula: FPS = Number of Frames Captured / Total Time (in seconds)
Components Required
- ESP32-CAM module (with OV2640 camera)
- FTDI Programmer (3.3V)
- Jumper wires (Female to Female)
- Breadboard (optional)
- 5V Power supply or USB source
ESP32-CAM Pin Configuration
- U0R (RX): Connects to FTDI TX for programming
- U0T (TX): Connects to FTDI RX for programming
- GND: Ground connection
- 5V: Power supply input (5V)
- IO0: Pulled LOW during upload mode
Ensure IO0 is connected to GND during upload, and disconnect it before rebooting the module to start video streaming.
Wiring ESP32-CAM with FTDI Programmer
- U0R (RX) -> FTDI TX
- U0T (TX) -> FTDI RX
- GND -> FTDI GND
- 5V -> FTDI VCC (5V)
- IO0 -> FTDI GND (only during upload)
Arduino Code to Stream Video from ESP32-CAM
1#include "esp_camera.h"
2#include <WiFi.h>
3
4const char* ssid = "Your_SSID";
5const char* password = "Your_PASSWORD";
6
7void startCameraServer();
8
9void setup() {
10 Serial.begin(115200);
11 WiFi.begin(ssid, password);
12 while (WiFi.status() != WL_CONNECTED) {
13 delay(500);
14 Serial.print(".");
15 }
16 Serial.println("");
17 Serial.println("WiFi connected");
18 Serial.println("IP address: ");
19 Serial.println(WiFi.localIP());
20
21 camera_config_t config;
22 config.ledc_channel = LEDC_CHANNEL_0;
23 config.ledc_timer = LEDC_TIMER_0;
24 config.pin_d0 = 5;
25 config.pin_d1 = 18;
26 config.pin_d2 = 19;
27 config.pin_d3 = 21;
28 config.pin_d4 = 36;
29 config.pin_d5 = 39;
30 config.pin_d6 = 34;
31 config.pin_d7 = 35;
32 config.pin_xclk = 0;
33 config.pin_pclk = 22;
34 config.pin_vsync = 25;
35 config.pin_href = 23;
36 config.pin_sscb_sda = 26;
37 config.pin_sscb_scl = 27;
38 config.pin_pwdn = 32;
39 config.pin_reset = -1;
40 config.xclk_freq_hz = 20000000;
41 config.pixel_format = PIXFORMAT_JPEG;
42
43 if(psramFound()){
44 config.frame_size = FRAMESIZE_VGA;
45 config.jpeg_quality = 10;
46 config.fb_count = 2;
47 } else {
48 config.frame_size = FRAMESIZE_CIF;
49 config.jpeg_quality = 12;
50 config.fb_count = 1;
51 }
52
53 esp_err_t err = esp_camera_init(&config);
54 if (err != ESP_OK) {
55 Serial.printf("Camera init failed with error 0x%x", err);
56 return;
57 }
58 startCameraServer();
59 Serial.println("Camera Ready! Use IP to view stream");
60}
61
62void loop() {
63 delay(10000);
64}
Code Explanation (Line-by-Line)
- WiFi.begin(ssid, password);: Connects the ESP32-CAM to the specified Wi-Fi network.
- camera_config_t config;: Structure that holds all configuration for the OV2640 camera.
- esp_camera_init(&config);: Initializes the camera with the defined configuration.
- startCameraServer();: Starts the HTTP server that streams video frames over Wi-Fi.
- Serial.println(WiFi.localIP());: Prints the IP address which can be opened in a browser to view the live stream.
Applications
- Wireless surveillance and security camera
- IoT-based home automation with visual monitoring
- Smart doorbell systems
- Remote livestock or greenhouse monitoring
- Facial recognition in embedded projects
Conclusion
The ESP32-CAM module provides a compact and cost-effective solution for wireless video streaming in IoT applications. Its onboard camera and Wi-Fi connectivity make it ideal for real-time surveillance, smart monitoring, and automation projects. With simple wiring and Arduino IDE support, it's a powerful tool for developers and hobbyists alike.