JetsonHacks

Developing on NVIDIA® Jetson™ for AI on the Edge

LIDAR-Lite Installation v1 on NVIDIA Jetson TK1

Note: This is for the original LIDAR-Lite. For LIDAR-Lite v2, click here: LIDAR-Lite v2.

LIDAR-Lite is a laser ranging module from Pulsed Light, Inc. which is a lightweight and cost effective measurement device. LIDAR-Lite can be accessed over I2C or PWM, for the Jetson TK1 I’ve written a small library for access over I2C. Looky here:

The LIDAR-Lite in the demo was purchased from Sparkfun for about $90 USD.

Background

Wikipedia describes lidar as “a remote sensing technology that measures distance by illuminating a target with a laser and analyzing the reflected light“. There are a variety of different lidars, each with specific uses. This is a large enough field where it’s difficult to summarize it in a short amount of space. Suffice it to say that current lidars can be relatively large, heavy and expensive. As of this writing, it’s not unusual for 3D lidar scanners to be between 5K to 20K USD. These scanners give a 3D view of an entire space within range of the scanner. 2D lidar scanners are generally more compact and less expensive in the 400 to 5K USD range. Think of a 2D lidar scanner as a single point lidar on a spinning turntable, so that you end up with the distance around a space from the center point at a given height. Accurate 1D (point) scanners tend to cost less than 2K USD, but generally cost more than 400 dollars.

The LIDAR-Lite is a Time of Flight (ToF) camera which is a class of scanner-less LIDAR. As you know, the speed of light is constant (here’s some background and a very scientific way of Finding the Speed of Light with Peeps). In a ToF system, a laser generates a pulse of light and a sensor measures how long it takes for that light to reflect back to the sensor from an object that is in the lasers path. Advances in image processing chips over the last decade have enabled this approach.

Description

Some techy stuff from the Sparkfun page that bears repeating:
Description: This is the LIDAR Lite, a compact high performance optical distance measurement sensor from PulsedLight. The LIDAR Lite is ideal when used in drone, robot, or unmanned vehicle situations where you need a reliable and powerful proximity sensor but don’t possess a lot of space. All you need to communicate with this sensor is a standard I2C or PWM interface and the LIDAR Lite, with its range of up to 40 meters, will be yours to command!

Each LIDAR Lite features an edge emitting, 905nm (75um, 1 watt, 4 mrad, 14mm optic), single stripe laser transmitter and a surface mount PIN, 3° FOV with 14mm optics receiver. The LIDAR Lite operates between 4.7 – 5.5VDC with a max of 6V DC and has a current consumption rate of <100mA at continuous operation. On top of everything else, the LIDAR Lite has an acquisition time of only 0.02 seconds or less and can be interfaced via I2C or PWM.Note: The LIDAR Lite is designated as Class 1 during all procedures of operation, however operating the sensor without its optics or housing or making modifications to the housing can result in direct exposure to laser radiation and the risk of permanent eye damage. Direct eye contact should be avoided and under no circumstances should you ever stare straight into the emitter.

Installation

In this example, the LIDAR-Lite is connected to the Jetson TK1 over I2C.

The LIDAR-Lite is connected to the Jetson J3A1 connector as follows:

LIDAR-Lite 5V to J3A1 Pin 1 (+)
LIDAR-Lite GND J3A1 Pin 14 (-)
LIDAR-Lite SCL J3A1 Pin 18 (C)
LIDAR-Lite SDA J3A1 Pin 20 (D)

There are several ways to actually connect the wires to the J3A1 connector, in this case we use simple female to female jumper wires (0.1″ spacing, 2.54mm pitch – this is standard Arduino size) to attach to the LIDAR-Lite wires, and then connect the jumper wire to a machine pin jumper wire, which is then connected to the Jetson J3A1 connector.

For the demo, I used Adafruit Premium Female/Female Jumper Wires – 40×6″ and 20 CM Machine Pin Wire Kit/10 Pack. This approach may be adequate for some projects, but for more rugged projects you will want to actually take a solder wires to the header pins approach or make a breakout board for the Jetsons’ J3A1 header. Remember that the J3A1 header is 2mm pitch (0.08″) which is slightly smaller than the more standard DIY 2.54mm pitch that something like an Arduino uses. You’ll also want to physically mount the device some where also, fortunately there are mounting holes for that purpose.

Once you have the LIDAR-Lite connected, you’re ready to test. There is a small library written for the Jetson to interface with the LIDAR-Lite over I2C available on Github. First, install some prerequisites:

$ sudo apt-get install libi2c-dev i2c-tools

You can then check to see if the Jetson can detect the LIDAR-Lite address:

$ sudo i2cdetect -y -r 1

You should see ’62’ as one of the entries, which is the address of the LIDAR-Lite.
You can then run the example:

$ git clone https://github.com/jetsonhacks/JHLidarLite.git
$ cd JHLidarLite
$ cd example
$ make

After the example compiles, run:

$ sudo ./example

The sudo is required to access the I2C bus from user space. The example program will show the measured distance, the previous measured distance, and the velocity (rate of change) repeatedly. If the distance is always -1, even after passing your hand over the LIDAR-Lite, this probably means that it is not being recognized by the Jetson.

Summary

There are a multitude of uses for these devices on robotic vehicles. These types of devices can be used as proximity sensors. On a UAV they can be used as a basis for terrain following algorithms. In that case, imagine a quadcopter flying along at a constant height over hills. Note that this is different than maintaining a constant altitude. Many autonomous vehicles use lidar for scanning obstacles in the vehicles path. With the advent of LIDAR-Lite LIDAR is now affordable, even for the hobbyist.

Note: The Jetson is running Linux for Tegra (L4T) 21.3.

