Maker.io main logo

LIDAR-Lite v3 Hookup Guide

33

Microcontrollers Proximity LIDAR Resistors Arduino Qwiic

Courtesy of SparkFun Electronics

Guide by Shawn Hymel

Introduction

Note: While this guide was written primarily for the LIDAR-Lite v3, it can be used for the LIDAR-Lite v3HP.

The LIDAR-Lite Series - the v3 and v3HP - are compact optical distance measurement sensors, which are ideal for drones and unmanned vehicles.

LIDAR is a combination of the words "light" and "RADAR." Or, if you'd like, a backronym for "LIght Detection and Ranging" or "Laser Imaging, Detection, and Ranging." At it's core, LIDAR works by shooting a laser at an object and then measuring the time it takes for that light to return to the sensor. With this, the distance to the object can be measured with fairly good accuracy.

By sweeping or spinning a LIDAR unit, systems can create detailed distance maps. Survey equipment, satellites, and aircraft can be equipped with complex LIDAR systems to create topographic maps of terrain and buildings. Luckily, Garmin™ has created a user-friendly LIDAR unit for your robotics and DIY needs!

Note that these use a Class 1 Laser, if you are concerned about your safety (in short: A Class 1 laser is safe under all conditions of normal use).

CLASS 1 LASER PRODUCT CLASSIFIED EN/IEC 60825-1 2014. This product is in conformity with performance standards for laser products under 21 CFR 1040, except with respect to those characteristics authorized by Variance Number FDA-2016-V-2943 effective September 27, 2016.

Suggested Viewing

What is the difference between the LIDAR-Lite v3 and the LIDAR-Lite v3HP? Let's ask Shawn Hymel!

Required Materials

To follow along with this project tutorial, you will need the following materials:

LIDAR-Lite v3 Hookup Guide

Suggested Reading

If you aren't familiar with the following concepts, we recommend checking out these tutorials before continuing.

  • Installing an Arduino Library: How do I install a custom Arduino library? It's easy! This tutorial will go over how to install an Arduino library using the Arduino Library Manager. For libraries not linked with the Arduino IDE, we will also go over manually installing an Arduino library.
  • How to Use a Breadboard: Welcome to the wonderful world of breadboards. Here we will learn what a breadboard is and how to use one to build your very first circuit.
  • What is an Arduino? What is this 'Arduino' thing anyway? This tutorials dives into what an Arduino is and along with Arduino projects and widgets.
  • Installing Arduino IDE: A step-by-step guide to installing and testing the Arduino software on Windows, Mac, and Linux.
  • I2C: An introduction to I2C, one of the main embedded communications protocols in use today.

Hardware Overview

Differences Between v3 and v3HP

Functionally, the LIDAR-Lite v3 and LIDAR-Lite v3HP are quite similar. The primary differences are listed here:

Image of LIDAR-Lite v3 Hookup Guide

Note: An IPX7 rating means that the body of this device can withstand incidental exposure to water of up to 1meter for up to 30 minutes. The bare wire portion of the wiring harness is not water resistant. All bare wire connections must either be made in a water tight location or properly sealed.

Case

The LIDAR-Lite has two tubes on the front that contain a transmitter (laser) and receiver. You'll want to face these toward your target.

Image of LIDAR-Lite v3 Hookup Guide

This step is only necessary for the LIDAR-Lite v3:

On the side, you'll find an electrical port that connects to the included 6-wire cable. Plug in the wire harness to the port to break out the pins.

Image of LIDAR-Lite v3 Hookup Guide

On the back, you'll find 4 mounting holes that are designed to accept #6 or M3.5 screws or bolts.

Image of LIDAR-Lite v3 Hookup Guide

Wires

The LIDAR-Lite has 6 wires that can be used to communicate with the sensor.

Image of LIDAR-Lite v3 Hookup Guide NOTE: This is looking at the back of the unit

Image of LIDAR-Lite v3 Hookup Guide

Note: V3's pinout, default address I2C (0x62), and overall functionality is the same as other versions. However, the connector and cable for the V3 are different compared to V3HP and V2.

Power

Both the LIDAR-Lite v3 as well as the LIDAR-Lite v3HP units require between 4.5V to 5.5V of DC power to operate (nominally, 5V). The LIDAR-LITE v3 can draw up to 135 mA of current during continuous operation (105 mA at idle). Contrarily, the v3HP unit draws up to 85 mA of current during continuous operation (65 mA at idle). To maintain a level voltage, Garmin recommends putting a 680 μF capacitor between power (5V) and ground (GND) as close to the LIDAR unit as possible.

⚡ Note the difference in current draw! Be aware that while the input voltage for the LIDAR-Lite v3 and v3HP is the same, the current draw is different.

Hardware Assembly

Follow the diagram below to connect the LIDAR unit to a RedBoard or other Arduino-compatible board. The LIDAR-Lite can communicate over I2C as well as use a pulse-width modulated (PWM) signal to denote measured distances. For this guide, we will show how to use I2C to communicate with the LIDAR unit.

Image of LIDAR-Lite v3 Hookup Guide

Note: Garmin recommends a 680 μF capacitor, but anything near that value will work. I used a 1000 μF capacitor in this example. Make sure to add the electrolytic capacitor correctly to the circuit since it has a polarity.

You also may need I2C pull-up resistors for the SCL and SDA lines. It depends on the length between the Arduino and I2C device but usually a 4.7kΩ resistor is a good start. For long runs or systems with lots of devices, it is recommended to use smaller resistors. You can also use a I2C bus extender for distances beyond the maximum bus length as well.

Software

Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.

Garmin maintains an Arduino library to make working with the LIDAR-Lite very easy. Visit the GitHub repository, or click the button below to download the library.

Download the Garmin LIDAR-Lite v3 Arduino library

Open a new Arduino sketch, and copy in the following code:

Copy Code
/**
 * LIDARLite I2C Example
 * Author: Garmin
 * Modified by: Shawn Hymel (SparkFun Electronics)
 * Date: June 29, 2017
 * 
 * Read distance from LIDAR-Lite v3 over I2C
 * 
 * See the Operation Manual for wiring diagrams and more information:
 * http://static.garmin.com/pumac/LIDAR_Lite_v3_Operation_Manual_and_Technical_Specifications.pdf
 */

#include <Wire.h>
#include <LIDARLite.h>

// Globals
LIDARLite lidarLite;
int cal_cnt = 0;

void setup()
{
  Serial.begin(9600); // Initialize serial connection to display distance readings

  lidarLite.begin(0, true); // Set configuration to default and I2C to 400 kHz
  lidarLite.configure(0); // Change this number to try out alternate configurations
}

void loop()
{
  int dist;

  // At the beginning of every 100 readings,
  // take a measurement with receiver bias correction
  if ( cal_cnt == 0 ) {
    dist = lidarLite.distance();      // With bias correction
  } else {
    dist = lidarLite.distance(false); // Without bias correction
  }

  // Increment reading counter
  cal_cnt++;
  cal_cnt = cal_cnt % 100;

  // Display distance
  Serial.print(dist);
  Serial.println(" cm");

  delay(10);
}

Upload the program, and open a Serial Monitor. You should see distance measurements (in cm) being printed.

Image of LIDAR-Lite v3 Hookup Guide

Troubleshooting

Arduino Output Error Poor Connection

Are you seeing this output from the LIDAR-Lite V3 I2C example code with the decoupling capacitors connected to the Arduino?

Copy Code
> nack
> nack
> nack

You probably do not have a secure connection between the Lidar and the Arduino. I2C is sensitive to its connection. The cable wires are thin and can disconnect when in the Arduino's female header from a bump. A breadboard seems to work fine if there is not a lot of mechanical vibrations. However, a small bump can mess up the timing for the I2C even on the breadboard.

Image of LIDAR-Lite v3 Hookup Guide

Image of LIDAR-Lite v3 Hookup Guide

