VL53L1X sensor

Hi,
i tried to use your VL53L1X sensor. The sensor was recognized on I2C, i can read various register values (ex. Model ), but reading distance is always 0.

range: 0 status: no update peak signal: 0.00 ambient: 510.00
range: 0 status: no update peak signal: 0.00 ambient: 510.00
range: 0 status: no update peak signal: 0.00 ambient: 510.00
range: 0 status: no update peak signal: 0.00 ambient: 510.00
range: 0 status: no update peak signal: 0.00 ambient: 510.00

or i get TIMEOUT, if i use the more simpler script.
If there a chance to check, what’s wrong?

Thx Peter

founded.
I use “normal Data Pins” to power the sensor (to realize deep sleep modi and save battery capacity).
The sensor need 20mA in ranging mode and with special configuration up to 40mA (ST dokumentation sheet).
The “normal Data Pins” of my board allow max. 10 mA current.
I there a chance to reduce the sensor current?

Thank you for letting us know you found the problem.

In general, powering a sensor like this directly from an I/O pin is not recommended. To control the power to the sensor like you described, you should probably use something like a MOSFET.

Brandon

Maybe pulling XSHUT low would do what you want, but remember that when the sensor wakes up after you release it you have to perform all the initializations again, as if it were powering up for the first time.

Yes, i know, powering by a I/O pin is a bad idea in the world of engineers :wink:
But,it is not unusual to connect an LED to an output Pin. The LED behaves no differently than any other power consumer. If the current consumption does not overload the pin or even shorting the circuit …
In my case i decided to take a additional transistor to switch the sensor current source. A cheap 2N2222 should be enough, to do the job.