Open-source UART drivers for 22 ERDI TECH LTD 905 nm laser rangefinder modules
(LR1000E-LR2000E, LRF1200A1, LRF3000A1, SPD1200N, SPD1200S2G (distance protocol), LRF50H-LRF1500H, LRF22VB, LRF50VB, LRF10VB),
with a Python library and CLI, an Arduino / ESP32 library and a ROS 2 Range node.
Two UART protocol families are covered (55 AA command/response at 115200 baud and
5C free-running stream at 460800 baud); see the model reference
and the matching erdilrf.com model pages.
Quick start · Model reference · Protocol A · Protocol B · Known gaps
| Environment | Start here | Next check |
|---|---|---|
| Python / PC / Raspberry Pi | Install, then Python | Select the exact model and serial port |
| Arduino | ErdiLRF examples | Confirm the board UART and module signal levels |
| ROS 2 | ROS 2 | Read the documented runtime validation limits |
The model table and protocol notes cite the source manuals. Source discrepancies remain visible in Known gaps; software tests do not establish live hardware performance.
Module Host (Arduino / ESP32 / Raspberry Pi / flight-controller TELEM port)
------- ------------------------------------------------------------------
TX -------------------> RX
RX <------------------- TX
GND -------------------- GND (one common ground, close to the module)
VCC <-- own regulator (supply per the model's manual; do NOT take it from the signal pins)
Cross TX and RX, share ground, and check the logic level of the module's TX line against your host before connecting: supply voltage is not the UART voltage (use a level shifter if they differ). Pin order and levels are model-specific, so take them from the model page on erdilrf.com and read UART hardware notes first.
| Platform | Example | Notes |
|---|---|---|
| Arduino Uno / Mega | BasicMeasure |
Hardware UART for family B (460800 baud) |
| ESP32 | BasicMeasure with Serial1 / Serial2 |
Pass the RX/TX pins to Serial1.begin() |
| Raspberry Pi / PC | erdi-lrf --port /dev/ttyUSB0 --model LRF3000A1 measure |
Python |
| ROS 2 | ros2 run erdi_lrf_driver range_node |
ROS 2 |
| Pixhawk / PX4 / ArduPilot | Flight-controller integration | No native driver is claimed; the recommended first path is a companion computer publishing MAVLink DISTANCE_SENSOR |
Engineering notes for choosing, wiring and validating a module:
- Evaluation checklist - what to test before design freeze
- 905 nm vs 1535 nm - wavelength trade-off and safety scope
- Flight-controller integration - PX4 / ArduPilot / ROS 2 patterns
- UART hardware notes - levels, grounds, cable, power
- Field troubleshooting - symptom to cause table
- ArduPilot test kit - test firmware, wiring and what log to send back
- Raw capture tool - record a module's serial bytes on any OS
# from the v0.1.0 release (pinned; no git needed at install time) pip install erdi-lrf # from PyPI # or track main directly pip install "git+https://github.com/ErdiTech/erdi-lrf-drivers#subdirectory=python"
Arduino: the library now lives in its own repository,
ErdiTech/ErdiLRF
(split out on 2026-09-17 so it could be registered — Arduino Library Manager
and the PlatformIO Registry both require a dedicated, tag-releasing repo, not
a subfolder of a mono-repo). Install via the Arduino IDE Library Manager —
search ErdiLRF and install (submission
merged 2026-09-17;
check the local index before installing). Or: arduino-cli lib install --git-url https://github.com/ErdiTech/ErdiLRF.git, or copy the repo into your
libraries/ folder. See that repo's README for details.
PlatformIO: published to the PlatformIO Registry
as erdi-tech/ErdiLRF — pio pkg install --library "erdi-tech/ErdiLRF", or by
Git URL: pio pkg install --library "https://github.com/ErdiTech/ErdiLRF.git"
(see platformio.ini example).
All release artifacts (wheel + sdist): https://github.com/ErdiTech/erdi-lrf-drivers/releases · Hardware and datasheets: https://erdilrf.com/?utm_source=github&utm_medium=readme&utm_campaign=erdi-lrf-drivers
cd python pip install -e . erdi-lrf models # every model and its wire facts erdi-lrf info --model LRF3000A1 # what the manual says, with sources erdi-lrf --port COM3 --model LRF3000A1 measure # one measurement erdi-lrf --port /dev/ttyUSB0 --model LRF100H stream --count 20
from erdi_lrf import ErdiLRF with ErdiLRF("/dev/ttyUSB0", model="LRF3000A1") as lrf: m = lrf.measure() print(f"{m.metres:.1f} m") # baud, framing and scaling come from the model with ErdiLRF("/dev/ttyUSB0", model="LRF100H") as lrf: for m in lrf.stream(): # family B free-runs at 460800 bps print(m.metres, "m", "(out of range)" if m.out_of_range else "")
The codecs (erdi_lrf.protocol_a, erdi_lrf.protocol_b) are pure functions with
no serial dependency, so you can encode and decode frames in tests, simulators
or your own transport.
The Arduino library is maintained standalone at
ErdiTech/ErdiLRF (see
arduino/README.md). Install it via Library Manager,
arduino-cli lib install --git-url https://github.com/ErdiTech/ErdiLRF.git,
or copy that repo into your libraries/ folder, then:
#include <ErdiLRF.h> ErdiLRF lrf(Serial1, ERDI_LRF3000A1); void setup() { Serial.begin(115200); Serial1.begin(erdiDefaultBaud(ERDI_LRF3000A1)); // 115200 here, 460800 for family B } void loop() { ErdiMeasurement m; if (lrf.measure(&m) == ERDI_OK) Serial.println(m.metres, 3); delay(500); }
Works with HardwareSerial or SoftwareSerial (anything that is a Stream).
The model table lives in flash, so the library costs ~350 bytes of SRAM on an
Uno. Examples: BasicMeasure,
ContinuousStream.
A step-by-step wiring and first-reading walkthrough for the Arduino side is here: Reading an ERDI laser distance module over UART with Arduino.
SoftwareSerial cannot reach the 460800 bps that family-B modules use by default. Use a hardware UART, or set the module to a lower documented rate first with
setBaudB().
ROS 2 support lives in its own package, erdi_lrf_driver (REP-144 naming; earlier releases were called erdi_lrf_ros2):
cd ~/ros2_ws/src && git clone https://github.com/ErdiTech/erdi_lrf_driver.git cd ~/ros2_ws && colcon build --packages-select erdi_lrf_driver source install/setup.bash ros2 run erdi_lrf_driver range_node --ros-args \ -p port:=/dev/ttyUSB0 -p model:=LRF3000A1 -p rate:=10.0 -p frame_id:=lrf_link # or ros2 launch erdi_lrf_driver erdi_lrf.launch.py port:=/dev/ttyUSB0 model:=LRF100H
Publishes sensor_msgs/Range on range. min_range and max_range come from
the model's own ranging-range specification; radiation_type is INFRARED.
field_of_view defaults to 0.0 (undeclared) because the protocol manuals do
not carry beam divergence — set it from your model's datasheet if you need it.
Parameters: port, model, baud (0 = model default), rate, frame_id,
field_of_view, continuous, acknowledge_protocol_hold.
- docs/protocol-A-55AA.md — frame layout, the two different checksums, the command table, error codes, both baud TYPE tables.
- docs/protocol-B-5C.md — data frames, the
Check_Sumfunction, the5Acommand table, baud codes, frequency divisors, the VB I²C register map. - docs/models.md — the 24 models documented in this repository with their wire facts and their hardware pages.
Every table row carries the manual sentence it came from.
cd python && pip install -e ".[test]" && pytest
The test suite is built from golden frames printed in the ERDI manuals —
55 AA 88 FF FF FF FF 84, 5C 02 11 EC, 5A 0D 02 0D 0D D6 and about thirty
more. Where a manual prints no full example (reply frames carrying real
distances), the expected checksum is computed by hand from the manual's stated
formula and the arithmetic is written into the test docstring. There are also
tests that assert the manual's own inconsistencies, so a future contributor
cannot quietly "fix" them.
Transport is tested against a scripted fake serial port, so pytest needs no
hardware.
Wiring, protocol and integration questions: ask on the ERDI engineering Q&A forum. Answers come from ERDI engineers and stay searchable for the next person. Bugs in this code still go to GitHub Issues.
| Model catalogue | https://erdilrf.com/models/ |
| Long range, 3 km | LRF3000A1 |
| 1–2 km OEM modules | LR1000E2 · LR1200E2 · LR1500E2 · LR2000E2 |
| 1.2 km SPD series | SPD1200N0 · SPD1200D03 |
| Short-range DToF, cm | LRF50H · LRF100H · LRF200H · LRF300H · LRF600H · LRF1500H |
| Short-range DToF, mm | LRF22VB · LRF50VB |
For each of those models, the specification page with the manufacturer's verbatim test condition sits on a separate site, which is the one this driver's constants were checked against: https://specs.erdilrf.com/models/. Every range number there carries the target, visibility and reflectance it was measured under, so a value can be compared against your own scene instead of trusted.
Questions, samples, datasheets and custom protocol work: https://erdilrf.com/contact/
Technical note with DOI (frame families, per-model units, manual inconsistencies): 10.5281/zenodo.23297197. Software archive of v0.1.0: 10.5281/zenodo.23297253.
Background write-ups on the manufacturer's site. They cover the same wire facts this repository implements, from the integration side rather than the code side:
-
Serial protocol, frames and checksums — why the transmit and reply checksum scopes differ, which is the most common reason a first integration returns nothing.
-
UART/TTL integration guide — levels, wiring and baud selection before any code runs.
-
Which modules support I²C — the register map and the models that genuinely publish an address.
-
Reading a module with Arduino — the walkthrough for the Arduino library above.
-
How to read the datasheet fields — minimum range, segmented accuracy and update rate, which decide which model you should have bought before the driver matters.
-
Update rate on moving platforms — what the
rateparameter of the ROS 2 node is actually bounded by. -
Raspberry Pi UART integration — the same frame parser on a Linux host, with the port, permission and ROS 2 checks that differ from Arduino.
-
PX4 rangefinder integration — the three routes into PX4 and the parameters each one needs.
-
dToF vs triangulation — why a single-point DToF module is not a scanning LiDAR, and where the comparison breaks down.
-
Beam divergence and spot size — the footprint at range, and why a small target at 3 km is a geometry problem before it is a driver problem.
These are places where the manufacturer manual is silent or disagrees with itself. The drivers surface them instead of papering over them. Full detail with quotations is in the two protocol documents.
SPD1200D03default baud rate is unresolved. Its manual states 115200 bps in the protocol section and 15200/9600 bps in the technical table, and adds "Do not select a host baud rate until the delivered unit configuration is confirmed." Both drivers therefore require an explicit baud rate for this model instead of choosing one.SPD1200D03publishes no distance scaling. The Python driver returns raw counts withmetres = None; the Arduino driver returnsNAN; the ROS 2 node refuses to start rather than publish aRangein metres it cannot justify.SPD1200D03publishes noSTAsemantics, so its status byte is returned unchecked.LRF1200A1andLRF3000A1continuous ranging is under a protocol hold. Their manuals record request function0x89and reply function0x88and explicitly decline to authorise a response parser. Streaming requires an explicit acknowledgement from the caller; single-shot is unaffected.LRF1500H's printed example frame contradicts its own checksum function.5C 02 11 03 ECshould be… E9;0xECis correct for the other models' 4-byte frame. The drivers implement the printed function and a test pins the discrepancy.LRF1500H's out-of-range value is stated twice, inconsistently — 16777215 in section 5.2 and "0xFFFF (16777215)" in section 6, where0xFFFFis 65535. The drivers use 16777215, matching the stated 3-byte field width.LRF50VBandLRF22VBprint different length bytes for the same serial-number request. LRF50VB prints5A 0D 02 0D 0D 0D 0D BCand LRF22VB prints5A 0D 04 0D 0D 0D 0D BA; both satisfy the publishedCheck_Sum. The drivers send each model the frame its own manual prints; if the module does not answer, the Python driver tries the other form once.SPD1200N0/N2/N4do not print a transmit checksum formula, only the note that request and reply scopes differ. The drivers use the family-A transmit formula, which reproduces every example frame those manuals do print.- The self-test
ErrCodebyte position differs between transcriptions — D3 in the LR-series row, D4 in SPD1200D03's eight-byte form. The Python driver exposes both candidates rather than choosing. LRF300H,LRF600HandLRF1500Hpublish no output-frequency divisor formula, so set/read frequency is not exposed for them.LRF50H,LRF100H,LRF300H,LRF600HandLRF1500Hpublish no I²C address. OnlyLRF200H(0x33) and the VB series (0x52) do.- Family-A stop bits and parity are not stated — only "Data bits: 8". The drivers leave the platform default (8N1) in place.
SPD1200S2Gis driven for its 8-byte distance protocol only. Its manual tells the integrator to confirm the 12-byte angle / point-to-point packets (scale, signed encoding) and the checksum overflow convention before implementing, so the angle packets are not driven and the lower-8-bit checksum is assumed from the other family-A manuals. The factory pack also holds a second manual headedSPD1200ZG; confirm which designation your unit carries.LRF10VB's manual publishes only start/stop ranging; its first command is labelled "Modify Baud Rate" but the frames printed are the same bytes the LRF22VB/LRF50VB manuals print for reading the serial number, so baud changes are not offered for it.- Not tested against live hardware in this repository. The codecs are verified against the manuals' golden frames and the transport against a fake serial port; the ROS 2 package is statically checked but has not been run in a ROS 2 environment here. Bench reports and pull requests are welcome.
Companion projects built around these drivers:
- erdi-lrf-pixhawk-ardupilot - Pixhawk / ArduPilot laser altimeter wiring and parameters
- erdi-lrf-ros2-examples - ROS 2 range node, RViz config, filters
- erdi-lrf-raspberry-pi-python - Raspberry Pi UART logger and systemd service
- erdi-lrf-esp32-micropython - ESP32 MicroPython driver
- erdi-lrf-stm32-hal - STM32 HAL driver with circular DMA
- erdi-lrf-home-assistant - ESPHome component for Home Assistant
- lrf-uart-protocol-decoder - WebSerial and Python protocol decoder (live)
- laser-rangefinder-module-database - open dataset of 109 modules (sortable table)
- awesome-laser-rangefinder and drone altimeter guide
Two rules, inherited from how the protocol reference was built:
- Cite the manual. Every constant needs the sentence it came from, in a comment or in the docs table.
- Never extrapolate across models. If a manual is silent, add a row to Known gaps. A blank costs a support email; a guess costs a returned module.
For model documents and configuration questions:
ERDI TECH LTD — 905 nm laser rangefinder modules. Check the selected model's documentation for its safety classification and use conditions.
| [email protected] | |
| +86 133 0819 5790 | |
| Web | https://erdilrf.com/?utm_source=github&utm_medium=readme&utm_campaign=erdi-lrf-drivers · Contact form |
| Address | Room 2812, 28/F, Building 3, No. 88 Jiaozi Avenue, Chengdu Hi-Tech Zone, Sichuan, China |
For samples, datasheets, mechanical drawings or protocol questions, use the contact details above and include the exact model and application.
Full table with baud rates, frame layouts, units and ranges: docs/models.md.
| Family | Models | Frame | Default baud | Raw unit |
|---|---|---|---|---|
A — 55 AA command/response |
LR1000E2/E4, LR1200E2/E4, LR1500E2/E4, LR2000E2/E4, LRF1200A1, LRF3000A1, SPD1200N0/N2/N4, SPD1200D03, SPD1200S2G (8-byte distance protocol only) | 8 bytes | 115200 for the listed models except SPD1200D03; confirm its delivered setting | value × 10 (0.1 m/count), except SPD1200D03: scaling not published |
B — 5C free-running stream |
LRF50H, LRF100H, LRF200H, LRF300H, LRF600H, LRF1500H | 4 bytes (LRF1500H: 5) | 460800 | centimetres |
B — 5C free-running stream |
LRF22VB, LRF50VB, LRF10VB | 4 bytes | 460800 | millimetres |
⚠️ The units are not uniform. The frame5C 02 11 ECmeans 43.54 m on an H-series module and 4.354 m on a VB-series module. Always select your model by name; never let a driver infer it from the family.
SPD1200S2G is driven from its factory-pack manual, 8-byte distance protocol only
(single / continuous / stop / baud request, reply x 10 in metres); the manual's 12-byte
angle packets are not driven until ERDI confirms their scale. LRF10VB (940 nm, 0.05-9 m)
is driven from its own Specification V3.0: same 4-byte 5C millimetre stream as
the VB series, out-of-range 65535, start/stop ranging only.
If these drivers save you time, a tip is appreciated (send the matching coin on the matching network only):
| Network | Address |
|---|---|
| USDT (TRC20) | TNGdTwE6opH6rmUyoG1JUR7FSyEb4k273R |
| USDT (ERC20 / BEP20 / Polygon), ETH (Ethereum / Arbitrum / Base) | 0x59c43144a862b351fa1086ae842d1327c9d91613 |
| BTC | 1RS6tWXHregLfEsiPzVUCUBuhgDg5uTSV |
| USDT (Solana) | HZguEXfTtLChNdJTxAYCbcGscaqikz8JYrEpUhEyeVd9 |
MIT — see LICENSE. Copyright (c) 2026 ERDI TECH LTD.
Two numbers decide whether a module fits a platform, and both are arithmetic on published specifications rather than measurements:
- Beam footprint at maximum range = divergence × range. A target smaller than the footprint is not fully illuminated, so the published maximum assumes something at least that large.
- Mass per kilometre = module mass ÷ published range — what reach costs you on a gimbal.
- Power per metre = average power ÷ published range, with the verbatim statement each watt was measured at (update rate and supply voltage move the figure by a factor of two).
tools/erdi_select.py prints all three from the open dataset:
python tools/erdi_select.py --url https://specs.erdilrf.com/data/erdi-lrf-specs.json \
--band 1535 --max-mass 200
# and check a specific target at a specific distance
python tools/erdi_select.py --url ... --need-range 2000 --target 0.5The same tables are published as pages: footprint and mass · power with conditions · range conditions, verbatim.
Full check with a worked example (0.5 m target at 2 km, two modules priced against it): docs/verifying-a-range-claim.md