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.

  1. Build the voltage divider (e.g. 10kΩ/10kΩ) between sensor output and GPIO 36. Set TURBIDITY_DIVIDER_RATIO to (R_top + R_bottom) / R_bottom.
  2. Prepare reference samples: clear tap water (~0 NTU) plus 2–3 diluted-milk or calibration-standard steps of known turbidity.
  3. Connect serial monitor. Dip the probe in each sample; record firmware NTU vs reference.
  4. 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

  1. Serial monitor open, sensor in dry air → record ADC → SOIL_DRY_VAL (shipped estimate: 2850).
  2. Sensor in water to the marked line → record ADC → SOIL_WET_VAL (shipped estimate: 1200).
  3. Verify: air reads ~0%, water ~100%.
  4. 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.

  1. Mark a 1m run on an arena-like surface.
  2. Drive forward at DRIVE_SPEED PWM; time the metre.
  3. 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:

  1. Serial-print raw TCS34725 values (r, g, b, c) while holding the robot over each surface.
  2. Record: each terrain, a water slot, a soil disc.
  3. 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)

  1. Full battery. Flash latest firmware.
  2. Power on holding BOOT (RC mode) → RobotAP visible → 192.168.4.1 loads.
  3. Serial monitor attached — verify sample lines print with units (this is the rulebook-approved output).
  4. Dip test SEN0189 in known water → NTU plausible.
  5. Press soil sensor into test medium → % plausible.
  6. One full rehearsal sample of each type → GET /data → drop into the visualiser.