TFmini-i LiDAR Range Sensor

From Waveshare Wiki
Jump to: navigation, search
TFmini-i LiDAR Range Sensor
TFmini-i LiDAR Range Sensor.png

RS485
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Overview

Introduction

TFmini-i is a single-point ranging radar based on the upgraded TFmini-S, with an optimized and upgraded communication interface and input voltage to adapt to various industrial scenarios. The product is based on the ToF (Time of Flight) principle and has stable, accurate, and highly sensitive measurement performance.

Features

  • Support wide voltage access
  • Support RS-485 interface

Application Scenarios

  • Pedestrian Detection
  • Vehicle Detection
  • Altimeter
  • Robotics

Specification

Product TFmini-i LiDAR Range Sensor
PERFORMANCE Ranging distance  0.1m~12m@90% reflectivity(indoor 0Klux)

0.1m~7m@10% reflectivity (Indoor 0Klux)
0.1m~12m@90% reflectivity (Outdoor 70Klux)
0.1m~7m@10% reflectivity (Outdoor 70Klux)

Accuracy ±6cm@(0.1m-6m)
±1%@(6m-12m)
Distance resolution 1cm
Frame rate 1~40Hz
Ambient light resistance 70Klux
Operating temperature -20℃~60℃
Protection level IP65
OPTICAL PARAMETERS Light source VCSEL
Central wavelength 850nm
Eye Safety Class1(IEC60825)
Field of view
ELECTRICAL PARAMETERS Power supply DC 7V~30V
Average current ≤65mA@12V
Power <0.8W@12V
Peak current 100mA@12V
Communication interface RS485
OTHERS Dimension 50mm*34mm*41mm
Case material ABS/PC/PMMA
Storage temperature -30℃~75℃
Weight 52g (connection cable included)
Cable length 70cm (7Pin included)/200cm (7Pin Not included)

Outline Dimensions

TFmini Lidar Dim.png

Working Principle

TFmini-i is based on the ToF (Time of Flight) principle. Specifically, the product periodically emits a modulated wave of near-infrared light outward, which is reflected when it meets an object. The time of flight is obtained by measuring the phase difference between the modulating wave and the round trip, and then calculating the relative distance between the product and the measured target.
TF Lidar Principle01.jpg

Communication Interface

RS485

RS485 Interface

Default Baudrate

115200 (Adjustable)

Data Bit

8

Stop Bit

1

Parity Check

None

Wiring Note

TFmini-i LiDAR Range Sensor WIRE02.png

Pin

Color

Function

Note

1

Red

VCC

Power Input

2

White/Yellow

RS485-B

RS485-B

3

Green

RS485-A

RS485-A

4

N/A

/

/

5

Blue / Orange

UART_RXD

Serial port reception (debugging)

6

Brown

UART_TXD

Serial port sending (debugging)

7

Black

GND

Ground

For more information about communication interfaces and setting interface parameters, see: TFmini-i User Manual

Software and Use Example

The following section describes how the module can be used under Windows PC, Raspberry Pi, Raspberry Pi Pico, Arduino, ESP32-S3, and other operating system/open-source hardware development platforms.

OS/Hardware Platform

Programming Languages / Software

Raspberry Pi Python, C(WiringPi)
Raspberry Pi Pico MicroPython
Arduino C(Arduino IDE)
ESP32 C(Arduino IDE)

Working with Raspberry Pi

Environment Configuration

UART Port Configuration

Since the Raspberry Pi serial port is used for terminal debugging by default, if you need to use the serial port, you need to modify the Raspberry Pi settings. Execute the following command to enter the Raspberry Pi configuration:

sudo raspi-config

Select Interfacing Options -> Serial -> no -> yes, and disable the serial debug function.
TOF Laser Range Sensor01.jpg
Open the /boot/config.txt file and find the following configuration statement to enable the serial port, if not, add it at the end of the file:

enable_uart=1

And then reboot the Raspberry Pi:

sudo reboot

Install WiringPi

Make sure your computer is 32-bit or 64-bit before installation.

