Skip to main content

Configure Serial Port

1 Overview

Hesai lidar products provide a standard serial port connection method, allowing developers to interact with the lidar via the serial port. This enables easy access to lidar point cloud data and configuration of lidar functions.

Note: Currently only JT16 supports serial port configuration.

2 Application Method

Taking JT16 as an example, the specific configuration method for serial port connection is as follows:

2.1 Driver Installation

The USB-to-RS485 cable provided with JT16 uses a third-party chip, and the corresponding driver file needs to be installed.

The installation methods for Windows and Ubuntu systems are as follows:

2.1.1 Windows System

  1. Open Device Manager.
  2. Connect the lidar.
  3. Install the driver (as shown below, the driver file can be downloaded here).
Serial port

2.1.2 Ubuntu System

  1. Check if the system has a built-in driver:
uname -r

Note: If the kernel version is 5.5 or above, the system already has a built-in driver. For kernel versions 2.6.15 to 5.4, proceed with the following steps:

  1. Download the driver:

a. Download the ZIP driver file, which contains multiple driver versions (the driver file can be downloaded here).

b. Locate the subfolder corresponding to your Linux kernel version in the ZIP file.

c. Copy the subfolder to a local directory.

  1. Install the driver:

a. Run the following command in the local directory to gain root privileges:

sudo su

b. Compile and install the driver by running the following command:

make all

c. Open the kernel module file in a text editor by running the following command:

sudo gedit /etc/modules

d. Add a new line at the end of the file, input "pl12303", save, and close the editor.

  1. Restart the Ubuntu system.
  2. Reconnect the USB-to-RS485 cable.

2.2 Configuration Process

2.2.1 Windows System

Method 1:

  1. View all port numbers:

    a. Open the Command Prompt window.

    b. Run the following command:

mode
  1. Plug and unplug the RS485 cable to determine its serial port number.

    Format: "COM" + number

Serial port

Method 2:

  1. Open Device Manager.

  2. In the device list, double-click [Ports (COM & LPT)] (refer to Driver Installation - Windows System).

  3. Record the RS485 port number (the port name of RS485 usually contains the model of the USB-to-RS485 chipset).

    Format: "COM" + number

2.2.2 Ubuntu System

  1. View all serial ports and their permissions:

    a. Open the terminal.

    b. Run the following command:

     ls -l /dev/ttyUSB*

Enabled serial ports: Start with "crw-rw-rw".

Serial port

Disabled serial ports: Start with "crw-rw----".

Serial port
  1. Plug and unplug the RS485 cable to determine its serial port number.

    Format: "/dev/ttyUSB" + number

  2. If there are disabled serial ports, run the following command to enable all serial ports:

sudo chmod 666 /dev/ttyUSB*
  1. Repeat step 1 to confirm the status of all serial ports again.

3 Point Cloud Visualization via Serial Port

Launch PandarView2 and follow the steps below to view real-time point clouds sent by JT16 via serial port:

  1. Click the [Listen for Data] button on the toolbar to open the configuration window.

  2. Configure the following parameters:

    Source TypeSelect Serial Port
    RS485 Serial PortEnter the port number of RS485
    Baud RateDefault: 3000000; if it fails, try 3125000
  3. Click [OK] to start viewing real-time point clouds.

JT16_PV

Note: Users can refer to Use PandarView - Download and Installation for instructions on installing the PandarView2 software.