Hi,
Just received 3ea VL53L0X sensors as possible replacements for the no-name GY530 modules I’m using now. I soldered on the supplied header and hooked it up to an Arduino Mega, using the pinouts from your website, and the ‘single’ example program.
In the photos, the red & black wires are +5V and GND respectively, YEL is SDA, and GRN is SCL. The VIN, GPIO1 and XSHUT pins are not connected to anything.
Unfortunately I’m getting the dreaded “Failed to detect and initialize sensor!” message. I’m pretty sure I have it connected properly (I know, you’ve certainly heard that many times before… ). I have included some photos so you can see the soldering job and the hookup configuration.
I’ll continue to troubleshoot, but I’m a bit reluctant to try the two remaining modules from this order until I can figure out what I did wrong with this one ;-).
Frank
And here’s the program - it’s the ‘single’ example from your library. The only modification I made to the code was to bump the serial port speed from 9600 to 115200.
/* This example shows how to get single-shot range
measurements from the VL53L0X. The sensor can optionally be
configured with different ranging profiles, as described in
the VL53L0X API user manual, to get better performance for
a certain application. This code is based on the four
"SingleRanging" examples in the VL53L0X API.
The range readings are in units of mm. */
#include <Wire.h>
#include <VL53L0X.h>
VL53L0X sensor;
// Uncomment this line to use long range mode. This
// increases the sensitivity of the sensor and extends its
// potential range, but increases the likelihood of getting
// an inaccurate reading because of reflections from objects
// other than the intended target. It works best in dark
// conditions.
//#define LONG_RANGE
// Uncomment ONE of these two lines to get
// - higher speed at the cost of lower accuracy OR
// - higher accuracy at the cost of lower speed
//#define HIGH_SPEED
//#define HIGH_ACCURACY
void setup()
{
Serial.begin(115200);
Wire.begin();
sensor.setTimeout(500);
if (!sensor.init())
{
Serial.println("Failed to detect and initialize sensor!");
while (1) {}
}
#if defined LONG_RANGE
// lower the return signal rate limit (default is 0.25 MCPS)
sensor.setSignalRateLimit(0.1);
// increase laser pulse periods (defaults are 14 and 10 PCLKs)
sensor.setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
sensor.setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);
#endif
#if defined HIGH_SPEED
// reduce timing budget to 20 ms (default is about 33 ms)
sensor.setMeasurementTimingBudget(20000);
#elif defined HIGH_ACCURACY
// increase timing budget to 200 ms
sensor.setMeasurementTimingBudget(200000);
#endif
}
void loop()
{
Serial.print(sensor.readRangeSingleMillimeters());
if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }
Serial.println();
}
Any help would be appreciated.