Skip to content

Sensor DFRobot 8x8 ToF

Thomas Chou edited this page Nov 11, 2026 · 2 revisions

Sensor: DFRobot 8x8 Matrix ToF (SEN0628)

Overview · Specifications · Connecting it · The USB output · Reading it from a computer · Firmware updates · On a robot · Status

Product DFRobot Gravity 8x8 Matrix ToF 3D Distance Sensor, SKU SEN0628
Sensor ST VL53L7CX multizone time-of-flight, 64 zones (8 × 8)
On-board MCU Raspberry Pi RP2040, running DFRobot's firmware
Interfaces USB-C (CDC serial), Gravity I2C (addresses 0x30–0x33) or UART (115200 baud)
Status 🟡 read by the cockpit: over USB checked on the board; on the MCU's I2C built for every board, not yet run on one

Overview

The SEN0628 puts ST's VL53L7CX on a board with an RP2040 that runs the sensor and hands out finished distances. Each frame is 64 distances in a 60° × 60° square, one per zone, out to about 3.5–4 m. For a small robot that is a short-range depth image of what is straight ahead: a chair leg, a step or a box below the LiDAR's plane, which a 2D LiDAR passes over.

The RP2040 does the work the VL53L7CX's own driver would ask of the robot's MCU: loading the sensor's firmware at power-on and decoding its results. The robot's side only reads distances.


Specifications

From DFRobot's product wiki:

