ESP32 + Browser Hybrid Security Setups
The ESP32-CAM is one of the most popular microcontrollers for DIY security projects. It costs under $10, has a built-in camera, Wi-Fi, and can stream video over HTTP. But its processing power is limited — running object detection on the chip itself is slow and unreliable.
A hybrid approach solves this: use the ESP32-CAM as a cheap, always-on camera node, and let a browser running AiSecam handle the AI inference. This gives you the hardware flexibility of ESP32 with the detection accuracy of a modern neural network.
Architecture Overview
The system works in two layers:
- ESP32-CAM — streams MJPEG video over your local network via its built-in HTTP server
- Browser (AiSecam) — connects to the ESP32 stream, processes frames through YOLO26n, and handles recording/alerts
The ESP32 acts as a dumb camera — it captures and streams video but does no analysis. The browser does all the intelligence: person detection, clip recording, and Telegram notifications. This separation of concerns means you can swap out either component independently.
Setting Up the ESP32-CAM
Popular ESP32-CAM boards include the AI-Thinker ESP32-CAM and the ESP32-S3-CAM. The setup process is similar for most boards:
- Flash firmware — use Arduino IDE, PlatformIO, or a pre-built binary. The
CameraWebServerexample from Espressif is a good starting point. - Configure Wi-Fi — enter your network credentials in the firmware code or via the board's configuration portal.
- Access the stream — navigate to the ESP32's IP address in a browser (e.g.,
http://192.168.1.50). You should see a live video feed. - Note the stream URL — the MJPEG stream is typically available at
http://[ESP32_IP]/stream.
Connecting ESP32 to AiSecam
AiSecam's camera interface uses the browser's getUserMedia API to access cameras. To use an ESP32 stream instead, you can:
- Use the ESP32 as a USB webcam — some ESP32-S3 boards support USB Video Class (UVC), appearing as a standard webcam to the browser. AiSecam will detect it like any other camera.
- Proxy the stream — run a simple local proxy that converts the ESP32's MJPEG stream into a WebRTC or MediaStream that the browser can consume.
- Embed in an iframe — the ESP32's own web interface can be embedded alongside AiSecam in a split-screen setup.
Benefits of the Hybrid Approach
- Cost — ESP32-CAM boards cost $5-10, versus $30-100 for a dedicated USB webcam
- Placement flexibility — small form factor fits in tight spaces; some boards are smaller than a credit card
- Power efficiency — ESP32 boards consume 100-200mA, far less than a phone running a camera app
- Always-on potential — with a USB power supply, the ESP32 can run indefinitely without battery concerns
- Multiple nodes — run several ESP32-CAM boards and monitor them from a single browser session
Limitations
The ESP32-CAM has real constraints. The camera sensor (typically OV2640) produces 2MP images at best, which is lower resolution than most phone cameras. Frame rates over Wi-Fi are typically 5-15 FPS at VGA resolution. The built-in flashlight LED can help with low-light situations but produces harsh, direct illumination.
Network latency also matters. If the ESP32 and the browser are on different subnets or the Wi-Fi is congested, the stream may stutter. For reliable operation, keep the ESP32 on the same local network as the browser device, ideally within good Wi-Fi range.
Advanced: Multi-Node Monitoring
One interesting pattern is running multiple ESP32-CAM boards pointed at different areas, each streaming to a central browser session. You can open multiple browser tabs — one per camera — each running AiSecam's detection independently. This gives you a multi-camera security system for under $50 in hardware.
Each tab processes its camera feed independently, and you can configure different Telegram alert channels for different cameras. For example, the front door camera alerts to one Telegram chat, while the garage camera alerts to another.
Try browser-based detection
Open AiSecam and see how it handles your camera feed — whether it is a phone, webcam, or ESP32 stream.
Start AiSecam camera