I found the following in STâs User Guide (here), regarding the FoV:
Setting ROI
The receiving SPAD array of the sensor consists of 16x16 SPADs which cover the full FoV.
It is possible to program a smaller ROI, with a smaller number of SPADs, to reduce the FoV for applications which require a narrow FoV.
Use the function VL53L1X_SetROI (dev, X, Y).
⢠X is the ROI width from 4 to 16, if X < 4 the Firmware limits the width to 4
⢠Y is the ROI height from 4 to 16, if Y < 4 the Firmware limits the height to 4
VL53L1X_GetROI returns the current ROI.
Note:Lowering the number of SPADs limits the maximum ranging distance. Some experimentation is required
So, âreducing the FoV for applications which require a narrow FoVâ is exactly what I want, I think!
I can find the following in your library (SparkFun_VL53L1X.h) about the ROI:
/**Table of Optical Centers**
*
* 128,136,144,152,160,168,176,184, 192,200,208,216,224,232,240,248
* 129,137,145,153,161,169,177,185, 193,201,209,217,225,233,241,249
* 130,138,146,154,162,170,178,186, 194,202,210,218,226,234,242,250
* 131,139,147,155,163,171,179,187, 195,203,211,219,227,235,243,251
* 132,140,148,156,164,172,180,188, 196,204,212,220,228,236,244,252
* 133,141,149,157,165,173,181,189, 197,205,213,221,229,237,245,253
* 134,142,150,158,166,174,182,190, 198,206,214,222,230,238,246,254
* 135,143,151,159,167,175,183,191, 199,207,215,223,231,239,247,255
* 127,119,111,103, 95, 87, 79, 71, 63, 55, 47, 39, 31, 23, 15, 7
* 126,118,110,102, 94, 86, 78, 70, 62, 54, 46, 38, 30, 22, 14, 6
* 125,117,109,101, 93, 85, 77, 69, 61, 53, 45, 37, 29, 21, 13, 5
* 124,116,108,100, 92, 84, 76, 68, 60, 52, 44, 36, 28, 20, 12, 4
* 123,115,107, 99, 91, 83, 75, 67, 59, 51, 43, 35, 27, 19, 11, 3
* 122,114,106, 98, 90, 82, 74, 66, 58, 50, 42, 34, 26, 18, 10, 2
* 121,113,105, 97, 89, 81, 73, 65, 57, 49, 41, 33, 25, 17, 9, 1
* 120,112,104, 96, 88, 80, 72, 64, 56, 48, 40, 32, 24, 16, 8, 0 Pin 1
*
* To set the center, set the pad that is to the right and above the exact center of the region you'd like to measure as your opticalCenter*/
void setROI(uint8_t x, uint8_t y, uint8_t opticalCenter); //Set the height and width of the ROI(region of interest) in SPADs, lowest possible option is 4. Set optical center based on above table
Since X and Y should be 4 for my application needs, I donât know how to figure out the correct value for âopticalCenterâ.
I do not understand the âTable of Optical Centersâ⌠could you explain what that actually is and what value might be correct for my needs?
//EDIT
Sorry for that spammingâŚ
No matter what i set via the âsetROIâ function, the next reading is â65535â and getRangeStatus() returns 13.
STâs âUser guideâ says:
This function programs the new user ROI center. Please note that there is no check in this function. If the ROIcenter vs the ROI size is outside the border, the ranging function returns an error #13
So⌠can someone tell me twhat correct values are?
//EDIT2
Another thing is, that getSpadNb() always returns different values when restarting my programm.
(I dont set that value by myself)
I seems the sensor calculates that value on its own⌠why? (and how?)