Sensor
Distance sensor VL53L0X
The VL53L0X is a new generation of ToF sensors that allows accurate distance measurements up to 2m.
Use with Python under Linux on the Zynq7000
The VL53L0X is connected directly to an I2C interface.
Zynq7000 | VL53L0X |
---|---|
MIO10 | SCL |
MIO11 | SDA |
<FlinkGPIO channel> | XSHUT |
GND | GND |
The sensors can be initialized using the vl53l0x_helper driver in the driver repository.
The XSHUT pin of each VL53L0X sensor requires its own FlinkGPIO channel. The pins/channels are to be passed to init_vl53l0x as a list of ints (integers). The number of sensors is derived from the number of GPIO channels with which init_vl53l0x is called. init_vl53l0x returns the initialized sensors as a list. Calling get_distance() on a list element returns the current measured value of the corresponding sensor.
Example: sensors = init_vl53l0x([0, 1]) initializes 2 sensors. sensors[0] uses FlinkGPIO channel 0 and sensors[1] uses FlinkGPIO channel 1. sensors[0].get_distance() returns the current measured value of the first sensor (GPIO 0), while sensors[1].get_distance() returns the measured value of the 2nd sensor (GPIO 1).
from vl53l0x_helper import init_vl53l0x
# initialize 2 ToF sensors conected to FlinkGPIO channels 0 and 1
tofs = init_vl53l0x([0, 1])
# print measurements
for _ in range(1, 11):
# combine all measurements into 1 string to print everything on one line
line = " ".join(["% d" % tof.get_distance() for tof in tofs])
print("distance %s" % line)
Use with Deep on the mpc555
The VL53L0X can be used with the MPC55 and the Zynq7000. However, a second microcontroller is required to connect it. The OST provides a ready-to-use firmware for the Nucleo STM32L432KC board. A maximum of 4 sensors can be controlled. For further information see VL53L0X Time of Flight Sensor.
Display
Character LCD display, see LCD-Display (2x16).