Distance display as it moves toward and away from the pillar directly ahead.

LiDAR (an acronym for light detection and ranging) is a technology that measures the distance to a target by shining a pulsed laser light on it and analyzing the reflections.

The surface that you are bouncing the laser light off of will impact how good of a reading you get. Smooth, reflective surfaces will tend to bounce the light away from the sensor depending on the angle at which the light is hitting the surface. If the light is coming straight at the surface, it will reflect directly back and you will get a good reading. The further from straight-on you get, the poorer of a reading you will get, eventually you'll get no reading at all. Glass, mirrors, and any highly polished surface will be have this way.

From the Garmin LiDAR Lite datasheet

If the surface is rougher (i.e. not smooth) light will reflect off in various directions, some of it making it back to the sensor and giving a reading. Examples are paper, wood (not highly polished), and pets.

From the Garmin LiDAR Lite datasheet

For more information, see the Wikipedia page on reflection.

LiDAR is often seen used with a rotating sensor that takes distance readings at various angles as the sensor assembly rotates. This provides distances in a circle around the sensor. This data can then be used to construct 2D maps.

Autonomous vehicles (i.e. self driving cars) often use LiDAR to map out the space around them.

The Garmin LiDAR Lite is a simple, non-rotating sensor that measures the distance to the target it is pointed at.

In this guide we will build a range finder, or electronic tape measure if you like, using the new Garmin Lidar-Lite. This is a laser based distance sensor that works by bouncing a modulated laser beam against an surface and measuring how long it take for a reflection to come back.

Anlged shot of a Garmin LIDAR-Lite Optical Distance Sensor.
You've heard about the sensors in the news, when used in self-driving cars, and now you can have your own! Garmin's LIDAR-Lite V3 is the ideal high-performance...
Out of Stock
Angled shot of a Adafruit Feather M4 Express.
It's what you've been waiting for, the Feather M4 Express featuring ATSAMD51. This Feather is fast like a swift, smart like an owl, strong like a ox-bird (it's half ox,...
In Stock
Angled shot of a rectangular shaped 7-segment breakout board with an LED matrix soldered on.
One segment? No way dude! 7-Segments for life!This is the Red Adafruit 0.56" 4-Digit 7-Segment Display w/ FeatherWing Combo Pack! We also have these combo...
In Stock
Angled shot of two stacking headers.
These two Short Female Headers alone are, well, lonely. But pair them with any of our 
In Stock
Angled shot of a Short Feather Male Headers - 12-pin and 16-pin Male Header Set.
These two Short Male Headers alone are, well, lonely. But pair them with any of our 
In Stock
Lithium Ion Polymer Battery 3.7v 1200mAh with JST 2-PH connector
Lithium-ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light, and powerful. The output ranges from 4.2V when completely charged to 3.7V. This...
In Stock
Angled shot of PowerBoost 1000 Charger.
PowerBoost 1000C is the perfect power supply for your portable project! With a built-in load-sharing battery charger circuit, you'll be able to keep your power-hungry...
In Stock
Breadboard-friendly SPDT Slide Switch
These nice switches are perfect for use with breadboard and perfboard projects. They have 0.1" spacing and snap in nicely into a solderless breadboard. They're easy to switch...
In Stock
1 x Power filtering capacitor
The datasheet calls for a 680 uF electrolytic across the power connection, but a 470 uF seems to work fine.

A Feather doubler is used above to show the Feather as well as the display wing. For the actual build, they are stacked using short Feather headers.

The LIDAR requires a 5v power source. To make it mobile, we can use a LiPo battery and a PowerBoost to get 5v. Using the PowerBoost 1000C also gives us a power/enable switch as well as a built-in charger.

Since we're not using the battery circuitry on the Feather (and the code is not very computationally demanding) we could use an ItsyBitsy M0/M4 or Trinket M0 just as well. Using a Feather and the 7-segment wing provides a simple, compact approach to circuit assembly. By the same token, a Feather M0 or M0 Express can be used.

I2C makes this a very simple circuit: both the display wing and the LIDAR use I2C. The only other aspect to the circuit is the PowerBoost which is also simple to connect.

You can quickly tack the LiDAR's wiring to the feather, ignoring the PowerBoost until the final assembly. Simply connect the LiDAR's power and ground to the Feather's USB and Gnd pins. This will let you load code onto the Feather; once things are assembled, the Feather's USB port is inaccessible.

We'll be using CircuitPython for this project. Are you new to using CircuitPython? No worries, there is a full getting started guide here.

Adafruit suggests using the Mu editor to edit your code and have an interactive REPL in CircuitPython. You can learn about Mu and its installation in this tutorial.

Install the latest release of CircuitPython, version 4. Follow the instructions here using the appropriate CircuitPython UF2 file.

3) Get the latest 4.0 library pack, unzip it, and drag the libraries you need over into the /lib folder on CIRCUITPY.