Supply 3.3–5 V
Zones 8 × 8 (64); the I2C/UART library also offers 4 × 4
Field of view 60° horizontal, 60° vertical, 90° diagonal
Range 20–4000 mm (DFRobot's overview says up to 3.5 m)
Accuracy ±11 mm (white) / ±12 mm (grey) from 20 to 200 mm; ±5 % (white) / ±6 % (grey) from 200 to 4000 mm
Frame rate 15–60 Hz; 15 Hz measured over USB in 8 × 8
I2C four addresses, 0x30–0x33 (DFRobot's library defaults to 0x33), so up to four on one bus
UART 115200 baud, fixed
USB USB-C, a CDC serial port that streams 8 × 8 frames as text (USB output is 8 × 8 only)
Connector Gravity 4-pin PH2.0
Laser Class 1

Connecting it

  • USB-C to a computer: the board powers from the cable and shows up as a serial port at once. Linux sees an RP2040 with the stock Raspberry Pi USB IDs (2e8a:000a, product "Pico") and a cdc_acm port. It looks exactly like a Raspberry Pi Pico. Name it by its serial number (/dev/serial/by-id/usb-Raspberry_Pi_Pico_<serial>-if00), never by ttyACMn, and keep it apart from any Pico you flash: a tool that takes it for a Pico may try to flash it.
  • Gravity I2C or UART to an MCU: the 4-pin connector carries power, ground and the bus. DFRobot's wiki shows how to pick I2C or UART and the address; its Arduino library is DFRobot_MatrixLidar (DFRobot_MatrixLidar_I2C, DFRobot_MatrixLidar_UART, setRangingMode(eMatrix_8X8), getAllData(), getFixedPointData(x, y)).

The USB output

At power-on the board streams frames on its USB port with nothing sent to it (115200 baud is DFRobot's setting; a CDC port ignores the rate). One frame is eight lines, y0 to y7, each with eight distances in millimetres and a trailing comma:

y0:4000,4000,2551,4000,4000,4000,4000,4000,
y1:4000,4000,4000,4000,4000,4000,1640,1196,
...
y7:1383,1411,1421,1421,1394,1480,1132,875,

4000 means no valid reading in that zone: nothing in range, or a result the sensor rejected. DFRobot's firmware V1.3 sets every invalid zone to 4000 (earlier versions could repeat a stale value). Which corner of the scene y0's first value is depends on how the board is mounted: cover one edge of the lens and see which zones drop.


Reading it from a computer

Python 3 with no extra packages, Linux:

#!/usr/bin/env python3
"""Print the DFRobot SEN0628's 8x8 frames from its USB serial port: tof_read.py /dev/serial/by-id/..."""
import sys
import termios
import time

port = sys.argv[1]
with open(port, "rb", buffering=0) as f:
    attrs = termios.tcgetattr(f)
    attrs[0] = attrs[1] = attrs[3] = 0                      # raw: no input, output or line processing
    attrs[4] = attrs[5] = termios.B115200
    termios.tcsetattr(f, termios.TCSANOW, attrs)
    rows, frames, t0, buf = {}, 0, time.monotonic(), b""
    while True:
        buf += f.read(256)
        *lines, buf = buf.split(b"\n")
        for line in lines:
            name, _, values = line.decode(errors="replace").strip().partition(":")
            if len(name) != 2 or name[0] != "y" or not name[1].isdigit():
                continue
            rows[int(name[1])] = [int(v) for v in values.split(",") if v.strip()]
            if name == "y7" and len(rows) == 8:
                frames += 1
                rate = frames / (time.monotonic() - t0)
                print(f"frame {frames}  {rate:4.1f} Hz  nearest {min(min(r) for r in rows.values())} mm")
                for y in range(8):
                    print("  " + " ".join(f"{d:5d}" if d < 4000 else "    -" for d in rows[y]))
                rows = {}

It skips the partial frame it starts in and prints each whole one, with - for an invalid zone:

frame 75  15.1 Hz  nearest 875 mm
      -     -     -     -     -     -     -     -
      -     -     -     -     -  2731     -     -
      -     -     -     -     -     -     -     -
   2482     -     -     -     -     -     -  1351
      -     -     -  2523     -     -     -  1254
   1455     -     -     -     -     -  1518  1142
   1434  1437     -     -     -  1516  1346  1036
   1383  1411  1421  1421  1394  1480  1132   875

Your user needs access to the port (the dialout group on most distributions).


Firmware updates

The RP2040 takes DFRobot's firmware as a UF2 file. DFRobot recommends V1.3 or later (the fix for invalid zones above): SEN0628-V1.3-20250904.uf2 on DFRobot's wiki.

  • With the BOOT button (DFRobot's way): hold BOOT while plugging in the USB cable, and copy the .uf2 to the drive that appears.
  • Without it: the board's USB port is the Arduino-Pico core, which reboots into the RP2040 bootloader when the port is opened at 1200 baud and closed (stty -F /dev/serial/by-id/usb-Raspberry_Pi_Pico_<serial>-if00 1200 then any read, or the same in Python). The RPI-RP2 drive appears; copy the .uf2 to it.

Either way the drive goes away by itself when the update is done, and the board comes back with the same serial number.


On a robot

Name it in the robot's config, or in the web UI's Sensors section (8x8 ToF Matrix):

base_controller:
  lidar:
    model: none               # never beside a LiDAR, see below
  tof:
    model: sen0628
    connection: usb           # usb: the robot computer reads it | i2c: the MCU reads it
    usb_port: /dev/serial/by-id/usb-Raspberry_Pi_Pico_<serial>-if00
    i2c_address: 0x33         # for i2c: 0x30-0x33
    rotation: 0               # 0/90/180/270: how the board is turned on its mount
    mirror: false
    floor_clearance: 0.05     # m above the floor: lower points are the floor
    max_height: 0.5           # m above the floor: higher points cannot touch the robot
geometry:
  tof: {x: 0.10, y: 0.0, z: 0.0, roll: 0.0, pitch: 0.0, yaw: 0.0}   # tof_link, from the robot's centre

What the cockpit does with it:

  • A point cloud for Nav2. tof/points, 15 Hz, in tof_link: an obstacle source for the local and global costmaps and for the collision monitor, from floor_clearance to max_height above the floor. It catches what a 2D LiDAR passes over: a box, a step, a chair leg below the LiDAR's plane. In the collision monitor it slows and stops forward motion in zones of its own, like a sonar.
  • The robot's /scan when it has nothing else. With no LiDAR and no depth camera, its two middle rows are also a LaserScan of 8 beams over 60°, so SLAM and Nav2 run on it. The map is coarse.
  • In simulation mode it is rendered in the simulated room, so a ToF robot can be tried without one.

Never beside a LiDAR. A LiDAR and this sensor are both infrared time-of-flight and blind each other. A config with both, a simulated LD19 included, is refused by bringup and by the web UI.

Connected to the MCU (connection: i2c, Gravity connector to the board's I2C bus) the firmware reads the board at that address and sends each frame to the robot computer, which makes the point cloud. Any board's image reads it; nothing to compile.

Connected over USB it looks exactly like a Raspberry Pi Pico. The port named in usb_port is shown as a ToF, never as a board, and the cockpit refuses to flash it.

Mounting. Level and low, the bottom rows see the floor at a distance set by the height; that is what floor_clearance cuts. rotation and mirror turn the 8 x 8 grid so its first row is the top of the view: cover one edge of the lens and see which zones drop to check.


Status

  • Over USB (stock firmware V1.3, a Linux PC): 15 frames a second, every line with eight zones, invalid zones exactly 4000. The cockpit's node read it and published tof/points at 15 Hz.
  • In simulation: bringup with a ToF-only robot publishes tof/points and /scan at 15 Hz in tof_link.
  • On the MCU's I2C: the driver is built into every board's image; not yet run with a board wired to one.
  • Not done yet: a ranging check against a measured target, and a drive with it on a robot.

Sensors, LiDAR & Maps · Building a Real Robot · Pin Matrix & Wiring

Clone this wiki locally