Using VL53L5CX with Particle Photon

The Sparkfun library has been ported over to the Particle Photon. I hooked up an SEN-18642 to the Photon’s I2C bus and ran the example 1 library program. The program compiled and flashed just fine and setup() runs correctly (device is detected and resolution is setup). However, after entering loop(), the example code is failing the line of code:

if (myImager.isDataReady() == true)

I have verified that setup() completes, including the line of code:

myImager.startRanging();

I have also verified that resolution of 8*8 is setup (by printing out the resolution obtained from the device after the line of code):

imageResolution = myImager.getResolution();

So, it appears that my Photon is communicating with the device over I2C correctly, but the device never reports that data is ready.

Any thoughts? I’m stumped!

PROBLEM SOLVED! It was operator error. My apologies. This is an exceptional sensor for the money and it works just fine with Particle devices, now that Sparkfun’s library is ported over to Particle’s environment.

Hi,

Glad to hear you got it working! I seem to be facing the same issue that you were: I can communicate with the device, and set various settings, but it never reports that the data is ready though.

What turned out to be the issue for you? Perhaps I am making the same mistake!

Best wishes

My issue was different. I stupidly connected 5 volt power to the sensor, instead of 3.3 volts. The photon’s I/O pins are 3.3 volt, so are compatible with the sensor. However, when the sensor was powered from 5 volts, it wouldn’t communicate at all. Happily, I don’t seem to have damaged it. After I realized my mistake, I used the Photon’s 3.3 volt regulated output to power the sensor and it is working well.

Make sure you are calling startRanging() in setup() in order to get the sensor going. If you leave this step out, you won’t get any data ready indication. If you are using Arduino or some Arduino-like processor (such as Particle Photon), try running Example1 from the library’s examples. This code appears to be the simplest example that gets ranging data back.

Thank you for your response, it turned out to be very helpful in the debugging process! I had a slightly dodgy connection on my breadboard which meant that the voltage being supplied was approximately 2.7V rather than 3.3V. This seemed to mean I could communicate with the board, but it never reported that the data was ready! All working perfectly now :smiley: