0

VL53L0X Time of Flight Distance Sensor
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

VL53L0X Time of Flight Distance Sensor

by dlernstrom on Sun Sep 03, 2017 2:58 pm

Order Number : 1493657-3190249121
Ordered 14 July, but just now cracked into the project

I ordered a Adafruit VL53L0X Time of Flight Distance Sensor. I cannot get it to go beyond the lox.begin() call in the sample code from the site. Looking at the forums, I found some suggestions to attempt running the pololu example as well to see if it was an Adafruit code issue. Unfortunately, the problem runs into problems at the init() call in his code. I have tried power cycling the Arduino as well as verified that my solder joints are good.

20170903_115253.jpg
20170903_115253.jpg (255.37 KiB) Viewed 1543 times

20170903_115334.jpg
20170903_115334.jpg (280.25 KiB) Viewed 1543 times

20170903_115409.jpg
20170903_115409.jpg (241.31 KiB) Viewed 1543 times

Code: Select all | TOGGLE FULL SIZE
#include "Adafruit_VL53L0X.h"

Adafruit_VL53L0X lox = Adafruit_VL53L0X();

void setup() {
  Serial.begin(115200);

  // wait until serial port opens for native USB devices
  while (! Serial) {
    delay(1);
  }
 
  Serial.println("Adafruit VL53L0X test");
  if (!lox.begin()) {
    Serial.println(F("Failed to boot VL53L0X"));
    while(1);
  }
  // power
  Serial.println(F("VL53L0X API Simple Ranging example\n\n"));
}


void loop() {
  VL53L0X_RangingMeasurementData_t measure;
   
  Serial.print("Reading a measurement... ");
  lox.rangingTest(&measure, false); // pass in 'true' to get debug data printout!

  if (measure.RangeStatus != 4) {  // phase failures have incorrect data
    Serial.print("Distance (mm): "); Serial.println(measure.RangeMilliMeter);
  } else {
    Serial.println(" out of range ");
  }
   
  delay(100);
}


All that prints on my console session is:
Code: Select all | TOGGLE FULL SIZE
Adafruit VL53L0X test

Since the Arduino Feather is running and getting to the point where it is serial outputting the Adafruit test line, I'm pretty sure the problem isn't with the feather, serial connections, etc.

Please help!

dlernstrom
 
Posts: 4
Joined: Sun Sep 03, 2017 2:48 pm

Re: VL53L0X Time of Flight Distance Sensor

by adafruit_support_carter on Tue Sep 05, 2017 1:58 pm

Your solder job looks great and the wires seems to be correct in terms of pin-to-pin hookup. The behavior seems like the I2C comms aren't working though. Wiring seems the most likely. Recheck your wiring to make sure they are all solid and try again.

adafruit_support_carter
 
Posts: 12958
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL53L0X Time of Flight Distance Sensor

by dlernstrom on Tue Sep 05, 2017 2:29 pm

Got it - rewired each wire and still the same behavior.

dlernstrom
 
Posts: 4
Joined: Sun Sep 03, 2017 2:48 pm

Re: VL53L0X Time of Flight Distance Sensor

by adafruit_support_carter on Tue Sep 05, 2017 2:34 pm

Try running this I2C scanner sketch as another way to check if the Feather can even see the VL53LOX:
https://playground.arduino.cc/Main/I2cScanner

Do you have any other I2C devices we could use to help check things?

adafruit_support_carter
 
Posts: 12958
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL53L0X Time of Flight Distance Sensor

by dlernstrom on Tue Sep 05, 2017 3:44 pm

All I see with that Sketch file is the following:
Code: Select all | TOGGLE FULL SIZE
I2C Scanner
Scanning...


I do not have any I2C devices I can test with. This is my first venture into this space.

I did order 2 more VL53L0X sensors when this one wasn't working and I felt like I had exhausted any troubleshooting via verifying wires or running debug code. When those sensors show up, I'll be able to report more. 1Z71EY050399491427

dlernstrom
 
Posts: 4
Joined: Sun Sep 03, 2017 2:48 pm

Re: VL53L0X Time of Flight Distance Sensor

by adafruit_support_carter on Tue Sep 05, 2017 6:49 pm

OK. Report back when you get the other sensors. Using those as a secondary test will really help. Just solder them up and try running the I2C scanner again.

adafruit_support_carter
 
Posts: 12958
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL53L0X Time of Flight Distance Sensor

by dlernstrom on Tue Sep 12, 2017 11:33 pm

