Close

Selecting the right distance sensor

A project log for Pipo modules

Turning sensors into IoT controllers for music, video, graphics, and more

rupRup 02/20/2025 at 18:140 Comments

Before even starting to layout a schematic for the new modules, the first steps was to select the sensors and peripheral for my Esp32-s3.

1) Choose the right technology for your application

The use cases for Pipo are the ability to track a hand, medium/large obstacles, or detect people approaching.

Having some experience with distance sensing from past interactive projects builds, I already knew the latest Time Of Flight sensors would be good candidates to try out, but I did not had sharp specifications upfront since manufacturers do not spec their sensor for how good they are at reliably detecting a hand or a human body...  

But let's go over the most common distance sensor types and see what criterion had to be taken into account for this project. (proximity sensors are excluded):

Here a high level comparison table for distance sensors

FreqMax rangeFoVAccImmunitySize$
Ultrasonic sensorsmediummediummediumlowgoodmedium-biglow
IR reflection sensorfastlowmediummediumlowmediummedium
Time of Flight sensormedium to fastmediummedium to largegoodaveragetinymedium
Lidar style ranging sensorfasthighvery smallgoodgoodbigHigh

In case of Pipo, the Ultrasonic sensor were eliminated due to their low accuracy and size, IR sensor due to their poor immunity and rather low range, while the great performance of Lidar was not sufficient to balance their size and cost.

2) Identify and source all candidates

While I tried to look for different manufacturers, I was always brought back to St Microelectronics, who has the largest product range and has good open library support available.
I could find the interesting following table to navigate their product range.


But don't be fooled by the nice looking numbers provided for the maximum range measurement. 
In most cases, these numbers are given for indoor use (no IR) on a white target covering the field of vision which doe not reflect use cases we are interested in.

In this situation, the best is to test, datasheets are not always enough. Buy a bunch of them and start testing.
For these tests I like to use an M5 stack Atom Esp32-s3 instead of the standard devkit, because it is compact and has the grove connector, allowing for a reliable and rapid connection.


3) Test plan

I defined some tests conditions to help me estimate their potential performance in my use cases.

To assess their performance I used different target types and sizes, tested different sensor modes depending on the models, and defined different measurements to execute in each case.
A good test plan is key to obtain relevant results.

After processing the results, the tests confirmed the 2 best performer were VL53L4CX and VL53L1CB.
But my tests allowed me to define the real ranges achieved in my application.  Tracking a hand or a body were far from the theoretical value, while still very decent for my application.
These sensors can detect people up to roughly 3m (further if 0 IR ambient), and a hand up to roughly 80cm.
Doing this whole process also allowed me to familiarize with the libraries, explore the settings, and get a good grasp on all the pros and cons of pursuing with ToF sensors which is important before building around it.

Discussions