esp32.diy

ESP32-CAM Webserver: Build a Wi-Fi Streaming Camera

Oct 11, 2026 · 6 min read

Intermediate 1.5k stars 389 forks C LGPL-2.1 Updated 2024-12-06

Live MJPEG stream from an ESP32-CAM catching two cats — the default simple viewer in action.

TL;DR esp32-cam-webserver transforms the official Espressif camera example into a practical, configurable Wi-Fi webcam with a browser-based UI, OTA firmware updates, and on-board lamp control. Flash it to an AI-Thinker ESP32-CAM and you have a live MJPEG stream you can embed in robots, monitoring rigs, or any project that needs remote eyes.
What you need
  • AI-Thinker ESP32-CAM
  • OV2640 camera module
  • OV3660 camera module
  • WRover Kit
  • ESP Eye
  • M5Stack ESP32 camera module
  • FTDI Friend 3.3 V serial adapter
BoardAI-Thinker ESP32-CAM (also WRover Kit, ESP Eye, M5Stack)
FrameworkArduino (ESP32 core 2.0.2)
LanguageC
LicenseLGPL-2.1
DifficultyIntermediate
Latest Releasev4.0 (2022-03-14)

What You Will Build — and an Honest Warning

This project gives you a self-contained Wi-Fi webcam server running on an ESP32-CAM module. Point a browser at the board's IP address and you get a live MJPEG video stream, camera controls (resolution, quality, white balance, and more), on-board lamp brightness, image rotation, a standalone full-screen stream viewer, and over-the-air (OTA) firmware updates — all without any cloud service or external server.

Before you commit time and parts, read the notice at the top of the repository: this sketch is described by its author as old and rather obsolete. It targets ESP32 Arduino core 2.0.2 specifically, and will not build correctly against newer core versions. If you need a project built on a current toolchain, the repository suggests looking for alternatives. That said, the sketch remains popular, is actively discussed in its forum, and works reliably within its stated constraints. It is a solid choice for learning, for retrofitting a robot or 3D printer with a camera, or for any build where you already have an AI-Thinker ESP32-CAM on hand and want results quickly.

Wiring diagram for connecting an FTDI serial adapter to the AI-Thinker ESP32-CAM for first-time programming.\2
Wiring diagram for connecting an FTDI serial adapter to the AI-Thinker ESP32-CAM for first-time programming.
Arduino IDE board configuration: select ESP32 Dev Module, enable PSRAM, and choose the Minimal SPIFFS partition scheme.\2
Arduino IDE board configuration: select ESP32 Dev Module, enable PSRAM, and choose the Minimal SPIFFS partition scheme.
The default simplified web viewer showing the stream window and essential camera controls.\2
The default simplified web viewer showing the stream window and essential camera controls.
Standalone stream viewer — no controls, resizable window, double-click for fullscreen.\2
Standalone stream viewer — no controls, resizable window, double-click for fullscreen.

What You Need

Hardware

Software

Typical use cases

Robot Camera Head

Mount the ESP32-CAM on a rover or arm and use the HTTP API to pull frames or stream live video to a control interface, giving your robot a wireless eye with no extra compute board needed.

3D Printer Monitor

Attach the module inside or above a printer enclosure and stream the build plate to a browser tab or OctoPrint. OTA updates mean you never have to physically reach the board again.

Local Security Camera

Point the module at a door, gate, or workshop bench and access the MJPEG stream from any device on your local network without any cloud account or subscription.

HTTP Camera API Node

Drive the camera programmatically from a Raspberry Pi, Home Assistant, or any HTTP-capable controller using the documented API endpoints for snapshots, resolution changes, and lamp control.

How It Works

The sketch starts a lightweight HTTP server on the ESP32. When a browser connects, it serves a single-page HTML/JavaScript UI (stored as raw text in the sketch, not compressed binary, which makes it easy to edit). The UI communicates with the camera over a documented HTTP API — the same endpoints you can call from scripts or automation tools.

The video feed is a MJPEG stream: the browser holds an HTTP connection open and JavaScript requests each new frame in turn. This means only one stream can be active at a time. If a second client tries to connect while streaming is in progress, it will time out.

On first boot the board creates a Wi-Fi access point named ESP32-CAM-CONNECT with the password InsecurePassword. Connect to it and browse to http://192.168.4.1/. For permanent use, copy myconfig.sample.h to myconfig.h in the sketch folder and fill in your home Wi-Fi credentials, a camera name, and any board-specific defaults. Because myconfig.h is your private file, it will not be overwritten when you update the sketch.

Wiring and Flashing

Wire the FTDI adapter to the AI-Thinker board

FTDI Friend AI-Thinker ESP32-CAM
RX TX
TX RX
5 V 5 V
GND GND
— GPIO0 → GND (for programming mode)

GPIO0 must be held LOW when the board powers up to enter programming mode. A jumper wire from GPIO0 to GND, connected before you apply power, is the minimum requirement. A momentary switch makes repeated flashing much less fiddly.

Arduino IDE board settings

In the IDE boards menu, select ESP32 Dev Module from the ESP32 Arduino section. Do not choose the dedicated AI-Thinker entry — it is not OTA-compatible and will cause the module to crash and reboot instead of updating.

Set these two options before compiling:

Upload sequence

  1. Ground GPIO0 and power the board.
  2. Click Upload in the IDE. When Connecting... appears in the console, reboot the ESP32 (most boards have a reset button) while keeping GPIO0 grounded.
  3. Once the progress bar completes, release GPIO0 and reboot the board normally.
  4. Open the Serial Monitor. The board will print its assigned IP address once it connects to Wi-Fi.
  5. Navigate to that IP in a browser. The settings panel will open automatically.

Subsequent uploads via OTA

After the first successful upload, the board appears in the IDE's network ports list. You can compile and upload wirelessly from that point on — no serial adapter needed.

If you configured a status LED, it gives a double flash when Wi-Fi connection begins and five short flashes on success.

Exploring the Web UI

The default view is a simplified layout showing the stream window and the most-used controls. A standalone stream viewer (no controls, resizable, double-click for fullscreen) is available at /stream. A /dump page shows detailed status information — useful for debugging and for checking whether the camera reports itself as currently streaming.

The HTTP API is documented in API.md in the repository. You can send commands directly from scripts, Home Assistant automations, a Raspberry Pi on the same network, or any robot controller that has HTTP client support. This makes the sketch useful as a camera node in a larger system rather than just a standalone viewer.

Extending the Build and Known Limitations

Ideas from the repository road map and community

Limitations to keep in mind

Verdict

esp32-cam-webserver is a well-documented, beginner-accessible starting point for adding a Wi-Fi camera to a robot or monitoring rig using the cheap AI-Thinker ESP32-CAM module. The OTA support, clean web UI, and documented HTTP API make it genuinely practical rather than just a demo. The core version lock and single-stream limit are real constraints — go in with eyes open, and if you need a project built on current tooling, follow the author's advice and look for a maintained successor.

Sources

github.comeasytarget/esp32-cam-webserver — repository & README hackaday.ioOfficial website

Facts in this article come from the project's public README and GitHub metadata at the time of writing. Images belong to their respective owners and link back to the original source.