2021-02-15 06:06 AM
Hi there
I can't find out how to connect my sensor to an arduino uno. Tried both with sample codes from SparkFun and i2C example code. It is connected in the following way:SCL -> SCL
SDA -> SDA
GND -> GND
VDD -> 5V
I also tried with 2K ohm pull-up resistors, but didn't work.
I hope someone can help :)
Solved! Go to Solution.
2021-03-01 07:35 AM
that's going to be a hard one.
the VL53L1X works using a algorithm we call Sigma/Delta. And as the name implies, it's a statisical model, where all the photon arrival times are averaged together and the answer is produced by the Sensor.
the VL53L3X however works differently. The raw data is gathered up into a histogram where each bin is the number of photons detected during each clock cycle.
That raw data is then sent to the host for processing. It is your host MCU that turns the raw data into an answer.
The answer does contain more information than Sigma Delta, but it takes more processing on your part.
The L3 can be made to run in Sigma Delta if you really need it to. (This is NOT in the datasheet, and not offically even allowed. It is a quirk of how the chips evolved from one to the other.)
If you want to run the L3 in Sigma Delta it would be easier to simply buy the VL53L0X (Because that's what you would be getting anyway.)
In Sigma/Delta the L1 is vastly better than the L3.
2021-02-15 06:40 AM
VDD has a max of 3.6.
5V is completely out of the question.
There are a good dozen variants of tiny carrier boards. Pololu, Sparkfun, and enen ST make them.
From the picture it looks like that's the green satellite board from ST and it does not have any voltage regulators on them.
So 3v3 is the right answer.
The VL53L1 doesn't really do very well if you over-voltage it, so I'm a little worried.
if you need to buy another, you can by the ST satellit board that does NOT come with the X-Nucleo-53L1A1.
Those are blue and do have voltage regulators on them.
Good luck.
2021-02-15 06:47 AM
Hi John
Thank you very much for the quick reply!
I thought the satellite board had regulator as seen in the documentation from 5v to 2.8 (https://www.st.com/resource/en/data_brief/vl53l1x-satel.pdf), but i also tried 3v3 without any luck. I thought this was a carrier board and the voltage regulator can be "broken" off at the dotted line.
2021-02-15 07:04 AM
We sell those two ways - with regulators and I2C level shifters and without.
The sensor itself only needs 3v3, ground and I2C clk and data. Although there is an interrupt line you can use.
Look on the back side of that board. Are the chips stuffed?
If so you should be good.
otherwise the most common mistakes are reversing the I2C clock and data or using too long a wire.
If you are going to use anything except 3v3 please use the entire board.
You need the regulators.
Another issue is that this device has 2-byte address. (Most I2C parts have a one-byte address.)
If you only send one byte addresses, the chip will not respond until it gets the second address.
The boad you have should work.
the easy thing is to try to do a read on I2C address 0x29 (write address 0x52/ read address 0x53)
there is an internal register - 0x10F
printf("VL53L1X Examples...\n");
Dev->I2cHandle = &hi2c1;
Dev->I2cDevAddr = 0x52;
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);
2021-02-15 07:24 AM
Hi
I not too experienced in electronics, but got it to work with the i2C scanner by adding wires to the "main" board (the small one) from 3v3.
Next step is to find a code in Arduino that utilised i2C
2021-02-15 07:46 AM
got to Github.com and search for VL53L1x Arduino
There is stuff from Pololu and Sparkfun - as well as a bunch more.
There were 17 projects that came up.
Something there will help you out.
Some of that code will do exactly what you want.
2021-03-01 12:06 AM
Thank you very much John, I got it to work! :) However when trying the VL53L3CX, I can't get it to work with the same code, any idea why not?
code:
#include <Wire.h>
#include <VL53L1X.h>
VL53L1X sensor;
void setup()
{
Serial.begin(115200);
Wire.begin();
Wire.setClock(400000); // use 400 kHz I2C
sensor.setTimeout(500);
if (!sensor.init())
{
Serial.println("Failed to detect and initialize sensor!");
while (1);
}
// Use long distance mode and allow up to 50000 us (50 ms) for a measurement.
// You can change these settings to adjust the performance of the sensor, but
// the minimum timing budget is 20 ms for short distance mode and 33 ms for
// medium and long distance modes. See the VL53L1X datasheet for more
// information on range and timing limits.
sensor.setDistanceMode(VL53L1X::Long);
sensor.setMeasurementTimingBudget(50000);
// Start continuous readings at a rate of one measurement every 50 ms (the
// inter-measurement period). This period should be at least as long as the
// timing budget.
sensor.startContinuous(50);
}
void loop()
{
Serial.print(sensor.read());
if (sensor.timeoutOccurred()) {
Serial.print(" TIMEOUT");
}
Serial.println();
delay(1000);
}
2021-03-01 07:35 AM
that's going to be a hard one.
the VL53L1X works using a algorithm we call Sigma/Delta. And as the name implies, it's a statisical model, where all the photon arrival times are averaged together and the answer is produced by the Sensor.
the VL53L3X however works differently. The raw data is gathered up into a histogram where each bin is the number of photons detected during each clock cycle.
That raw data is then sent to the host for processing. It is your host MCU that turns the raw data into an answer.
The answer does contain more information than Sigma Delta, but it takes more processing on your part.
The L3 can be made to run in Sigma Delta if you really need it to. (This is NOT in the datasheet, and not offically even allowed. It is a quirk of how the chips evolved from one to the other.)
If you want to run the L3 in Sigma Delta it would be easier to simply buy the VL53L0X (Because that's what you would be getting anyway.)
In Sigma/Delta the L1 is vastly better than the L3.
2021-03-09 05:36 AM
Hi John
Thank you so much for the response, you are a huge help!
What is the VL53L1CB running? It seems to have 8m range and i am using it for water table measurement, where the longer the range the better.
Can it run on a Particle device like electron or boron?
2021-03-09 07:01 AM
The VL53L1CB and the VL53L3 run the same algro - histograms. If conditions are perfect, you can indeed get to 8M. It does take a very reflective surface however. A customer asked us to focus a projector, and he needed that extra distance, and a projector screen is rather refletive.
I have no idea what a particle device is.
Our little chip uses 940nm near I/R light. It's the same laser thats in all the fiber optics in the world.
That made the laser cheap and available.