2025-01-26 10:23 AM - last edited on 2025-01-26 11:53 PM by mƎALLEm
Hi everybody.
Please help me.
I bought a VL53L4ED sensor and would like to learn how to use it.
I have found a number of documents and driver examples, but have been unable to find a document describing the internal registers and their function. (programming manual) .
I must be looking for it wrong. Can you please direct me to the proper document?
Thank you very much.
Jaroslav
Solved! Go to Solution.
2025-01-29 7:46 AM
The VL53L4ED is an extended temperature version of the VL53L4CD. The CD is a bit cheaper, so I'd go with that one.
If you have power and ground, and the I2C lines are hooked up correctly, and the XShut line is lifted high there is nothing that can prevent the chip from responding.
But try this...
Search GitHub for the VL53L1, or L4 and your MCU. With a little luck someone has done the work for you.
Try this snippet of code. change the the L1 to L4X and your model ID will be different. But you should get a response.
(The L1X and the L4CD are the same silicon but with different optics.
VL53L1_RdByte(Dev, 0x010F, &byteData);
printf("VL53L1X Model_ID: %02X\n\r", byteData);
VL53L1_RdByte(Dev, 0x0110, &byteData);
printf("VL53L1X Module_Type: %02X\n\r", byteData);
VL53L1_RdWord(Dev, 0x010F, &wordData);
printf("VL53L1X: %02X\n\r", wordData);
I got:
VL53L1X Model_ID: EA
VL53L1X Module_Type: CC
VL53L1X: EACC
There is also an 'is_booted' function that should return a 1. Can't get much simpler than that.
I didn't know I2C can go down to 20KHz. Might want to crank that up to 100KHz.
- john
2025-01-30 9:10 AM
Hi John,
I guess we don't quite understand each other,
I've been reading the I2C from the beginning, and I can read the ID code reliably.
The sequence of writes to register 0x003A appears to be fine according to the oscilloscope,
the I2C cycle ends with ACK, but subsequent reads from 0x003A 0x00 (I2C waveform also OK but with 0 in the data).
According to the datasheet the minimum I2C frequency is not limited,
but I've tried slowing down and speeding up I2C. I also inserted a delay between writing and reading a byte. All without success.
Where can I please find the 'is_booted' function you mention?
I can't seem to find it.
I found a VL53L0X board on the web. The programming is probably much different, but I want to verify the I2C communication.
Does the VL53L0X also have a register (like 0x3A) to test writing and reading on?
Thank you,
best regards
Jaroslav Brazdil
2025-03-24 7:24 AM
Hi John,
After tinkering with the I2C speed and using some additional delay, I was able to read the distance from the VL53L4ED.
I have one more question for you please.
I need to detect the tube between the arms of a gripper.
The problem is that the tube may be of transparent material
and that the distance to the tube is small.
If I measure the distance to the tube without any other background,
the tube is safely detected,
But if there is some background behind the tube (say 100mm),
the distance to the background is measured, not to the tube.
I would probably need some function opposite to Xtalk calibration
I've also tried measuring between two gripper arms, opposite arm shiny, or
taped with matte paper tape and calibrated at a relatively close distance (20mm).
But the results were not good. The insertion of the tube sometimes even led to an increase in the measured distance.
So please I ask, is it possible to adjust the sensor to measure at such a short distance (1-20mm) and with a transparent object?
Alternatively, can you recommend another type of sensor for such a task?
Thank you for your patience.
Best regards
Jaroslav Brazdil
2025-03-24 9:01 AM
Your issue is the sensor averages all the photon return times it gets to give you a distance.
So if your rod is the only thing in the field of view, then it works fine.
But with a background – especially a reflective background you are stuck.
The other problem is your distances. These sensors really don't do well at zero distance.
(Actually, we spend a lot of time trying to eliminate the signal which comes from the coverglass.)
But from your picture, your tube looks a lot like a coverglass.
Before you keep making experiments, attach a coverglass to your sensor.
Not having one and having the sensor touch stuff is going to cause debris to enter the cavity and it will ruin the sensor and ruin all your results.
I don't think the distance is going to give you good results. But consider using signal strength. Try looking at the signal strengths of the empty gripper and a full one. There might be enough difference to imply that the tube is there.
but to make this experiment, change the GetResult() function to use floating point. The integer arithmetic is simpler, but you need more accuracy.
2025-03-25 3:11 AM
Hi John,
Thank You for the idea with signal strength.
I only did a basic experiment, but the signal strength varies significantly more than the measured distance. Depending on the position of the tube it sometimes gets smaller, sometimes bigger, but it seems to change.
I need to test this detection in a real configuration.
Thank You.
Jaroslav