Application of lidar on STM321.Introduction to lidar1.1Product feature1.2 Application scenario1.3 Interface definition2.Important communication protocols2.1 Start ranging2.2 Stop ranging2.3 Set output frequency2.4 Set baud rate3.Connection mode of stm32 and SDM153.1Wiring instructions4.Experimental result
YDLIDAR SDM15 lidar is a high-performance single-point lidar (hereinafter referred to as SDM15). This product is based on the principle of time-of-flight distance measurement, combined with relevant optical, electrical and algorithm design, to achieve high-precision laser distance measurement and output high frame rate point cloud data. It can be used for UAV altitude determination, robot obstacle avoidance, navigation, etc.
➢ Small ranging error and good ranging stability ➢ The range scanning frequency is high, and internal high sampling and filtering pretreatment can be configured ➢ Output frequency can be flexibly configured according to requirements ➢ Long detection distance, up to 15 meters ➢ The detection distance is small, and the nearest detectable distance is 50mm ➢ Laser power meets FDA Class I safety standards ➢ Service life 10000h
➢ UAV height setting and obstacle avoidance ➢ Robot obstacle avoidance ➢ Intelligent equipment obstacle avoidance ➢ Navigation and obstacle avoidance of household service robot/sweeping robot
VCC: power supply interface (positive) 5V (The measured data below 5V is inaccurate, and the laser radar may be burnt out if it is higher than 5V)
TX: output port of communication serial port
RX: input port of communication serial port
GND: power supply interface (negative) 0V
Package | type | Length | Data segment | Check code |
---|---|---|---|---|
2 bytes | 1 bytes | 1 bytes | N bytes | 1 bytes |
The communication protocol used in the provided routine is as follows: ➢ Baotou: SDM_ The message header flag of 15 is 0x55AA; ➢ Package type: the type of system command, as shown in the table; ➢ Data length: refers to the length of response data; ➢ Data segment: the response content under different system commands and different data content are fed back. The data format is also different, and the length is determined by the data length. ➢ Check code: check code, the sum of all other data except the check code, taking the lower 8 digits;
stm32 send :0xAA 0x55 0x60 0x00 0x5F SDM15 response :0xAA 0x55 0x60 0x04 Distance (low 8 bits) Distance (high 8 bits) Strength (8 bits) Interference (8 bits) Check code (sum of previous data)
stm32 send : 0xAA 0x55 0x61 0x00 0x60 SDM15 response:0xAA 0x55 0x61 0x00 0x60
stm32 send: 0xAA 0x55 0x64 0x01 Set frequency check code SDM15 response: 0xAA 0x55 0x64 0x01 Set frequency check code
The frequency of the set frequency check code is: 10hz, 100hz, 200hz, 500hz, 1000hz, 1800hz output frequency, corresponding to code 0-5 (default is 100hz)
stm32 send: 0xAA 0x55 0x66 0x01 Set frequency check code SDM15 response: 0xAA 0x55 0x66 0x01 Set frequency check code
Baud rate set: 230400, 460800, 512000, 921600, 1500000 correspond to code 0-4 (default is 460800). After the baud rate is set, it takes effect after being powered on again
This routine uses usart1 and usart2 for experiments
Use objects to block the part as shown in the figure. The data of the experimental results are shown in the figure below (dis: distance, intensity: intensity, noise: interference)
In addition, the light on the stm32 board will change its state every time it receives the range data from the radar to achieve the flashing effect.