RNGFND_SCALING value

Hi all,
I’ve connected the analog Ultrasonic Range Finder - HRLV-MaxSonar-EZ4 to the pixhawk’s RNGFND_PIN = 14. It has a max range of 500 cm with a V range of 2.5-5.5V.
I cannot understand the range finder scaling formula from this page: http://copter.ardupilot.com/wiki/common-optional-hardware/common-rangefinder-landingpage/common-rangefinder-maxbotix-analog/. It seems to be defined like: RNGFND_SCALING=max range / ADC V. But the example shown is unclear.
It says: RNGFND_SCALING = “2.04” (i.e. 7m / 5v) if using EZ0 or EZ4, “4.08” (i.e. 10m / 5v) if using EZL0.
But 7m/5V is not 2.04 m/V, nor 10m/5V = 4.08m/V.
Besides, with the pixhawk, pin 14 is connected to the ADC 3.3V, not 5V nor 6.6V

However in this page: http://planner.ardupilot.com/wiki/other-project-and-common-topics/common-optional-hardware/common-rangefinder-landingpage/common-rangefinder-sf02/, albeit using a different type of range finder, the example with the same formula is correct: RNGFND_SCALING = “12.12” (ie. 40m / 3.3v = 12.12), using pin 14 in the ADC 3.3V

I tried to use the max range/ADC v formula (in my case 5m/3.3V = 1,51 m/V), but the distance measured is wrong.

I believe there are some mistakes, or at least the formula is not that clear, in http://copter.ardupilot.com/wiki/common-optional-hardware/common-rangefinder-landingpage/common-rangefinder-maxbotix-analog/.

Hello krutemp,

I have the same doubts as you, the formula example given at the Copter wiki does not make sense to me. Did you find a reliable way to calculate RNGFND_SCALING or some empirical values that work? I have LV Maxbotix EZ4 and pin 14 is connected to ADC 3.3V. However, when measured with a multimeter it displays 4.8 V…

Thanks and regards,

Robert

Hopefully the thread rezzing isn’t a problem. I found this post trying to find some insight from Google.

The wiki page is very misleading - I was confused as well.

The ADC 3.3 port supplies ~5v (5.1 when I measured), not 3.3. I think it’s for measuring things up to around 3.3v
The Matbotix rangefinders according to their data sheets output Vcc/1024 volts per centimeter, or 0.488 v/m when supplied with 5v, which translates into 2.04meters / volt.
The range is 7.6m according to the datasheet, but analog output is limited to 7m.

I haven’t tested the analog sensing, but if it can only read up to 3.3v, then that means 6.75m is the furthest it can really measure. Maybe someone else can test that someday.

I submitted a bug to the wiki bug tracker: github.com/diydrones/ardupilot- … issues/208