Source guide drawn from the files in this repository; not a runtime screenshot or a fresh benchmark.
An ESP32 motor-control sketch paired with a Python/OpenCV face-following prototype. The car controller reads an Android IP Webcam stream, detects faces with a Haar cascade, estimates distance from face width, and sends HTTP movement commands. Separate Flask scripts explore phone video/location/audio uplinks. These are distinct experiments, not one finished autonomous rescue system.
Bench prototype only. Keep wheels raised for initial tests, use an independent power cutoff, and do not deploy around people or obstacles. Capture faces, location, video, or audio only with informed consent.
| Piece | Behavior |
|---|---|
| ESP32 controller | Serve a browser control page and /action movement/speed endpoint. |
| Vision client | Maintain a threaded OpenCV stream reader, detect the largest face, and steer by position/width. |
| Image logging | Save detection frames into a local logs/ directory. |
| Phone camera controls | Send IP Webcam torch requests separately from motor commands. |
| Flask uplink demo | main.py accepts browser frames, location JSON, and media chunks. |
| Alternate receiver | server.py accepts frame/location uploads and plays TCP audio through PyAudio. |
“Survivor” labels in the source are prototype terminology: face detections are not proof of a person needing rescue, and repeated logs are not unique-person counts.
Open sketch_jan4a.ino in the Arduino IDE with an appropriate
ESP32 board selected. Its ledcAttach/pin-based ledcWrite calls target the
Arduino-ESP32 3.x API; the older DOCX code uses different PWM APIs.
Replace the sketch's Wi-Fi settings with your own private local configuration. The repository contains hardcoded Wi-Fi credential text, including in a DOCX code copy: do not reuse it, and rotate any real credentials it represents.
| Motor-driver input | GPIO in the sketch |
|---|---|
| Right input 1 | 26 |
| Right input 2 | 27 |
| Left input 1 | 25 |
| Left input 2 | 33 |
Use a suitable H-bridge/driver and verify its wiring, power ratings, and common ground separately. Do not power motors directly from GPIO pins. After upload, read the controller's actual address at 115200 baud and inspect its browser controls with the motor supply disconnected initially.
Use a Python environment with desktop OpenCV display support. The repository has no dependency manifest; imports identify these controller dependencies:
python -m pip install opencv-python numpy requestsConfigure CAMERA_IP and MOTOR_IP in main code of the car.py for your
isolated test network. The controller expects IP Webcam's /video stream on
port 8080 and the ESP32 /action endpoint on port 80.
Only after the bench safety checks above:
python "main code of the car.py"The OpenCV window uses q to quit and l to toggle the phone torch.
Exiting requests a stop, but network failures/throttling can prevent delivery;
software stop commands do not replace a physical cutoff.
main.py needs Flask and starts a debug server on all interfaces at port
5000; it serves / for the phone and /dashboard for the receiver.
server.py needs Flask plus PyAudio/working PortAudio and also uses port
5000, with raw TCP audio on 9999. Do not start both on the same web port.
Their upload route names and payload formats differ. The browser demo does
not directly feed server.py's raw-PCM socket, and neither is the car's
IP Webcam server. Read and harden these scripts before any network use.
| File | Purpose |
|---|---|
| ESP32 sketch | GPIO mapping, PWM setup, browser controls, and action parser. |
| Vision controller | Video capture, Haar detection, steering, torch commands, and image logs. |
| Browser uplink demo | Browser permissions, uploads, and a Flask receiver dashboard. |
| Alternate media receiver | Different video/GPS endpoints and raw TCP audio playback. |
| Older ESP32 code copy | Historical firmware with legacy PWM API and credential text. |
| Older Python code copy | Historical camera/controller implementation with different endpoints. |
- No obstacle sensor, emergency-stop circuit, watchdog/dead-man timeout, or demonstrated field safety is supplied. Loss of communications does not automatically stop the firmware's last motor output.
- Face-width distance is an unvalidated heuristic; it is not calibrated depth sensing. Lost faces trigger forward patrol, not obstacle-aware navigation.
- The camera reader retains its last frame after a stream failure, and the controller does not check frame age. Stale imagery can continue driving decisions.
/sensorsreturns constant zero temperature/humidity; it is not real telemetry.- Network endpoints have no application authentication or TLS. Keep them off public networks; Flask debug mode is unsuitable for deployment.
- Phone browser camera/microphone/location APIs require permissions and often a secure context. The plain-HTTP demo is not a reliable remote capture setup.
main.pycounts uploaded audio bytes; despite its UI wording, it does not actually save or play those chunks.server.pyexpects a separate PCM sender.- No hardware run, dependency installation, camera test, or end-to-end integration was performed for this documentation refresh.
No license file is present in this repository. This README does not grant a license.
