cancel
Showing results for 
Search instead for 
Did you mean: 

How to calibrate VL53L0x

zhy
Associate III

Hi,

     1》In the dark,Place the white target 140mm from the sensor

          call function

         Status = VL53L0X_perform_offset_calibration(&vl53l0x_dev,0x8c0000,&pOffsetMicroMeter);
     2》In indoor environments ,Place the black target  600mm from sensor
         call function
         Status = VL53L0X_perform_xtalk_calibration(&vl53l0x_dev, 0x2580000, &pXTalkCompensationRateMegaCps);
    3》in main function       
        Status = VL53L0X_set_offset_calibration_data_micro_meter(&vl53l0x_dev,&pOffsetMicroMeter);  
        Status = VL53L0X_SetXTalkCompensationRateMegaCps(&vl53l0x_dev,pXTalkCompensationRateMegaCps); 
    Is the above process correct?  
       But
       
     Status = VL53L0X_set_offset_calibration_data_micro_meter(&vl53l0x_dev,11300);              //设置offset
     Status = VL53L0X_get_offset_calibration_data_micro_meter(&vl53l0x_dev,&pOffsetMicroMeter);   //读取offset
         pOffsetMicroMeter = 11250   
    if ony call 
          Status = VL53L0X_get_offset_calibration_data_micro_meter(&vl53l0x_dev,&pOffsetMicroMeter);   //读取offset
          pOffsetMicroMeter = 32150        
   it seem :
           dtat not be write NVM
                                                      best wish
                                                                      thank you

     

1 ACCEPTED SOLUTION

Accepted Solutions
Zhiyuan.Han
ST Employee
Hi     
About your concern, it is reasonable. 
     Status = VL53L0X_set_offset_calibration_data_micro_meter(&vl53l0x_dev,11300);              //设置offset
     Status = VL53L0X_get_offset_calibration_data_micro_meter(&vl53l0x_dev,&pOffsetMicroMeter);   //读取offset
         pOffsetMicroMeter = 11250   
 

The register format is 10.2 fixed-point with units in mm:

  • 10 bits for the integer part
  • 2 bits for the fractional part
    The fractional bits represent 1/4,   mm = 250 µm.
OffsetCalibrationDataMicroMeter = 11300; // µm
encodedOffsetVal = 11300 / 250 = 45 // exact division, remainder 50 is discarded, This is integer division, so it truncates toward zero (it is not rounding):
What actually gets written into the register is “45 steps of 250 µm.”, that's why you read out value is 11250.
 
 
And if you don't set the offset value, or you rebooted the device after you setting the offset value, the read value will be the NVM offset value. 
 
 
Br
Zhiyuan.Han

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.

View solution in original post

7 REPLIES 7
zhy
Associate III
   Hi, 
   
    PALDevDataSet(Dev, LinearityCorrectiveGain, 1000);        //How to adjust it if I have a cover plate?
    PALDevDataSet(Dev, DmaxCalRangeMilliMeter, 400);        //  Only 400mm can be measured  ?
    PALDevDataSet(Dev, DmaxCalSignalRateRtnMegaCps,
        (FixPoint1616_t)((0x00016B85))); /* 1.42 No Cover Glass*/   //Do I need to adjust it if I have a cover plate?
John_Kvam
Senior II

With no coverglass, there should be no crosstalk. (There can be some if you have part of your structure near the sensor, but that's a mechanical issue to be avoided.)

But when you put on the coverglass you get the photons bouncing back from this glass and that's crosstalk.

The algo is trying to figure out how many photons are from the target and how many are from the glass. 

So with a target at some distance - that you supply - the algo has Number of photons, the correct distance and the measured distance. With those 3, it works out what percentage of photons come from the coverglass. 

But to do this it needs help. 

YOU have to experiment and find a target reflectivity and a distance where you are under-ranging by 10 or 20 percent. Just picking 600mm isn't going to do it. 

So find a dark target (I use matte finish black spray paint). And start ranging. If you've done the offset cal, you should be reasonably spot on  if the target is near, and it should get worse as you increase the distance. 

Once you find a spot where you under-range by 10 to 20%, use that target and location in your production. 

The correct distance depends on the quality of your glass. Very thin, clear, closely mounted and clean glasses will need a longer distance than thick, hazy, dirty ones with a large air gap between the sensor and the glass. 

In production I suggest making a range set up where the sensor is pointed at the crosstalk target, a white flap can be installed that when folded down, you can do the offset, fold away the offset target and do the crosstalk. 

- john 

 

If this or any post solves your issue, please mark them as "Accept as Solution". It really helps the next guy.
And if you notice anything wrong do not hesitate to "Report Inappropriate Content".
I am a recently retired ST Employee. My former username was John E KVAM.
Zhiyuan.Han
ST Employee
Hi     
About your concern, it is reasonable. 
     Status = VL53L0X_set_offset_calibration_data_micro_meter(&vl53l0x_dev,11300);              //设置offset
     Status = VL53L0X_get_offset_calibration_data_micro_meter(&vl53l0x_dev,&pOffsetMicroMeter);   //读取offset
         pOffsetMicroMeter = 11250   
 

The register format is 10.2 fixed-point with units in mm:

  • 10 bits for the integer part
  • 2 bits for the fractional part
    The fractional bits represent 1/4,   mm = 250 µm.
OffsetCalibrationDataMicroMeter = 11300; // µm
encodedOffsetVal = 11300 / 250 = 45 // exact division, remainder 50 is discarded, This is integer division, so it truncates toward zero (it is not rounding):
What actually gets written into the register is “45 steps of 250 µm.”, that's why you read out value is 11250.
 
 
And if you don't set the offset value, or you rebooted the device after you setting the offset value, the read value will be the NVM offset value. 
 
 
Br
Zhiyuan.Han

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.

zhy_0-1766479293008.png

 

 

I want to reduce power consumption, but there's an error. Could you advise how to configure XSHUNT for the next measurement after lowering it?

zhy
Associate III

Hi,Han

Does lowering the XSHUT really save power? I'm using a battery!

                                         thank you

Zhiyuan.Han
ST Employee

Hi 

Pulling down XSHUT will help to set the sensor to HW standby status, and it helps to save 1uA standby current from 6uA to 5uA.

to save battery power, I suggest you disabling the power supply directly, this will be the best case. 

 

Br

Zhiyuan.Han 

 

 


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.

Hi 

You need to pull-high the XSHUT again, and re-initialize the sensor, then perform the ranging test.

 

Br

Zhiyuan.Han


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.