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

Pololu Forum

VL53L0X not initializing

Hi folks,

I want o connect mine first VL53L0X sensor to ESP8266 but still getting errors about sensor initialization. I don’t think it is some hardware issue as the sensor is detected by i2c bus, I also use the same board and wires to connect other i2c sensor (bme280) which are working fine.

I tried to use Arduino examples from your lib but still get the same error:

*14:31:00.212 -> *
14:31:00.212 -> >>>stack>>>
*14:31:00.212 -> *
14:31:00.212 -> ctx: cont
14:31:00.212 -> sp: 3ffffdf0 end: 3fffffc0 offset: 01b0
*14:31:00.281 -> 3fffffa0: feefeffe feefeffe 3ffee4f4 40202ce0 *
*14:31:00.318 -> 3fffffb0: feefeffe feefeffe 3ffe84ec 401011e9 *
14:31:00.355 -> <<<stack<<<
14:31:00.388 -> #_⸮rS⸮f⸮
14:31:00.456 -> SDK:2.2.2-dev(38a443e)/Core:2.6.3=20603000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-16-ge23a07e/BearSSL:89454af
14:31:00.566 -> Failed to detect and initialize sensor!

Wiring diagram:
VCC — 3.3V
GND — GND
SDA — GPIO4
SCL — GPIO12

Could help me with it??

Regards
Michal Taterka

Hello, Michal.

I am sorry you are having trouble communicating with your VL53L0X. Specifically which ESP8266 are you using? Can you post the simplest version of your code that should work but does not? It might help if you also include pictures that show your board and connections.

-Jon

Hi Jon,

I’m using example provided by pololu’s lib

#include <Wire.h>
#include <VL53L0X.h>

VL53L0X sensor;

void setup()
{
  Serial.begin(9600);
  Wire.begin(4, 12);

  sensor.setTimeout(500);
  if (!sensor.init())
  {
    Serial.println("Failed to detect and initialize sensor!");
    while (1) {}
  }
  sensor.startContinuous(1000);
}
void loop()
{
  Serial.print(sensor.readRangeContinuousMillimeters());
  if (sensor.timeoutOccurred()) { Serial.print(" TIMEOUT"); }
  Serial.println();
}

and here are pics of the board

./michal

Can you also post a picture that shows the front of your time-of-flight sensor? You mentioned that “the sensor is detected by i2c bus”; specifically how did you determine that? Also, can you use an oscilloscope to look at the outputs of SCA and SCL to see if they are really doing what you expect?

-Jon

Hi Jon,

Yes, the sensor is discoverable by I2C - I’ve used ESPhome for that :slight_smile:

here is a front picture

I do not have an oscilloscope to check the signals

./michal

It looks like you are actually using our VL53L1X instead of the VL53L0X. Can you try using the Continuous example from our VL53L1X Arduino library?

-Jon

Jon,

Thank you very much :slight_smile: it was quite stupid problem :smiley:

it is working properly now

Best regards
./michal

2 Likes

here is the solution of VL53L0X “Failed to detect and initialize sensor!”


this video provide the solution
i was facing same issue now is working ok
1 Like