Calibration
Every constant below lives in
config.h. The shipped values are estimates — measure and update each one before Testing Day. Category 1 (30 pts) requires readings within ±10% of the judges' reference values; calibration is the highest-value engineering time in this project.
SEN0189 Turbidity (highest priority)
Two things must be right: the divider ratio and the curve.
- Build the voltage divider (e.g. 10kΩ/10kΩ) between sensor output and GPIO 36. Set
TURBIDITY_DIVIDER_RATIOto (R_top + R_bottom) / R_bottom. - Prepare reference samples: clear tap water (~0 NTU) plus 2–3 diluted-milk or calibration-standard steps of known turbidity.
- Connect serial monitor. Dip the probe in each sample; record firmware NTU vs reference.
- Within ±10% across the range → done. Outside → refit the quadratic coefficients in
readTurbidityNTU()from your measured (voltage, NTU) points.
The DFRobot curve assumes the sensor's direct 5V output. After the divider and the ESP32's ADC characteristics, expect to adjust it.
Soil Moisture
- Serial monitor open, sensor in dry air → record ADC →
SOIL_DRY_VAL(shipped estimate: 2850). - Sensor in water to the marked line → record ADC →
SOIL_WET_VAL(shipped estimate: 1200). - Verify: air reads ~0%, water ~100%.
- If competition-style soil pots are available at a workshop, sanity-check mid-range readings.
Drive Speed (position estimate)
No encoders — the path log uses a speed model.
- Mark a 1m run on an arena-like surface.
- Drive forward at
DRIVE_SPEEDPWM; time the metre. MM_PER_SEC_AT_DRIVE = 1000 / seconds(shipped estimate: 150).
Repeat on carpet/grass if possible — surface drag changes the constant. This only affects the path plot, not sampling.
Zone Detection Thresholds (autonomous mode only)
Under venue lighting, on the real arena:
- Serial-print raw TCS34725 values (r, g, b, c) while holding the robot over each surface.
- Record: each terrain, a water slot, a soil disc.
- Update in
config.h:
| Constant | Shipped | What to measure |
|---|---|---|
WATER_CLEAR_MIN |
800 | Clear-channel value over water slot |
WATER_RED_RATIO_MAX |
0.40 | r/c over water (blue → low red ratio) |
SOIL_RED_RATIO_MIN |
0.45 | r/c over soil disc |
SOIL_BLUE_RATIO_MAX |
0.20 | b/c over soil disc |
Validation: water and soil signatures must be clearly separated from every terrain's signature. If sand triggers isWaterZone(), tighten WATER_CLEAR_MIN upward.
Timing Constants
| Constant | Shipped | Tune when |
|---|---|---|
SAMPLE_SETTLE_MS |
500 | Reading unstable after arm deploy → increase |
SAMPLE_LOCKOUT_MS |
4000 | Robot re-samples the same zone → increase; misses adjacent zones → decrease |
POND_BACKOFF_MS |
900 | Reverse distance after water sample — must clear the slot |
WALL_STOP_MM |
120 | Stop margin before octagon wall |
Pre-Run Sequence (Testing Day morning)
- Full battery. Flash latest firmware.
- Power on holding BOOT (RC mode) →
RobotAPvisible →192.168.4.1loads. - Serial monitor attached — verify sample lines print with units (this is the rulebook-approved output).
- Dip test SEN0189 in known water → NTU plausible.
- Press soil sensor into test medium → % plausible.
- One full rehearsal sample of each type →
GET /data→ drop into the visualiser.