Component guide · Intermediate · 3 min read
TF-Luna LiDAR Sensor

Pinout, Wiring and Code
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
The TF-Luna from Benewake is a small single-point LiDAR that measures distance from 0.2 to 8 m using time of flight. It runs from 5 V and sends readings over 3.3 V UART at 115200 baud (or I2C at address 0x10 when pin 5 is grounded). It suits robot obstacle detection, drone altitude hold, parking sensors and level measurement.
Key specs at a glance
- Range
- 0.2 to 8 m (indoor, 90% reflectivity)
- Accuracy
- ±6 cm up to 3 m, ±2% beyond
- Frame rate
- 1 to 250 Hz (100 Hz default)
- Supply
- 3.7 to 5.2 V, about 70 mA average
- Interface
- UART 115200 baud, or I2C (address 0x10), 3.3 V logic
- Field of view
- 2°
What the TF-Luna LiDAR is
The TF-Luna sends out modulated infrared light and measures the phase shift of the reflection to work out distance. Unlike an ultrasonic sensor it has a narrow 2° beam and works at up to 250 readings a second, so it sees thin objects and fast changes.
In UART mode it streams a 9-byte frame for every measurement. In I2C mode you read registers when you want. A signal strength value comes with every reading so you can reject weak returns.
TF-Luna LiDAR pinout
The pins on the TF-Luna LiDAR and what each one does.
| Pin | Function |
|---|---|
| 1 +5V | Supply, 3.7 to 5.2 V |
| 2 RXD / SDA | UART receive, or I2C data |
| 3 TXD / SCL | UART transmit, or I2C clock |
| 4 GND | Ground |
| 5 Config | Leave open for UART; connect to GND for I2C |
| 6 Mux | Multiplexed output (on/off switching mode); leave open |
- 1 +5V
- Supply, 3.7 to 5.2 V
- 2 RXD / SDA
- UART receive, or I2C data
- 3 TXD / SCL
- UART transmit, or I2C clock
- 4 GND
- Ground
- 5 Config
- Leave open for UART; connect to GND for I2C
- 6 Mux
- Multiplexed output (on/off switching mode); leave open
Wiring the TF-Luna LiDAR
The UART pins are 3.3 V. An Uno reads the TF-Luna's TX fine; for the Uno's TX into pin 2 a 1 kΩ / 2 kΩ divider is safer. SoftwareSerial at 115200 baud is unreliable on an Uno, so lower the sensor's baud rate or use a board with a spare hardware serial port.
| TF-Luna LiDAR pin | Arduino Uno | ESP32 |
|---|---|---|
| 1 +5V | 5V | 5V (VIN) |
| 4 GND | GND | GND |
| 3 TXD | D2 (SoftwareSerial RX) | GPIO 16 (RX2) |
| 2 RXD | D3 (SoftwareSerial TX) | GPIO 17 (TX2) |
| 5 Config | Open (UART) | Open (UART) |
- 1 +5V
- Arduino Uno:
- 5V
- ESP32:
- 5V (VIN)
- 4 GND
- Arduino Uno:
- GND
- ESP32:
- GND
- 3 TXD
- Arduino Uno:
- D2 (SoftwareSerial RX)
- ESP32:
- GPIO 16 (RX2)
- 2 RXD
- Arduino Uno:
- D3 (SoftwareSerial TX)
- ESP32:
- GPIO 17 (TX2)
- 5 Config
- Arduino Uno:
- Open (UART)
- ESP32:
- Open (UART)
Example code
Each frame is 0x59 0x59, distance (2 bytes, cm), strength (2 bytes), temperature (2 bytes) and a checksum. Ignore readings with strength below 100 or at 65535 (saturated).
// TF-Luna TX -> GPIO 16, RX -> GPIO 17
uint8_t f[9];
void setup() {
Serial.begin(115200);
Serial2.begin(115200, SERIAL_8N1, 16, 17);
}
void loop() {
if (Serial2.available() >= 9 && Serial2.read() == 0x59 && Serial2.peek() == 0x59) {
f[0] = 0x59;
for (int i = 1; i < 9; i++) f[i] = Serial2.read();
uint8_t sum = 0;
for (int i = 0; i < 8; i++) sum += f[i];
if (sum == f[8]) {
int dist = f[2] | f[3] << 8; // cm
int strength = f[4] | f[5] << 8;
Serial.printf("%d cm strength %d\n", dist, strength);
}
}
}Setup and tuning
lower it with a command if your board cannot keep up; faster rates also use more current.
reduces range outdoors; expect less than 8 m.
keep the lens clean and do not put glass in front of it without testing.
ground pin 5 at power-up, then read distance from registers 0x00 and 0x01 at address 0x10.
What you need
Shop this list3 of 5 found in our store · ₹577
- Benewake TF-Luna LiDAR sensor: the sensor this guide coversFind this part
ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389- Mega 2560 board: spare hardware serial ports for 115200 baudFind this part
0.96 inch OLED display 128x64: to show readings without a computer0.96" OLED Display 128x64₹139Closest match, check the specs
Dupont jumper wires: for the connectionsDupont Jumper Wires (40 pcs)₹49Closest match, check the specs
Alternatives and when to choose them
- TFmini: up to 12 m and better outdoors.
- VL53L0X: short range (up to about 2 m), tiny and I2C.
- HC-SR04: wide-beam ultrasonic, cheaper, slower.
- LiDAR distance sensors: single-point and scanning LiDAR compared.
Try it: Uart baud rate error calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Driving the 3.3 V RX pin straight from a 5 V TX pin.
- Using SoftwareSerial at 115200 on an Uno and getting garbled frames.
- Not checking the checksum, so random bytes appear as distances.
- Expecting full range against dark or shiny surfaces.
Frequently asked questions
What is the TF-Luna's range?
0.2 to 8 m indoors on a white target; less on dark surfaces and in bright sun.
What voltage does it need?
3.7 to 5.2 V supply, with 3.3 V UART or I2C logic.
How do I switch to I2C?
Connect pin 5 to GND before power-up; it then answers at address 0x10.
Can I use it on a drone for altitude?
Yes, it is often used for low-altitude hold and landing.
Is the laser eye-safe?
Yes, it is a Class 1 device.
Parts for this guide
Calculators
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

