Product Introduction

The 8x8 Matrix LiDAR Ranging Sensor is a compact and efficient 3D depth-sensing solution that fills the gap between simple distance sensors and complex depth cameras. Driven by on-board firmware running on an RP2040 microcontroller, it can provide real-time depth data at 64 points in an 8×8 matrix within a 60° field of view, with a detection range of up to 3.5 meters. Featuring low power consumption and plug-and-play functionality, this sensor is highly suitable for robotics, interactive art, gesture recognition, and intelligent automation. It supports Arduino, micro:bit, and ESP32, enabling the development of advanced applications such as intelligent obstacle avoidance, contactless gesture control, and immersive interactive devices.

Unlike sensors that only detect a single point, it generates a 64-pixel depth map, providing environmental context—such as obstacles, clear paths, and table edges. This enables smoother and more intelligent navigation without the need for complex advanced camera processing and computation. With its affordable price and ultra-low power consumption, it offers a "just-right" level of 3D vision for various creative projects.

This matrix LiDAR ranging sensor is designed specifically for the maker workflow and can seamlessly connect to nearly any platform on your workbench.

  • Supported Platforms: Ready to use out of the box, compatible with Arduino, micro:bit, and ESP32.
  • Programming Methods: Comprehensive libraries and tutorials are available whether you use the Arduino IDE or graphical programming tools like Mind+ and MakeCode.
  • Connection Methods: Supports Gravity-I2C interface, UART connection, or direct connection to a computer via USB-C.
  • Cascading Support: Provides 4 switchable I2C addresses, allowing cascading of up to 4 sensors to expand the field of view.

Beyond its plug-and-play capability, the 8x8 Matrix ToF (Time of Flight) Sensor also serves as a flexible development platform. Its on-board RP2040 processor allows developers to load custom firmware or run lightweight machine learning models (TinyML), enabling functions such as recognizing specific gestures, detecting motion patterns, or adding new features directly on the sensor. With open-source schematics and comprehensive documentation support, this module can be customized for advanced robotics, IoT, and AI-driven applications—making it much more than a fixed-function sensor.

Product Features

  • 8x8 matrix ranging: 64 independent distance points for high-resolution object recognition and distance measurement.
  • High-precision ranging: The measuring distance range can reach 4 meters, with an accuracy of ±5mm.
  • Fast response: The maximum measurement rate is 60Hz, meeting the needs of real-time applications.
  • Multi-target recognition: It can recognize multiple targets simultaneously and measure their distances separately.
  • Rich interfaces: Supports 3 communication methods including I2C, UART, and USB, facilitating connection with the main control chip.

Application Scenarios

  • Robot Navigation: Enables smooth obstacle avoidance and drop detection.
  • Gesture Control: Provides innovative contactless interaction for smart devices.
  • Interactive Installations: Artistic displays, such as "eye-following" or responsive lighting.
  • Intelligent Automation: Directional entrance monitoring and smart room sensing.

Specification Parameters

  • Number of matrix laser ranging sensors: ×1
  • Power supply voltage: 3.3V-5V
  • Data interface: I2C/UART/USB
  • Interface type: PH2.0-4P (Gravity pin order)
  • Matrix quantity: 8*8, totaling 64 ranging points
  • I2C address: 4 adjustable options: 0x30/0x31/0x32/0x33
  • Serial baud rate: 115200bps (fixed, non-modifiable)
  • Firmware update: USB interface update
  • Ranging mode: Continuous ranging
  • Ranging speed: 15Hz-60Hz
  • Ranging range: 20mm-4000mm
  • Ranging accuracy:

Within the range of 20-200mm, the accuracy for white targets is ±11mm, for light gray targets is ±12mm, and for gray targets is ±12mm; within the range of 200-4000mm, the accuracy for white targets is ±5%, for light gray targets is ±6%, and for gray targets is ±6%.

  • Ranging angle: 60° horizontally, 60° vertically, 90° diagonally
  • Laser safety class: Compliant with Class 1 laser safety standards.

Functional Indication Diagram

Dimension Diagram

Unit: mm

Matrix Layout Diagram

Tutorial for Use Based on Arduino IDE

