ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

AP_BattMonitor: Add FuelLevel_Analog support

Open TunaLobster opened this issue 3 years ago • 4 comments

Adds a BattMonitor driver to use analog fuel sensors. Such as SAE fuel senders that output resistance or voltage. Tested on a CubeOrange with a potentiometer as the fuel level sensors on pin 103.

FuelLevelAnalog

TunaLobster avatar Jun 20 '22 19:06 TunaLobster

I think we'll need a low pass filter, maybe 0.2Hz cutoff?

I'm pretty sure the sensor I'm looking at is internally filtered, but obviously not all sensors are, and for gas applications I don't think we will notice any problems from a filter that slow. (Maybe 0.5Hz, but that might be too fast?)

WickedShell avatar Jun 21 '22 00:06 WickedShell

Built and tested on Cube Orange pin 103.

  • Added a low pass filter at 0.3Hz. 0.2Hz seemed a little slow and 0.5Hz seemed a little fast for a typically slow speed signal. So I put it on the safe side of the middle.
  • Used _volt_offset for empty voltage and _volt_multiplier for full voltage. Slightly cumbersome, but not additional parameter space is taken up. The AP_Float values were already there.
  • Added the ADC value to the voltage field and the filtered value to the current_amps.
  • Linear interpolation between low and high voltage.
  • Added an option to enable the low pass filter.

TunaLobster avatar Jun 21 '22 21:06 TunaLobster

I'll wait for the reviews before asking for the flapping CI tests to be re-run.

TunaLobster avatar Jun 28 '22 23:06 TunaLobster

Changed the filter toggle to be slightly more helpful. Retested on a cube orange.

TunaLobster avatar Jun 29 '22 22:06 TunaLobster