Cliff Detection with VL53L4CD

Measurement of distance within the range 1 mm to 1300 mm for cliff detection using VL53L4CD.

INTRODUCTION

The B3RB can use a TOF distance sensor as a cliff detector and the appropriate software to prevent it from driving off a table, down a stairway or any other "cliff" it may encounter while moving forward. These sensors could also be used pointing in other directions for other proximity detection applications. This tutorial describes how to perform cliff detection on MR-B3RB using TOF VL53L4CD sensor with MR-CANHUBK344 and MR-CANHUBK3-ADAP boards. The example and configuration shown below is with the MR-CANHUBK344 running Zephyr and Cognipilot but is showing the board outside of the installation on a MR-B3RB. When used with a B3RB, the power is supplied in the normal fashion and not with external connectors shown.

Operation Explanation

The Time of Flight VL53L4CD sensor measures distance within the range 1 mm to 1300 mm.

The sample application "samples/sensor/vl53l4cd" polls on the sensor every 1 second and reads the current distance measured from the device. Then it prints the distance on the console (in meters).

ITEMS REQUIRED

All items except 3 (Cable), 4 (TOF sensor) and 10 (5V DC Power supply) are included with MR-B3RB-S.

Re: item no. 9, MR-CANHUBK344 kit that comes with MR-B3RB-S, includes multiple cables with "SYP" connector which could be utilized for supplying power to the MR-CANHUBK344.

SETUP DIAGRAMS

HARDWARE SETUP

This hardware setup shows these boards outside of MR-B3RB on a tabletop. This of course can also be done on the vehicle itself. Simply plug in the sensor and the STEMMA QT cable to the CANHUB-ADAP. The power and other connections do not change from a normal MR-B3RB configuration.

The JLINK can alternatively connect to the small DCD-LZ board if preferred.

Power may be supplied using either of the power connectors. In an assembled MR-B3RB this would be using the 5 pin JST-GH power in cable rather than the SYP cable.

  1. Connect hardware components as shown in the block diagram above. The CANHUB-ADAP includes a I2C connector that follows the ADAFRUIT STEMMAQT standard.

  2. Attach the MR-CANHUBK3-ADAP board on top of MR-CANHUBK344.

  3. Power on the MR-CANHUBK344 board - connect the SYP connector to the MR-CANHUBK344, and the other end of the cable to your bench power supply or any source that could provide 5V DC.

SOFTWARE SETUP

Setup West Workspace

cd ~
west init -m "https://github.com/NXPHoverGames/zephyr.git" cliff_detection_project

cd ~/cliff_detection_project
west update

Building and Flashing

cd ~/cliff_detection_project/zephyr
git checkout tof_vl53l4cd_with_mux_pr

west build -b mr_canhubk3 samples/sensor/vl53l4cd -p
west flash

RESULTS

Get the shell of MR-CANHUBK344.

sudo chmod 666 /dev/ttyUSBn
cu -l /dev/ttyUSBn -s 115200

The shell should display output as:

proximity = 1
distance = 0.019 m
proximity = 1
distance = 0.021 m
proximity = 1
distance = 0.019 m
proximity = 1
distance = 0.018 m
proximity = 1
distance = 0.020 m
proximity = 1
distance = 0.017 m
proximity = 1
distance = 0.018 m
proximity = 1
distance = 0.019 m
proximity = 1
distance = 0.020 m
proximity = 1
distance = 0.018 m
proximity = 1
distance = 0.020 m
proximity = 1
distance = 0.018 m
proximity = 1
distance = 0.020 m
proximity = 1
distance = 0.020 m
proximity = 1
distance = 0.019 m
proximity = 1
distance = 0.016 m

Last updated