Ranging Module Communication Protocol


Ranging Module Standard Communication Protocol

The standard communication protocol is applicable to all ranging module products of our company.

Function settings

1.1 Baud rate setting

1.1.1 Baud rate 9600bps setting


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x1
0xFF
0xFF
0xFF
0xFF
check code


Check code = byte 3+ byte 4+ byte 5+ byte 6+ byte 7

Return value:


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x1
Status
0xFF
0xFF
0xFF
check code


status=0x00,Baud Rate Setting Failed;

status=0x01,Baud Rate Setting Successfully

NoteThe baud rate will not be changed immediately after setting. It will not take effect until restart.


1.1.2 Baud rate 115200bps setting


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x2
0xFF
0xFF
0xFF
0xFF
check code


Command = 0x1Baud=115200bps

Check code = byte 3+ byte 4+ byte 5+ byte 6+ byte 7

Return value:


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x2
Status
0xFF
0xFF
0xFF
check code


status=0x00,Baud Rate Setting Failed;

status=0x01,Baud Rate Setting Successfully

NoteThe baud rate will not be changed immediately after setting. It will not take effect until restart.


1.2 Infrared light turn-on and turn-off settings (this specification applies to all ranging modules with Infrared light )

1.2.1 Infrared light turn-on


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x04
0xFF
0xFF
0xFF
0xFF
check code


Return value:


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x04
Status
0xFF
0xFF
0xFF
check code


Status =0x0    Failed to turn on infrared indicator;   

Status = 0x1,Successful Turning on Indicator


1.2.2 Infrared light turn-off


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x03
0xFF
0xFF
0xFF
0xFF
check code


Return value


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x03
Status
0xFF
0xFF
0xFF
check code


Status =0x0    Failed to turn on infrared indicator;   

Status = 0x1,Successful Turning on Indicator



1.3 Display Open and Close Settings (this specification applies to all ranging modules with Display configuration)

1.3.1 Display Display Open Settings


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x06
0xFF
0xFF
0xFF
0xFF
check code


Return value


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x06
Status
0xFF
0xFF
OLED
0xED


Status =0,Failed to open the display screen;   

Status =1,Successful opening of display screen


1.3.2 Display Close


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x05
0xFF
0xFF
0xFF
0xFF
check code


Return value


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x05
Status
0xFF
0xFF
OLED
0xED


Status =0,Failed to open the display screen;   

Status =1,Successful opening of display screen


2 Functional operation

2.1 Single measurement command


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x88
0xFF
0xFF
0xFF
0xFF
check code


Return value


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x88
Status
0xFF
DATA_H
DATA_L
check code


Status = 0, single measurement failure;

DATA_H = 0xFF, DATA_L = 0xFF;

Status = 1, single measurement success;

DATA_H = high bytes of measurement results;

DATA_L = low bytes of measurement results


2.2 Continuous Measuring Command


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x89
0xFF
0xFF
0xFF
0xFF
check code


Return value


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x89
Status
0xFF
DATA_H
DATA_L
check code


Status = 0, multiple measurement failures;

DATA_H = 0xFF, DATA_L = 0xFF;

Status = 1, multiple measurement success;

DATA_H = high bytes of measurement results; DATA_L = low bytes of measurement results






2.3 Angle measurement command


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x8A
0xFF
0xFF
0xFF
0xFF
check code


Return value


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x8A
Status
0xFF
0xFF
DATA
check code


Status = 0, angle measurement failure; DATA = 0xFF;    

Status = 1, angle measurement success; DATA = angle data


2.4 Speed measurement command


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x8B
0xFF
0xFF
0xFF
0xFF
check code


Return value


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x8B
Status
0xFF
DATA_H
DATA_L
check code


Status = 0, speed measurement failure;

DATA_H = 0xFF, DATA_L = 0xFF;    

Status = 1, speed measurement success;

DATA_H = high bytes of measurement results; DATA_L = low bytes of measurement results


2.5 Altimetry command


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x8C
0xFF
0xFF
0xFF
0xFF
check code


Return value


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x8C
Status
0xFF
DATA_H
DATA_L
check code


Status = 0, single measurement failure;

DATA_H = 0xFF, DATA_L = 0xFF;

Status = 1, successful single measurement;

DATA_H = high bytes of measurement results;

DATA_L = low bytes of measurement results


2.6 Horizontal Distance Measuring command


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x8D
0xFF
0xFF
0xFF
0xFF
check code


Return value


Byte1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
0x55
0xAA
0x88
Status
0xFF
DATA_H
DATA_L
check code


Status = 0, horizontal distance measurement failed; DATA_H = 0xFF, DATA_L = 0xFF;

Status = 1, successful horizontal distance measurement; DATA_H = high bytes of measurement results; DATA_L = low bytes of measurement results


Note: Data is returned in hexadecimal system. All data results multiply real data by 10.

Example: dist = 2000.3m, output data for 2003, conversion to 16-digit 4E23, that is, Data1 = 0x4E, Data2 = 0x23.


The Data of Angle and Velocity are the Same


share :