TFmini-i LiDAR Range Sensor
| ||
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 2° 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
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.
Communication Interface
RS485
RS485 Interface Default Baudrate
115200 (Adjustable)
Data Bit
8
Stop Bit
1
Parity Check
None
Wiring Note
Pin
Color
Function
Note
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.
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:
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
Hardware Connection
RS485 mode: (Connect to GPIO14 and GPIO15).
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
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
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
Working with Raspberry Pi Pico
Hardware Connection
RS485 mode: (Connect to GPIO8 and GPIO9).
Software Debug
Preparation
- Install Thonny. (Thonny Python IDE (Windows V3.3.3))
- Press the "BOOTSEL" key on the Raspberry Pi Pico, and release it after powering it on.
- 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).
- Open Thonny, click on "Python x.x.x" at the bottom right, and select "Configure interpreter".
- Select "Interpreter" in the pop-up window -> select "MicroPython (Raspberry Pi Pico)" as the interpreter -> select "Auto-detect port" as the port.
- 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:
The successful connection is shown below:
Running Example
- Open the downloaded demo example. (Demo example).
- Go to "TFmini-i-LiDAR-Range-Sensor-Demo"->"Raspberry Pi Pico".
- There is a file under the "Raspberry Pi Pico" folder, which means get data through RS485.
- Go to the "RS485" folder and use Thonny to open RS485.py (the example is to get data via RS485).
- Click Run in Thonny.
The debug effect is shown below:
Working with Arduino
Hardware Connection
RS485 mode: (Connect to D0 and D1).
Software Debugging
- Install Arduino. (Click here to download).
- Open the downloaded demo code. (Demo code)
- Enter "TFmini-i-LiDAR-Range-Sensor-Demo" -> "Arduino".
- There is a file in the "Arduino" folder, which indicates the data acquisition via RS485.
- Go to the "RS485" folder and use Arduino IDE to open RS485.ino (the example is to get data via RS485).
- Connect to the Arduino board and select the corresponding development board and port.
- Click to verify and click to upload.
- 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:
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).
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.
- Double click the APP downloaded:
- Open the Arduino IDE to check whether the installation is successful.
Running Example
The default mode is UART, if you switch modes, please remember the current mode.
- Open the downloaded demo. (Demo code)
- Enter "TFmini-i-LiDAR-Range-Sensor-Demo" -> "ESP32".
- There is 1 file in the "ESP32" folder, which indicates the data acquisition via RS485.
- Enter the "RS485" file folder, and use Arduino IDE to open RS485.ino. (Example of data acquisition via RS485).
- Connect the ESP32 board, select the corresponding development board, and port on the Arduino IDE.
- Click to verify, and then click to upload.
- Debugging effect:
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
- TFmini-i User_Manual
- TFmini-i Datasheet
- Quick Implementation of TFmini-I-CAN and Computer Communication Operation Instructions
FAQ
{{{5}}}
{{{5}}}
{{{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)