Translating Lidar Lite I2C example to Teensy

Status
Not open for further replies.
After some experimentation I got the code running reliably on Teensy 3.1 at 96MHz by changing the delay in the "C" loop from 1ms to 5ms.

I had been getting 8-10 "C"'s each time before receiving an ACK. Increasing the delay resulted in only 1 "C" consistently and stable operation at 12ms/sample.
 
attempt to extend useful range of lidar

In case of interest. Using the (original) Lidar-Lite, plus a homebrew telescope (32 mm f=123 mm objective from cheap 8x32 binocs + 20mm surplus eyepiece) I got pretty steady readings from white garage door at 40 m distance. In one position, at least several hundred readings fell in the range 3986 - 4010 cm (LCD readout is showing MIN, AVG, MAX readings, with min and max values on a quasi-peak-hold filter.) Alignment of the Lidar module to the telescope was critical. The outgoing path (laser) was unmodified, telescope only on the incoming (photodiode) side. Yes, that is a T3.1 hidden in the thicket of wires.

I only had a few minutes to play with it so far but I *think* this setup gave me more consistent range data than without the telescope. Not sure what the effective detector size is, it may be so small that it no longer captures the full laser spot size after the 3x mag. of the telescope.
20150719_171152.jpg 20150719_171503.jpg
 
Last edited:
Quick update: I have been playing around with my Lidar-Lite V2 and I think it is an improvement.

They have released an Arduino library to support it up on github: https://github.com/PulsedLight3D/LIDARLite_v2_Arduino_Library/
The library includes several examples including working with multiple sensors. Also this new library is based on using the wire library and not the i2c library.

Yesterday I was playing some with it, actually trying to translate a Lidar setup by another member up on Trossen Robotics. http://forums.trossenrobotics.com/showthread.php?7508-LIDAR-lite-360-Mirror-Scanner

She was having problems earlier using Teensy 3.1 and currently using Arduino mega...

I had some pretty good luck with the new sensor as I was able to get pretty fast sensor readings. I have not pushed it fully yet, but was getting pretty fast 1-3ms samples and it ran for maybe 20 minutes before I had a lock up... Need to investigate more, but looks more promising.

Kurt
 
Wow jbeal that is ingenious! We spent $700 on a lightware laser range finder to get those results. How much did yours cost?
 
Hi, I may be reviving an old thread, but I have been using a LIDARlite with my teensy 3.2 and I have been able to successfully get readings from it. However, when I try to use the device to measure predetermined distances, such as 20cm, 30cm, 40cm, 50cm, the averages of the distances outputted by the device are almost never the same as the predetermined measurement (+/- 1-6cm). Furthermore, upon restarting the sensor (eg. taking the USB cable out of teensy and then reinserting it), the averages that the sensor outputs vary from the actual distance differently than the previous time (eg. it would output an average of 55 cm for the first 50cm measurement, and then output 47cm after a reset). Has this every happened to anybody else? Could it be a hardware issue or a software one?
 
Yes, this is not abnormal. If you are using the second generation, variability can be reduced by passing an extra integer parameter that defines how many samples/noise processing strategy to use. I believe "2" gives very low noise. I never quite understood why the variability between restarts (I power the device on and off), something in the tuning process on startup , but I havent found a way to normalize that other than sampling and comparing against previous knowns. Beware a non-linear error as well (at short distances the offset to correct it is different than at long distances).

myLidarLite.begin(2,true); // << 2 for low noise, true for 400khz i2c
 
Wow jbeale that is ingenious! We spent $700 on a lightware laser range finder to get those results. How much did yours cost?
About $100 for Lidar-Lite (gen.1), $25 binoculars, $5 eyepiece, and some time designing a 3D printed coupling for the eyepiece. The tube holding the objective lens is made of paper cardstock and glue. Oh, and the Teensy 3.1 of course.
 
Yes, this is not abnormal. If you are using the second generation, variability can be reduced by passing an extra integer parameter that defines how many samples/noise processing strategy to use. I believe "2" gives very low noise. I never quite understood why the variability between restarts (I power the device on and off), something in the tuning process on startup , but I havent found a way to normalize that other than sampling and comparing against previous knowns. Beware a non-linear error as well (at short distances the offset to correct it is different than at long distances).

myLidarLite.begin(2,true); // << 2 for low noise, true for 400khz i2c

Hey, thanks for the reply! The readme of the library does not include this, so I had no idea this existed. However, in the library itself, it says that the "2" setting will "lower sensitivity". Is this bad?
 
After reading through the code and looking at documents for low level mode settings and registers in the LidarLite, I am not sure the code is implemented correctly. The switch to 400khz works (though you can likely run it at higher rates if your comfortable with I2C debugging). The 2 for sensitivity probably doesn't do much. Its worth reading the Lidar I2C document to see how to switch modes and configure things directly on the device, and write your own implementation if you want to control sensitivity and noise.
 
@dmhummel A while back in this thread you posted that the LidarLite i2c lines can handle 5v. Is that true for LidarLite v2? I hope so, it would be very helpful.
 
I'm new to the world of Arduino and it's been some time since I've done any programming.

I bought a LIDAR LITE (V1) a little while ago with the intent of putting it in a homebuilt airplane that I'm helping to rebuild. I'm trying to connect it to a Mega 2560 board and read two aviation gauges (EFIS and EMS) and parse the data output from these. My goal is to display the data from the LIDAR, EFIS, and EMS to a TFT attached to the Mega.

I've read through https://forum.pjrc.com/threads/28036-Translating-Lidar-Lite-I2C-example-to-Teensy/page5 several times but can't get your update wire library working. I get the error below:
Lidar-Lite-PaulStoffregen.ino:1:18: fatal error: Wire.h: No such file or directory
compilation terminated.
Error compiling.


I have installed WIRE, shown as version unknown in Library Manager. The code that I'm using for my sketch is
// https://forum.pjrc.com/threads/28036-Translating-Lidar-Lite-I2C-example-to-Teensy/page4
// code sourced from comment #86

Any ideas what I'm doing wrong? Have I provided enough information?

best regards,
Howard
 
I would venture to guess that you are not compiling for a Teensy. I loaded the code you reference and when selecting a Teensy board it compiles fine. If I select uno or Mega2560 not so much. I suspect the code is optimized for the Teensy chip and will not run on the Mega / Uno

I would recommend a Teensy 3.2 linked here:
http://pjrc.com/store/teensy32.html

very powerful and flexible, and I would think affordable to many budgets. a list of official distributors can be found here:
https://forum.pjrc.com/threads/23601-Official-Distributors

Cheers Kb
 
Thanks for the insight Kb.

I will try and figure out the changes in the improved wire library posted here and make those changes in wire library for the Uno/Mega and see if that compiles.

Then I'll take another look at the code from comment #86.
 
Would some one know how to block the LIDAR LITE detection reading? For example when pointing the laser to the sky it gives an no detection result. Instead of giving me the distance on my serial port, it keeps giving the number 1 as output. Does anyone know how to block the Lidar Lite to not detect any output when the distance is over 40m?

Thanks!!
 
Status
Not open for further replies.
Back
Top