Arduino - Pixhawk - QGC

I’m currently trying to send data from Arduino Uno to QGroundcontrol via the Pixhawk.
On board of my plane I have two NTC sensors and a RPM Sensor to measure temperature and speed (rpm).
I think Mavlink is the right path to send the data from the Arduino to my Pixhawk and then to QGC or what do you think?

This is my Arduino code:

#include <Thermistor.h>
#include <NTC_Thermistor.h>
// wiring:
const int Sensor_Pin1 = A0;
const int Sensor_Pin2 = A1;
const int signalPin = 2;

#define Referenzwiderstand   10000 // 
#define Nominalwiderstand     10000 // 
#define Nominaltemperatur    25 // 
#define BWert                3950 // 

Thermistor* thermistor1;
Thermistor* thermistor2;

volatile unsigned long startMicros = 0;
volatile bool firstEdgeDetected = false;

void setup() {
  pinMode(signalPin, INPUT);
  attachInterrupt(digitalPinToInterrupt(signalPin), handleInterrupt, RISING);
  thermistor1 = new NTC_Thermistor(Sensor_Pin1, Referenzwiderstand, Nominalwiderstand, Nominaltemperatur, BWert);
  thermistor2 = new NTC_Thermistor(Sensor_Pin2, Referenzwiderstand, Nominalwiderstand, Nominaltemperatur, BWert);

void loop() {
  double celsius1 = 0;
  double celsius2 = 0;

  for (int i = 0; i <= 999; i++) {
    celsius1 += thermistor1->readCelsius();
    celsius2 += thermistor2->readCelsius();

  celsius1 /= 1000;
  celsius2 /= 1000;

  Serial.print("Temperatur1: ");
  Serial.print(" °C");
  Serial.print(" Temperatur2: ");
  Serial.println(" °C");


void handleInterrupt() {
  if (!firstEdgeDetected) {
    startMicros = micros();
    firstEdgeDetected = true;
  } else {
    unsigned long endMicros = micros();
    firstEdgeDetected = false;
    unsigned long timeBetweenEdges = endMicros - startMicros;
    float frequency = 1000000.0 / timeBetweenEdges;
    Serial.print("Frequenz: ");
    Serial.println(" Hz");

Doesn’t anyone have an idea?

When you are saying

How do you connect to QGC? Via telemetry link?
I’ve always done it the other way around:
Used a companion computer like the RPi, received mavlink messages, added additional stuff (including video) and then sent everything via 4G Wireless broadband device to my Ground-Station.

I would think doing it your way could be challenging as the Pixhawk (and other FC’s) requires specific data protocol. And then there is the control of data flow to your telemtry device or whatever you are using to connect to QGC.
Perhaps can be done in a certain way but you may want to ask that question on the Ardupilot forum if you want a fast reply.

1 Like

Thanks for your reply!
Yes I see that most people do it the other way…
I wanted to use either the telemetry port or I²C

there is a mavlink library for arduino, you can use that and create a custom mavlink message for your data or there are 2 or 3 mavlink messages that are free and can be used for debug or in your case to send your data. I think one of the is DEBUG_VECT.