adafruit_lidarlite

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

  • Author(s): ladyada

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_lidarlite.LIDARLite(i2c_bus, *, reset_pin=None, configuration=0, address=98)

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)

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 distance

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

read_distance(bias=False)

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

reset()

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 status

The status byte, check datasheet for bitmask