Lidar Lite v3HP and Pixhawk 2.1, squarish readings

Hi! Based on your recommendation that LLv3HP was working well in I2C with ardupilot, I went ahead and bought one for an octocopter that requires terrain following. We are using Arducopter v3.5.7 on a DJI S1000+, previous loiter was great with TFMini on serial bus. However we needed greater sensor range to avoid terrain failsafe errors when passing over sudden deep ravines or boulders, which caused a vertical position variance and RTL.
So the enhanced processing and temperature calibrated range of 40m on LLv3HP seemed perfect.

We installed the LLv3HP lidar using 1000uF 35V cap on power lines to a dedicated 5V 3A BEC, hooking up to the shared I2C wires of the M8N GPS/mag combo on the Pixhawk 2.1 Cube, and at first no additional pullup resistors on the lidar SDA/SCL lines. Loiter/althold over grass performance was awful, resulting in wide sweeping oscillations of over 1-2m from setpoint of 5m. After talking to some engineers they said that we should try adding the pullup resistors, even though the pixhawk probably already has an internal pullup (the gps/mag reads fine). We tried 4.7kohm, 8.1kohm, and 10kohm resistors between SDA+SCL and 5V, the variability indoors (pointing at wall) was still erratic, varying 3-5cm every few seconds at 3m, but we tested loiter/althold anyway. We settled on 4.7kohm resistors as suggested in the lidar manual and did another test flight. Still not stable at all, gradually increasing altitude oscillations of 1-2m after 10 seconds, unacceptable.

Looking at the logs we saw that the lidar was reading the correct altitude but there is something else wrong with the sensor or settings as it appears it is sampling every few seconds with big square data on the graph, weird. We used the lidar out of the box, we did not attempt to configure any settings besides in Mission Planner.

The logs show 4 flights outdoors with 15+ GPS satellites, over cement with small pebbles.

  1. RNGFND_GAIN 0.5, althold P 1.0

  2. Gain 1.3

  3. Gain 0.3

  4. Gain 0.8, althold P 1.3

Any feedback or suggestions would be much appreciated!!
18 8-21-2018 11-44-04 AM.bin.log (10.6 MB)

Hi,

The very first thing to test would be the LLV3HP in isolation to ensure everything is fine on that end. The easiest way to do this is with an Arduino-compatible microcontroller board and the sample code & library provided by the manufacturer.

As for the LLV3HP in your setup (I2C), the best would be to connect a logic analyzer to your bus to check what is actually done communication-wise and confirm the proper things are happening.

Finally, you mentioned obtaining proper results using the TFMini, which uses a UART interface. Keeping this in mind, you may want to modify one of the examples from the manufacturer to read the LLV3HP in I2C and output the result on a microcontroller’s UART bus. This bus would also be connected to your flight controller. It seems very likely you are having an I2C issue with the sensor.

Concerning the integration of this sensor with any specific setup, it would be best to contact the developers or maintainers of your flight controller as they would have more details about what it requires/expects when connecting to the LLV3HP.

On our end, the most we can really do is ensure your LLV3HP is in working condition by itself.

Sincerely,

Thank you Sebastien, we were hoping to not have to do Arduino testing as we are short staffed but will try our best. I would probably agree it is either the I2C bus or the sensor, so we have to test it independently of the Pixhawk controller, since we don’t have a logic analyzer or any fancy scopes handy.

I cross-posted this in the Ardupilot Pixhawk 2 forum. FYI for anyone else curious here are our settings in Copter 3.5.7.

RNGFND Params:
RNGFND_ADDR = 0
FUNCTION = 0
GAIN = 0.5
GNDCLEAR = 35
MAX_CM = 4000
MIN_CM = 20
OFFSET = 0
ORIENT = 25
PIN = -1
PWRRNG = 12
RMETRIC = 1
SCALING = 1
SETTLE = 0
STOP_PIN = -1
TYPE=15

EK2_ALT_SOURCE = 1
TERRAIN_FOLLOW = 1

many thanks,

-swansong

Hey swansong,

Sorry about that… :neutral_face:

Unfortunately, without the ability to reproduce your setup and issue, it would be quite difficult to determine the cause and solution.

Therefore, ensuring the LLV3HP is functional is the best we can do remotely.

Sincerely,

We just hooked up the LLv3HP to an Arduino Uno, keeping the 1000uF 35V cap on the power lines and the sda and scl 4.7kohm pullup resistors connected to the 5V arduino pin, as instructed in the manual. Upon uploading the program to the Uno, there was no response or data output in the serial monitor, regardless of baud rate. We confirmed with a multimeter that 4.9V was being fed to the lidar, but no way to tell if it is actually “on.” We will look for another arduino to test in case this one is bad and try again tomorrow. Sigh.