For this project you will need the following libraries:

  • adafruit_busdevice
  • adafruit_lidarlite
  • adafruit_ht16k33

When these are installed, your CIRCUITPY/lib directory should look something like:

The code is very simple. Once the hardware is set up, the main loop gets the distance (in cm) from the LIDAR and displays it on the 7-segment display. 

# SPDX-FileCopyrightText: 2018 Dave Astels for Adafruit Industries
# SPDX-License-Identifier: MIT

Rangefinder byuit around the Garmin LidarLite

Adafruit invests time and resources providing this open source code.
Please support Adafruit and open source hardware by purchasing
products from Adafruit!

Written by Dave Astels for Adafruit Industries
Copyright (c) 2018 Adafruit Industries
Licensed under the MIT license.

All text above must be included in any redistribution.
import time
import busio
import board
import adafruit_lidarlite
import adafruit_ht16k33.segments

i2c = busio.I2C(board.SCL, board.SDA)

sensor = adafruit_lidarlite.LIDARLite(i2c)
display = adafruit_ht16k33.segments.Seg7x4(i2c)

while True:
    except RuntimeError as e:
        # If we get a reading error, just print it and keep truckin'

What If I Don't Have A 3D Printer?

Not to worry! You can use a 3D printing service such as 3DHubs or MakeXYZ to have a local 3D printer operator 3D print and ship you parts to you. This is a great way to get your parts 3D printed by local makers. You could also try checking out your local Library or search for a Maker Space.

You might also consider modifying a project case or box of similar dimensions for this project.

There are three pieces to print: the main case, the lid, and the divider (print two of these). Files are below. The lid and dividers are flat and don't need supports and require minimal cleanup. The body needs full supports (from everywhere rather than just from the build plate) and will take a fair bit of careful cleanup to remove them.

When slicing, orient the body so that it opens up, and the lid with the rounded edges up. The divider should already be oriented flat.

If you have heat seatable M3 inserts they can be placed in the four bolt-holes in the top corners of the base.

The Feather

Start by assembling the display Featherwing, but use the short male headers instead of the regular headers that come with the wing.


Solder the short female headers on the top of the Feather. This will let the display clip onto the Feather with a minimum of space between them, allowing it to fit into the designed case.


Place the PowerBoost as shown: slide the USB connector out the hole in the side of the body, and slide it onto the two rear pegs.


Place the capacitor as shown (it's top against the opposite side of the body). This will position it clear of the LiDAR unit. Clip its leads where they meet the center power pads of the PowerBoost. Pay close attention to the polarity of the capacitor and match it's negative side to the ground/- power pad. Clip the leads and solder them to the power pads.


Solder the power leads from the LiDAR wiring harness (red is +, black is -) to the outer power and ground pads of the PowerBoost. The power and ground lines can be trimmed some but take care not to make them too short.


Connect two wires to the side power and ground pads. These will go to the Feather and should be fairly long to allow assembly later. 10 cm (4 in) is fine.

The I2C lines on the LiDAR harness shouldn't be trimmed much; they similarly need to be 10 cm (4 in). These are too short in the photo and unfortunately the LiDAR only comes with one harness [the author ended up trimming them all the way back and adding silicon wires to get the required length].

Attach the power and I2C lines (blue is SDA, green is SCL) to the Feather. This can be done by soldering to the corresponding pins on the back or the Feather (power to the USB pin).

With the PowerBoost still in place, a drop of superglue can be placed in each to its mounting holes to secure it in place.


Now for some soldering finesse. Slide the switch in from the outside until it is touching the side of the PowerBoost.


The switch's pins should line up with Vs, EN, and GND pads. Trim them so the just reach the pads and solder them in place.


The final step for the PowerBoost is to plug the battery into the battery connector.

Internal Assembly

Put the LiDAR unit in place, making sure that the battery wires go around the PowerBoost side, and the rest go around the other side. The connector on the LiDAR unit should be visible as shown.


Slide one of the dividers into the guide immediately behind the LiDAR unit.  Verify that the notches are along the top edge of the divider, and that the small notch is near the side where the battery cable is.

Carefully place the Feather in place by sliding the LED display into the rectangular opening in the front of the body. Ensure that the decimal points are at the bottom. The Feather's battery connector should be visible. After this step the Feather's USB connector is not accessible so it should be programmed prior to this step (although you can easily undo a few steps to extract the feather if needed).


Slide the second divider into place immediately behind the Feather. If you cut the wires to the Feather too short, this is when you'll find out.


Slide the battery into place between the two dividers.


Finally, plug the LiDAR wiring harness plug into its connector.

Final Step

Route the battery, Feather power, and LiDAR I2C lines into their respective notches and carefully put the cover in place, securing it with 4 M3 bolts. Using heated M3 inserts in the body holes is recommended as shown in the above photos.

Turn the switch on and you should soon see a distance reading. It can take a short while for the unit to calibrate and the reading to settle.

This guide was first published on Dec 29, 2018. It was last updated on Apr 22, 2024.