For a secure connection, it is recommended soldering header pins with some heat shrink or make sort of adapter when connecting it to an Arduino. Once disconnected, the Arduino might stop outputting sensor data. You can reset the Arduino for testing but to prevent the wires from disconnecting, it would be better to solder the wires to header pins. This is a common "issue" with any I2C sensor and if they do not secure the wires, the Arduino will have problems talking with the Lidar Lite V3.

Arduino Output Error I2C Pull-Up Resistors

Another reason for the nack error may be that you need I2C pull-up resistors for the SCL and SDA lines. It depends on the length between the Arduino and I2C device but usually a 4.7kΩ resistor is a good start. For long runs or systems with lots of devices, it is recommended to use smaller resistors. You can also use a I2C bus extender for distances beyond the maximum bus length as well.

Decoupling Capacitor

Looking for a 680µF capacitor? Unfortunately, the SparkFun catalog does not include a 680µF capacitor. There are 1000µF capacitors, which can work as a substitute with the Lidar Lite.

Or, you can also wire capacitors in series and parallel to get an equivalent capacitance.

Image of LIDAR-Lite v3 Hookup Guide Capacitors: Capacitors in Parallel

Dimensions

For more details on the dimensions, check out the links below.

Product Showcase Example for LIDAR-Lite V3 Wand

Looking for the example code used in the product video for the LIDAR-Lite V3? Nick Poole basically used the same parts and example code that was used with the Lidar Lite V2 Glasses. For the Lidar Lite V3 Wand, he used the following components:

He happened to have a 5V/16 MHz Pro Micro around when building the project for the Lidar Lite V2 Glasses. The parts were reused for the Lidar Lite V3 Wand. Try looking at the old Wishlist for the Lidar Lite V2 Glasses for more information. Make sure to also add a 1kΩ resistor when using the PWM wiring as stated on page 3 of the user manual.

Additional Troubleshooting

Looking for additional troubleshooting tips and application notes related to the LIDAR Lite? Check out Garmin's support on the LIDAR Lite:

Garmin Support: Lidar Lite V3 and V3HP

Application Notes on Reflective Surfaces

For more application notes on using the LIDAR-Lite v3/v3HP, check out the link below.

Garmin Support: How the LIDAR-Lite v3/v3HP Works with Reflective Surfaces

This can also be found in the operation & technical manual on page 11.

Resources and Going Further

Now that you've successfully got your LIDAR up and running, it's time to incorporate it into your own project!

For more information, check out the resources below:

Número de parte del fabricante 14032
SENSOR OPTICAL 3-200CM I2C
SparkFun Electronics
$168.69
Ver más Details
Número de parte del fabricante 14599
SENSOR OPT 30-1200CM I2C PWM
SparkFun Electronics
$230.98
Ver más Details
Número de parte del fabricante 10215
USB MICRO-B CABLE - 6 FOOT
SparkFun Electronics
Número de parte del fabricante 10969
RESISTOR KIT - 1/4W (500 TOTAL)
SparkFun Electronics
$10.50
Ver más Details
Número de parte del fabricante 15123
REDBOARD QWIIC ATMEGA328 BRD
SparkFun Electronics
$21.95
Ver más Details
Número de parte del fabricante 12002
BREADBOARD - SELF-ADHESIVE (WHIT
SparkFun Electronics
Número de parte del fabricante 08431
JUMPER WIRE M/M 6" 10PCS
SparkFun Electronics
Número de parte del fabricante 13698
SPARKFUN CAPACITOR KIT
SparkFun Electronics
$11.50
Ver más Details
Número de parte del fabricante 00116
BREAK AWAY HEAD
SparkFun Electronics
Número de parte del fabricante 12035
MICROB USB BREAKOUT
SparkFun Electronics
Número de parte del fabricante 12640
PRO MICRO ATMEGA32U4 5V/16MHZ
SparkFun Electronics
$23.99
Ver más Details
Add all DigiKey Parts to Cart
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.