LamaPLC: Waveshare TOF Laser Range Sensor with UART / I²C communication

  • UART / I²C / CAN / IO Communication Support, 25m / 50m Measuring Range
  • This is a TOF-based (time of flight) laser ranging sensor with embedded MCU and ranging algorithm, which is capable of offering up to 25m / 50m measuring range, and ±3cm accuracy.
  • It supports UART or I²C communication bus, features longer measuring distance and higher light interference tolerance capability due to its ultra-narrow FOV, suitable for either indoor or outdoor conditions. Its ambient light tolerance is up to 100K lux.
  • This sensor can be widely used in applications like standard distance measuring, robot obstacle avoidance/route planning/ceiling detection, and more…
  • long range low cost ranging module, high stability, high accuracy, high sensitivity ranging; UART / I2C / IO communication support UART mode: supports active query output I²C mode: up to 8x cascades I/O mode: unable to output distance parameter

Waveshare TOF (time of Flight) Laser Range Sensor

Core Product Comparison

Waveshare offers several versions to match different distances and environmental requirements:

ModelRangeAccuracyInterfaceBest For
Standard TOF0.01 – 5m±1.5cmUART / CANIndoor robots, obstacle avoidance
TOF (B)0.10 – 15m±2%UART / I2C Long-range indoor/outdoor use
TOF (C)0.05 – 25m±3cmUART / I2COutdoor navigation, material levels
TOF (D)0.05 – 50m±3cmUART / I2CExtreme long-distance detection
TOF Mini0.02 – 7.8m±4cmUART / I2CUltra-compact builds (1g weight)

Key Technical Features

  • Cascading Support: Up to 8 sensors on UART and 7 on CAN can be connected in series to a single bus, each assigned a unique ID.
  • High Ambient Light Resistance: Most “B,” “C,” and “Mini” models resist up to 100K LUX, making them functional in direct sunlight.
  • Configurable FOV: The standard model offers an adjustable Field of View (15° to 27°), while long-range models feature a narrow FOV (1° to 2°) to minimize interference.
  • Integrated Processing: Includes an embedded MCU and ranging algorithm, providing filtered distance data rather than raw phase shifts.
  • Software Tools: Waveshare provides a PC Assistant Software for real-time waveform monitoring, configuration, and data recording.
SpecificationData
Typical measuring range0.05..25 m / 0.05..50 m
Measuring accuracy+-3 cm
Wavelength905 nm
Field of view1°..2°
Communication interfacedefault: UART (3.3V TTL)
I²C Addr: 0x08
BaudrateUART: 4.8 kbps .. 3000 kbps (921.6 kbps default)
I²C: up to 400 kbps
Power supply4.3 .. 5.2 V
Power consumption250 mW (UART active output, 5.0 V power supply, 50 mA current)
Operation temperature-10 °C .. 60 °C

If you'd like to support the development of the site with the price of a coffee — or a few — please do so here.

Here's a handy tip: you can quickly save this page as a PDF by clicking “export to PDF” in the menu on the right side of the screen.

2026/02/14 22:38

Wiring Diagram (UART)

The sensor operates at 3.3V TTL signal levels, but the module has voltage translation for 5V compatibility.

Waveshare PinArduino Uno/Nano PinDescription
VCC5V (or 3.3V)Power Supply
GNDGNDGround
TXD10Arduino RX (SoftwareSerial pin)
RXD11Arduino TX (SoftwareSerial pin)

Arduino Example Code (UART Communication)

This example utilizes the SoftwareSerial library to actively read distance data from the sensor, which outputs at the default baud rate of 115200.

#include <SoftwareSerial.h>
 
SoftwareSerial TOFSerial(10, 11); // RX, TX pins for the sensor
unsigned char TOF_data[32] = {0}; // Buffer to store the data frame
unsigned char TOF_length = 16;
unsigned long TOF_distance = 0;
unsigned char TOF_check = 0;
 
void setup() {
  Serial.begin(9600);      // Initialize hardware serial for monitoring
  TOFSerial.begin(115200); // Initialize software serial for the sensor
  Serial.println("Waveshare TOF Sensor Test");
}
 
void loop() {
  if (TOFSerial.available() > 0) {
    // Read the incoming bytes from the sensor
    if (readTOFData()) {
      Serial.print("Distance: ");
      Serial.print(TOF_distance);
      Serial.println(" mm");
    }
  }
}
 
// Function to read and parse the data frame based on Waveshare protocol
bool readTOFData() {
  if (TOFSerial.available() >= TOF_length) {
    for (int i = 0; i < TOF_length; i++) {
      TOF_data[i] = TOFSerial.read();
    }
 
    // Verify the checksum
    TOF_check = 0;
    for (int k = 0; k < TOF_length - 1; k++) {
      TOF_check += TOF_data[k];
    }
 
    if (TOF_check == TOF_data[TOF_length - 1] && TOF_data[0] == 0x57) { // Check header 0x57
      // Data is valid. Distance is a 3-byte value (little-endian)
      TOF_distance = (TOF_data[8]) | (TOF_data[9] << 8) | (TOF_data[10] << 16);
      return true;
    }
  }
  return false;
}

This page has been accessed for: Today: 2, Until now: 61