Built to order

Obstacle-Avoiding Surveillance Robot with ESP32-CAM Live Video Feed

This project builds an obstacle-avoiding surveillance robot around the ESP32-CAM: the robot streams live video over Wi-Fi while an HC-SR04 ultrasonic sensor and avoidance logic keep it from hitting walls and furniture during autonomous patrol. A single-file web console shows the live feed alongside drive buttons, distance and battery telemetry, and an event log. Suitable for B.E./B.Tech final-year projects in Electronics, E&TC and Electrical.

Electronics / E&TC HC-SR04 ultrasonic sensorL298N motor driverArduino IDE · ESP32 coreESP32-CAM · AI-ThinkerOV2640 camera moduleHTML5 · CSS · JavaScriptWi-Fi MJPEG streaming2S 18650 battery packHybrid
Obstacle-Avoiding Surveillance Robot with ESP32-CAM Live Video Feed — project thumbnail preview
More project photos (2)

The problem

Fixed CCTV cameras can only watch one corner, and toy RC cars have no camera at all — students who want a mobile eye for a lab, corridor or storeroom usually find the two ideas live in separate projects. This project merges them: a small two-wheel robot that carries its own Wi-Fi camera, streams live video to any phone or laptop browser, and navigates on its own without crashing into obstacles. The ESP32-CAM board does double duty — it runs the video stream and the drive logic — while a front-mounted ultrasonic sensor watches for walls and furniture and an L298N driver runs the two gear motors. It is a realistic embedded-systems build: sensing, decision-making, motor control and wireless streaming all have to work together in one firmware, which is exactly the kind of integration a viva panel probes.

SYSTEM FLOW

7 components 8 connections

Live flow
Drag to explore
100%
sensorHC-SR04 Sensor

Front ultrasonic sensor polled about every 120 ms; distance from echo pulse width, 2-400 cm range.

Follow the working sequence

How it works

  1. On power-up the ESP32-CAM boots in Wi-Fi access-point mode and starts an MJPEG stream server plus the control web page, both served from 192.168.4.1 — no router or internet needed.
  2. The HC-SR04 is polled roughly every 120 ms; distance is computed as (echo pulse width × speed of sound) / 2, giving the sensor's datasheet range of 2–400 cm.
  3. In autonomous mode the L298N drives both BO gear motors forward at the configured PWM while the measured distance stays above the avoid threshold (~30 cm).
  4. When an obstacle enters the threshold, the firmware stops both motors, reverses for a calibrated interval, then turns roughly 70° left or right and rescans the corridor.
  5. If the new heading is clear the robot resumes forward patrol; if not, it repeats the avoid maneuver — each event is pushed to the console's event log with its distance.
  6. In manual mode the browser's directional buttons send drive commands that override patrol; releasing the buttons stops the motors immediately.
  7. The console continuously shows distance, battery voltage, RSSI and drive state, so the operator always knows what the robot is seeing and doing.

Tech stack:

  • ESP32-CAM (AI-Thinker) — camera + controller in one board
  • OV2640 camera, MJPEG streaming
  • HC-SR04 ultrasonic distance sensor
  • L298N dual H-bridge motor driver
  • Arduino IDE with ESP32 core
  • HTML5 · CSS · JavaScript web console
  • 2S 18650 battery pack
Parameter Value
Controller ESP32-CAM (AI-Thinker), ESP32-S dual-core
Camera OV2640, 2 MP; 640×480 MJPEG stream, ~10–15 fps (design target over Wi-Fi)
Obstacle sensor HC-SR04, 2–400 cm range, ~15° beam angle (datasheet)
Avoid threshold ~30 cm (configurable constant in firmware)
Drive 2× BO gear motors via L298N (2 A per channel, datasheet)
Battery 2S 18650 pack, 7.4 V nominal
Patrol runtime Approximately 45–90 min on a full charge (expected; load-dependent)
Wi-Fi Access-point mode, 192.168.4.1; tens of meters line-of-sight (environment-dependent)
Console Single-file web page served by the robot; no app install

Components & software requirements

  • ESP32-CAM (AI-Thinker) with OV2640 camera
  • HC-SR04 ultrasonic sensor, L298N motor driver module
  • 2-wheel robot chassis kit with BO motors and caster wheel
  • 2S 18650 battery pack with holder and charger
  • Jumper wires, mini breadboard or perfboard, USB-to-serial programmer
  • Arduino IDE with ESP32 board support; any modern browser for the console

