Unable to get "sonarrange" data from rangefinder

Hello Everyone!

First post here. I’m a little stuck. I’m running a Pixhawk 2.1 with Copter 3.5.5.

I’m trying to get precision landing to work with the IR-LOCK Marc One Beacon. The rangefinder I am using is Lightware’s LW20/B. Here’s the issue: I’m unable to get a “sonarrange” value (other than zero) via MavLink.

I am connecting via I2C. I haven’t changed the default hexadecimal address of 0x66 (102 decimal). I thought for sure it was the rangefinder not sending any data (or using the wrong protocol). However, I connected the rangefinder to my PC via a Devantech USB to I2C adapter. When I brought up the Lightware terminal on my PC I was able to connect with the rangefinder and get accurate distance measurements. I was also able to do a few other commands, everything seemed to work alright.

When I hook the rangefinder up to my pixhawk via the I2C port, I don’t seem to be getting anything.

I have changed several parameters as follows:

  • RNGFND_TYPE = 7 (LightWareI2C)
  • RNGFND_ADDR = 102
  • RNGFND_MAX_CM = 2500

Any help would be greatly appreciated! Thank you so much :slight_smile:

Try using master from today instead of the outdated 3.5.3 version:

Got it. I’ll flash my pixhawk with the latest and see how it goes :slight_smile:


I feel like I must be missing something pretty basic here. I uploaded the latest firmware on my pixhawk: 3.6.6 (I guess I need to move this topic to a new thread). Still nothing on the “Sonarrange” field. I’m really running out of ideas though. I’d probably assume a dead lidar except that I can get accurate readings using the Lightware terminal via the I2C protocol.

Is there a basic parameter I need to update in order to “enable” the “sonarrange” and “sonarvoltage” fields?


Check out this guide, it helped me.


I appreciate the link. I’ll check it out and let you know how it goes.


Hi there!
I am having some problems connecting the MB1043 rangefinder to my PX4 controller, either directly or via a PX4Flow (optical flow), as the PX4 does not detect the sonar, so I always get 0 values for the sonarrange and sonarvoltage parameters .
The connection is made via the GPS1 port, as it appears that the I2C 2 port has a malfunction, and I can read the parameters provided by the PX4Flow, but not those of the sonar. Alsom I tried a lot of different combinations for the ports, but this is the only one that works for the Optical Flow.


In Mission Planner, I can’t directly activate either PX4Flow or the sonar (these options are grayed out) so I had to activate PX4Flow through the parameters tree. However, for sonar, I am unable to do so. I have already tried to change the various respective parameters, namely Addres and Type, but I cannot get the Flight Controller to detect the Sonar.

Can somebody help me?