Sensors used with the LMS-ESP32 board from Antons Mindstorms and LEGO® Spike running Pybricks.
| Name: | Technology: | Interface: | Measurement Time: | Distance Resolution |
Jitter: | Cost: |
|---|---|---|---|---|---|---|
| Lego 45604 | ultrasonic | Lego LPF2 | ~20msec | 1mm | very low | high |
| HC-SR04 | ultrasonic | Echo / I2C / UART | ~8msec / ~10msec / ~12msec | 3mm | very low | low |
| RCWL-1601 | ultrasonic | Echo / I2C / UART | like above | 3mm | very low | low |
| US-100 | ultrasonic | Echo / UART | low | |||
| VL53L0X | ToF (laser) | I2C | 20-...msec, default 35msec | 1mm | high | low |
| VL53L4CD | ToF (laser) | I2C | 10-...msec, default 50msec | 1mm | high | medium |
| TMF8820 | ToF (laser) | I2C | 6-230msec, default 32msec | 1mm | low | high |
Diagrams per device:
Not all tests done here, e.g. temperature sensitivity of ultrasonic sensors and target object color sensitivitiy of some ToF sensors.
Impact of bad values at 1. or 3. is unclear, a PID based wall follower could show which devices are suitable.

I used a variant with 3 chips on the back and solder jumper for I2C and UART. Works identical with 3.3V and 5V.
All interfaces return data with 3mm distance resolution. Tested timing resolution at 100mm distance, the time increases with larger distance.
Trigger/Echo interface: used with rsc1975/micropython-hcsr04 module.
I2C interface: write 0x01 to address 0x57, read 3 bytes from same address. Needs pull-up resistor at SDA.
UART interface: write byte 0xA0, read 3 bytes at 9600 baud. See chinese data sheet here.

With single chip from RCWL instead of 3 chips, using same interfaces.
The 3rd image looks slightly better, might be better but could also be coincidence or device variation.

todo
See detailed analysis here.
Diagram taken at default measurement time of ~30msec. Has higher jitter at lower measurement time.

Has narrower FoV and supports lower measurement time and lower minimum distance than VL53L0X. Precision looks similar.
Tested with AHSPC/VL53L4CD_micropython module using AHSPC/adafruit_i2c_device_micropython.

Used the SparkFun Qwiic dToF Imager - TMF8820 board with K1ngGrim/tmf882X_micropython library.
Basically no jitter, values not sensitive to target object color. No cover glass used, therefore no calibration performed (and not needed?). Each of the 9 SPADs returns a different distance, why?
With default setting the center SPAD seems overexposed when exactly perpendicular to a wall and reports flapping values. Issue gone if the sensor is looking slightly downwards or when using tof.configure(spad_map_id=12).
For maximum performance use the functions used inside tof.measure_frame() in main loop and tof enable/disable command separately.
Diagrams taken at default measurement time of 32msec.
