Connecting a VL53L1X laser sensor via I2C or GPIO to Jetson nano

I’m trying to connect a TOF sensor, (the VL53L1X sensor) which has 6 pins (VIN, GND, SCL, SDA, GPIO1, XSHUT) to the Jetson Nano. As far I understood (tell me if I’m wrong!) I can connect this sensor via I2C or GPIO.
I’m trying the GPIO way because I’m planning to use 6 of these sensors, and the Jetson Nano doesn’t have enough I2C connections, but I’m getting weird measures. My questions are:

  1. Is there any way to connect 6 sensors via I2C to the Nano, maybe using an expansion board?
  2. How can I get reasonable measures using the GPIO?

Thanks in advance. This is the code I have written so far; it’s very similar to the code I used with an ultrasonic sensor:
import Jetson.GPIO as GPIO
import time

GPIO.setmode(GPIO.BOARD)
TRIGGER = 11 (Corresponding to the XSHUT)
ECHO = 7 (Corresponding to GPIO1)

GPIO.setup(TRIGGER, GPIO.OUT)
GPIO.setup(ECHO, GPIO.IN)

GPIO.output(TRIGGER, GPIO.LOW)
GPIO.input(ECHO) == GPIO.LOW
time.sleep(1)

while True:
 GPIO.output(TRIGGER, GPIO.HIGH)
 time.sleep(0,00001)
 GPIO.output(TRIGGER GPIO.LOW)
 GPIO.input(ECHO) == GPIO.HIGH
 start = time.time()
 GPIO.input(ECHO) == GPIO.LOW
 stop = time.time()
 tof = stop - start
 print(tof)
 time.sleep(0.5)

You should be able to use i2c mux to connect much more i2c device like E3333 6 camera sensors design.
For the GPIO, do you mean using GPIO to simulate i2c?

1 Like

I think I’m going that way; I just bought a mux so I can connect more devices. Any tutorials about how interact with I2C with Python?

Below link may help on you.

1 Like

Hello,

you can change the address of the VL53L1X.
https://forum.pololu.com/t/using-multiple-vl53l1x-with-raspberry-pi/16651

1 Like

I got to connect and communicate with the VLX53L1X via I2C. Using python smbus library I can get some data from it (a list of byte values). I took a look to the specifications of the VLX53L1X and I don’t get any clue about which values are each one, so I can’t read the distance. I did something similar with a TFLidar mini and in the manual there is specified which byte corresponds to each value, but I couldn’t find it for the VL53L1X. Any ideas, counting I’m working on Python?

Ok so I solved part of the problem; I found this library https://github.com/pimoroni/vl53l1x-python which let me get the sensor data without any problem! I’m waiting for the TCA9548A multiplexer to arrive, then I’ll try to connect 6 or 8 sensors to the same bus. Thanks for everyone for the help!