The Garmin / PulsedLight LIDAR-Lite rangefinder is a low-cost optical distance measurement solution with a 40m range under most operating conditions, low power consumption, and small form factor.
Reference | Datasheet |
Requred periphery | I2C |
Unit tests | test_garmin_lite.cpp |
Installation:
- Include the header file
garmin_lite.h
and source filegarmin_lite.c
in your C/C++ code. - Ensure that the required dependencies are installed, such as the STM32 HAL library or any other libraries specific to your STM32 development environment.
Usage:
- During the boot of your application initialize I2C driver and then call
garminLiteInit()
- Periodically (with rate 10 Hz) call
garminLiteCollectData()
. If it returnsLIBPERIPH_OK
, then callgarminLiteParseCollectedData()
.
The simplest method of obtaining measurement results from the I2C interface is as follows:
- Write 0x04 to register 0x00
- Read register 0x01. Repeat until bit 0 (LSB) goes low
- Read two bytes from 0x8f (0x0f and 0x10) to obtain 16-bit measured distance in centimeters.
Slightly optimized algorithm:
- Read two bytes from 0x8f (0x0f and 0x10) to obtain 16-bit measured distance in centimeters
- Write 0x04 to register 0x00
- Sensor connection with Ardupilot based autopilots: https://ardupilot.org/copter/docs/common-rangefinder-lidarlite.html
- Sensor connection with PX4 based autopilots: https://docs.px4.io/main/en/sensor/lidar_lite.html