Pixhawk ADC and Mavlink


I’m running Ardurover on a Pixhawk one. I want to read sensor values off the ADC and send them over Mavlink. Is this possible? Much to my surprise, all the digging I have done seems to imply it’s not? Yet, in the header files for Mavlink I can see ADC mesages?

It’s actually a two step implementation.
First, create an appropriate sensor driver, you can check the analog_source in the AP_HAL class and take my pull request (adding a thermistor support) as an example.
Secondly, you’ll have to define a new MAVLink message and transmit to the GCS.

I think a good default setup for the pixhawk firmware would be to read the raw ADC values and pump them over standard Mavlink message defined in the extra streams/pixhawk specific streams.

I guess it’s an external sensor’s value that you’d like to be visible in the ground station? I.e. it’s not a sensor that the autopilot is using? Although AP uses analog input voltages for various sensors it normally converts it to a meaningful value (like a pressure) and sends that instead of the raw voltage.

It might be a good idea to capture this enhancement request in the issues list.

I have created the issue and linked it here: https://github.com/ArduPilot/ardupilot/issues/9977

1 Like