adafruit_lidarlite

A CircuitPython & Python library for Garmin LIDAR Lite sensors over I2C

  • Author(s): ladyada, johnrbnsn

Implementation Notes

Hardware:

Software and Dependencies:

adafruit_lidarlite.CONFIG_LOWSENSITIVE = 5

Status Registers

class adafruit_lidarlite.LIDARLite(i2c_bus: I2C, *, reset_pin: Pin | None = None, configuration: int | None = 0, address: int | None = 98, sensor_type: str | None = 'V3')

A driver for the Garmin LIDAR Lite laser distance sensor.

Initialize the hardware for the LIDAR over I2C. You can pass in an optional reset_pin for when you call reset(). There are a few common configurations Garmin suggests: CONFIG_DEFAULT, CONFIG_SHORTFAST, CONFIG_DEFAULTFAST, CONFIG_MAXRANGE, CONFIG_HIGHSENSITIVE, and CONFIG_LOWSENSITIVE. For the I2C address, the default is 0x62 but if you pass a different number in, we’ll try to change the address so multiple LIDARs can be connected. (Note all but one need to be in reset for this to work!)

Parameters:
  • i2c_bus – The busio.I2C object to use. This is the only required parameter.

  • address (int) – (optional) The I2C address of the device to set after initialization.

configure(config: int) None

Set the LIDAR desired style of measurement. There are a few common configurations Garmin suggests: CONFIG_DEFAULT, CONFIG_SHORTFAST, CONFIG_DEFAULTFAST, CONFIG_MAXRANGE, CONFIG_HIGHSENSITIVE, and CONFIG_LOWSENSITIVE.

property correlation_data: int

Reads correlation data

property distance: int

The measured distance in cm. Will take a bias reading every 100 calls

property health_status: int

Reads health status for v3HP (not available on v3, will return -1)

property i2c_config: int

Reads the I2C config

property power_control: int

Reads the power control register

read_distance_v3(bias: bool | None = False) int

Perform a distance reading with or without ‘bias’. It’s recommended to take a bias measurement every 100 non-bias readings (they’re slower)

read_distance_v3hp() int

Perform a distance measurement for the v3 HP sensor

reset() None

Hardware reset (if pin passed into init) or software reset. Will take 100 readings in order to ‘flush’ measurement unit, otherwise data is off.

property signal_strength: int

Reads the signal strength of the last measurement

property status: int

The status byte, check datasheet for bitmask

property test_command: int

Reads the test command

property unit_id: int

Reads the serial number of the unit