VL53L4CD and VL53L4CX TOF sensors

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ProtoPix
 
Posts: 57
Joined: Sun Sep 11, 2016 6:49 pm

VL53L4CD and VL53L4CX TOF sensors

Post by ProtoPix »

I have both the Adafruit VL53L4CD and VL53L4CX TOF devices.

Both devices have Device Id of 0xEBAA, the device Id documented for the VL53L4CD sensor. The VL53L4CX datasheet indicates the Device Id for the VL53L4CX sensor should be 0xEAAA.

Could both the Adafruit devices I have, have the same sensor? In any case, the VL53L4CX driver works with both devices.

I have a Qt Py ESP32S2 board connected to the Adafruit VL53L4CD Time of Flight Distance Sensor, and using the stm32duino/STM32duino VL53L4CX driver, I'm seeing the following serial terminal output:

desktop to the ceiling: VL53L4CX Proximity (mm): 2013 (in): 79.25
room wall to opposite wall: VL53L4CX Proximity (mm): 3282 (in): 129.21

Which are very good values, well beyond the ~1 to 1300mm advertised for the VL53L4CD sensor. I see the same or very similar results with the Adafruit VL53L4CX device.

Are Adafruit's VL53L4[CD/CX] devices the same? The VL53L4CX datasheet indicates the device Id should be 0xEAAA, but for my Adafruit VL53L4CX device, it is the same as my VL53L4CD device.

Is it possible that the VL53L4CD sensor could have been mistakenly integrated into some Adafruit VL53L4CX Time of Flight Distance devices?

Does the stm32duino VL53L4CX driver take more advantage of the capabilities of the VL53L4CD than the stm32duino VL53L4CD driver?

Inquiring via a comment through GitHub at stm32duino/VL53L4CX, I got a kind of non-answer to actual questions asked:
"The official rule is you should use the driver delivered with the sensor. This is not recommended by ST to use a different driver but if you test it, it might work for you."

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: VL53L4CD and VL53L4CX TOF sensors

Post by Franklin97355 »

They are not the same and we have no idea why they are reporting the device IDs. You might use the correct drivers unless you feel lucky since there is no telling what might happen.

User avatar
adafruit2
 
Posts: 22144
Joined: Fri Mar 11, 2005 7:36 pm

Re: VL53L4CD and VL53L4CX TOF sensors

Post by adafruit2 »

we dont *think* they got mixed but, but also agree they look the same
we wouldnt be surprised if there was some sort of 'binning' done- one sensor if fabricated and depending on whether it can do shorter or longer (6m) it is classified as CD or CX :/ ST probably is not terribly forthcoming on the details.

User avatar
ProtoPix
 
Posts: 57
Joined: Sun Sep 11, 2016 6:49 pm

Re: VL53L4CD and VL53L4CX TOF sensors

Post by ProtoPix »

Thanks for the replies!

My original intent was to try to determine the appropriate driver to use for the connected device by the device ids, but in this case, they are the same.

A reviewer for stm32duino/VL53L4CX on GitHub indicated there is a firmware difference but I don't see anything in the API that returns the firmware version that would allow me to know which device is connected. The CD and CX devices look the same

I never did think about the 'binning' possibility. If 'binning' is being done, then they are essentially the same devices, the CX just 'better quality' and the CX driver should work for the CD and it does for my CD device.

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL53L4CD and VL53L4CX TOF sensors

Post by adafruit_support_carter »

Both devices have Device Id of 0xEBAA, the device Id documented for the VL53L4CD sensor.
How are you getting this value? What code in your sketch makes the query?

User avatar
ProtoPix
 
Posts: 57
Joined: Sun Sep 11, 2016 6:49 pm

Re: VL53L4CD and VL53L4CX TOF sensors

Post by ProtoPix »

I think the VL53L4CD driver will work with the VL53L4CX device. Here's some code fragments I use for both devices (altered in this editor so they may need modifying in your environment if planning any testing):

Code: Select all

