← How-Tos
electronics May 7, 2026 ◯ 3 min read

How to Use the ESP32-CAM: Video Streaming, Motion Detection, and Time-Lapse

esp32 camcameraov2640streamingmotion detectiontimelapsearduinoweb serversurveillance

Introduction

The ESP32-CAM is a tiny $6-8 development board that combines an ESP32 Wi-Fi microcontroller with an OV2640 2-megapixel camera. It can stream video over Wi-Fi, capture photos, detect motion, and even run basic face recognition โ€” all without a Raspberry Pi or computer. This guide covers the complete ESP32-CAM workflow from wiring and programming through setting up a web streaming server, building a motion-activated camera trap, and creating automated time-lapse photography. For under $10, you get a wireless camera system that rivals products costing 10x more.

What You Need

Step 1: Wiring for Programming

The ESP32-CAM has no onboard USB, so you need an FTDI adapter to program it.

FTDIESP32-CAM GNDGND TXDRX (U0R) RXDTX (U0T) 3.3V3.3V (NOT 5V) โ€”IO0 โ†’ GND (for programming mode)

Short IO0 to GND, then press RESET on ESP32-CAM to enter download mode. Remove IO0-GND short after flashing.

Step 2: Arduino IDE Setup

  1. Add ESP32 board package: File > Preferences > Additional Boards Manager URLs: https://dl.espressif.com/dl/package_esp32_index.json
  2. Tools > Board > ESP32 Arduino > AI Thinker ESP32-CAM
  3. Select correct COM port
  4. Partition Scheme: Huge APP (3MB No OTA/1MB SPIFFS) for camera apps

Step 3: Basic Camera Web Server

The ESP32 Arduino core includes a CameraWebServer example:

  1. File > Examples > ESP32 > Camera > CameraWebServer
  2. Edit the sketch: select CAMERA_MODEL_AI_THINKER
  3. Enter your Wi-Fi SSID and password
  4. Upload (remember IO0โ†’GND for programming)
  5. Open Serial Monitor at 115200 to see the IP address
  6. Browse to the IP address in your web browser

You now have a live video stream, still photo capture, and resolution controls.

Step 4: Motion Detection Camera

Compare consecutive frames to detect motion:

// Simplified motion detection logic camera_fb_t *fb = esp_camera_fb_get(); // Compare current frame with previous // If pixel difference exceeds threshold โ†’ motion detected // Save to SD card, send HTTP notification, or trigger relay

Step 5: Time-Lapse Photography

void captureTimelapse() { camera_fb_t *fb = esp_camera_fb_get(); if(fb) { char filename[32]; sprintf(filename, "/img_%05d.jpg", imageCount++); fs::File f = SD.open(filename, FILE_WRITE); f.write(fb->buf, fb->len); f.close(); esp_camera_fb_return(fb); } delay(intervalMs); // e.g., 60000 for 1 photo per minute }

Power and Heat Management

Pro Tips

Conclusion

The ESP32-CAM is the most capable wireless camera module under $10. With streaming, motion detection, SD storage, and GPIO control, it handles surveillance, wildlife monitoring, time-lapse photography, and IoT camera applications that used to require a full Raspberry Pi setup. The key challenges are stable power supply and reliable Wi-Fi signal โ€” solve those and you have a professional camera system for pocket change.