Python code for LPB60B Lidar Sensor
Robots.Are.Cool 2025-03-02 08:47:27 3110 Views1 Replies Hi Everyone,
I've purchased a LPB60B IP65 DToF Single-Point Ranging LiDAR Sensor and I am trying to get it to work with Python on a PC. We have connected it using a USB to 5v TTL UART Serial Cable. Here is the code we are using:
import serial
port = “COM3”
baudrate = 9600
ser = serial.Serial(port, baudrate)
data_to_send = b'\x55\x01\x00\x00\x00\x00\xd3\xaa'
ser.write(data_to_send)
while True:
# Read data from the serial port
if ser.in_waiting > 0:
data = ser.readline().decode('utf-8').rstrip()
print(data)
This is simple code to simply request the hardware and software version (once we get communication working, we'll be able to pull distance measurements). The COM3 port is recognized by the driver (it throws an error if it is anything else, and COM3 also shows in the computer's control panel when the USB is plugged in), but the code will just loop through and won't ever “receive” anything from the LiDAR sensor.
What are we missing? Does anyone have python code that works with the LiDAR sensors? Google searches have been unsuccessful. Thanks!


