using two VL53L1X with one Arduino and Qwiic shield issues

Hello all!

I have been trying to connect multiple VL53L1X sensors to an Arduino Uno board with a qwiic shield attatched. what happened was when I connected the two sensors to the board, only one sensor would work or they would overlap each other when getting a new signal. my code is based on the hookup guide code. some things I tried were designating new shutdown pins and interrupt pins to the second sensor but this would result in me getting data like distance: 10000001011001, which is outlandish. I also tried daisy chaining but that did not work either. I’m really stuck and don’t know what to do. any help would be very much appreciated.

The hookup guide https://learn.sparkfun.com/tutorials/qw … -guide/all mentions:

Optional Features

The VL53L1X breakout has pull up resistors attached to the I2C bus as well as the interrupt pin; if multiple sensors are connected to the bus with the pull-up resistors enabled, the parallel equivalent resistance will create too strong of a pull-up for the bus to operate correctly. As a general rule of thumb, disable all but one pair of pull-up resistors if multiple devices are connected to the bus. If you need to disconnect the pull up resistors they can be removed by cutting the traces on the corresponding jumpers highlighted below

I did cut those but I still get the wrong data. I attached the code and a picture of the serial port to this post.

#include <Wire.h>

#include “SparkFun_VL53L1X.h”

//Optional interrupt and shutdown pins.

#define SHUTDOWN_PIN1 2

#define INTERRUPT_PIN1 3

//#define SHUTDOWN_PIN2 11

//#define INTERRUPT_PIN2 12

SFEVL53L1X distanceSensor1(Wire);

SFEVL53L1X distanceSensor2(Wire);

void setup(void)

{

Wire.begin();

Serial.begin(9600);

Serial.println(“VL53L1X Qwiic Test”);

if (distanceSensor1.init() == false)

Serial.println(“Sensor1 online!”);

if (distanceSensor2.init() == false)

Serial.println(“Sensor2 online!”);

}

void loop(void)

{

distanceSensor1.startRanging(); //Write configuration bytes to initiate measurement

distanceSensor2.startRanging(); //Write configuration bytes to initiate measurement

int distance1 = distanceSensor1.getDistance(); //Get the result of the measurement from the sensor

int distance2 = distanceSensor2.getDistance(); //Get the result of the measurement from the sensor

distanceSensor1.stopRanging();

distanceSensor2.stopRanging();

Serial.print("Distance(mm): ");

Serial.print(distance1);

//float distanceInches = distance * 0.0393701;

//float distanceFeet = distanceInches / 12.0;

Serial.print("\tDistance(2): ");

Serial.print(distance2, 2);

Serial.println();

}

Are you aware that you are printing out the distance2 numbers as binary (second argument of 2 to Serial.print is the base if the 1st argument is an int and number of digits after the decimal point if a float)?

BTW, your code is also not making any use of the shutdown/interrupt defines (for your test program they should not be needed).

Someone from SparkFun should check this. I believe your distanceSensor1 and distanceSensor2 are really talking with the same sensor. I took a quick look at the arduino library for it I am not sure it can handle more then one of these devices: there is no way I can see to specify the address (like there is with the python version). I believe the setI2CAddress() is use to set the address on a distance sensor.