Skip to content

Aiming Video Stream

Daniel Frenkel edited this page Jun 11, 2026 · 2 revisions

Aiming Video Stream

A built-in, temporary MJPEG video stream from the OV2640 camera, used to aim and mount the MiniSpeedCam. Open it on a phone or laptop to see exactly what the camera sees while you position the device, then turn it off so normal speed measurement resumes.

⚠️ Setup aid only. While the stream is running, speed measurement is paused (no radar tracking, no speed photos) and the device will not enter power-saving sleep. It auto-stops after 5 minutes so it can't be left on by accident.


Quick start

  1. Power on the MiniSpeedCam and make sure it's joined to your WiFi (or connect your phone to the device's setup access point if it has no WiFi credentials yet).
  2. Open the device's web interface in a browser — the same page you use to configure WiFi / units / speed thresholds.
  3. On the Settings tab, find "Aiming Stream (video, 5 min):" and turn the switch ON.
  4. The "Stream URL" field changes from off to a link such as http://192.168.1.50:81/.
  5. Open that URL on your phone or laptop (on the same network) → you'll see the live camera feed, full width. Aim the device.
  6. Turn the switch OFF when finished (or simply wait 5 minutes for it to stop itself).

What it does

  • Serves a live MJPEG feed on port 81 (the configuration web UI stays on port 80, so both run at once).
  • Exposes two URLs:
    • http://<device-ip>:81/ — a simple full-screen viewer page (open this on a phone).
    • http://<device-ip>:81/stream — the raw MJPEG stream, for embedding or opening in VLC.
  • Drops the camera to VGA (640×480) for smooth video while aiming, then restores full resolution (UXGA) for speed photos once the stream stops.
  • Keeps WiFi up and pauses speed tracking while active.
  • Auto-stops after 5 minutes. Re-toggle the switch to start another session.

Finding the device

By IP address

  • Easiest: the "Stream URL" label shows the full address as soon as the stream turns on.
  • The IP is also printed on the USB serial console at boot ([WIFI] STA ip=...) and is the same address as the configuration web UI.
  • In access-point mode (no WiFi configured yet), connect your phone to the device's AP first; the stream URL will use the AP gateway address (typically http://192.168.4.1:81/).

By name (mDNS / .local)

Each device advertises a unique mDNS name — MiniSpeedCam-XXXXXX, where XXXXXX is the last 6 hex digits of its WiFi MAC — so two units can share one network. When the device is on your WiFi (station mode), you can reach it by name without knowing the IP:

  • Configuration UI: http://minispeedcam-XXXXXX.local/
  • Aiming stream: http://minispeedcam-XXXXXX.local:81/

Finding your unit's XXXXXX: it's the soft-AP SSID shown during setup (MiniSpeedCam-XXXXXX), and the hostname listed in your router's client/DHCP table. It equals the last three octets of the device's WiFi MAC address.

.local (mDNS/Bonjour) resolves on most modern phones and computers. If yours can't resolve it, just use the IP address. mDNS applies in station mode (on your network), not during AP setup.


Notes & limitations

  • One viewer at a time. The stream server is intentionally configured for minimal socket use (it shares the radio with WiFi and the configuration web server), so use a single browser tab.
  • Don't leave it on during normal operation — speed measurement is suspended while it streams. The 5-minute auto-off is the safety net.
  • Video smoothness depends on WiFi signal strength; VGA over 2.4 GHz WiFi is intended for framing the shot, not high-quality recording.
  • If the camera failed to initialize at boot, the viewer page loads but shows no image — check the serial log for [CAM] FAILED.

Troubleshooting

Symptom Likely cause / fix
Switch flips back to OFF; label stays off The stream server couldn't start (low memory/sockets). Serial shows [STREAM] httpd_start FAILED. Reboot and retry; close any other clients.
Can't reach the URL Confirm you're on the same network as the device and used port :81. In AP mode, connect to the device's access point first.
Stream stops on its own Expected — it auto-stops after 5 minutes. Toggle the switch again to resume.
No speed readings while streaming Expected — measurement is paused during streaming. Turn the stream off to resume tracking.
Laggy / low frame rate Normal for VGA MJPEG over WiFi; move closer to the access point or accept it (this is an aiming aid, not a recorder).

Serial log reference

On the USB serial console (115200 baud) the stream prints:

[STREAM] requested ON
[STREAM] started at http://192.168.1.50:81/ (auto-off in 300s)
[STREAM] auto-off (timeout)
[STREAM] stopped; camera restored to UXGA
[STREAM] httpd_start FAILED        (only if the server fails to start)

Technical reference (for developers)

  • Files: src/camera_stream.cpp / src/camera_stream.h (server); the UI switch + label live in src/espui_settings.h; reconciled each loop by streamService() on Core 1.
  • HTTP server: ESP-IDF esp_http_server on port 81 (control port 32769), max_open_sockets = 2, max_uri_handlers = 2.
  • Desired state: globals stream_active / stream_deadline (in variables.h), set by the ESPUI switcher and the auto-off timer; streamService() reconciles them against the actual server state.
  • Timeout: STREAM_TIMEOUT_MS (5 minutes) in camera_stream.h. Change it there to adjust the auto-off window.
  • Port: STREAM_PORT (81) in camera_stream.h.
  • Isolation: the stream module is kept in its own translation unit and does not include ESPUI, because esp_http_server and ESPUI's ESPAsyncWebServer define clashing HTTP_GET/HTTP_POST/… enums. Start/stop are reported to main.cpp through callbacks (streamSetCallbacks) that update the ESPUI label/switcher. Note the header is named camera_stream.h, not stream.h, which would shadow the Arduino core's own Stream.h on a case-insensitive filesystem.

Clone this wiki locally