Forums Technical Articles Developer Docs 中文区 UART Decoder Module Database Models Quotes & Orders EN · 中文 · 日本語 · DE · ES

LRF3000A1: how do I build the single-ranging command and check the reply checksum?

Viewed 0

Reposted by ERDI Engineering from a customer email (anonymized).

I am writing my own parser for the LRF3000A1 laser rangefinder module over UART. What exactly is the single-measurement command, how is the checksum calculated for the command and for the reply, and how do I turn the returned bytes into a distance?

1 Answers

Frame basics (from the LRF3000A1 datasheet): UART, TTL 3.3 V, 115200 baud by default (9600 is the other listed rate), 8 data bits, every frame is 8 bytes, header 55 AA.

Single ranging

  • Send: 55 AA 88 FF FF FF FF 84
  • Reply: 55 AA 88 STA FF DIS_H DIS_L SUM
  • STA = 1 means the measurement succeeded, STA = 0 means it failed.
  • DIS_H / DIS_L are the high and low bytes of the result, in hexadecimal.

Checksum: the two directions use different ranges

  • Command (send) frame: low 8 bits of the sum of bytes 3 to 7. For the single-ranging command: 0x88 + 4 x 0xFF = 0x484, low 8 bits = 0x84. That is the last byte above.
  • Reply frame: low 8 bits of the sum of bytes 1 to 7 (header included).

Scaling: the datasheet states that all data results are output as the real value multiplied by 10. Combine DIS_H and DIS_L into one 16-bit number and divide by 10.

Illustrative arithmetic only (not a captured frame): if DIS_H DIS_L = 00 64, the raw number is 100, so the real value is 10.0. The reply checksum for 55 AA 88 01 FF 00 64 is (0x55+0xAA+0x88+0x01+0xFF+0x00+0x64) & 0xFF = 0xEB.

Things to know

  • Unit: the datasheet frame table does not state the unit of the returned number. Do not assume metres or centimetres from a sibling model; datasheet does not specify, email us and we confirm in writing.
  • Continuous ranging: the request uses function byte 89 (55 AA 89 FF FF FF FF 85) but the reply is printed with function byte 88. The datasheet itself marks this as on hold (spec inconsistent within the datasheet; the written confirmation from us is the one that counts), so accept both in a parser and confirm with us before relying on it.
  • Other commands use the same 8-byte layout: stop ranging 55 AA 8E FF FF FF FF 8A; the power-on self-test reply starts 55 AA 80.
  • Pin 6 is the enable pin (power on at low level); pins 4 and 5 are TX and RX at 3.3 V.

For price and delivery please use https://erdilrf.com/contact/ or [email protected].

Sources:

ERDI Verified Answer — checked against the datasheet by ERDI Engineering.

ERDI Engineering Community is run by ERDI TECH LTD (Chengdu, China) · erdilrf.com · GitHub · Civil applications only · Questions about modules from any brand are welcome.