For the first environment sensor for RoboBobLet I thought I would try and use the VL53L0X based PCB from Pololu and associated Arduino library (VL53L0X.h). This is some sort of time-of-flight laser rangefinder connected via the SPI bus to the Nano. I just used the standard connections for the SPI but you have to be careful as there are some Nano pin out diagrams that have the SPI connections wrong. Then I just amended the example programme provided so that it provided one reading every second, in order to reduce the amount of data. I think the VL53L0X can provide one distance value every 40 milliseconds at it's maximum range but this would produce far too much data for me to handle at this stage. The beam width is around 1 cm and it measures distances in millimetres. I preferred this sensor to an ultrasonic rangefinder due to the small beam width as the ultrasonic rangefinders can have beam widths of 30 degrees or more. The maximum realistic sampling rate for the ultrasonic rangefinder is also much higher, at around 400-500 milliseconds as you have to allow for sounds waves reflecting all around the room to die away before taking another measurement, otherwise some spurious results can be obtained. The VL53L0X datasheet claims good linearity and accuracy for distances upto and beyond 1000 mm, depending on the obstacle surface and the way the sensor is operated. I think you can have higher sampling rates or higher accuracy but not both at the same time. I setup the sensor so that it measured distances and compared the values obtained with those measured using a steel tap measure, see the graph below.
I haven't been consistent with my units as the distance column (tape measure) is in cm and the VL53L0X is in mm. It is reasonably linear but does seem to start to saturate at the higher ranges. There is also a considerable variation between consecutive measurements at the same distance. The graph below shows measurements taken at 40 cm.
I tried this again at 60 cm and 80 cm and a similar results was obtained. As I wanted to know what the variation was I calculated the standard deviation of these values and surprisingly it shows that the variation is not that great, being 2.5% at 40cm and around 4.0% at 80 cm. The 80 cm plot shows some spikes where results of 1500 mm were obtained. This is a software imposed limit and indicates that the sensor is having difficulty detecting the object.(I averaged out these 1500 mm values when calculating the standard deviation for the 80 cm values.)
I think this shows that with the simple setup used for the VL53L0X that reasonable results can be obtained up-to and perhaps beyond 100 cm, although some filtering might provide better results. Maybe some form of low pass filtering might work well.
I now have to fix this sensor to the RoboBobLet chassis. The easiest solution would be affixed orientation, probably at the front but that would require the chassis to be rotated in order to obtain a scan of the nearby environment. Instead, I will use an ordinary micro servo motor with the VL53L0X fixed to the servo shaft, to provide 180 degree scans of the area immediately in front of the robot. It would also be good to add additional sensors to the side and rear but the sensor is relatively expensive (at least for me) and require more servos, and connections to the Nano, plus more complicated software, so I think I will just use one for the moment.