esp32.diy

ESP32-CAM Webcam Firmware: Build an OV2640 Streaming Camera

Nov 22, 2026 · 7 min read

Intermediate 159 stars 44 forks C No license Updated 2021-09-10

The esp32-cam web interface, with live preview and camera, Wi-Fi and network settings editable from the browser.

TL;DR bkeevil/esp32-cam is an ESP-IDF firmware that turns an ESP32 camera board with an OV2640 sensor into a network webcam with a browser-based interface, persistent settings, optional LED flash control and an optional SSD1306 OLED status display. You configure your board in menuconfig, build and flash with idf.py, then grab snapshots and a live MJPEG stream from simple HTTP URLs.
What you need
  • ESP32 based camera board
  • OV2640 camera module
  • High power LED flash (optional)
  • SSD1306 OLED display (optional)
  • Motion detector (optional)
  • External SPI RAM (optional)
BoardESP32 camera boards with OV2640
FrameworkESP-IDF (release/v4.0 branch)
LanguageC
LicenseEspressif MIT License
DifficultyIntermediate
StatusNo longer actively maintained, PRs still processed

What you will build and why it is useful

This guide walks you through flashing a standalone webcam firmware onto an ESP32 camera board fitted with an OV2640 sensor. When you are done, the board joins your Wi-Fi network (or creates its own access point), serves a web interface for configuration, and exposes a still-image capture endpoint and a live stream that any browser or network tool can consume.

The project started life as one of the example programs for Espressif's ESP-WHO face recognition framework. The author stripped out the face detection and recognition code to free up resources and remove the dependency on external SPI RAM, then added a set of practical features that turn the example into a usable device:

For robotics and monitoring projects this is a handy building block: a cheap camera node that you can drop onto a rover, point at a workbench, or mount in a test rig, and then pull frames from over HTTP. Keep expectations realistic, though. The README is clear that ESP32 resources for cameras are very limited and you should not expect the full resolutions and frame rates the OV2640 is capable of.

What you need

Hardware

Software

The board you are using is selected under Camera Web Server -> Camera Pins in menuconfig, so you do not need to hand-edit pin definitions for supported boards.

Typical use cases

Rover first-person view

Mount the camera on a small robot and pull the port 81 MJPEG stream into your control software for a live driver's-eye view.

Snapshot monitor

Poll the /capture endpoint from a script to grab stills of a 3D printer, bench or doorway at intervals.

Headless field camera

Add an SSD1306 OLED to read Wi-Fi status and frame rate directly on the device while testing away from a laptop.

Lit inspection camera

Use the LED intensity endpoint to switch on the onboard flash when inspecting dark enclosures or machinery.

How it works

Wi-Fi startup sequence. On boot, the firmware attempts to connect to Wi-Fi in a fixed order:

  1. Using the SSID and password stored in non-volatile storage (NVS).
  2. Using the default station (STA) SSID and password you provided in menuconfig.
  3. After five failed attempts in STA mode, it falls back to SoftAP mode and acts as its own access point.

In SoftAP mode you connect to the camera's network and point a browser at 192.168.4.1. There is no username or password. From the web interface you pick a Wi-Fi SSID, enter the password, and optionally set a static IP address and other network settings. Reboot the device for the new settings to take effect; they are then saved in NVS and used on the next boot.

Camera services. Once the camera is on your network, three URLs do the heavy lifting:

The stream runs on port 81, separate from the main web interface, which is a useful detail when you are writing a client or configuring a firewall. The LED control endpoint accepts an intensity from 0 to 255.

Extras. An mDNS server announces the camera's services on the local network. If NTP is enabled in menuconfig, the firmware syncs the RTC with your chosen NTP server and timezone. With an SSD1306 display enabled, the OLED shows information about the Wi-Fi connection and the current frame rate, which is handy for a headless rover where you cannot easily open the web page.

Camera settings are also stored in NVS, so adjustments you make through the web interface survive a power cycle.

Build and flash

1. Set up the ESP-IDF environment. Follow Espressif's getting started guide to install ESP-IDF, making sure you are on the release/v4.0 branch. Then export the environment and create a project folder:

cd /home/username/esp/esp-idf
. ./export.sh
cd ..
mkdir myprojects
cd myprojects

2. Clone the repository. The --recursive flag matters because the project pulls in submodules:

git clone --recursive https://github.com/bkeevil/esp32-cam.git
cd esp32-cam

3. Compress the web assets. The stylesheet, HTML and JavaScript in main/www need to be compressed before building:

cd main/www
./compress_pages.sh
cd ../..

4. Configure the firmware. Run idf.py menuconfig from the root of the source tree. Work through these settings:

Save and exit when done.

5. Build, flash and monitor. If needed, clean first with idf.py fullclean. Then:

idf.py build
idf.py flash
idf.py monitor

The monitor output will show the Wi-Fi connection attempts described above, which is the quickest way to find the camera's IP address.

Partition table note. The author moved the partition table offset from 0x8000 to 0x18000. If you see Detected overlap at address: 0x8000 for file: partition_table/partition-table.bin, check that both sdkconfig and sdkconfig.defaults contain:

CONFIG_PARTITION_TABLE_OFFSET=0x18000

Windows 10. Use idf.py commands rather than make, launched from the ESP-IDF Command Prompt in the Start Menu. For example:

idf.py build
idf.py menuconfig
idf.py app
idf.py -p Portname app-flash

To simplify repeated builds, write your COM port to a file named build-windows-defaultcomport (no extension) and run the included PowerShell script:

echo COM15 > build-windows-defaultcomport
powershell.exe .\build-windows.ps1

Ideas to extend it and limitations

Ways to build on it

Limitations to know before you start

Verdict

esp32-cam is a lean, practical webcam firmware that improves on Espressif's camera example with a real configuration UI, persistent settings, mDNS, NTP and optional OLED and LED support. It is well suited to makers who want a no-frills HTTP camera for a robot or monitor and are comfortable with ESP-IDF menuconfig. Be aware that it is pinned to ESP-IDF v4.0 and no longer actively maintained, so expect to do some porting work if you need a newer toolchain.

Sources

github.combkeevil/esp32-cam — repository & README

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.