Home > Sensors & Modules > Sensors > Range & Distance Sensors
Introduction
TFmini
The TF Mini LiDAR is an unidirectional laser range finder based on time-of-flight (ToF) technology. It consists of special optical and electronic devices, which integrates adaptive algorithm for indoor and outdoor application environment. It has tiny body and high performance in distance measurement.
The laser sensor can be used as a distance-measuring tool to detect the distance from it to obstacles. It can also be used as an eye of a robot; it provides distance information for robotic safe avoidance and route selection. It supports for system automation in a variety of machine control scenarios. Because of its small size, light weight and low power consumption, it is also suitable for altitude holding and terrain following.
TF Mini's maximum detection distance is 12 meters. TF Mini also supports 100Hz sampling resolution, within 6 meters, its accuracy is within 4cm, 6~12 meters, accuracy within 6 cm. FOV of 2.3 degree. Its anti-interference is strong, and can work in outdoor light, the overall weight is 4.7g.
TF Mini LiDAR adopts UART (TTL) communication interface, can supplied by standard 5V, and its average power consumption is 0.6w. It can be compatible with a variety of Arduino controllers. With the DFRobot Gravity IO Expansion Shield, Arduino can be plugged in directly without additional wiring. It can be easily integrated into the system when used with the Arduino library developed by DFRobot.
NOTE:
- The product may be invalid when probing objects with high reflectivity, such as mirrors and smooth tiles.
- When there are transparent objects, such as glass and water, between the product and the tested object, it may become invalid.
- Do not touch the circuit board with your bare hands. If necessary, please wear an electrostatic wristband or antistatic gloves.
TFmini Plus
TFmini Plus is a great improvement over the original TFmini. It is a small single-point ranging sensor with unique optical and electrical algorithms, which can realize accurate and quick distance measurement as well as keep a stable and high-sensitive performance. TFmini Plus is based on TOF, namely, Time of Flight principle. To be specific, the product emits modulation wave of near infrared ray on a periodic basis, which will be reflected after contacting object. The product obtains the time of flight by measuring round-trip phase difference and then calculates relative range between the product and the detection object.
Inherited characters of low cost, small size and low power consumption from TFmini, TFmini Plus has greatly improved its whole performance—increasing the frame rate from 100Hz to 1000Hz, reducing blind zone to 10cm, improving accuracy and stability. What’s more, TFmini Plus introduces IP65 enclosures that could effectively prevent water and dust, which also makes the product more adaptable to outdoor light or environment with different temperatures and reflectance. The sensor can provide much lower power consumption and more flexible detecting frequency. It is compatible with UART and IIC communication (send command to switch) and adopts standard 5V power supply. The average power is 0.55W. This sensor works well with all sorts of Arduino controllers. It can be easily integrated into the system when used with the Arduino library developed by DFRobot.
TFmini Plus features a tiny size of 35×21×18.5mm(1.38×0.83×1.73”), as small as a finger, but it brings us excellent ranging performance. Use the sensor to detect the distance between it and obstacle ahead; use it as an eye of a robot to provide distance information for robot to safely avoid obstacle and select route; or apply it in Automotive Collision Avoidance System; it is also suitable for altitude holding system of UAV and UAV landing scenarios.
NOTE:
- The maintenance of this product should be done by the professional technician, and the product can only work with the factory spare part for ensuring the performance and safety.
- This product itself has no polarity and over-voltage protection. Please properly connect and supply power as described in this manual.
- Operating temperature of this product is between -20℃ and 60℃. Do not use it beyond this temperature range to prevent malfunction.
- Storage temperature of this product is between -20℃ and 75℃. Do not store it beyond this temperature range to prevent malfunction.
- For ensuring the product performance, do not open the product shell to do any adjustment or maintenance against the instruction.
- Detecting object with high reflectivity, such as the mirror or the smooth floor tile, may cause a system malfunction.
- The product will malfunction if there is any transparent object between it and the detecting object, such as glass or water.
- The product will malfunction if its emitting or receiving IR-pass filter is covered by the dust. Please keep the IR-pass filters clean. Please do not spread ethyl alcohol on the IR-pass filters, which are made of acrylic, IR-pass filters will be damaged.
- Please do not pull the fine wire, it may cause product damage.
Specification
TFmini
- Voltage Range: 4.5V-6V
- Communication Interface: UART (TTL)
- Working Range: 0.3m-12m (indoor)
- The Maximum Range of Reflectivity 10%:5m
- Average Power: 0.6W
- Receive Angle: 2.3°
- Minimum Resolution: 5mm
- Refresh Frequency: 100Hz
- Ranging Accuracy: 1% (<6m), 2% (6 ~ 12m)
- Ranging Unit: mm
- Band: 850nm
- Size: 1.65in x0.59in x0.63in / 42mm x15mm x16mm
- Operating Temperature: 0°C ~ 60°C
- Storage Temperature: -20°C~75°C
- Anti-light Environment: 70Klux
- Weight: 4.7g
TFmini Plus
Product Characteristics
- Detecting Range: 0.1m~12m
- Accuracy: ±5cm@ (0.1-6m), ±1%@(6m-12m)
- Resolution: 5mm
- Frame Rate : 1-1000Hz(adjustable)
- Anti-ambient Light: 70klux
- Operating Temperature: -20℃~60℃
- Protection Degree: IP65
Optical Characteristics
- Light Source: LED
- Operating Center Wavelength: 850nm
- Signal Acceptance Angle: 3.6°
Electrical Characteristics
- Input Voltage: 5V±0.5V
- Average Current: ≤110mA
- Power Consumption: 550mW (Low Power Mode: 85mW)
- Peak Current: 500mA
- Communication Level: LVTTL (3.3V)
- Communication Interface: UART, IIC, I/O
Others
- Enclosure Material: ABS+PC
- Storage Temperature: -20℃~75℃
- Weight: 12g
- Wire Length: 30cm
Board Overview

Label | Name | Function Description |
---|---|---|
Black | GND | - |
Red | VCC | + |
Blue | RXD | Receive Data |
Green | TXD | Transmit Data |
Note: The pinouts of TFmini sensor and TFmini Plus sensor are all the same.
Tutorial
Here are two ways listed to make the LiDAR(ToF) laser range finder be more intuitive.
- Arduino Usage
- PC software Debugging
- Black and white line detection (line-tracking)
Requirements
- Hardware
- DFRduino UNO R3 x 1
- IO Sensor Expansion Board V7.1 x1
- Gravity: I2C 16x2 Arduino LCD with RGB Backlight Display x1(part of project will use it)
- 7.4V 2500MA lithium battery (with charge and discharge protection board) x1
- Serial port: USB to Serial x1
- Dupont wires
- Software
- Arduino IDE , [https://www.arduino.cc/en/Main/Software| Click to Download Arduino IDE from Arduino®]
- DFRobot TF Mini Library, Click to download TF Mini Library
- DFRobot LCD Library file, Click to download DFRobot_RGBLCD(Github)
Arduino Debugging (PC serial port)
Since TF mini is a serial device and the ordinary Arduino only has one hardware serial port, so we recommend you to use a software serial port to match the sensor. Users can also use multi-serial port devices such as Arduino Leonardo and Arduino Mega2560. Here we choose Arduino UNO as a controller, which is very common to see and define D12 and D13 as software serial port.
Connection Diagram
- Use PC-side serial port to display the detected distance and power the entire system.


Sample Code(Arduino Debugging)
- PC serial port tool is needed. Data been read will be displayed in the serial port tool interface.
/*
* @File : DFRobot_TFmini_test.ino
* @Brief : This example use TFmini to measure distance
* With initialization completed, we can get distance value and signal strength
* @Copyright [DFRobot](https://www.dfrobot.com), 2016
* GNU Lesser General Public License
*
* @version V1.0
* @date 2018-1-10
*/
#include <DFRobot_TFmini.h>
SoftwareSerial mySerial(12, 13); // RX, TX
DFRobot_TFmini TFmini;
uint16_t distance,strength;
void setup(){
Serial.begin(115200);
TFmini.begin(mySerial);
}
void loop(){
if(TFmini.measure()){ //Measure Distance and get signal strength
distance = TFmini.getDistance(); //Get distance data
strength = TFmini.getStrength(); //Get signal strength data
Serial.print("Distance = ");
Serial.print(distance);
Serial.println("cm");
Serial.print("Strength = ");
Serial.println(strength);
delay(500);
}
delay(500);
}
- Serial port software shows the data format as below
Distance = 1000 mm
Strength = 688
Arduino LCD Distance Numerical Display
In practical application, the sensor will generally work offline. We provide a special case, which powered by a lithium battery and display distance measurement data with LCD. It is especially suitable for outdoor usage.
Connection Diagram(LCD)


Sample Code (Arduino Test)
/*
* @File : DFRobot_TFmini_test.ino
* @Brief : This example use TFmini to measure distance
* With initialization completed, we can get distance value and signal strength
* @Copyright [DFRobot](https://www.dfrobot.com), 2016
* GNU Lesser General Public License
*
* @version V1.0
* @date 2018-1-10
*/
#include <Wire.h>
#include <DFRobot_RGBLCD.h>
#include <DFRobot_TFmini.h> //TF Mini header file
SoftwareSerial mySerial(12, 13); // RX, TX
DFRobot_TFmini TFmini;
uint16_t distance,strength;
unsigned int lcd_r = 0, lcd_g = 0, lcd_b = 0;
unsigned long delaytime = 0, lighttime = 0;
DFRobot_RGBLCD lcd(16, 2);
void setup()
{lcd.init();
delay(5000);
Serial.begin(115200);
Serial.println("hello start");
TFmini.begin(mySerial);
lighttime = millis();
lcd.setCursor(0, 0);
lcd.print("Dis:");
lcd.setCursor(0, 1);
lcd.print("Str:");
lcd.setRGB(255, 255, 000);
}
void loop() {
/******************LCD*******************/
lcd_r = random(256);
delayMicroseconds(10);
lcd_g = random(256);
delayMicroseconds(10);
lcd_b = random(256);
if (millis() - lighttime > 3000)
{
lcd.setRGB(lcd_r, lcd_g, lcd_b);
lighttime = millis();
}
//delay(100);
/**************TF Mini***************/
if(TFmini.measure()){ //Measure Distance and get signal strength
distance = TFmini.getDistance(); //Get distance data
strength = TFmini.getStrength(); //Get signal strength data
lcd.setCursor(5, 0); //LCD display
lcd.print( distance / 10000);
lcd.print( distance/ 1000 % 10);
lcd.print('.');
lcd.print( distance / 100 % 10);
lcd.print( distance / 10 % 10);
lcd.print( distance % 10);
lcd.print(" m");
lcd.setCursor(5, 1);
lcd.print(strength / 10000);
lcd.print(strength / 1000 % 10);
lcd.print(strength / 100 % 10);
lcd.print(strength / 10 % 10);
lcd.print(strength % 10);
}
}
- The following data format is displayed on the LCD monitor
Dis: 05.000 m
Str: 00600

Upper Computer Display
In addition to reading data through a single chip, we can also use PC Software to read distance output. ====Connection Diagram(Upper PC Display)====
- Connect TF Mini LiDAR(ToF) Laser Range Sensor to PC by an USB to TTL converter and read data by upper PC.


- Upper PC Data Display

Black & White Line Detection (Line-tracking Inspection)
- TF Mini laser ranging radar is an optical sensor, but any optical sensor, the sensitivity of the light will be higher. We can use this feature to achieve close-range black and white line detection, line-tracking inspection. (NOTE: black is to absorb all the lights, do not reflect; white is to reflect all the light, do not absorb)
- We use the signal strength 'Strength' to distinguish between the two colors.
Connection Diagram(Line-tracking)


Sample Code(Line-tracking)
- NOTE: The code needs to be used in concert with TF Mini Library.
/*
* @File : DFRobot_TFmini_test.ino
* @Brief : This example use TFmini to measure distance
* With initialization completed, we can get distance value and signal strength
* @Copyright [DFRobot](https://www.dfrobot.com), 2016
* GNU Lesser General Public License
*
* @version V1.0
* @date 2018-1-10
*/
#include <DFRobot_TFmini.h>
SoftwareSerial mySerial(12, 13); // RX, TX
DFRobot_TFmini TFmini;
uint16_t distance,strength;
void setup(){
Serial.begin(115200);
TFmini.begin(mySerial);
}
void loop(){
if(TFmini.measure()){ //Measure Distance and get signal strength
strength = TFmini.getStrength(); //Get signal strength data
Serial.print("Strength = ");
Serial.println(strength);
}
}
- Downloaded the program, when you repeatedly measure white and black paper at the same distance, a signal strength changes could be seen through the serial port drawing tool.

FAQ
Q&A | Some general Arduino Problems/FAQ/Tips |
---|---|
A | For any questions, advice or cool ideas to share, please visit the DFRobot Forum. |