Skip to content
LeafTeaNeko edited this page Mar 12, 2020 · 5 revisions

Hardware: Pololu VL53L1X Time -of-Flight Laser sensor

Library: https://github.com/melopero/Melopero_VL53L1X

The linked library is a python-wrapper for the VL53L1X C library available at the ST Microelectronics website.

OVERVIEW:

The Time of Flight (ToF) sensor by Pololu is a breakout board for the VL53L1X by ST Microelectronics. The sensor can report distances up to 4 m (max range) with 1 mm resolution. The VL53L1X offers three distance modes: short, medium, and long. Long distance mode allows the longest possible ranging distance of 4 m, but the maximum range is significantly affected by ambient light. Short distance mode is mostly immune to ambient light, but the maximum ranging distance is typically limited to 1.3 m (4.4 ft). The maximum sampling rate in short distance mode is 50 Hz while the maximum sampling rate for medium and long-distance modes is 30 Hz. Performance can be improved in all modes by using lower sampling rates and longer timing budgets. This project uses the sensor in long distance mode.

WIRING:

The sensor is wired up to PIN3 and PIN5 on Raspberry Pi-zero (or Raspberry Pi-3B+) with PIN3 connected to SDA and PIN5 for SCL. It is also connected to 3.3V line from PIN1 for power and Ground to GND. It communicates using the I2C protocol and the polling rate can be changed along with the distancing modes (please refer to the library link).

MECHANISM:

The sensor uses the timing between the transmitted laser and received laser to calculate the distance to the detected object. The sensor is triggered using the start_ranging function followed by the ranging mode (LONG/SHORT/MEDIUM). The sensor returns the measured distance using get_measurement function. Once the data is received, it is important to close the connection to the sensor using stop_ranging function and close_connection function. Please refer to the library link for example code as well as other library functions such as polling rate and timings.

NOTE: It is possible for the sensor to output wrong data if the sensor is too close to the ground, this happens when the transmitted cone hits the ground just below the sensor instead of the object far way. It is advisable to use the sensor at an appropriate height from the platform (at least 5 cm off the platform). Please refer to the data sheet for the detection cone and angles.

FILTERS:

The data collected through the LIDAR sensor can be passed through to one of the filters designed for the system. Two filters namely: Kalman filter and Alpha-trimmed filter. The Kalman filter is our implementation of Kalman filter in NumPy and python while the Alpha-trimmer filter is an adaption of Alpha trimmer from Image processing that removes random fast noise like bugs or other fast-moving objects or very slow-moving objects. These filters can be switched to activate from the Masterfile, but a program reboot is required.

HOW-TO-USE:

STEP 1: Mount the sensor on platform (Breadboard or PCB)

NOTE: It is possible for the sensor to output wrong data if the sensor is too close to the ground, this happens when the transmitted cone hits the ground just below the sensor instead of the object far way. It is advisable to use the sensor at an appropriate height from the platform (at least 5 cm off the platform). Please refer to the data sheet for the detection cone and angles.

STEP2:

  • Connect the 3.3V line to the Vcc of the sensor Pin
  • Connect the GND line to GND of the sensor
  • Connect SDA line to PIN 3 of the Pi(Refer to your Raspi pinout diagram)
  • Connect SCL line to the PIN5 of the Pi(Refer to your Raspi pinout diagram)
  • Rest of the connections, XSHUT and GPIO are not necessary for distance measurements.

STEP 3: Download the library to use the sensor, check library link for instructions and examples.

Library: https://github.com/melopero/Melopero_VL53L1X

STEP 4: Make a new file/script in python, copy all the code from Lidar function and call the function. If no mode is specified in the mode parameter in the function, it uses the long distance mode(Default state).

STEP 5: Run the code in console and check if there is any output.

STEP 6: The output in the console should be the distance (in centimetres) to the object. This can be changed in the code, by editing the TOF/10 line. The library returns the distance in millimetres by default.

STEP 7: OPTIONAL Pass the output of the Lidar through the filters for more accurate distance measurements.

Clone this wiki locally