2025-07-25 4:05 AM
Hi All,
I'm developing a proximity switch using VL53L4CD
My unit works perfectly 99.9% of the time but I’m seeing occasional instances where the unit triggers very briefly even when there’s nothing in range. It may go an hour between such events, even several hours, but equally it can on rare occasions do it twice in a minute. It’s almost like a fly flew through the beam. It’s literally on in one frame and off again in the next.
I’m using the UL driver without thresholds (RS_IT_DEFAULT), since I need to enforce some hysteresis. My ranging frequency is 20Hz. The unit has the standard cover glass and I’m calibrating it before use with a 17% target. I get the problem whether or not the cover glass is fitted, and the amount of ambient light doesn’t seem to be a factor.
I only allow a change of state to ‘on’ when ToF status = 0 and distance <= threshold, so that must be happening occasionally even when there’s no target.
This is a production ready pcb but in an effort to see what was happening I lashed an ST-Link into the circuit so I could set a breakpoint and see what’s going on. Here’s the weird bit – it never happens when running the code that way (although because it happens so infrequently it’s difficult to be sure of anything). The only way I see this problem is when the unit is completely stand-alone, which denies me any debugging capability.
So my question is whether it’s possible for the device to report status =0 and a plausible distance even when there’s no target? If so, is there any way to address it or do I need to think about adding debounce? I was trying to avoid debounce because it will introduce lag.
I’m aware that the device is essentially running a statistical model so maybe there are extreme occasions where it gets it wrong.
Many thanks for any advice.