Tool Preparation

  • DFR0654: FireBeetle ESP32-E main board *1
  • SEN0628: Matrix Laser Ranging Sensor *1
  • PH2.0-4P data cable *1
  • USB TYPE-C data cable *1
  • Arduino library download link: https://github.com/DFRobot/DFRobot_MatrixLidar

I2C Communication Example

Hardware Connection

Toggle the switch to the position as shown in the figure:

  • At this time, the communication mode is set to I2C mode. It can be known from the table that the I2C address at this time is 0x33.
  • Each time the I2C address is switched or the I2C/UART function is changed, the power supply must be disconnected and restarted for the change to take effect.

Wiring diagram:

Example 1: Read 4*4 matrix data via I2C

Program Description:

  • This example demonstrates how to read distance values from 16 matrices and display them in the serial monitor.
  • This example code can also be found in ArduinoIDE under File > Examples > DFRobot_MatrixLidar > I2C > get4*4data, as shown in the following figure:

![](https://dfimg.dfrobot.com/62d52567aa9508d63a4247a1/wikien/786232cfa7ffdb10481618fa68f9f0ce.png

Example code:

  #include "DFRobot_MatrixLidar.h"
   
       DFRobot_MatrixLidar_I2C tof(0x33);  //Default I2C address 0x33
        uint16_t buf[16]; //A total of 16 points of data
        
        void setup(void){
          Serial.begin(115200);//Set the serial communication baud rate to 115200.
          while(tof.begin() != 0){
            Serial.println("begin error !!!!!");
          }
          Serial.println("begin success");
          //config matrix mode
          while(tof.setRangingMode(eMatrix_4x4) != 0){ //Set to 4*4 mode
            Serial.println("init error !!!!!");
            delay(1000);
          }
          Serial.println("init success");
        }
        
        void loop(void){
          tof.getAllData(buf);
          for(uint8_t i = 0; i < 4; i++){
            Serial.print("Y");
            Serial.print(i);
            Serial.print(": ");
            for(uint8_t j = 0; j < 4; j++){
              Serial.print(buf[i * 4 + j]);
              Serial.print(",");
            }
            Serial.println("");
          }
          Serial.println("------------------------------");
          delay(100);
        }

Program execution effect:

Click the button in the upper right corner of the IDE to open the serial monitor, as shown in the figure:

The output data is as shown in the figure below.

The horizontal direction is the X-axis from left to right, with the unit being mm. The vertical direction is the Y-axis from top to bottom.

For example, the number 12 in the data at the third row and second column in the figure is the distance value of 12 corresponding to the point (x1, y2), with the unit being mm.

Example 2: Read distance data of 8*8 matrix via I2C

Program Description:

  • This example demonstrates how to read distance values from 64 matrices and display them in the serial monitor.
  • This example code can also be found in ArduinoIDE under File > Examples > DFRobot_MatrixLidar > I2C > get8*8data, as shown in the following figure:

Example code:

#include "DFRobot_MatrixLidar.h"
  
  DFRobot_MatrixLidar_I2C tof(0x33); //Default I2C address 0x33
  uint16_t buf[64]; //Data from a total of 64 points
  
  void setup(void){
    Serial.begin(115200); //Set the serial communication baud rate to 115200
    while(tof.begin() != 0){
      Serial.println("begin error !!!!!");
    }
    Serial.println("begin success");
    //config matrix mode
    while(tof.setRangingMode(eMatrix_8x8) != 0){ //Set to 8*8 mode
      Serial.println("init error !!!!!");
      delay(1000);
    }
    Serial.println("init success");
  }
  
  void loop(void){
    tof.getAllData(buf);
    for(uint8_t i = 0; i < 8; i++){
      Serial.print("Y");
      Serial.print(i);
      Serial.print(": ");
      for(uint8_t j = 0; j < 8; j++){
        Serial.print(buf[i * 8 + j]);
        Serial.print(",");
      }
      Serial.println("");
    }
    Serial.println("------------------------------");
    delay(100);//Setting this time allows adjustment of the interval for reading distances.
  }

Program execution effect:

Click the button in the upper right corner of the IDE to open the serial monitor, as shown in the figure:

The output data is as shown in the figure below.

The horizontal direction from left to right is the X-axis, with the unit being mm. The vertical direction from top to bottom is the Y-axis.

For example, the data "322" in the second row and second column in the figure represents the distance value of 322 at the x1, y1 point, with the unit being mm.

Example 3: Obtain the distance value of a specified point via I2C

Program Description:

  • This example demonstrates how to read the distance value of a specified point and display it in the serial monitor.
  • Of course, the same method can also be used to read the distances of multiple specified points simultaneously.
  • This example code can also be found in ArduinoIDE via File > Examples > DFRobot_MatrixLidar > I2C > get FixedPoint, as shown in the figure below:

Example code:

#include "DFRobot_MatrixLidar.h"
DFRobot_MatrixLidar_I2C tof(0x33); //Default I2C address 0x33

void setup(void){
  Serial.begin(115200); //Set the serial communication baud rate to 115200.

  while(tof.begin() != 0){
    Serial.println("begin error !!!!!");
  }
  Serial.println("begin success");
  //config matrix mode
  while(tof.setRangingMode(eMatrix_8x8) != 0){ //The default matrix mode is 8x8, which can be set to 4x4
    Serial.println("init error !!!!!");
    delay(1000);
  }
  Serial.println("init success");
}

void loop(void){

    uint16_t data = tof.getFixedPointData(1,0); //Read the distance value of the x1, y0 point, in mm
    Serial.print(data);
    Serial.println(" mm"); 
    delay(10);
}

Program execution effect:

Click the button in the upper right corner of the IDE to open the serial monitor, as shown in the figure:

The output data is as shown in the figure below:

UART Communication Example

The baud rate of this product's serial communication is 115200 and cannot be modified. If you need to use Arduino UNO, please use the I2C mode. The stable communication rate of UNO's software serial port is 9600, which cannot communicate stably with this product and may cause stuttering.

Therefore, the following examples all use FierBeetle ESP32-E as the demonstration routine.

Hardware Connection

Toggle the switch to the UART position as shown in the figure:

  • At this point, the communication mode is set to UART mode.
  • Each time the I2C/UART function is switched, the power supply must be disconnected and restarted for the change to take effect.

Wiring diagram:

Example 1: UART obtains 4*4 dot matrix data

Program Description:

  • This example demonstrates how to use ESP32-E to read distance values from 16 matrices and display them in the serial monitor.
  • This example code can also be found in ArduinoIDE via File > Examples > DFRobot_MatrixLidar > UART > get4 4data, as shown in the figure below:

Example program:

Note: Connect the R of the sensor to D2 of ESP32-E, and T to D3.

#include "DFRobot_MatrixLidar.h"

 #if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
 #include <SoftwareSerial.h>
 #endif
 
 #if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
   SoftwareSerial mySerial(/*rx =*/4, /*tx =*/5);
   DFRobot_MatrixLidar_UART tof(&mySerial);
 #else
   DFRobot_MatrixLidar_UART tof(&Serial1);
 #endif
 uint16_t buf[16];
 
 void setup(void){
   #if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
     mySerial.begin(115200);
   #elif defined(ESP32)
     Serial1.begin(115200, SERIAL_8N1, /*rx =*/D3, /*tx =*/D2);
     // Connect the R of the sensor to D2 of ESP32-E, and T to D3.
   #else
     Serial1.begin(115200);
   #endif
   Serial.begin(115200);
   while(tof.begin() != 0){
     Serial.println("begin error !!!!!");
   }
    Serial.println("begin success");
   //config matrix mode
   while(tof.setRangingMode(eMatrix_4x4) != 0){
     Serial.println("init error !!!!!");
     delay(1000);
   }
   Serial.println("init success");
 }
 
 void loop(void){
   tof.getAllData(buf);
   for(uint8_t i = 0; i < 4; i++){
     Serial.print("Y");
     Serial.print(i);
     Serial.print(": ");
     for(uint8_t j = 0; j < 4; j++){
       Serial.print(buf[i * 4 + j]);
       Serial.print(",");
     }
     Serial.println("");
   }
   Serial.println("------------------------------");
   delay(100);
 }

Program execution effect:

Click the button in the upper right corner of the IDE to open the serial monitor, as shown in the figure:

The output data is as shown in the figure below:

Example 2: UART obtains 8*8 dot matrix data

Program Description:

  • This example demonstrates how to use ESP32-E to read distance values from 64 matrices and display them in the serial monitor.
  • This example code can also be found in ArduinoIDE via File > Examples > DFRobot_MatrixLidar > UART > get8 8data, as shown in the figure below:

Example code:

Note: Connect the R of the sensor to D2 of ESP32-E, and T to D3.

#include "DFRobot_MatrixLidar.h"

#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
#include <SoftwareSerial.h>
#endif

#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
  SoftwareSerial mySerial(/*rx =*/4, /*tx =*/5);
  DFRobot_MatrixLidar_UART tof(&mySerial);
#else
  DFRobot_MatrixLidar_UART tof(&Serial1);
#endif
uint16_t buf[64];

void setup(void){
  #if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
    mySerial.begin(115200);
  #elif defined(ESP32)
    Serial1.begin(115200, SERIAL_8N1, /*rx =*/D3, /*tx =*/D2);
    // Connect the R of the sensor to D2 of ESP32-E, and T to D3
  #else
    Serial1.begin(115200);
  #endif
  Serial.begin(115200);
  while(tof.begin() != 0){
    Serial.println("begin error !!!!!");
  }
   Serial.println("begin success");
  //config matrix mode
  while(tof.setRangingMode(eMatrix_8X8) != 0){
    Serial.println("init error !!!!!");
    delay(1000);
  }
  Serial.println("init success");
}

void loop(void){
  tof.getAllData(buf);
  for(uint8_t i = 0; i < 8; i++){
    Serial.print("Y");
    Serial.print(i);
    Serial.print(": ");
    for(uint8_t j = 0; j < 8; j++){
      Serial.print(buf[(i * 8 + j)]);
      Serial.print(",");
    }
    Serial.println("");
  }
  Serial.println("------------------------------");
  delay(100);
}

Program execution effect:

Click the button in the upper right corner of the IDE to open the serial monitor, as shown in the figure:

The output data is as shown in the figure below:

Example 3: UART obtains data of specified points

Program Description:

  • This example demonstrates how to use ESP32-E to read the distance value of a specified point and display it in the serial monitor.
  • Of course, the same method can also be used to read the distances of multiple specified points simultaneously.
  • This example code can also be found in ArduinoIDE via File > Examples > DFRobot_MatrixLidar > UART > get FixedPoint, as shown in the figure below:

Example code:

#include "DFRobot_MatrixLidar.h"
#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
#include <SoftwareSerial.h>
#endif

#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
  SoftwareSerial mySerial(/*rx =*/4, /*tx =*/5);
  DFRobot_MatrixLidar_UART tof(&mySerial);
#else
  DFRobot_MatrixLidar_UART tof(&Serial1);
#endif
void setup(void){
  #if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
    mySerial.begin(115200);
  #elif defined(ESP32)
    Serial1.begin(115200, SERIAL_8N1, /*rx =*/D3, /*tx =*/D2); 
   // Connect the R of the sensor to D2 of ESP32-E, and T to D3
  #else
    Serial1.begin(115200);
  #endif
  Serial.begin(115200);

  while(tof.begin() != 0){
    Serial.println("begin error !!!!!");
  }
  Serial.println("begin success");
  //config matrix mode
  while(tof.setRangingMode(eMatrix_8X8) != 0){
    Serial.println("init error !!!!!");
    delay(1000);
  }
  Serial.println("init success");
}

void loop(void){

    uint16_t data = tof.getFixedPointData(1,0);
    Serial.print(data);
    Serial.println(" mm");
    delay(10);
}

Program execution effect:

Click the button in the upper right corner of the IDE to open the serial monitor, as shown in the figure:

The output data is as shown in the figure below:

API

/**
   * @fn begin
   * @brief Initializes the sensor
   * @return NULL
   */
  uint8_t begin(void);

   /**
   * @fn setRangingMode
   * @brief Configures the retrieval of all data
   * @param matrix Configuration matrix for sensor sampling
   * @return Returns the configuration status
   * @retval 0 Success
   * @retval 1 Failure
   */
  uint8_t setRangingMode(eMatrix_t matrix);


  /**
   * @fn getAllData
   * @brief Retrieves all data
   * @param buf Buffer to store the data
   */
  uint8_t getAllData(void *buf);

  /**
   * @fn getFixedPointData
   * @brief Retrieves data for a specific point
   * @param x X coordinate
   * @param y Y coordinate
   * @return Returns the retrieved data
   */
  uint16_t getFixedPointData(uint8_t x, uint8_t y);

USB output data

Connect to the computer

This product supports USB output of matrix data. With this function, you can connect to a computer via a TYPE-C data cable and quickly view distance data in the serial monitor.

Plug in the USB cable to connect to the computer:

View data

Open the serial monitor, set the baud rate to 115200, and open the serial port to see the real-time distance output.

USB output currently only supports 8*8 mode.

USB outputs 8*8 matrix data:

MakeCode Usage Tutorial

Function Description

MakeCode Programming Platform Link: https://makecode.microbit.org/

Library Address: https://github.com/DFRobot/pxt-DFRobot_matrixLidarDistanceSensor

The functions after loading the library via the extension feature are shown in the figure below:

In MakeCode, there are two modes: Matrix Mode and Obstacle Avoidance Mode.

  • Matrix Mode: By selecting different I2C addresses, it supports cascading up to 4 sensors for simultaneous use.
  • Obstacle Avoidance Mode: This is a test function intended solely for testing purposes. It may contain bugs or have limitations in user experience.

Example: Reading the Distance of a Specified Point in Matrix Mode

Hardware Preparation:

  • MBT0039: micro:bit Main Board *1
  • DFR1231: IO Extender for UNIHIKER K10 / micro:bit *1
  • SEN0628: Matrix LiDAR Sensor *1

Wiring Diagram:

Example Program:

This example will demonstrate reading data from the left and right points and printing it on the computer.

Result Demonstration:

MindPlus Usage Tutorial

Function Description

MindPlus Graphical Programming Platform Download Link: https://mindplus.cc/download.html

MindPlus User Library Link:

dfrobot-matrixlidardistancesensor-thirdex-V0.0.2.mpext

https://gitee.com/zhangtang6677/ext-matrixLidarDistanceSensor.git

https://github.com/DFRobot/ext-matrixLidarDistanceSensor.git

The functions available after loading the library via the extension feature are shown in the figure below:

In MindPlus, there are two modes: Matrix Mode and Obstacle Avoidance Mode.

  • Matrix Mode: By selecting different I2C addresses, it enables the cascading use of up to 4 sensors.
  • Obstacle Avoidance Mode: This is a test function, intended solely for testing purposes. It may contain bugs or have shortcomings in user experience.

Example: Reading the Distance of a Specified Point in Matrix Mode

Hardware Preparation:

  • DFR0992: UNIHIKER K10 Main Board *1
  • DFR1231: IO Extender for UNIHIKER K10 / micro:bit *1
  • SEN0628: Matrix LiDAR Sensor *1

Wiring Diagram:

Example Program:

This example will demonstrate reading data from the left and right points and displaying it on the screen of the UNIHIKER K10.

Result Demonstration:

Firmware Update

Tool Preparation

  • USB TYPE-C data cable × 1
  • Computer with Windows 10 or above × 1

Firmware Update Method

Step 1: Download the firmware

Download firmware V1.2: SEN0628-矩阵式激光雷达测距传感器-V1.2-20250226.uf2

The suffix of the decompressed firmware is: .uf2

Step 2: Connect to the computer via a USB cable

Press and hold the BOOT button on the sensor, and at the same time, connect to the computer using a USB TYPE-C data cable, as shown in the figure:

At this point, a USB flash drive pops up on the computer. As shown in the figure:

Step 3: Copy the firmware to complete the update

Copy and paste the downloaded firmware with the .uf2 suffix to the USB flash drive. After the pasting is completed, the USB flash drive interface will exit automatically, and the firmware update is finished at this point.