VL53L1X Range sensor on Photon


#1

I have a VL53L1X range sensor from Pololu (https://www.pololu.com/product/3415/pictures). I loaded the VL53L0X library, and compiled with the Web IDE for my 0.7.0 Photon. I tried flashing the Single.ino example from the VL53L0X library. It appears to start normally, but several seconds after the “Hello” message it goes from “breathing” cyan to “breathing” green and produces no output to the serial console.

If I disconnect the sensor, the program runs OK (though it obviously just gives a string of Timeout messages on the console). I’ve triple-checked my wiring:

Sensor      Photon
Vin          3V3
GND          GND
SDA           D0
SCL           D1

If I run my I2C scanner, it correctly reports a device at 0x29 and doesn’t fall into “breathing” green.

As far as I can tell, the only difference between the VL53L1X and the VL53L0X is that the former has a 400 cm. range while the latter has a 200 cm. range.

Has anyone successfully gotten the VL53L1X to work with a Photon? Or am I just doing something stupid trying to get the 0X library to run the 1X sensor. There does seem to be something this library doesn’t like about the 1X sensor.


#2

Give this library a try:


#3

Oh. I actually had seen that, noticed it was for Arduino, and passed on it because it didn’t say Photon.

So I added it manually to a new project (and for once I got a clean compile right away), ran the Example1_ReadDistance.ino code there and hey presto, it works. Thanks!

So the moral for anyone else wanting to use this sensor with the Photon, don’t use the Particle VL53L0X library. Use the Github Sparkfun VL53L1X Arduino library instead. (And don’t forget to remove the tiny little nearly invisible plastic protection sheet from the face of the sensing element).


#4

How accurate has the VL53L1X been with this library? I’ll be working with the VL53L1X soon and I’m wondering if this library will be a viable option.


#5

I haven’t had the chance to check that out yet. They claim 0.1 cm.resolution. I don’t need anywhere near that much. I want to use this as a snow depth sensor. We’ll see.


#6

Snow flying in front of the sensor path will be picked up by the sensor and will throw off the readings based on my testing of the 200cm version.


#7

Indeed. Not only that but the sensor I’m using now (Parallax LaserPING 28041) turns out to be completely useless outdoors in daylight. It reports its maximum distance until the sun sets.

To be fair, the LaserPING does report distance correctly at night in light snowfall but I need something that works in daylight too. The claim is that the VL53L1X is immune to ambient lighting up to 40 cm. We’ll see that too.

This is proving to be a lot harder problem than I first thought. To be fair again, a human being reading a yardstick will also have at least some trouble getting a good reading in a swirling snowstorm.


#8

If you were pointing the sensor down at the ground and just averaged the readings over every 100-1000 readings then you should get a pretty accurate number since most of the snowflake readings would get averaged out I would assume.


#9

That’s what I thought too. But what really happens is that you get the average interference, not an average of the actual distance, so the number will always show a greater depth than is the case.

I’m starting to believe that there is no good optical solution to this problem. Maybe when Sparkfun comes out with a radar breakout we’ll be in business. But these IR lasers just don’t cut it, at least while the snow is flying.


#10

Usually the snow stops flying after a flurry so you could always just look at readings when it stops snowing hard.

I would think averaged readings would be shorter and not deeper because the snow interfering with readings would be above ground or the current snow fall.


#11

Well what happened with the LaserPING at least is that when the snow got heavy enough, it wouldn’t get any relfection back and so it would report a distance of 80".

I’m thinking that I could just put up the word “snowing” in the display if the results start looking squirrely.

I was trying out the VL53L1X last night. It’s minimum range seems to be around 9". Below that, it reports 0. In the region of 9" to 40", I’m seeing sampling errors on the order of 1/2". I don’t know where they get this “1 mm. resolution” from. It may be that precise, but it’s not that accurate. No matter, 1/2" is fine for a snow depth sensor. The next test is to see if it works in daylight.


#12

Hi @Michele I received the promotion that Pololu sent for the VL53L1X too and it seems like an interesting board. Now that you got it to work with the Photon could you spare a minute on what are some applications you think it could it be used for? Curious.
Thanks.


#13

Gee, there’s all sorts of things you could use it for I suppose. I’m going to use it as a snow depth sensor (if it works out). Basically anywhere you need a non-contact distance reading.


#14

I’m having a lot of success with this library:


#15

Hi @Michele do you think it could be used for detecting mail in a mailbox?

Thanks.


#16

Sure it would. In fact someone has a thread about that right here: VL53L0X Time-of-Flight Ranging Sensor. They’re using the 0X sensor, not the 1X but it should work the same.


#17

@Michele thanks for the info.