Repository navigation
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.
- 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).
- Open the device's web interface in a browser — the same page you use to configure WiFi / units / speed thresholds.
- On the Settings tab, find "Aiming Stream (video, 5 min):" and turn the switch ON.
- The "Stream URL" field changes from
offto a link such ashttp://192.168.1.50:81/. - Open that URL on your phone or laptop (on the same network) → you'll see the live camera feed, full width. Aim the device.
- Turn the switch OFF when finished (or simply wait 5 minutes for it to stop itself).
- 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.
- 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/).
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.
- 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.
| 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). |
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)
-
Files:
src/camera_stream.cpp/src/camera_stream.h(server); the UI switch + label live insrc/espui_settings.h; reconciled each loop bystreamService()on Core 1. -
HTTP server: ESP-IDF
esp_http_serveron port 81 (control port 32769),max_open_sockets = 2,max_uri_handlers = 2. -
Desired state: globals
stream_active/stream_deadline(invariables.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) incamera_stream.h. Change it there to adjust the auto-off window. -
Port:
STREAM_PORT(81) incamera_stream.h. -
Isolation: the stream module is kept in its own translation unit and does not include ESPUI, because
esp_http_serverand ESPUI's ESPAsyncWebServer define clashingHTTP_GET/HTTP_POST/… enums. Start/stop are reported tomain.cppthrough callbacks (streamSetCallbacks) that update the ESPUI label/switcher. Note the header is namedcamera_stream.h, notstream.h, which would shadow the Arduino core's ownStream.hon a case-insensitive filesystem.