Community project

WiFi Camera Streaming Board

Photo of WiFi Camera Streaming Board
Generated with AI

Attila Farago

Last updated December 4, 2026

This project turns an ESP32 microcontroller into a WiFi-enabled camera streaming board. By connecting an OV2640 camera module and powering the board over USB, the device broadcasts live video frames over a local network that can be viewed in any web browser.

The guide includes a complete wiring diagram showing camera ribbon and power connections, a full parts list, and ready-to-flash firmware with web server functionality. Assembly takes just minutes: seat the camera ribbon carefully, upload the code, connect to the board's WiFi network, and open the live view in a browser.

Wiring diagram

Wiring diagram for WiFi Camera Streaming Board
Loading diagram…

Assemble it in 2 steps

1. Check the camera ribbon

With USB unplugged, seat the camera ribbon in the ESP32-CAM socket and close the latch. Reconnect your USB programming base.

2. Open the live view

After deployment, join ESP32-Camera with the existing password and open http://192.168.4.1 in a browser.

Deploy the firmware

#include <Arduino.h>
#include <WiFi.h>
#include <WebServer.h>
#include <esp_camera.h>
#include <img_converters.h>

constexpr char AP_PASSWORD[] = "change-me-123";
WebServer server(80);
bool cameraReady = false;

bool initCamera() {
  camera_config_t c = {};
  c.pin_pwdn = 32;
  c.pin_reset = -1;
  c.pin_xclk = 0;
  c.pin_sccb_sda = 26;
  c.pin_sccb_scl = 27;
  c.pin_d0 = 5;
  c.pin_d1 = 18;
  c.pin_d2 = 19;
  c.pin_d3 = 21;
  c.pin_d4 = 36;
  c.pin_d5 = 39;
  c.pin_d6 = 34;
  c.pin_d7 = 35;
  c.pin_vsync = 25;
  c.pin_href = 23;
  c.pin_pclk = 22;
  c.xclk_freq_hz = 20000000;
  c.ledc_timer = LEDC_TIMER_0;
  c.ledc_channel = LEDC_CHANNEL_0;
  c.pixel_format = PIXFORMAT_JPEG;
  c.frame_size = FRAMESIZE_QVGA;
  c.jpeg_quality = 12;
  c.fb_count = 1;
  c.fb_location = psramFound() ? CAMERA_FB_IN_PSRAM : CAMERA_FB_IN_DRAM;
  esp_err_t result = esp_camera_init(&c);
  if (result == ESP_ERR_NOT_SUPPORTED) {
    c.pixel_format = PIXFORMAT_RGB565;
    c.frame_size = FRAMESIZE_QVGA;
    result = esp_camera_init(&c);
    if (result == ESP_OK) Serial.println("Camera ready: software JPEG encoding");
  }
  if (result != ESP_OK) Serial.printf("Camera init failed: %s (0x%x)\n", esp_err_to_name(result), result);
  return result == ESP_OK;
}

void frame() {
  if (!cameraReady) {
    server.send(503, "text/plain", "Camera not detected; unplug USB, check ribbon seating, and restart.");
    return;
  }
  camera_fb_t *fb = esp_camera_fb_get();
  if (!fb) {
    server.send(502, "text/plain", "Camera detected, but no complete frame was received.");
    return;
  }
  uint8_t *jpeg = fb->buf;
  size_t length = fb->len;
  const bool convert = fb->format != PIXFORMAT_JPEG;
  if (convert && !frame2jpg(fb, 75, &jpeg, &length)) {
    esp_camera_fb_return(fb);
    server.send(502, "text/plain", "JPEG conversion failed.");
    return;
  }
  server.sendHeader("Cache-Control", "no-store");
  server.setContentLength(length);
  server.send(200, "image/jpeg", "");
  server.client().write(jpeg, length);
  if (convert) free(jpeg);
  esp_camera_fb_return(fb);
}

void setup() {
  Serial.begin(115200);
  cameraReady = initCamera();
  Serial.println(cameraReady ? "Camera detected" : "Camera not detected; check wiring and reset");
  WiFi.mode(WIFI_AP);
  if (!WiFi.softAP("ESP32-Camera", AP_PASSWORD)) return;
  server.on("/frame.jpg", HTTP_GET, frame);
  server.on("/", HTTP_GET, [] {
    server.send(200, "text/html", R"HTML(<!doctype html><meta name="viewport" content="width=device-width,initial-scale=1"><title>ESP32 Camera</title>
<h1>ESP32 Camera</h1><p id="status">Waiting for camera…</p><img id="view" alt="Live camera" style="width:min(100%,640px)">
<script>
let previous;
async function update(){
  try {
    const r=await fetch('/frame.jpg',{cache:'no-store'});
    if(!r.ok) throw new Error(await r.text());
    const next=URL.createObjectURL(await r.blob());
    document.getElementById('view').src=next;
    if(previous) URL.revokeObjectURL(previous);
    previous=next;
    document.getElementById('status').textContent='Live';
  } catch(e) { document.getElementById('status').textContent=e.message; }
  setTimeout(update,200);
}
update();
</script>)HTML");
  });
  server.begin();
  Serial.println(WiFi.softAPIP());
}

void loop() {
  server.handleClient();
  delay(2);
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik