CircuitPython driver for ERDI 905 nm laser rangefinder modules read over UART (busio.UART). Use it for a laser distance sensor on CircuitPython boards such as RP2040 (Raspberry Pi Pico, Feather RP2040), ESP32-S2/S3 and nRF52, and for desktop CPython tests. Module pages, datasheets and public prices are in the ERDI laser rangefinder model list.
It supports both published ERDI protocol families, taken from the module manuals:
- Stream modules (460800 baud): LRF22VB, LRF50VB (distance in millimetres), LRF50H, LRF100H, LRF200H, LRF300H, LRF600H, LRF1500H (distance in centimetres). Read the newest value with
read_latest(). - Single-shot modules (115200 baud): LR1000E2 to LR2000E4, LRF1200A1, LRF3000A1, SPD1200N0/N2/N4. Request one reading with
measure().
The model table also holds each model's out-of-range marker, so the right unit and marker are applied automatically. Check the delivered UART interface and logic level of your module against the board before wiring (a UART level shifter may be needed).
Copy erdi_lrf.py to the lib folder of the CIRCUITPY drive. For a desktop test: pip install circuitpython-erdi-lrf is not published yet, use the file directly.
import board, busio, erdi_lrf
uart = busio.UART(board.TX, board.RX, baudrate=460800, timeout=0)
lrf = erdi_lrf.ErdiLRF(uart, "LRF22VB")
print(lrf.read_latest()) # metres, or None when out of range / no frame yetSingle-shot modules:
uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=0)
lrf = erdi_lrf.ErdiLRF(uart, "LRF3000A1")
print(lrf.measure(timeout_ms=1000)) # metres, None when the module reports no echo, OSError on timeoutSee examples/ for complete scripts.
python -m pytest tests runs 13 protocol and reader tests on CPython with a fake UART (frame vectors from the module manuals, unit handling, out-of-range marker, checksum rejection, resync, single-shot request and reply, timeout). The frame parsing is the same code that runs in the MicroPython driver. The busio.UART wrapper has been tested only against the fake UART so far, not on a CircuitPython board.
erdi-lrf-drivers (Python, Arduino, ROS 2), erdi-lrf-esp32-micropython, erdi-lrf-home-assistant.
If this project saved you time, you can buy the author a coffee in crypto. Thank you! 如果这个项目帮到了你,欢迎用加密货币打赏支持,谢谢!
| Network | Asset | Address |
|---|---|---|
| TRON (TRC20) | USDT | TNGdTwE6opH6rmUyoG1JUR7FSyEb4k273R |
| Ethereum / BNB Chain / Polygon | USDT | 0x59c43144a862b351fa1086ae842d1327c9d91613 |
| Ethereum / Arbitrum / Base | ETH | 0x59c43144a862b351fa1086ae842d1327c9d91613 |
| Bitcoin | BTC | 1RS6tWXHregLfEsiPzVUCUBuhgDg5uTSV |
| Solana | USDT | HZguEXfTtLChNdJTxAYCbcGscaqikz8JYrEpUhEyeVd9 |
MIT, copyright 2026 ERDI TECH LTD. See LICENSE.