This example project demonstrates how to measure distance of an object with TFMini LiDAR sensor using CASP. TFMini Plus is also supported by CASP and can be used in similar manner.
Target
Aries v2.0 development board is used in this project. However, any supported micro-controller board can be used.
Pre-Requisites
- CASP software is installed on the host PC
- Vega Aries BSP is installed.
- The project files are located at CASP installed directory ‘CASP/support/examples/vega_aries_examples/hw_interface/06_lidar_tfmini’. These are also available for download at this link.
Connection Diagram
TFMini is connected to the target board as shown in the circuit diagram. A model is developed to measure the distance of the target object from the sensor and vary the brightness of the on-board LED such that as the object comes closer to the sensor LED brightness increases. The measured data is also send to the serial port. User can see the measured data from the ‘Configure Simulation Hardware’ interface window by clicking on Simulation->Configure Simulation IO menu item from the CASP main tool bar. Please go through the individual block parameters used in the model along with respective documentation for better understanding.
By default TFMini gives output in terms of centimeters. To change this and to configure other parameters, perform the following steps on TFMini block:
- From TFMni block parameters, select Mode as ‘Configuration Mode’. Also, select Detection Mode as 0-5Mtr (15X) from TFMini Configuration Group.
- With these parameters program the target. After the board is programmed wait for 10secs.
- Now, from the TFMni block parameters, select Mode as ‘Normal Mode’ and program the target. Now, distance should be measured in millimeter.

Model

Procedure
- Connect the peripherals as shown in above connection diagram and connect the target board to the host PC.
- Launch CASP and open the downloaded project.
- Click ‘Setup Simulation’ to open a dialog box.
- Select ‘Target Programmer’ to ‘Programmer0’ to upload the program to RAM or ‘Programmer1’ to upload the program to flash memory of the target board.
- Set the ‘Target Programmer Port’ to which the board is connected.
- Save and Close the dialog box.
- Click Run button to build and program the board.
- The measured data is also send to the serial port. User can see the measured data from the ‘Configure Simulation Hardware’ interface window by clicking on Simulation->Configure Simulation IO menu item from the CASP main tool bar as shown in below figure.
