Showing results for 
Search instead for 
Did you mean: 

VL53l1X - can I fix used number of SPAD's

Associate III

I use a VL53l1X looking trough a oil layer of ca. 20 mm. When getting measured distance 3 times with GetResult(), it returns (example):

Status = 0, dist = 11, Ambient = 16, Signal = 20936, #ofSpads = 6

Status = 0, dist = 19, Ambient = 8, Signal = 18104, #ofSpads = 6

Status = 0, dist = 38, Ambient = 16, Signal = 15864, #ofSpads = 19


--> some 'magic' automatic changed the NrOfSpads from 6 to 19, which also affects the measured distance. When I set the NrOfSpads with VL53L1X_Status_t VL53L1X_SetROI(uint16_t X, uint16_t Y);, this only limits the maximal used NrOfSpads, but it's further possible that the sensor switches to a lower NrOfSpads autonomous.


How can I force the sensor to use a defined NrOfSpads?

ST Employee

Alas you cannot. 

The sensor does a Dynamic Spad Select (DSS) at the start of ranging. Ideally the senor wants a signal of 20M. So it adds SPADs if the signal is low and it turns some off it the signal is high. 

(It takes energy to reset or 'quench' a SPAD, so the object is to pick just the right amount. And despite the #ofSpads being an integer, there are some that are occluded and if you really dig into the code you can see a float.)

Try your experiment again changing from a black bit of paper to a piece of aluminum foil.  You will see the # of SPAD fluctuate to the extremes. 

I'm not sure what caused your SPAD count to change so much. But I'd have to guess it was a change of target reflectivity. And the reflectivity extremes lead to most of the error we see in the sensor. 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question. It helps the next guy.