Cathodic Protection - Adding Voltage to Telemetry Overlay

Hi @rovmig, welcome to the forum! :slight_smile:

I don’t have previous experience with cathodic protection instruments, but from a look at the Buckleys website (and a glance through this guide to CP electrode potentials) it seems like you’re wanting to measure the voltage across two wires from your sensor, which you’ve said you then want to send and display on the topside.

There are a few main steps involved here, and it may not be as easy as you’re expecting/hoping.

Measuring the Voltage

Your sensor outputs an analog electrical signal in the form of a voltage. As analog signals go, voltage is the most direct one to measure, but it still requires an Analog to Digital Converter (ADC) to convert the physical voltage into a digital number that can be passed around in software.

ADCs work by comparing an input voltage to a set of known internal voltages, so you’ll need to ensure the ADC you use has a large enough range to measure the possible output range of your sensor, and a fine enough resolution (enough comparison voltage levels, which are converted to binary bits of result) that you get a meaningful output for your application.

Our Raspberry Pi Companion computer is generally the easiest way to manage custom integrations, but Raspberry Pis don’t have ADCs, which means you’ll need an ADC board/chip that can communicate readings to the Raspberry Pi via a protocol like I2C or SPI, or serial via a serial-USB converter like our BLUART.

Alternatively it may be possible to use one of the existing 3.3V or 6.6V ADCs on the Pixhawk flight controller, but their values don’t seem to be automatically streamed to the topside, so I expect you would need to modify and build a custom version of the ArduSub firmware to read and transmit the values you want. I don’t have much experience with ArduSub modifications, so I’ve asked our software team whether this would be hard to achieve.

Sending Measurements to the Topside

The difficulty of this depends a lot on how well-integrated you need the measurements to be. If your readings are coming in via the Companion computer the easiest approach is to just print the values to a terminal window that you can access from the topside. If you need the values to be viewable in QGroundControl (and want them automatically saved as part of the normal telemetry logs) then you’ll need to use the MAVLink communication protocol.

ArduSub already uses MAVLink for all its communication to the topside, and for the Companion computer you can use the Pymavlink Python library, or some other MAVLink implementation if you prefer.

Receiving Measurements at the Topside

Viewing printed values on a Companion terminal can be easily done using a screen session which can be accessed from the webterminal.

QGC is unfortunately quite convoluted to modify/extend. If QGC access is required you can potentially piggy-back off an existing MAVLink message that it already tries to display but which ArduSub doesn’t actively use, but if there’s nothing suitable then you’ll need to make a modified version of QGC that supports your custom message, as outlined here.