yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
SDM18 Laser Ranging Module📖
Module Introduction
  • Module Introduction
1.Preparation before use
  • Preparation before use
2.Get distance information_Linux
  • Get distance information_Linux
3.Get distance information_ROS
  • Get distance information_ROS
4.Multiple master control tutorials
  • 1.Get distance information_MSPM0
  • 2.Get distance information_ESP32
  • 3.Get distance information_Jetson
  • 4.Get distance information_Raspberry Pi
  • 5.Get distance information_RDK
  • 6.Get distance information_STM32
  • 7.Get distance information_MSPM03519new
Download
  • Code
  • DataSheet
  • 3D_Model_File
  • PC_Software
Download ZIP

Welcome to SDM18 Laser Ranging Module repository

4.Get distance information_Raspberry Pi

SDM18 and Raspberry Pi Communication

SDM18 and Raspberry Pi CommunicationSDM18 Introduction1. Experimental Preparation2. Experimental Wiring3. Experimental Steps4. Experimental Results5. Explanation of Some Important SDM18 Parameters and Default Values

SDM18 Introduction

  • The YDLIDAR SDM18 LiDAR (hereafter referred to as the SDM18) is a high-performance single-point LiDAR. This product utilizes the time-of-flight ranging principle and incorporates relevant optical, electrical, and algorithmic design to achieve high-precision laser distance measurement and output point cloud data at a high frame rate.

  • Product Features ➢ High ranging frequency, internal high sampling rate combined with filtering algorithms, resulting in highly stable data ➢ Long detection range, up to 18 meters ➢ Lightweight, approximately 1.35g ➢ Laser power meets FDA Class I safety standards

1. Experimental Preparation

  • SDM18 Laser Ranging Module

  • Raspberry Pi Series This tutorial uses a Raspberry Pi 5

2. Experimental Wiring

Note: You can solder the pin headers to the serial port adapter board yourself. The default pin headers are not included. For our testing, we cannot use pin-based communication, so we need to use a USB port. Here, we directly connect the motherboard and SDM18 via Type-C (UART baud rate 921600).

The wiring diagram is shown in the figure. image-20250814200048054

3. Experimental Steps

  1. Install the sdm18_test.py program provided in the example on the Raspberry Pi.

  2. After connecting the USB, enter lsusb. If the following device is recognized, the connection is successful.

  3. Run ls /dev/ttyUSB* to see if the USB device is recognized. If it is, skip step 4. If not, proceed to step 4.

    The following driver installation tutorial takes jetson as an example. It is also applicable to Raspberry PI. With our image, you can directly ignore it and run the program

    image-20250814174839068

  4. Enter lsusb -t in terminal

image-20250814191637820

git clone https://github.com/juliagoda/CH341SER.git cd CH341SER make -j6 sudo make install sudo modprobe ch34x

Then enter modinfo ch34x

If successful, the following message will be displayed.

image-20250814185721840

You can first execute the following command to see if a device such as 'ttyUSB*' appears. If successful, continue with the following steps. If still unsuccessful, connect the USB to TTL pins (GND-->GND RXD-->TX TXD-->RX 3V3-->3.3V)

sudo sh -c 'echo "1a86 7522" > /sys/bus/usb-serial/drivers/ch34x/new_id'

image-20250814194131171

​x
#1. Create the binding script
sudo tee /usr/local/bin/ch34x_bind.sh <<EOF
#!/bin/bash
sudo modprobe ch34x
echo "1a86 7522" > /sys/bus/usb-serial/drivers/ch34x/new_id
EOF

# Grant execution permissions
sudo chmod +x /usr/local/bin/ch34x_bind.sh

#2. Enable automatic startup via cron
# Edit the cron task
sudo crontab -e
Add the following to the end of the file:

@reboot /usr/local/bin/ch34x_bind.sh
  1. Modify the program based on the actual device number, such as /dev/ttyUSB0

  2. This experiment requires the Python environment and pyserial library, which you need to prepare yourself .

xxxxxxxxxx
pip3 install pyserial
  1. You need to upload the sdm18_test.py program to the Raspberry Pi in advance, then enter the following command in the terminal:

xxxxxxxxxx
python3 sdm18_test.py

4. Experimental Results

After connecting the cables and communicating normally, the serial port assistant will print the measured distance information, as shown in the figure. image-20250814190535398

  • dis: Distance in mm

  • strength: Strength

5. Explanation of Some Important SDM18 Parameters and Default Values

  1. The SDM18 interface is shown in the figure: image-2024032800004

  2. Default Serial Port Configuration The default baud rate of the SDM18 is 921600 image-2024033800005

  3. Important protocol commands based on the serial port (all sent in hexadecimal format) The SDM18 defaults to idle mode upon power-up. To perform ranging, you must first issue the start ranging command.

  • Start ranging: A5 03 20 01 00 00 00 02 6E

  • Stop ranging: A5 03 20 02 00 00 00 46 6E

  • Protocol analysis for receiving ranging signals image-2024033800006 image-2024033800007

  1. Checksum Calculation This checksum uses the CRC-16-modelbus method, calculating all bytes except the check digit.

The following figure shows the checksum calculation result for the "Start Ranging" command. image-2024033800008

Other protocols will not be explained here. Interested parties can refer to the SDM18 Development Manual.

Get distance information_Jetson
Get distance information_RDK

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文