Skip to main content
Associate II
August 22, 2024
Solved

How to configure and access histogram data in VL53L1

  • August 22, 2024
  • 1 reply
  • 1160 views

HI,

Could somebody tell me how to configure and access VL53L1 histogram data in detail.

Thank you

Best answer by John E KVAM

It's easy - buy and use the VL53L1CB. There is a VL53L1CX which is the same chip (almost) but it does not use histograms.

So just do a range with the VL453L1CB and get the result. Under the covers, the histogram is read from the sensor and the answer is obtained. 

There is a call - something like GetAdditionalData() that is in the API

VL53L1_Error VL53L1_GetAdditionalData(VL53L1_DEV Dev,
        VL53L1_AdditionalData_t *pAdditionalData)
it calls (in the core.c)
status = VL53L1_get_histogram_bin_data(
                        Dev,
                        &(pdev->hist_data));
The trick is to know that during the A range you will get 24 historam bins, During the B range you get 4 ambient light levels and 20 bin values. Or maybe its the other way around. I always forget.  
But it's obvious. 
Good luck, 
- john

1 reply

John E KVAM
John E KVAMBest answer
ST Employee
August 22, 2024

It's easy - buy and use the VL53L1CB. There is a VL53L1CX which is the same chip (almost) but it does not use histograms.

So just do a range with the VL453L1CB and get the result. Under the covers, the histogram is read from the sensor and the answer is obtained. 

There is a call - something like GetAdditionalData() that is in the API

VL53L1_Error VL53L1_GetAdditionalData(VL53L1_DEV Dev,
        VL53L1_AdditionalData_t *pAdditionalData)
it calls (in the core.c)
status = VL53L1_get_histogram_bin_data(
                        Dev,
                        &(pdev->hist_data));
The trick is to know that during the A range you will get 24 historam bins, During the B range you get 4 ambient light levels and 20 bin values. Or maybe its the other way around. I always forget.  
But it's obvious. 
Good luck, 
- john
If this or any post solves your issue, please mark them as 'Accept as Solution' It really helps. And if you notice anything wrong do not hesitate to 'Report Inappropriate Content'. Someone will review it.
Visitor II
April 21, 2025

您能更详细地介绍一下吗?为什么我收集的所有bin_data都是 0?