RC & Communications
WiFi Access Point
The ESP32 starts as a WiFi AP at power-on — in both modes. No router, no internet.
SSID: RobotAP
Password: enviro123
Robot IP: 192.168.4.1
HTTP Endpoints
| Method | Endpoint | Use |
|---|---|---|
GET |
/ |
RC page (served from flash — PROGMEM, no SPIFFS upload needed) |
POST |
/rc |
All commands (JSON body) |
GET |
/data |
Full run JSON (live; falls back to saved results.json after reboot) |
There is no WebSocket and no UDP — plain HTTP is fast enough at D-pad cadence and far simpler to debug.
Command Protocol (POST /rc)
{ "cmd": "FWD" } // drive; optional "speed": 0-255
{ "cmd": "BWD" }
{ "cmd": "LEFT" }
{ "cmd": "RIGHT" }
{ "cmd": "STOP" }
{ "cmd": "SAMPLE_WATER", "sector": 2 } // arm 0° → read → 90°; returns {"ntu": 42.3}
{ "cmd": "SAMPLE_SOIL", "sector": 2 } // arm 180° → read → 90°; returns {"pct": 68.5}
{ "cmd": "END_RUN" } // finalise + save results.json to SPIFFS
sector(1–4) is chosen by the operator on the RC page — this is how samples get accurate sector + terrain labels.- Every sample is also printed to serial with units (rulebook-approved output).
- Drive commands accept an optional
speed; default isDRIVE_SPEEDfrom config.
RC Page Interface (192.168.4.1)
Single self-contained HTML page compiled into the firmware (rc_page.h, generated from arduino/rc_page/index.html). No CDN, no external requests.
| Element | Function |
|---|---|
| D-pad (hold-to-drive) | FWD / BWD / LEFT / RIGHT; STOP centre; releases auto-stop |
| Sector selector S1–S4 | Tags the next sample with the sector the robot is in |
| 💧 Sample Water | Deploys arm A, logs NTU, shows reading in the log |
| 🌱 Sample Soil | Deploys arm B, logs %, shows reading |
| 🏁 End Run | Finalises and persists results.json |
| Status + log | Connection state; last 40 events with timestamps |
Editing the page: change arduino/rc_page/index.html, then regenerate the header (command in PLAN.md Phase 2), then re-flash.
Data Retrieval After a Run
- Stay connected to
RobotAP. GET 192.168.4.1/data→ save JSON (works in both modes; survives reboot via SPIFFS fallback).- Back up to two devices.
- Drag-drop into the visualiser for the judges.