bool VL53L4CDCheck(TwoWire *wire)
{
  // Initialize I2C bus ( Wire or Wire1 depending on bus device is connected )
    wire->begin();

    // Configure VL53L4CD satellite component.
    VL53L4CD vl53l4cd = VL53L4CD(wire, XSHUT_PIN); 
    vl53l4cd.begin();

    // Switch off VL53L4CD satellite component.
    vl53l4cd.VL53L4CD_Off();

    //Initialize VL53L4CD satellite component.
    VL53L4CD_ERROR status = vl53l4cd.InitSensor();

    if (status == VL53L4CD_ERROR_NONE)
    {
        // Expected ID: 0xEBAA
        vl53l4cd.VL53L4CD_GetSensorId(&VL53L4CD_ID);
        Serial.print("VL53L4CD Sensor Id: 0x"); Serial.println(VL53L4CD_ID,HEX);
        vl53l4cd.end();
    }
    wire->end();
    return (status == VL53L4CD_ERROR_NONE);

//-----------------------------------------------------------------------------
bool VL53L4CXCheck(TwoWire *wire)
{
   // Initialize I2C bus.
    wire->begin();

    // Configure VL53L4CX satellite component.
    vl53l4cx.setI2cDevice(wire);    // dependent on added VL53L4CX() constructor & functions to vl53l4cx_class.h
    vl53l4cx.setXShutPin(XSHUT_PIN);    // dependent on added VL53L4CX() constructor & functions to vl53l4cx_class.h

    vl53l4cx.begin();

    // Switch off VL53L4CX satellite component.
    vl53l4cx.VL53L4CX_Off();
   
    //Initialize VL53L4CX satellite component. 
    // dev.address is the actual I2c physical address.
    // Shift the I2c address left to the expected I2c address 
    // expected by the driver which internally, shifts it right
    // to set it to the actual physical I2c address.
    VL53L4CX_Error status = vl53l4cx.InitSensor((dev.address << 1));

    if (status == VL53L4CX_ERROR_NONE)
    {
        uint16_t sensorId;
        vl53l4cx.VL53L4CX_GetSensorId(&sensorId);  // New function add to driver via GitHub PR
        Serial.print("    VL53L4CX SensorId: 0x"); 
        Serial.println(sensorId, HEX); 

       // Expected Device Type: 0xAA expected for VL53L4CX
        vl53l4cx.VL53L4CX_GetDeviceInfo(&VL53L4CX_DEV_INFO); 
        uint8_t deviceType = VL53L4CX_DEV_INFO.ProductType;
        Serial.print("    Device Type:       "); Serial.println(deviceType, HEX); 
        Serial.print("    Product Revision:  "); 
        Serial.print(VL53L4CX_DEV_INFO.ProductRevisionMajor);
        Serial.print(".");
        Serial.println(VL53L4CX_DEV_INFO.ProductRevisionMinor);
        VL53L4CX_Version_t version;
        vl53l4cx.VL53L4CX_GetVersion(&version);
        Serial.print("    Product version:   "); 
        Serial.print(version.build); Serial.print(" ");
        Serial.print(version.major); Serial.print(" ");
        Serial.print(version.minor); Serial.print(" ");
        Serial.println(version.revision); Serial.print(" ");

        vl53l4cx.end();
    }
    wire->end();
    return (status == VL53L4CX_ERROR_NONE);
}

}


I also submitted a couple of pull requests on GitHub at stm32duino/VL53L4CX, both have been merged, but only the first has been included in their latest library (version 1.1.0) so far. The latest PR included new function VL53L4CX_GetSensorId, comparable VL53L4CD_GetSensorId.

If you are doing any testing with the VL53L4CX driver, you will need to fetch the latest code from GitHub to get the GetSensorId function.

I originally had assumed the device Id for VL53L4CX was 0xEAAA per an earlier datasheet but the latest datasheet does document the device Id as the same as the VL53L4CD device. Only the firmware appears to be different per a PR reviewer but I don't see anything I recognize in the API that returns the firmware version for either device.

Not sure all that went into the firmware changes but the VL53L4CX driver works for my VL53L4CD device giving it expanded range.

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL53L4CD and VL53L4CX TOF sensors

Post by adafruit_support_carter »

I'd still be cautious about using the Vl53L4CX driver with the VL43L4CD. As STM mentions - they are running different firmware:
https://github.com/stm32duino/VL53L4CX/ ... r913100019
The drivers are written to match. There may be some overlap, but the extent to which you can get away with this is not documented anywhere. Doubt you'll do any damage to the sensor itself. But just keep in mind the answer for any weird behavior you may see will most likely be:
The official rule is you should use the driver delivered with the sensor

User avatar
ProtoPix
 
Posts: 57
Joined: Sun Sep 11, 2016 6:49 pm

Re: VL53L4CD and VL53L4CX TOF sensors

Post by ProtoPix »

Noted! Thanks!

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”