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

Pololu Forum

Issue with reading multiple VL6180x sensor breakout boards


I’ve managed to get two VL6180x sensor breakout boards reading in Arduino’s serial monitor, but the issue is that the range seems to be offset. If I read a single sensor I have full range (0-190ish or about 19cm), but when I implement two sensors their range is cut in half (0-100ish) and they only start reading about 10cm away from the sensor. For example, 0 starts 10cm away from the sensor, and where 190mm would be, the reading is only about 100mm.

Another small thing I noticed is that if I pull the GPIO pin on one of the sensors low again after setting the i2c address, the sensor loses it’s custom address. This shouldn’t happen, should it? From what I understand, when the GPIO0/CE pin is pulled low, the device isn’t turned completely off, just put into standby mode. If that’s the case, then why does the device seemingly lose it’s address if it hasn’t been fully powered off? Maybe I’m misunderstanding the function of the GPIO0/CE pin.

If anyone has any ideas on this, please help me out! I’m stumped and have no idea where to begin.

Looks like I fixed the issue with a couple well-placed 50ms delays right after sending the GPIO0/CE pin a high signal. Apparently I was starting initialization routines too quickly after turning the sensors on.


Thanks for letting us know you got it working. Which issue did the delays fix? We generally would expect pulling the GPIO0/CE pin LOW to reset the board. There is an application note on ST’s product page for the sensor that you might find useful.


Hi Nathan,

It fixed the first issue, I’ll share the code I used (for Arduino) for the setup:

  void setup() 
  pinMode(sensor1_pin, OUTPUT);
  pinMode(sensor2_pin, OUTPUT);
  digitalWrite(sensor1_pin, LOW);
  digitalWrite(sensor2_pin, LOW);

  digitalWrite(sensor1_pin, HIGH);

  digitalWrite(sensor2_pin, HIGH);

The delays highlighted with the asterisks are what solved the offset and reduced range issue. They probably don’t even need to be that long, but it was what I tested with and it worked the first time so I left them at 50ms.

I appreciate the application note, I’ve changed my original code so that there was less off/on/off/on operation of the GPIO0/CE pin. According to the note, all you need to do is bring one sensor online at a time. No need to turn on one sensor, change address, then turn it off again. Just put them all low at the beginning and bring each one high one at a time to set the addresses until they are all set.

1 Like

This is also a really handy piece of code that you can insert into your program to double check if the addresses have been set correctly for each sensor: