Home > Sensors & Modules > Sensors > Range & Distance Sensors

Introduction

TFmini

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.

warning_yellow.png 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 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.

warning_yellow.png NOTE:

  1. 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.
  2. This product itself has no polarity and over-voltage protection. Please properly connect and supply power as described in this manual.
  3. Operating temperature of this product is between -20℃ and 60℃. Do not use it beyond this temperature range to prevent malfunction.
  4. Storage temperature of this product is between -20℃ and 75℃. Do not store it beyond this temperature range to prevent malfunction.
  5. For ensuring the product performance, do not open the product shell to do any adjustment or maintenance against the instruction.
  6. Detecting object with high reflectivity, such as the mirror or the smooth floor tile, may cause a system malfunction.
  7. The product will malfunction if there is any transparent object between it and the detecting object, such as glass or water.
  8. 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.
  9. Please do not pull the fine wire, it may cause product damage.

Specification

TFmini

TFmini Plus

Product Characteristics

Optical Characteristics

Electrical Characteristics

Others

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.

  1. Arduino Usage
  2. PC software Debugging
  3. Black and white line detection (line-tracking)

Requirements

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

Sample Code(Arduino Debugging)

/*
  * @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);
}
 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)

TFmini Connection Diagram(LCD) TFmini Plus 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);
    }
}
Dis: 05.000 m
Str: 00600
The following data format is displayed on the LCD monitor

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)====

TFmini Upper Computer Display TFmini Plus Upper Computer Display TFmini Plus Upper PC Data Display

Black & White Line Detection (Line-tracking Inspection)

Connection Diagram(Line-tracking)

TFmini Connection Diagram(Line-tracking) TFmini Plus Connection Diagram(Line-tracking)

Sample Code(Line-tracking)

/*
  * @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);
    }
}
TFmini Plus

FAQ

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

More Documents

DFshopping_car1.png Get TF Mini LiDAR(ToF) Laser Range Sensor from DFRobot Store or DFRobot Distributor.