Implementing driver for external magnetometer

Hello all,

I already have a working drone and would like to equip it with a good magnetic field sensor (Bartington Mag03-MCL70) for scientific purposes. I have connected the sensor to a USB controller, which translates the sensor’s measurement data into a USB signal for me.

I am using a Pixhawk 4 and Ardupilot 4.0 on it. I would like to know how to customize the Ardupilot firmware so that I can transmit the magnetometer data during a flight.

I was planning on connecting the USB controller to the Pixhawk via a UART interface, can I write a driver in the Ardupilot code for this? and if so how and what would it need to look like?

I appreciate any help and input :slight_smile:

Greetings Moritz