32-bit Raspberry Pi System

Execute the following commands separately for WiringPi installation:

wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v

(Optional) If an error occurs during installation, install all missing dependencies and other necessary packages by running the following command, and then re-run the installation command:

sudo apt --fix-broken install

Run "gpio -v" and version 2.52 will appear. If it does not appear, there is an installation error:
TF-Luna LiDAR Range SensorRas 03.png

64-bit Raspberry Pi System

Copy the resource package to the Raspberry Pi using the command:

wget https://files.waveshare.com/upload/8/8c/WiringPi-master.zip

(optional, you can skip this step if you have used the unzip command) Install the unzip environment:

sudo apt-get install unzip

Go to the file location and execute the unzip command:

unzip WiringPi-master.zip

Go to the file directory (go to the "WiringPi-master" folder):

cd WiringPi-master/

Run sudo . /build:

sudo . /build 

(optional, see point 4 for errors) If . /build does not work, execute "chmod +x . /build" and then "sudo . /build":

chmod +x . /build

Example:
TF-Luna LiDAR Range SensorRas 05.png

TF-Luna LiDAR Range SensorRas 07.png

Hardware Connection

RS485 mode: (Connect to GPIO14 and GPIO15).
TFmini-i LiDAR Range Sensor Rasp01.png

Software Example

Preparation

Download the program packet to the Raspberry Pi.

wget https://files.waveshare.com/upload/3/33/TFmini-i-LiDAR-Range-Sensor-Demo.zip

Unzip the file and create a new file with the same name and extract it to the appropriate folder:

unzip TFmini-i-LiDAR-Range-Sensor-Demo.zip -d ./TFmini-i-LiDAR-Range-Sensor-Demo

Example:
TFmini-i LiDAR Range Sensor Rasp02.png

C

Go to the package path "TFmini-i-LiDAR-Range-Sensor-Demo" in the terminal.

cd TFmini-i-LiDAR-Range-Sensor-Demo/

Enter the sample file path, the 4 files under the folder corresponding to the 4 main controllers, and the files in the subordinate folder are the data acquisition demos and mode switching demos for the TFmini-i in the corresponding mode (example: acquiring data via RS485).

cd Raspberry\ Pi/WiringPi/RS485 

Use "gcc -o main main.c -lwiringPi" to compile the program.

gcc -o main main.c -lwiringPi

Run the main program (Previously, you need to open the relevant functions in the front Raspberry Pi configuration).

sudo ./main

Execute:
TFmini-i Plus LiDAR Range Sensor 05.png

Python

Go to the package path "TFmini-i-LiDAR-Range-Sensor-Dem" in the terminal:

cd TFmini-i-LiDAR-Range-Sensor-Demo/

The 4 files under the folder correspond to the 4 main controls, and the files in the subordinate folder are the data acquisition demos and mode switching procedures for the TFmini-i in the corresponding mode (such as acquiring data via RS485).

cd Raspberry\ Pi/Python/RS485 

Run the demo:

python3 main.py

Example:
TFmini-i LiDAR Range Sensor 06.png

Working with Raspberry Pi Pico

Hardware Connection

RS485 mode: (Connect to GPIO8 and GPIO9).
TFmini-i LiDAR Range Sensor Pico.png

Software Debug

Preparation

  1. Install Thonny. (Thonny Python IDE (Windows V3.3.3))
  2. Press the "BOOTSEL" key on the Raspberry Pi Pico, and release it after powering it on.
  3. A new disk will appear on your computer, extract the firmware (Raspberry Pi Pico firmware) and copy the firmware (suffix uf2) to that disk (the disk will automatically disappear if the copy is successful).
  4. Open Thonny, click on "Python x.x.x" at the bottom right, and select "Configure interpreter".
  5. Select "Interpreter" in the pop-up window -> select "MicroPython (Raspberry Pi Pico)" as the interpreter -> select "Auto-detect port" as the port.
  6. Click on "Stop", and the Shell window will show "MicroPython v1.20.0-50-g786013d46 on 2023-05-04; Raspberry Pi Pico with RP2040 Type "help()" for more information. " is a successful connection.
  • The following is the procedure for points 4 and 5:

