Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Failed to detect and initialize sensor!


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 ;-).


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

void setup()

  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)
  // increase laser pulse periods (defaults are 14 and 10 PCLKs)
  sensor.setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
  sensor.setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);

#if defined HIGH_SPEED
  // reduce timing budget to 20 ms (default is about 33 ms)
#elif defined HIGH_ACCURACY
  // increase timing budget to 200 ms

void loop()
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }


Any help would be appreciated.

Forgot to mention that I measured the voltage at the VIN pin on the module at 5.01V, and the voltage on the VDD pin at 2.8V

False alarm - all is working now. All I did was remove all the connections, unplug and replug the module on the breadboard, and reconnect everything. Go figure :wink:


Hi, Frank.

I’m glad you were able to get your sensor working. Thanks for letting us know what solved the issue.



I’m not actually sure what I did to resolve the problem. I think it was more ‘The Microsoft Solution’ (when all else fails, reboot) than anything else. However, things are working OK at the moment so I’m not bitching :wink:


Hi i was facing same issue, finally i solve the issue my VL53L0X/VL53L1X now working ok, here is the solution of the issue in this video. https://youtu.be/QEiNbTB8nNE