I have built an autonomous boat for water quality surveys. I am trying to add a fluorometer which uses RS232. I want the output of the fluorometer to be fed into a Teensy 4.1 (using a max232 logic shifter) and then sent to the pixhawk via a Mavlink serial connection between the Teensy and Pixhawk. I then want the fluorometer output to be telemetered back to Mission Planner so it can be monitored in real time and then logged onto the Pixhawks SD card.
It would be possible to do this in the script if you autopilot hardware supports Lua scripting. If not, here is a thread with examples for using the mavlink library with arduino. I’m not sure of a way to write data to a dataflash log using mavlink. It might be possible.