# vl53l0x-avoid — the rover learns to see (minirobo EP8)

The EP6 rover plus a VL53L0X laser distance sensor: drive forward until something
is closer than `STOP_MM`, then back up, turn, and carry on.

## Wiring

| VL53L0X | ESP32-C3 SuperMini |
|---------|--------------------|
| VIN     | 3.3V               |
| GND     | GND                |
| SDA     | GPIO 0             |
| SCL     | GPIO 1             |

Drive side is exactly the EP6 rover: DRV8833 inputs on GPIO 5/6 (left) and
7/10 (right), motors on the A/B outputs, battery on VM/GND, one shared ground.

## Before it will work

1. **Solder the headers** — breakouts ship with the pins loose in the bag.
2. **Peel the protective film** off the sensor window. It's nearly invisible
   and it turns the readings into a lottery machine.
3. Install the **VL53L0X library by Pololu** from the library manager.
4. Mount the sensor at the very front, dead level, with nothing in its view —
   it will happily report your own chassis as an obstacle, forever.

## Tuning

- `STOP_MM` — 150 mm is a comfortable reaction distance at `drive(200, 200)`.
  Faster rover → bigger number.
- `RIGHT_TRIM` — carry over your trim number from the EP6 build.
- "Sensor not found" at boot → SDA and SCL are swapped, nine times out of ten.
- Out-of-range reads return a huge timeout value (8190). The sketch clamps
  anything past 2 m to "path clear" — keep that habit in your own code.

## The challenge

Drive at a wall and stop one hand-width (~100 mm) away. Post your stopping
distance — and the speed it survived — in the comments on YouTube.
