DI/MR Distance Sensor, Grove Ultrasonic Ranger, and C/C++

In robots gone by, the HC-SR04 ultrasonic distance sensor was king of the “long” distance ranging options. It was inexpensive, wide beam, and with a 10 Hz read cycle (constrained by the “slow” speed of sound) it did not tax the slow processors of those days.

Today nearly all robots are doing “long” ranging at the speed of light, enabling 5000 Hz read cycles with much narrower beams.

For the GoPiGo3, ModRobotics offers a VL053L0X based Distance Sensor with I2C interface and a diverse set of Python examples. The GoPiGo3 also offers software I2C which brings an advantage of allowing up to three VL053L0X MR Distance Sensors on one robot, (with perhaps a lower read rate for the software I2C sensors).

Also available for ranging, from third parties, is the $4 Grove Ultrasonic Ranger which is similar to the HC-SR04 but implements the Grove four-wire standard interface. The GoPiGo3 can utilize up to two Grove interface devices, and supports Python, C++ and Java API.

Seeing that the GoPiGo3 C++ API does not support the VL053L0X Distance Sensor, I went looking for a Linux on Raspberry Pi C or C++ library. I actually found three and they all three recognized the ModRobotics Distance Sensor was attached to the GoPiGo3 hardware I2C bus, but none of them were able to provide valid readings from the device. The packages I found ranged from 4 to 7 years old, and I was trying them with the PiOS Bookworm operating system.

So Python on the GoPiGo3 provides the most diverse sensor interfaces with three levels of sensor API (Base sensor, GoPiGo3 sensor, and EasyGoPiGo3 sensor APIs).

C++ users can use the GoPiGo3 supported Grove Ultrasonic Ranger, but not the ModRobotics Distance Sensor.

(The YD LIDARs and the Oak-D-Lite provide both Python and C++ support.)