TF-Luna LiDAR Range Sensor Pico10.png
The successful connection is shown below:
TF-Luna LiDAR Range Sensor Pico11.png

Running Example

  1. Open the downloaded demo example. (Demo example).
  2. Go to "TFmini-i-LiDAR-Range-Sensor-Demo"->"Raspberry Pi Pico".
  3. There is a file under the "Raspberry Pi Pico" folder, which means get data through RS485.
  4. Go to the "RS485" folder and use Thonny to open RS485.py (the example is to get data via RS485).
  5. Click Run in Thonny.

The debug effect is shown below:
TF-mini-i LiDAR Range Sensor Pico08.png

Working with Arduino

Hardware Connection

RS485 mode: (Connect to D0 and D1).
TFmini-i LiDAR Range Sensor Ard.png

Software Debugging

  1. Install Arduino. (Click here to download).
  2. Open the downloaded demo code. (Demo code)
  3. Enter "TFmini-i-LiDAR-Range-Sensor-Demo" -> "Arduino".
  4. There is a file in the "Arduino" folder, which indicates the data acquisition via RS485.
  5. Go to the "RS485" folder and use Arduino IDE to open RS485.ino (the example is to get data via RS485).
  6. Connect to the Arduino board and select the corresponding development board and port.
  7. Click to verify and click to upload.
  8. After successfully uploading, you can connect the device to the Arduino board. (Make sure that Arduino's D0 and D1 are not connected to the device before each upload.)
  • The debugging effect is shown below:
TF-Luna-Arduino程序调试图.png

Working with ESP32

ESP32-S3-DEV-KIT-N8R8 development board is adopted in this demo example.

Hardware Connection

  • RS485 version (Connect to the GPIO16 and GPIO17).

TFmini-i LiDAR Range Sensor ESP02.png

Software Debugging

Preparation

  • Install Arduino. (Click here to download).
  • Install the ESP32 library when installing the Arduino. Click to download.
  • Go to the file opened in point 2 and select the corresponding version of ESP32 to download.

TF-Luna LiDAR Range Sensor E03.png

  • Double click the APP downloaded:

TF-Luna LiDAR Range Sensor ESP03.png

  • Open the Arduino IDE to check whether the installation is successful.

TF-Luna LiDAR Range Sensor ESP04.png

Running Example

The default mode is UART, if you switch modes, please remember the current mode.

  1. Open the downloaded demo. (Demo code)
  2. Enter "TFmini-i-LiDAR-Range-Sensor-Demo" -> "ESP32".
  3. There is 1 file in the "ESP32" folder, which indicates the data acquisition via RS485.
  4. Enter the "RS485" file folder, and use Arduino IDE to open RS485.ino. (Example of data acquisition via RS485).
  5. Connect the ESP32 board, select the corresponding development board, and port on the Arduino IDE.
  6. Click to verify, and then click to upload.
  • Debugging effect:

TFmini-i LiDAR Range Sensor ESP 08.png

Resource

Demo Code

"Note:"
There are 4 files in the "TFmini-i-LiDAR-Range-Sensor-Demo" folder, corresponding to 4 hardware platforms, and 1 file in each of the 4 folders corresponding to the following functions:

File

Note

RS485 Device data acquisition via RS485 interface

Software

Related Document

FAQ

 Answer:
TFmini-i standard power supply 7V~30V, if you have other needs, please contact our sales staff for customization.

{{{5}}}


 Answer:
This is the normal working state of the product. After the chip and board continue to work, slight heating is normal.

{{{5}}}


 Answer:
When two TFmini-i are placed in the same direction and the light spots hit the same object and overlap, there will be no mutual interference; when more than 2 TFmini-i are placed in the same direction and the light spots overlap, there will be mutual interference; when 2 TFmini-i are working face to face, there will be serious interference.

{{{5}}}


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)