I am using a VL53L0X sensor in my project. It was working fine when suddenly it started to show failed to boot error. I tried debugging but of no use. I ran I2C scanner sketch and it detected the sensor at 0x29.

I get the following error -

23:38:27.797 -> Adafruit VL53L0X test
23:38:27.830 -> VL53L0X Info:
23:38:27.830 -> Device Name: VL53L0X ES1 or later, Type: VL53L0X, ID: VL53L0CBV0DH/1$1
23:38:27.830 -> Rev Major: 1, Minor: 1
23:38:27.864 -> VL53L0X: StaticInit
23:38:27.932 -> VL53L0X: PerformRefSpadManagement
23:38:27.932 -> refSpadCount = 2226323456, isApertureSpads = 92
23:38:27.932 -> VL53L0X Error: -6
23:38:27.932 -> Failed to boot VL53L0X

This is the code I used (its the example code with just 0x29 and true passed in begin function for verbose output):

#include "Adafruit_VL53L0X.h"

Adafruit_VL53L0X lox = Adafruit_VL53L0X();

void setup() {

  // wait until serial port opens for native USB devices
  while (! Serial) {
  Serial.println("Adafruit VL53L0X test");
  if (!lox.begin(0x29,true)) {
    Serial.println(F("Failed to boot VL53L0X"));
  // 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 ");

I am using an Arduino nano - following are the connections


I have rechecked the connection and voltages the sensor does receive 3v3 and gnd.

I need help with this asap.

Thanks in advance :)

  • what is the actual error description? ... the Serial.println(F("Failed to boot VL53L0X")); could just as easily be Serial.println(F("the sky is blue"));
    – jsotola
    Sep 26, 2020 at 1:00
  • This is the entire error message, could you let me know what you are looking for? Sep 27, 2020 at 10:36

4 Answers 4


I was facing same issue, now my problem is solved here.

This problem mostly occurs when we apply a power supply to the MCU that has capacitors at its output. This type of power supply's rising voltage is like you can see the image:

enter image description here

If you look at the data sheets of MCUs, you see that most MCUs can work at 1.8V to 5.5V. Here the rising voltage is slow; the MCU starts working at 1.8V and send signals to VL53L0x, but the sensor doesn't work at 1.8V.

So, what you need to do is add some delay (first power supply gets stable then start communication with sensor) in your code to avoid this issue. Do not add delay in the loop; it will affect the working of the MCU, where exactly you need to add delay. Code modifications are in the video below:


or you just can search on Youtube: How to fix VL53L0X error


Since it sort of worked before I am assuming it is connected correctly. However you failed to mention pull up resistors on the I2C bus. If they are not there or to weak that could cause what you are seeing.

  • I tried the same code with another sensor, without any pull ups, it works fine with it. However, it is this particular sensor which throws an error which i am unable to resolve. Sep 27, 2020 at 10:32
  • IIRC, the VL53L0X modules have 10K pullups on SDA/SCL already - no need to add
    – starship15
    Sep 27, 2020 at 18:06

From the VL53L0X API documentation The error shows up as

#define VL53L0X_ERROR_RANGE_ERROR   ((VL53L0X_Error) -6)

Not very helpful, but maybe you still have the factory protective cover installed?

Also, IMHO the Adafruit library is a bit buggy. I now use the Pololu library (among other things, the Pololu library allows usage of the WIRE1, WIRE2, & WIRE3 hardware I2C busses.

27 September 2020 Update: On the Adafruit technical support forum, I did a search for 'VL53L0X ERROR'. There were several thread mentioning ERROR -6 issues, but most of them were due to poor or missing solder on the VL53L0X header pins. Could that be your problem?

  • I have removed the factory protective cover. I understand that the error message is not very helpful, I do not know what else I can deduce from it. I will try to use the Pololu library as suggested. Sep 27, 2020 at 10:34

I found a new possible solution to this problem, as I spent 2 days to solve it, I feel that I need to share it with you guys. I also could find the sensor through i2C scanner, but could not initialize it.

Here is the summary of solutions:

  1. Powering problem 1: add a 50ms delay in the setup function (before the sensor init, obviously). This way, the Vin will have time enough to reach the level needed by the sensor, as explained in a previous message (ocrdu)
  2. Powering problem 2: This sensor demands more than others, normally the 5V pin of your board will do it better than the 3v3. If there are many sensors connected at the same time, disconnect all of them to check whether they are using the power our vl53l0x needs.
  3. Powering problem 3: If you feed it with an external source, unify grounds with the board, don't forget it
  4. SCL - SDA weak signals: add a pullup (2k2 - 4k7 from each channel to vin), this way the signals will perform better, that could be the problem
  5. Soldering problem: Make sure that each header pin is well soldered. I've found many cases of poor soldering. The tiny pads don't help. It is advisable to check continuity with a multimeter between the headers and the pads where they should be connected
  6. XSHUT not pulled up: My problem, this was that AZDelivery board says that it has a pull up in XSHUT (which works like an enable). But it could either be false, or badly implemented. Xshut needs to be high, 3v3/5v, otherwise, the sensor won't work. Bridge the XSHUT to Vin or implement a pull up and the problem will be solved.
  • I am using adafruit's library 1.1.2, and it works, with pullups, without pullups, connected to 5V and also connected to 3V3, with the 50ms delay, and connecting XSHUT to high (3V3 / Vin)
  • My board is vl53l0x from AZDelivery (5€ amazon)
  • I have tested the sensor with arduino nano and with ESP32, both work fine

Hope you guys find this useful <3

[esp32] [sensor] [i2c] [boot] [error]

Not the answer you're looking for? Browse other questions tagged or ask your own question.