Hello. I did find my Adafruit order today (UPS delivered the Adafruit envelope on my front porch but the wind blew it about 100' away onto the west lawn!).

The new sensor did not immediately solve my problem, though. I was really bummed and so started wondering if my problem was the Adafruit Feather 32u4. I pulled up the spec from the Adafruit site. I verified SCL, SDA, and GND. The only other pin that was questionable was the 3V. The VL53L0X sensor spec claims "you can use it with any 3-5V power or logic microcontroller with no worries", and that it only draws 2.8V, I figured I was fine. Boy was I wrong.

The Adafruit Feather 32u4 also had a pin called USB, which claimed to be "positive voltage to/from the micro USB jack if connected". Didn't say how many volts, but at this point, I was out of options. I moved my wire from the 3V line to the USB line. Then I power cycled the Feather via the RST button. After a few seconds, I pushed the code to the Feather and my sensor sprang to life!

All things considered, I'm glad to not have a defective board. I am a bit annoyed that I filed the technical support ticket and somebody from Adafruit looked over my pictures and said the wiring looked fine. I find it annoying that the 3V line did not provide enough juice for the lidar. Grateful, though, that I got the project working and I can advance my work project.

Now what am I going to do with this extra $43.44 in sensors that I am sitting on that I didn't need. :\

dlernstrom
 
Posts: 4
Joined: Sun Sep 03, 2017 2:48 pm

Re: VL53L0X Time of Flight Distance Sensor

by adafruit_support_mike on Wed Sep 13, 2017 5:25 am

I just checked the VL53L0X datasheet, and the 3v pin should provide more than enough power. The chip's maximum supply voltage is 3.5v, and it should only use 19mA at most while ranging.

The Feather's 3v pin should be able to provide 150mA @ 3.3v, which is well beyond the sensor's requirements.

As a sanity check, try moving the Feather and VL53L0X to different spots in the breadboard and see if the 3v pin will work. Breadboards are notorious for flaky connections, and there might be a marginal connection on the row you happened to use.

adafruit_support_mike
 
Posts: 58798
Joined: Thu Feb 11, 2010 2:51 pm

Re: VL53L0X Time of Flight Distance Sensor

by jerryn on Wed Sep 13, 2017 7:50 am

Just a concern/warning.
If you power the VL53L0X from USB (5V) then if I am not mistaken, it will use 5V for the I2C lines which is not good for the feather board. On a feather, it should be powered by 3.3V.
Do I have this correct?
From the guide:
Vin - this is the power pin. Since the chip uses 2.8 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V

jerryn
 
Posts: 990
Joined: Sat Sep 14, 2013 9:05 am

Re: VL53L0X Time of Flight Distance Sensor

by adafruit_support_carter on Wed Sep 13, 2017 9:26 am

I just tested a Feather 32u4 Adalogger with a VL6180X (don't currently have a VL53L0X on hand) and it worked fine being power from the 3V pin. I second Mike's suggestion of trying it again from the 3V pin but restage everything on your breadboard to make sure it's not just a wiring issue.

adafruit_support_carter
 
Posts: 12958
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL53L0X Time of Flight Distance Sensor

by adafruit2 on Wed Sep 13, 2017 4:45 pm

jerryn wrote:Just a concern/warning.
If you power the VL53L0X from USB (5V) then if I am not mistaken, it will use 5V for the I2C lines which is not good for the feather board. On a feather, it should be powered by 3.3V.
Do I have this correct?
From the guide:
Vin - this is the power pin. Since the chip uses 2.8 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V


this isnt as big a deal as people make it out to be, the pullups are really weak, 10K each - it will not fry your feather, its just not 'ideal'

adafruit2
Site Admin
 
Posts: 18652
Joined: Fri Mar 11, 2005 7:36 pm

Re: VL53L0X Time of Flight Distance Sensor

by adafruit2 on Wed Sep 13, 2017 4:47 pm

dl, if you ordered sensors you dont need you can email support@adafruit for a return or refund.

we did test these with a feather so it ought to work, you can also try adding another capacitor to the VIN line - maybe 0.1uF ceramic? if you have an oscilloscope, looking at the power trace may be useful!

adafruit2
Site Admin
 
Posts: 18652
Joined: Fri Mar 11, 2005 7:36 pm

Re: VL53L0X Time of Flight Distance Sensor

by mcscruf61 on Thu Feb 08, 2018 5:01 pm

I had an identical issue with a Adafruit HUZZAH32 Feather board. Adding 0.1uF helped slightly, but VL53L0X would still fail to initialize at least 50% of the time. Connecting the Vin pin to 5V power instead of the 3.3V power immediately seemed to fixe the issue. With the VL53L0X connected to 5V I have not been able to recreate the issue.

mcscruf61
 
Posts: 1
Joined: Mon May 05, 2014 11:44 am

Re: VL53L0X Time of Flight Distance Sensor

by adafruit_support_carter on Fri Feb 09, 2018 12:48 pm

@mcscruf61 Thanks for the info. With regards to I2c issues on ESP32, it may be related to ongoing work:
https://github.com/espressif/arduino-esp32/issues/741
https://github.com/espressif/arduino-esp32/issues/839

adafruit_support_carter
 
Posts: 12958
Joined: Tue Nov 29, 2016 2:45 pm

Re: VL53L0X Time of Flight Distance Sensor

by dhruvan1992 on Wed Apr 25, 2018 5:02 am

what does these lines mean and do?
lox.rangingTest(&measure, false); // pass in 'true' to get debug data printout!
what does false do here?
if (measure.RangeStatus != 4) { // phase failures have incorrect data
why does it have to be != 4?

dhruvan1992
 
Posts: 1
Joined: Wed Apr 25, 2018 5:00 am

Please be positive and constructive with your questions and comments.