When diving into the world of LEGO robotics or any STEM-related project, choosing the right components can significantly impact your results. Today, we’re focusing on an essential tool for precision and efficiency in robotics: Time-of-Flight (TOF) distance sensors. Specifically, we’ll compare various TOF Laser Distance Sensors to help you select the one for your needs. In the past, I mistakenly assumed that small differences in the type designation of the sensors wouldn’t matter in their usage. But I learned the hard way that details matter in this investigation.
What is a VCSEL TOF Distance Sensor?
Imagine a bat navigating in the dark using echolocation. A VCSEL TOF distance sensor works on a similar principle but uses light instead of sound. It emits laser signals (from a Vertical Cavity Surface Emitting Laser, or VCSEL) and measures the time-of-flight (TOF) it takes for the light to return after hitting an object. This measurement helps determine the distance to that object with high accuracy. It’s the same technology as the sensor in your iPhone that helps with face recognition.
Are Laser Distance Sensors safe?
You might know lasers from laser pointers — don’t point them into people’s eyes! — or from Sci-fi laser guns and be a little scared. No reason to be afraid of these distance sensors. They use ultra low power lasers that are invisible to the eye! They can send out and time single photons with a SPAD. I think it is astonishing that single photon avalanche diodes (SPADs) exist. Sounds like something out of Start Trek, but you can build into your LEGO robot! In another article, I describe how to make these sensors appear like an official LEGO sensor to your SPIKE and MINDSTORMS hub. Now let’s go over some laser distance sensor options you can buy and build in.
The classic VL53L0x
The VL53L0x is like the reliable compact car of TOF sensors — small, efficient, and widely applicable. This ST product has been in production since 2016, and it never went away. I’ve been using a simple one from Aliexpress, glued to a 3M beam. If you would rather not hot glue LEGO, There is also a nice DFRobot version with handy mounting holes and a Gravity port and jumper wires. M5 stack also sells a VL53L0x. It is rather bulky, but it features two technic holes, and it has the same Grove connector as the LMS-ESP32.
Advantages:
- Compact size.
- Usable detection rate: 30 samples per second.
Disadvantages:
- Jittery results. I use a running average in most programs to avoid the jitter.
- Limited maximum range. The specs give it a max range of up to 2m, but I found it was unreliable over 80cm. The 2m range is probably for a large white object, indoors.
- Performance degrades in high ambient light, like direct sunlight. On a very sunny day I have to close the blinds a bit.
The advanced VL53L3cx
Think of the VL53L3cx as an upgraded version of its predecessor, offering enhanced features suitable for more dynamic applications. I have tested a VL53L3cx from DFRobot. For my testing application, I built a Bluetooth MIDI controller with Arduino, and I was delighted with the low latency and accurate sensor readings.
Advantages:
- Improved range over the VL53L0x.
- Better performance in various lighting conditions.
- Less jittery compared to the VL53L0x.
- 4×4 and 8×8 grid of distance detection, instead of a single point, though I have not been able to access this feature yet.
Disadvantages:
- No python library that I could find. I had to use Arduino.
- Needs 6 wires to connect instead of the standard four i2c leads
The super high-tech VL53L5cx
The VL53L5x could be considered the sports car among TOF sensors — fast, powerful, and equipped with advanced features.
Advantages:
- Wide field of view allows detection over larger areas: 65º diagonal field of view.
- Even faster at 60 ranging samples per second.
- Up to 4m detection range.
- Smart on-chip functions like motion tracking.
- I found a python library, but I wasn’t able to test it, because…
Disadvantages:
- I don’t have one!
- I found the VL53L3CX challenging to use, and I expect this one to be even harder to use, since it comes with so many features!
The TMF8801 and TMF8701 alternative from AMS OSRAM
The TMF8701 and TMF8801 are range sensing alternatives from AMS OSRAM. Reliable, robust and slow. The 8801 is long range, the 8701 is short range (<60cm).
Advantages:
- Robust against different surface colors and reflectivities.
- Robust outdoor performance.
- There was a Python library for Raspberry Pi. I ported the TMF8801 library to Micropython and ESP32.
- Works with the four i2c leads
- Has an (optional) interrupt pin to signal new data
Disadvantage:
- Too slow for steering fast robots, at 3 samples per second. The spec sheet says it should be able to do 10Hz sampling, but that only works at distances of less than 12cm.
- Slow to boot. The driver needs to upload a ‘ram update’ every time you want to use it.
Choosing the right TOF sensor
The right sensor involves considering your project’s specific needs — whether it’s range, accuracy, size constraints, or cost. By understanding each model’s strengths and weaknesses, you can tailor your selection process to ensure optimal performance in your robotics applications.