Facebook
Twitter
LinkedIn
Reddit
Email
Print

17 Responses

  1. I tried to get this working last night with a v2 Lidar Lite. All the numbers coming out are the same but not -1. Checked over the wiring and all I can see it with I2c-tools. Works perfectly on the arduino so I’m wondering if there might be a difference in registers etc with the new unit. Says on their site that they are the same. Any Ideas? Also in the video what are you using to visualize the data at the end of the video? Is that something you wrote or PD software? I’m trying to build something similar to your jetson bot except use a lidar and camera instead of the Kinect since I want to use it outside.

    1. I’m assuming that you’re running the example with sudo, and that you’re moving your hand over the sensor.
      When you say that it works on the Arduino, is that using the old library, or the new one?
      The visualizer at the end is just some hack I wrote, I never published it.
      Looking forward to seeing your robot! What kind of camera are you going to use?

      1. I thought the visualizer at the end is included the exmple code. Can you please publish or send the code to me privately? I need it desperately.

        1. The visualizer is not part of the example code, it’s just a sketch I wrote for the demo.
          I’ve placed the source code in a repository: https://github.com/jetsonhacks/LidarPlotSketch

          The code is provided as is, and while you’re welcome to use it, I will not be supporting or answering questions about it. The code in the video was compiled using Qt Creator 5.5. You can check on the blog or jetsonhacks YouTube channel for installation instructions for Qt.

          Good luck!

  2. I like to take photos at motorsports events. But I need a mobility scooter to do it. I rigged up a gimbal on a monopod so I can shoot sitting down. Works great but its a real pain to have to move the scooter swivel the seat then look through the viewfinder. So I want to give my scooter self driving capabilities so I can just pick up my feet and have it move where I want and keep looking through the viewfinder. Maps and GPS to find stuff easier and a little augmented reality display to help me navigate through the crowd. I managed to get the LL to start exhibiting the same behavior on the dino so I think I know whats up now. Needs the cap across the power and ground lines. I suspect there is a momentary dip in the power that puts it in a semi reset state and causes the numbers to be all the same. I set it up to use the high speed I2C and it happened all the time. Slow it down and it behaves most of the time.

    1. Yes, looking at the recommended schematic on the V2 Lidar Lite they recommend the capacitor, I think the answer you came to is correct.

      That sounds like a very interesting application. I’m glad to hear that you got it working!

    2. D Pollock,

      Can you confirm that you got the Lidar Lite v2 working on the Jetson? So far, I’ve followed this blog set of instructions, but to no avail. I2C reads do not appear to work for me. I get values, but they never change. I’ve added a 470 nF cap, but still no joy. Any suggestions?

      1. Yes I did get it working with the Jetson. Also an IMU and GPS that are all on I2C. Are you sure you have the levels right? I used a level shifter. There was something else I found but I can’t remember right now. As soon as it comes back to my tired old brain I’ll add it to this post. I just started working on the rotating base for mine today so I’ll be getting it back out and hooking it back up soon. Working with a Zed camera instead of Lidar now. But I want Lidar too especially for low light or after dark roving.

  3. Thanks. I have Rviz working now and plotting the scans. Not totally working yet since the driver is looking for 360deg scans and I’m trying to do 180 with a 60deg up and down sweep with each click in X. Using a Trossen Robotics turret. It has an arduino clone to run it so I’m reading the Lidar Lite with that. Waiting on the Zed to get here. That should finish up the sensor array. I’m thinking of using the lidar as a detection and tracking device that works mainly where the Zed is not pointing. A quick 360 scan and if it picks up a mover track that until it comes into the view of the Zed camera. I managed to get some point clouds with a pair of life cams but the Zed is so much better and cuts out so much development time that I had to have one. Full SDK for the Jetson too. Although there is a current problem with the USB3 implementation that StereoLabs and Nvidia are working on. So right now all the resolutions don’t function properly. I figure it will be fixed by the time they start shipping in 2-3 weeks. If not its probably the 2K res the rest should work fine but maybe its just the ones that work with USB 2 worst case. We will see.

    1. I’ve been talking with several people using the ZED on the Jetson, everyone says that the results have been very positive, even with the hiccup over USB3. Hopefully you can post some picture or videos of your setup once you get everything up and running.

      1. Zed is awesome and new ROS driver in latest SDK is easy to install and get working. I put the finishing touches on my chassis tonight. Screwed up on sizing the motors but found a page and worked through that to get the correct ones this time 🙂 No worries though I’m using one of the ones with an encoder to spin my rotating base for the Lidar unit now. Going to use the other one with encoder to level the base using the IMU for input eventually. But I’m freezing any more mods till I get the thing operational. I’ll hack on it forever if I don’t 🙂 Finishing wiring up my motors tonight so I can test those tomorrow.

  4. Thanks for getting back to me! Interesting that you needed to do level translation…it looks like both the Jetson and LidarLite use 3.3 V logic levels. But, it’s hard to find good docs on the differences between v1 and v2. If you think of the other thing you forgot, please let me know. Thanks!

    1. My mistake I looked back through my notebook and I didn’t get it working on the Jetson. I did contact them and they said there is no change in the code. What I ended up doing is using the state machine code example on a trinket pro. But I’ll be getting back to figuring that out soon. Just waiting on my breakout boards to get here to hook everything up. I’m wondering since the v2 has two speeds it can run at if its coming up at a speed that is mismatched with what the Jetson expects. I’m going to check that out first. Sorry about that the old memory isn’t what it used to be.

Leave a Reply

Your email address will not be published. Required fields are marked *

Disclaimer

Some links here are affiliate links. If you purchase through these links I will receive a small commission at no additional cost to you. As an Amazon Associate, I earn from qualifying purchases.

Books, Ideas & Other Curiosities