LIDAR-Lite connection to Pixhawk

I can’t make LIDAR-Lite v3 work with pixhawk1 on Copter-3.6.11 via PWM. Followed official instructions on https://ardupilot.org/copter/docs/common-rangefinder-lidarlite.html page. LIDAR is connected to AUX5 and configured to work in continuous mode. I can see narrow 3.3v pulses coming to “pin 54” AKA AUX5 with my oscilloscope. Parameters are set as follows:
RNGFND_TYPE = 5;
RNGFND_PIN = 54;
RNGFND_MAX_CM = 3500;
RNGFND_MIN_CM = 20;
RNGFND_SCALING = 1;
BRD_PWM_COUNT = 4
Autopilot does not see the LIDAR. MP always outputs “rangefinder_distance=0” in Status bar.
Previously I had ultrasonic rangefinder in that quad and it did function pretty well.
Can anyone please tell me what am I doing wrong?
P.S. Recently I looked at “Complete Parameters List” webpage more carefully and realized that I need to set RELAY_PIN = -1 (was 54) and RPM_PIN = -1 (was 54). Still not working…

Good day, did you check if the sensor work also on, i2c?
if you wire in pwm just check also the correct voltage… if you supply the sensor with wrong voltage the damage is done.

1 Like

Tridge just helped me with this same setup on an octocopter using a Cube with chibios running Arducopter 3.6.12. Turns out the driver support was not in the firmware. Try using a beta of arducopter 4. Hopefully one of the devs will see this and comment.

1 Like

Yeah, the voltage is correct. 5V in, 3.3V pulses out. Will check on I2C tomorrow, thanks.

Is that conversation public? Can I have a link please?

It was two weeks ago at the club where we both fly so no link.

I have checked the sensor on I2C. It works fine. However the problem not solved. I still need the sensor to work via PWM. Help me please!

Dear moderator! May I take a couple of corrections in topic name and in first post? I have made mistakes there… Can’t see “edit” icon for my first post.
Topic name:
was: LIDAR-Lite connection to Pixhawk
wanted: LIDAR-Lite PWM connection to Pixhawk
First post:
was: MP always outputs “rangefinder_distance=0” in Status bar.
wanted: MP always outputs “sonarrange=0” in Status tab.

Good day, today i will try test the sensor on my fc… i will let you know if it will work properly so i can send you the procedure

1 Like

I decided to check firmware source and tried to understand the reason why PWM not working for me. Did find the driver “pwm_input_main(int, char **)” in PX4_Firmware and pointed out where it has been referenced at least for AP_RPM and AP_RangeFinder. But can’t figure out the way this driver turned off. HAL_PX4_HAVE_PWM_INPUT is 1 for fmuv2 and vmuv3 by default. PWMIN0_DEVICE_PATH is “/dev/pwmin0”. But the code similar to

_fd = open(PWMIN0_DEVICE_PATH, O_RDONLY);
if (_fd == -1) {
hal.console->printf(“Unable to open %s\n”, PWMIN0_DEVICE_PATH);
return;
}

does not either work nor output anything to console. Other techs in same file (eq RPM_Pin) work as intended.

And yes, in “Arducopter 4.0 rc5” PWM LIDAR works normally. Its implementation resembles old RPM_Pin input technique without external PWM driver.
So, waiting for stable 4.0 to test the LIDAR in flight.