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:
- Is there any way to connect 6 sensors via I2C to the Nano, maybe using an expansion board?
- 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
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)