LIDAR Issues


In our manual for LIDAR Lite v3, we are confused about a step for programming LIDAR. Here is the step:

Read register 0x01. Repeat until Bit 0 (LSB) goes low.

Can anyone help us understand this step?

I have only worked with the V2, but here’s a working example of how to interface with it in C++ from sparkfun (an arduino library, but you can follow the steps they take to figure it out):

It would appear that the read requires 3 steps:

  1. write to register 0x03 or 0x04 to tell the lidar “Take a measurement”
  2. Poll register 0x01. The Lidar will use this register to indicate if a new measurement is available yet or not.
  3. Read two bytes from registers 0x0F and 0x10 and interpret them. This is the distance result.

Instead of polling in step 2, you could just wait for some period of time, and then assume that 0x0F/0x10 got updated. That’s what we did in our libraries (although I wouldn’t recommend it). Here’s the source for that if you’re curious (

In general, this is needed since there is a non-zero amount of time required after starting the measurement before it completes. I presume the designers of the lidar couldn’t ensure the measurement would happen between two subsequent I2C reads, so they put in place the 0x01 register mechanism to provide the user a way to check whether their requested result was ready or not.

Do you have a solution that works with Java?

I’d say give the linked java code above a shot, I think it has a good chance of working (although I don’t have a V3 to confirm that with).

I say good chance because deltaing the official arduino libraries for V2 and V3, it looks like there are more features in V3, but the I2C communication used in V2 should still be comparable with V3.

See and for reference

Also too - if you happen to try it and it works (or needs modifications), please send me the changes (and/or a PR on github) and I can either update our documentation and/or incorporate your changes!

If you need to read individual bits, it helps to understand how binary and boolean logic works.

A binary number, say 10111001, has a Most Significant Bit (MSB) and a Least Significant Bit (LSB). The right-most digit is the LSB.

A quick Boolean logic lesson:

1 AND 1 is 1.
1 AND 0 is 0.
0 AND 0 is 0.

1 OR 1 is 1.
1 OR 0 is 1.
0 OR 0 is 0.

(This should be intuitive: imagine if I ask you “did you have bacon AND eggs for breakfast?” as opposed to “did you have bacon OR eggs?”)

1, yes, high are all the same in binary.
0, no, low are all the same.

The instructions are asking you to test if the LSB “goes low” (i.e. is it 0). You can test for this by using what is called a “bitwise AND” and doing “bit masking” by using the properties of Boolean logic.

Say I’m looking at my binary number 10111000 and I want to test if the 4th digit (bit 3) is a 1 or a 0. I set up a “bit mask” and AND each individual bit, like this:

10111001 <– number to test (decimal “185”)
00001000 <– bit mask for the 4th digit, bit 3 (decimal “8”)

00001000 <– answer

Like magic, out pops only the bit I’m interested in. If it’s 0, then the bit was 0. If it’s equal to your bit mask, then the bit was 1.

This thread helped us get V3 working with LabVIEW:

Maybe it will help you as well. Basically we had to break out our Reads & Writes.

Thank you so much for this message! It helped a lot

Thanks to everyone for your help, LIDAR Code is now complete!!! :slight_smile: :slight_smile: :slight_smile: :smiley: :smiley:



Never mind, our code didn’t work; we ended up not using Lidar last year.

I suggest that you do not invest in Lidar, as the code is much too difficult to understand and it just costs too much money.

We were contacted by another team with a similar question about the V3 again this year. Still haven’t tried our old code with any of the latest hardware. There’s a thread on delphi here I think about how there are potential issues that both the V3 and the RIO have internal pull-ups (making the total pull-up too strong). I have not at all confirmed, but you are not the only one to report issues integrating the Lidar Lite with the roboRIO.

Edit: Here’s the other thread. Teams with more hardware than us have more details on the exact issues in the 2016-2017 timeframe with I2C on the RIO: