A 3D-Printed Mount for Time-of-Flight Distance Sensors

Getting the right vertical angle is easy with this simple design

A simple but well-designed 3D printed mount for the low-cost VL53L0X time-of-flight sensor allows precise vertical angle adjustment that prevents false-positive backscatter triggering. Photo by the author.

I am working with several other engineers to design a new class of low-cost robots for teaching computational thinking to STEM students. As we started to roll out our design to our students, we focused on giving our students a great user experience. One of the most challenging problems was precisely mounting our awesome new VL53L0X time-of-flight sensors. This blog will discuss creating a simple 3D printed part that makes mounting simple and vertical angle calibration easy to adjust.

Until a few years ago, most of our CoderDojo educational robots used the ubiquitous and low-cost HC-SR04 ultrasonic “ping” distance sensor. We call them “ping” sensors because they work similarly to the “ping” sound signals used in submarines to detect distance in the water.

The old HC-SR04 ultrasonic “ping” distance sensor is mounted on the front of an old CoderDojo robot. Image by the author.

However, a new class of distance sensors has become incredibly affordable in the last few years: the new time-of-flight laser distance sensor.

Here is a photo of the new time-of-flight distance sensor on the left compared with the older HC-SR04 ultrasonic distance sensor.

Our new VL53L0X time-of-flight distance sensor is on the left vs. the older HC-SR04 ultrasonic ping sensor on the right. The smaller size, low power, and I2C digital interface give the time-of-flight sensor advantages. Image by the author.

Both these sensors are now produced at high volumes, driving the sensors' cost below $3 when purchased in quantity 10, which is typical of a small CoderDojo coding club. But the time-of-flight sensor uses very low-power and kid-safe pulses of laser light to calculate distance. This is unlike the older ultrasonic ping sensor that sends sound wave pulses out and measures the time for the return sound.

From our physics classes, you might recall that light travels 186,000 miles per second. In contrast, the speed of sound is only about 1/5th of a mile per second. So we can see that light travels roughly a million times faster than the speed of sound. So to time the speed of these pulses returning requires very accurate clocks! Integrating this technology into a $3 part is a truly amazing feat of engineering, which we won’t go into in detail here. Still, the take-home point is that we want to incorporate the benefits of using light to measure distances into our CoderDojo robots. We still think the newer HC-SR04P (note the P for “Pico-compatible” 3.3-volt interfaces) ultrasonic sensors are still advantageous. We will use them in some of our robot designs when appropriate.

The problem I had with these small sensors is that I didn’t really understand their characteristics when I first started testing them. We were so excited to get them we literally just put some hot glue on our sensors and stuck them to the bottom of the robots!

My first attempt at mounting the time-of-flight distance sensor with hot glue turned out to be a hot mess. Getting the proper vertical angle required several attempts, and it was hard to fine-tune—photo by the author.

The problem with this is that our collision avoidance robots didn’t work very well on surfaces that reflected the laser light from the floor. The robots would get some “false positive” collision avoidance readings and continually turn. The problem turns out they were aimed straight out in front at an angle almost parallel to the floor. But the laser beam was not a perfect point of light. It has a cone-shaped field, and the bottom of the cone was pointing down to the floor.

The time-of-flight distance sensor must be angled upward about 3 degrees so that reflections on the surface will not trigger a false-positive signal—image by the author.

The solution was to angle the sensor up about 3 degrees. This gave us a very accurate distance measurement on all the surfaces we tested. So now that we figured out the problem, how can we make it easy for our students to adjust in the classroom? The answer was a small 3D printed holder that allowed the angle to be adjusted by slightly bending the header pins.

Close up of the 3D printed time-of-flight sensor mount. Note that the mounts are often done under the robot chassis and are upside-down in the photos—image by the author.
Close-up of the time-of-flight sensor mount from the rear that shows the female Dupont connector pressure structures. Image by Gerd.

We found we can use small plyers to make small changes in the angles of the header pins to adjust the sensors. We can easily do this to continually adjust our robots until we get a good signal on reflective surfaces. We used M3x6 (metric) machine screws to mount the sensor on the bottom of our SmartCar chassis and M3 nuts. Alternatively, you can use #4–40 1/4 inch non-metric screws. Note that we keep the top of the SmartCar chassis open to mount a breadboard, displays, and buttons to control and program the SmartCars.

Sample 3D rendering of time-of-flight sensor mount from https://cad.onshape.com/. Image by Gerd.

I want to thank my friend Gerd for doing the design and printing of these sensor mounts. Designing these mounting connectors is not easy. They need to be designed to be easy to print and work on a wide variety of 3D printers with tolerance for alignment errors.

We printed this batch of 9 sensors with the front-side down. This image shows 9 of them being printed together—An image by Gerd.

We plan to include these sensor mounts in our CoderDojo Twin Cities robotics kits. The designs are available to any schools and coding clubs that would like to print their own under the Creative Commons Sharealike Noncommercial Attribution license. You can access the 3D model files directly from the onshape.com website.

Distinguished Engineer with an interest in knowledge graphs, AI and complex systems. Big fan of STEM, Arduino, robotics, DonkeyCars and the AI Racing League.