Project features

  • [Live MJPEG video feed] The ESP32-CAM's OV2640 camera streams 640×480 video over Wi-Fi to any browser at 192.168.4.1 in access-point mode — viewable on a phone or laptop with no app install and no router.
  • [Ultrasonic obstacle avoidance] A front-mounted HC-SR04 measures distance continuously; inside the ~30 cm threshold the robot stops, reverses and turns to a clear heading automatically.
  • [Autonomous patrol mode] The robot drives a forward patrol sweep on its own and handles obstacles without any input — this is the default behavior on power-up.
  • [Manual drive console] The web console adds a directional pad and stop button for press-and-hold manual driving, overriding patrol while buttons are held.
  • [Live telemetry] Distance, battery voltage, motor PWM state, Wi-Fi RSSI and uptime are displayed in the console and updated continuously.
  • [Event log] Every obstacle-avoid event is recorded with timestamp and distance, giving demonstrable evidence of the avoidance logic for the report.
  • [Configurable firmware constants] Avoid distance, turn duration and motor speeds are plain constants in the code — adjustable for different floor surfaces and speeds.

What is included

  • Working robot prototype (assembled chassis, motors, ESP32-CAM, sensors, battery)
  • ESP32 firmware source (stream server, avoid logic, web console)
  • Web control console (drive pad, telemetry, event log)
  • Wiring/circuit diagram and complete component list
  • Calibration guide (avoid threshold, motor trim, Wi-Fi setup)
  • Project report PDF (architecture, working, results)
  • PPT presentation for final review
  • Viva Q&A preparation document
  • Abstract PDF

Limitations & prerequisites

  • The ESP32-CAM delivers an MJPEG preview at modest resolution and frame rate (~10–15 fps at 640×480 is the design target) — it is a surveillance preview, not HD CCTV, and latency rises on congested Wi-Fi.
  • The HC-SR04 cannot measure below ~2 cm, misses very soft or steeply angled surfaces that absorb or scatter the echo, and its ~15° cone leaves blind spots at the robot's sides.
  • Patrol runtime is approximately 45–90 minutes on a charged 2S pack (expected) — motors plus Wi-Fi streaming drain the battery faster than either alone; runtime is load-dependent.
  • Access-point Wi-Fi range is tens of meters line-of-sight; walls and interference shorten it, and the feed drops outside range while avoidance keeps running.
  • The OV2640 performs poorly in low light — usable in lit indoor spaces; dark corridors need added illumination (optional customization).
  • The prototype is for indoor floors only — not weatherproof, and not for stairs or rough terrain.
  • The base build streams video only; it does no image-based detection — person or face detection is an optional customization, not included.

Delivery information

Built-to-order project. Assembly, firmware flashing, calibration and documentation are prepared fresh for the order; the delivery timeline is shared after order confirmation based on the current queue.

Support & explanation

Complete documentation, wiring diagrams, setup guide and viva preparation are included. Support for assembly, calibration, demonstration and viva explanation is provided.

Frequently Asked Questions

Which controller runs the robot — is the camera separate?

The ESP32-CAM does both: its ESP32 chip serves the video stream and the web console while running the obstacle-avoidance logic, driving the L298N motor driver and reading the HC-SR04. One board and one firmware handle everything — no separate Arduino or Raspberry Pi is needed.

How do I view the live video feed?

Power the robot, join its Wi-Fi network from any phone or laptop, and open 192.168.4.1 in a browser. The console shows the live MJPEG feed with drive buttons, distance, battery and the event log — no app install and no router required.

What exactly happens when the robot meets an obstacle?

The front HC-SR04 is polled roughly every 120 ms; inside the ~30 cm threshold the robot stops, reverses for a calibrated interval, turns about 70° left or right, rescans the corridor and resumes patrol. Each avoid event is recorded in the console's event log with its distance.

Does it work without Wi-Fi?

Obstacle avoidance runs entirely on the robot and needs no network at all. Wi-Fi is only required for the live video feed and the web drive console — with the network off, the robot still patrols and avoids obstacles autonomously.

Can person detection or night vision be added?

Yes, as optional customizations. On-board detection would need a separate processing step since the ESP32-CAM's frame-rate budget is tight, and night vision needs an IR illuminator because the OV2640 struggles in the dark. Both are scoped separately from the base build.

Is this project suitable for a final-year project?

Yes — for Electronics, E&TC and Electrical programs. It demonstrates embedded C programming, ultrasonic sensing, DC motor control, Wi-Fi networking and live video streaming in one working system, and every subsystem is demonstrable in the viva. Suitable for B.E./B.Tech final-year projects in Electronics, E&TC and Electrical.

Components & software requirements
  • ESP32-CAM (AI-Thinker) — camera + controller in one board
  • OV2640 camera, MJPEG streaming
  • HC-SR04 ultrasonic distance sensor
  • L298N dual H-bridge motor driver
  • Arduino IDE with ESP32 core
  • HTML5 · CSS · JavaScript web console
  • 2S 18650 battery pack
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download free synopsis (PDF)

Enter your name and email — the synopsis PDF downloads immediately. We may send occasional project updates; no spam, unsubscribe anytime.

Get a quotation