Configuring TF03 with UART Interface on ArduPilot Flight Stack using Cube Orange Flight Controller
Written by: Ibrahim (FAE)
www.benewake.com
Benewake (Beijing) Co., Ltd.
Introduction
This document provides instructions for configuring the Benewake TF03 LiDAR sensor with a UART interface on the ArduPilot flight stack, utilizing the Cube Orange flight controller. The TF03 can be used for Altitude Hold or Obstacle Avoidance functionalities. This guide is applicable to both Cube Orange and Cube Black flight controllers, as they share the same interfaces for connecting the TF03.
The TF03-100, TF03-180, and TF350 models can be interfaced with the serial ports of the Cube Orange flight controller. There are four available serial ports for devices with UART interfaces. The following table outlines the hardware and software serial port mapping:
- TELEM1 > SERIAL1
- TELEM2 > SERIAL2 (used in this tutorial)
- GPS1 Port > SERIAL3
- GPS2/UART4 > SERIAL4
The controller used in this tutorial was a Cube Orange flashed with ArduCopter V4.0.7. While this document is specific to that setup, it can be adapted for other flight controllers and ArduCopter firmware versions with minor parameter name adjustments and by selecting the appropriate serial port.
Connecting TF03 to Cube Orange
The following diagram illustrates the connection between the TF03 and the TELEM2 interface (Serial Port 2) of the Cube Orange flight controller:
Hardware Connection Diagram:
Cube Orange TELEM2 Port:
- TELEM2: LIDAR
- VCC_5 > 5V of LiDAR
- MCU_TX > RX of LiDAR
- MCU_RX > TX of LiDAR
- GND > GND of LiDAR
Figure 1: Schematic Diagram of Connecting TF03 with TELEM 2 Interface (Serial Port 2) of Cube
Serial Port Pinout Descriptions
The same connection procedure can be followed for other serial ports like TELEM1/GPS1/UART4 by referring to the pinout details provided below:
TELEM 1 & 2 Pinout
Pin # | Name | Dir | Wire Color | Description |
---|---|---|---|---|
1 | VCC_5V | in | red | Supply to GPS from AP |
2 | GPS_RX | in | black | 3.3V-5.0V TTL level, TX of AP |
3 | GPS_TX | out | black | 3.3V-5.0V TTL level, RX of AP |
4 | MCU_CTS (TX) | out | gray/black | 3.3V-5.0V TTL level or TX of AP |
5 | MCU_RTS (RX) | in | gray/black | 3.3V-5.0V TTL level or RX of AP |
6 | GND | black | GND connection |
GPS 1 Pinout
Pin # | Name | Dir | Wire Color | Description |
---|---|---|---|---|
1 | VCC_5V | out | red/gray | Supply to GPS from AP |
2 | MCU_TX | out | yellow/black | 3.3V-5.0V TTL level, TX of AP |
3 | MCU_RX | in | green / black | 3.3V-5.0V TTL level, RX of AP |
4 | SCL | in | black | 3.3V-5.0V I2C1 |
5 | SDA | in/out | black | 3.3V-5.0V I2C1 |
6 | BUTTON | out | black | Signal shorted to GND on press |
7 | BUTTON_LED | out | black | LED Driver for Safety Button |
8 | GND | black | GND connection |
GPS 2 Pinout
Pin # | Name | Dir | Wire Color | Description |
---|---|---|---|---|
1 | VCC_5V | out | red/gray | Supply to GPS from AP |
2 | MCU_TX | out | yellow/black | 3.3V-5.0V TTL level, TX of AP |
3 | MCU_RX | in | green / black | 3.3V-5.0V TTL level, RX of AP |
4 | SCL | out | gray/black | 3.3V-5.0V I2C2 |
5 | SDA | in | gray/black | 3.3V-5.0V I2C2 |
6 | GND | black | GND connection |
Figure 2: Pinout description of available serial ports on Cube
Note: Standard output mode of LiDAR should be used instead of PIX mode in the latest firmwares. PIX mode was only required for firmware versions older than Arducopter V3.6.2.
Configuration for Altitude Hold
a) Mission Planner configuration description of TF03 for the purpose of altitude hold
Connect the flight control board to Mission Planner. Attention: the installation height should be larger than the non-detection/blind zone of LiDAR.
Navigate to the [CONFIG/TUNING] tab and select [Full Parameter List] from the left-hand menu.
Find and modify the following parameters:
SERIAL2_PROTOCOL
= 9 [Rangefinder option]SERIAL2_BAUD
= 115 [Set to match the LiDAR's baud rate; default is 115200, represented as 115]RNGFND1_TYPE
= 27 [TF03 UART option]RNGFND1_MIN_CM
= 30 [Adjustable based on requirements; should be greater than the non-detection zone, in cm]RNGFND1_MAX_CM
= 500 [Adjustable based on requirements; should be less than the effective measure range of LiDAR, in cm]RNGFND1_GNDCLEAR
= 15 [Expressed in cm, depending on mounting height; should be greater than the non-detection zone]RNGFND1_ORIENT
= 25 [Facing down]PRX_TYPE
= 0
After setting these parameters, click [Write Params] on the right side of Mission Planner to save the changes. Power cycle the controller for the settings to take effect.
If you encounter a “Bad LiDAR Health” error, verify the connection, power supply, and ensure the controller has been restarted. Also, check if the mode was changed from Standard to Pix mode on firmware versions 3.6.2 or higher, as this can cause the error. Revert to Standard mode by sending the appropriate command from the LiDAR manual.
To view the altitude value from the LiDAR sensor, double-click the relevant area in Mission Planner. The altitude will be displayed in the Sonar Range (meters) field.
(Image description: A screenshot of Mission Planner showing flight data, including altitude, ground speed, and GPS status. The Sonar Range is displayed as 1.80 meters.)
Configuration for Obstacle Avoidance
B) Mission Planner configuration description of TF03 for the purpose of Obstacle Avoidance
While the TF03 is primarily used for Altitude Hold, it can also be utilized for obstacle avoidance, particularly for high-speed drones. Connect the flight control board to Mission Planner. Attention: Ensure the distance between the UAV margin and the LiDAR is greater than the LiDAR's blind zone.
Navigate to the [CONFIG/TUNING] tab and select [Full Parameter List].
Find and modify the following parameters:
AVOID_MARGIN
= 5 [Unit: m, set obstacle avoidance distance as required]SERIAL2_PROTOCOL
= 9 [Rangefinder option]SERIAL2_BAUD
= 115 [Set to match the LiDAR's baud rate; default is 115200, represented as 115]RNGFND1_TYPE
= 27 [TF03 UART option]RNGFND1_MIN_CM
= 30 [Adjustable based on requirements; should be greater than the non-detection zone, in cm]RNGFND1_MAX_CM
= 700 [Adjustable based on requirements; should be less than the effective measure range of LiDAR, in cm]RNGFND1_ORIENT
= 0 [Depends on the LiDAR's installation direction; options range from 0-7, with 24=Up and 25=Down]PRX_TYPE
= 4 [Rangefinder should be selected for proximity sensor in obstacle avoidance mode]AVOID_ENABLE
= 3 [If 3 = UseFence and UseProximitySensor do not work, choose 2 = UseProximity Sensor]
After setting these parameters, click [Write Params] to save the configuration. Power cycle the controller to apply the changes.
If the error message “PreArm: check the proximity sensor” appears, verify the connection, power supply, and restart the controller.
To view the target distance measured by the LiDAR (for obstacle avoidance), it cannot be displayed in the Sonar Range option. Press Ctrl+F on the keyboard to open a separate window showing this information.
(Image description: A screenshot of Mission Planner showing the proximity sensor data, with a red arc indicating the detected object and its distance.)
Using Other Serial Ports
If the TELEM2 port has been used, the GPS2/UART4 and TELEM1/SERIAL1 interfaces can also be utilized with the same settings.
Configuration Descriptions on Mission Planner (for GPS2/UART4 and TELEM1)
Connect the flight control board to Mission Planner and select [Full Parameter List] in the [CONFIG/TUNING] tab.
For GPS2/UART4:
SERIAL4_PROTOCOL
= 9 (LiDAR)SERIAL4_BAUD
= 115
For TELEM1:
SERIAL1_PROTOCOL
= 9 (LiDAR)SERIAL1_BAUD
= 115
After setting these parameters, the other configurations remain the same as described for Obstacle Avoidance or Altitude Holding. Click [Write Params] to save.
Important Note: If you configure multiple UART ports with SERIALX_PROTOCOL
set to 9 (Rangefinder) but only connect the LiDAR to a single UART port, you may encounter a “Bad LiDAR Health” error. Ensure that only the UART ports connected to the LiDAR are configured as 9: Rangefinder. The number of serial ports configured as 9 must match the number of connected LiDARs.
Related Documents
![]() |
Benewake TF03-100 LiDAR Sensor: Product Specification V1.0 Detailed product specification for the Benewake TF03-100 industrial high-speed LiDAR sensor, covering its technical specifications, performance, dimensions, communication interfaces (TTL, CAN, RS485/RS232), and certifications. |
![]() |
Benewake TF02-Pro-W User Manual: LiDAR Distance Sensor Guide Comprehensive user manual for the Benewake TF02-Pro-W LiDAR distance sensor. Covers technical specifications, operation, maintenance, communication protocols (UART, I2C), parameter configuration, quick testing, and firmware updates. |
![]() |
Benewake TFS20-L LiDAR User Manual: Specifications, Operation, and Testing Detailed user manual for the Benewake TFS20-L LiDAR sensor. Covers technical specifications, hardware interface (UART/I2C), custom configuration commands, and a quick test guide with software setup. Learn about its measuring principle, pinout, and troubleshooting. |
![]() |
Benewake TFmini Plus User Manual: Comprehensive Guide Explore the Benewake TFmini Plus User Manual for detailed information on its features, operation, specifications, and troubleshooting. Learn about this advanced LiDAR sensor for precise distance measurement. |
![]() |
Benewake TFmini-S LiDAR Module Product Manual Comprehensive product manual for the Benewake TFmini-S LiDAR module, covering specifications, operating principles, communication protocols (UART, I2C), parameter configuration, remote upgrading, troubleshooting, and PC software usage. |
![]() |
Benewake TFA170-L LiDAR User Manual User manual for the Benewake TFA170-L LiDAR sensor, detailing its measuring principle, technical specifications, installation, and communication protocols. |
![]() |
Benewake TFmini Plus Single-Point Ranging LiDAR Datasheet Datasheet for the Benewake TFmini Plus, a single-point ranging LiDAR module based on ToF principle, used for stable, accurate, and high-frequency range detection. Details include product description, technical specifications, parameters, and certifications. |
![]() |
Benewake TF02-Pro User Manual: Comprehensive Guide Explore the Benewake TF02-Pro User Manual for detailed information on product introduction, usage, maintenance, and troubleshooting. Learn about technical specifications, communication protocols, and parameter configuration for this advanced LiDAR sensor. |