Lidar Rangefinder for Pixhawk Cube

Hi All
I am looking for a tested and working lidar rangefinder for Pixhawk 2.1. I have been trying for 2 days to try and get a Lightware SF10/C (have tested 2 of these) and a Lidar Lite V2 to work but no luck. I could not get the SF10/C to work on serial/i2c on pixhawk 1 or 2 while the Lidar lite worked in the pixhawk 1 using PWM but the same setup did not work on pixhawk cube. Getting a bit frustrated now. Has anyone got a working solution they are using and can recommend?

I use the LW20 on Pixhawk 2.1 over serial. It works, except there is a bug regarding out-of-range readings, which applies to any device using this serial driver. I believe I2C is generally the preferred method.

That said, I am quite certain the devices you listed should work without issue - both the Lidar Lite V2 and SF10C are popular rangefinders and known to be compatible with the Pixhawl 2.1; I used the 10C myself before the LW20 came out. I suspect there may be a configuration or wiring issue that is causing problems for you. If you detail your hardware and parameters here, we can help find out what’s wrong without having to buy another device.

I saw the LW20 and thought it looked nice but had a bunch of these SF10/Cs lying around and the lidar lite so though I would try these out before purchasing new. With the SF10/C I tried using the serial port (GPS 2 which is Serial 4 I believe). I wired the SF10 as shown in both the manual and the APM page on this lidar. I used the Lightware terminal software to connect to the drone and set up the parameters for me which I checked and seemed to agree with the APM page description. All I got was bad lidar health and no sonnarvoltage or range readings. With the i2c I wired as on the APM page and I got 0 for voltage and 122.88 then 125.63 for range (it just flicked between these 2 ranges even though the ground was 30cm away not 125m! With the Lidar lite I wired as APM instructed and it worked perfect on the pixhawk 1. I then transferred the settings and wiring to the pixhawk 2 and nothing but bad lidar health messages.

So to confirm the parameters for SF10/C serial were
SERIAL4_BAUD = 19 (19200 baud)
RNGFND_TYPE = 8 (LightWareSerial)
RNGFND_MAX_CM = 10000 (for SF10C)

For i2c

RNGFND_TYPE = 7 (LightWareI2C)
RNGFND_ADDR = 85 (I checked hex was 05xx)

Then for the lidar lite I used PWM

and same max min etc from above

I did not try the i2c method for the lidar lite V2 on the cube as I did not have a 680uF capacitor on hand. Perhaps this is my next move. Also Just to let you know I did have 5v BEC to the rail for the PWM method for Lidar lite on the cube.

One further bit of info is that I tested both the SF10/C over USB to laptop and both are providing perfect readings of range. Is only when I try to hook them up using there serial/i2c to pixhawk they go bad

Your parameters look correct, although I am not sure about the I2C address. The Copter documentation says that newer LW devices use address 0x66 instead of 0x55.

This sounds like you’re almost there. Perhaps the address is wrong, or maybe your signal wires are flipped. Try address 0x66 (RNGFND_ADDR = 102), or maybe the LightWare software lets you check/change it. I think the voltage reading is always 0 for non-analog rangefinders.

I did try 102 to start with and I was getting nothing at all> I then used Lightware terminal and it reported that the address was 05xx (this is the older models) so I used 85. I then got the 125m stuff happening. I wonder if I can change the address to 102 on the lidar and try again. Worth a crack as I have tried everything else!

Oh and I tried reversing wires as well on all attempts just in case. Nothing

Apologies 0x55 not 05xx was the address. I am trying to change it now

I tried resetting the address on the SF10C to 0x66. I then updated address to 102 in parameters. I get nothing at all.Tried wires both ways and same result. I reset to 0x55 and try wires both ways and get the sonnar range flicking between 2 numbers 122.88 and 163.63. This is killing me. I am almost ready to throw in the towel. Was your LW20 plug and go as in no major issues? I might just buy one of these. At least I know it works for you. I am running 3.5.3 copter. Maybe I should try updating to 3.5.5? Will probably get other issues then!

I also made sure I am getting 5 volts up the line from i2c to the SF10C and it is getting power so I don’t know what the story is

Yes. That said, the LW20 uses the same configuration and wiring as the 10C, so you’ll run into the same problems unless the problem is the device itself.

Oh. I just thought of something. Which port are you plugging the I2C plug into? IIRC, the port labeled “I2C 2” on the Pixhawk 2.1 was not enabled until a quite recent version of ArduCopter. Let me look up which version, this might be your issue.

Yeah, if you’re using the secondary I2C bus (the plug labeled I2C 2, the primary is incorporated into the GPS1 port), then you might just need to update.

Ahhhh. I see what you mean. Did not realise that the i2c port was not the primary i2c! I will try update and see how I go. Thanks for the new avenues to follow!

So I updated to latest and then tried wires both ways with address of both 85 and 102 and still nothing. I get the 163.63 and 122.88 ranges with the 85 address with wires both ways and nothing at all when I change the address in both APM and the Lidar to 102 (0x66).
I officially give up as am all out of ideas. Such a simple device and so many issues. I guess I will buy an LW20 as you have that working and will try that.
Thanks for your help

We are now developing up to two meters.

I suggest you upgrade to VL53L1 … you will get extended range :wink:

Thanks, in Europe they are not yet on sale. I ordered in the USA. We want to increase the number of sensors to 10 directly in Ardupilot. We want to expand the Ardupilot library for the IO expander and for the multiplexer.

That would be great
I suggest you start optimizing the scanning method so that the average “per sensor “ refresh rate is 10 hz or faster