Streaming arbitrary sensor or serial data to GCS?

Hi,

I am in the process of completing my first Ardupilot build: a quadcopter for autonomous data collection. The data will be collected by a sensor on the quad, which is processed by a UART capable analogue to digital converter. Ideally, I would want the data to be logged, perhaps by a companion computer, and streamed to the GCS via the dragonlink telemetry radio I’m using. Based on preliminary research, it seems that to make the latter part happen, I would need to write custom sensor drivers for the autopilot to interpret the ADC’s signal and then write custom MAVlink messages to send the data to the GCS. Assuming this is correct, I am still missing two parts of that equation: how to get the ADC data (which is interpreted by the custom sensor driver) into the new MAVlink message, and then how to have mission planner see those new messages (or having any other software read them).

However, this method seems very involved. Would it be possible to, for example, have the ADC plugged into a raspberry pi, which processes the data (would end up being two three-channel data sources) and then sends it to the autopilot via UART, which in turn sends it to the GCS without having to write custom messaging? Or is there a completely different method I’m missing?

Thanks!

You do not need new MavLink messages. You can use existing MavLink debug messages, or user messages.

Ah ok that simplifies things. How would I get sensor input into those MAVlink messages?

You will need to write some lua scripting code for ardupilot and switch to ArduCopter 4.1

And then can those debug messages be read by mission planner, or do I need some other way of intercepting the MAVlink data?

Were you able to make any progress on this? I’m basically working on the same thing. I am using a python script that reads the sensor data and I’m trying to format it into a mavlink frame then sending it via mavproxy. Is there an easier way of doing this?

is a good start

Thank you for your response!

I’ve read that post and I appreciate it. However, after reading through the forums and sifting through all the advice I was given, I was hoping to use a mavlink debug messages as you’ve previously described in this discussion. I would do something along the lines of crafting a mavlink frame using the NAMED_VALUE_FLOAT message for the message ID packet then using mavproxy to forward it to a UDP listening port. I am not sure if there is an easier way to craft the frames that I would be forwarding but this is the route I’ve taken. I’m open to any constructive criticism towards reaching my objectives :pray: :palms_up_together: