Skip to main content
MBaum.7
Associate III
December 5, 2023
Solved

VL53L8CH Example code to configure for histogram and get data

  • December 5, 2023
  • 1 reply
  • 2186 views

I want to use the VL53L8CH in histogram mode to distinguish between multiple reflective surfaces. I found a c-driver package in STSW-IMG043, but no useful example how to initialize the sensor and get data out (over I2C).

What I'am looking for:

1) initialize sensor and start ranging, with some example code to setup the histogram configuration

2) get histogram data over I2C

In the mentioned driver software there are a lot of functions, some of them are clear what they do, other are not clear, but I did not found an application in a software layer avbove which bundles these driver functions to a senseful initialization- or read method.

This topic has been closed for replies.
Best answer by Anne BIGOT

Hello,

 

You can find some example in the STSW-IMG043_ULD from here .

The en.STSW-IMG043_ULD\VL53LMZ_MassMarket_ULD\Examples\Example_12_cnh_data.c file is dedicated to cnh

 

If you download the package and unzip it,  then do the following :

  • go to en.STSW-IMG043_ULD\VL53LMZ_MassMarket_ULD\CubeIDE_F401RE_Example\ and double click on .project
  • The project is imported in CubeIDE
  • Compile the project : OK
  • Flash the Nucleo board with the binary
  • Start TeraTerm and here is what you can see : distances and CNH for each zone

y

 

Hope this helps,

 

Anne

1 reply

MBaum.7
MBaum.7Author
Associate III
December 6, 2023

Hi John

Thank for your answer. Water level in a cup, that's exact the use case I want to realize. And because of multiple reflective areas, a histogram would be best to recognize the liquid level without crosstalk of the cup bottom or roof. I do not expect that I will need many features of this sensor for that, just get out a histogram, perhaps reduced to a partial zone of the sensor area. 

 

Altough I understand that there is no sense to publish code for every use case, it would be good to have some basic functionallity examples.to see which of the bunch of functions are needed to setup a basic configuration and read data.

Anne BIGOT
Anne BIGOTBest answer
Technical Moderator
December 6, 2023

Hello,

 

You can find some example in the STSW-IMG043_ULD from here .

The en.STSW-IMG043_ULD\VL53LMZ_MassMarket_ULD\Examples\Example_12_cnh_data.c file is dedicated to cnh

 

If you download the package and unzip it,  then do the following :

  • go to en.STSW-IMG043_ULD\VL53LMZ_MassMarket_ULD\CubeIDE_F401RE_Example\ and double click on .project
  • The project is imported in CubeIDE
  • Compile the project : OK
  • Flash the Nucleo board with the binary
  • Start TeraTerm and here is what you can see : distances and CNH for each zone

y

 

Hope this helps,

 

Anne

Our community relies on fruitful exchanges and good quality content. You can thank and reward helpful and positive contributions by marking them as 'Accept as Solution'. When marking a solution, make sure it answers your original question or issue that you raised. ST Employees that act as moderators have the right to accept the solution, judging by their expertise. This helps other community members identify useful discussions and refrain from raising the same question. If you notice any false behavior or abuse of the action, do not hesitate to 'Report Inappropriate Content'
MBaum.7
MBaum.7Author
Associate III
December 6, 2023

Hi Anne
Thanks for the link to the exitsing usage examples. I think this helps a lot, I will try as soon as possible.

Best regards, Michael