Hello Carl Michael,
I started just as you did about 1 or 2 months ago. This is the information I have gathered to use telemetry port 2:
2. The Pixhawk Tx(green) is connected to the Arduino pin that you set as Rx. Pixhawk Rx(orange) is connected to the Arduino pin that you set as Tx.
3. On the Pixhawk, connect it to either Mission Planner or QGroundControl applications. Find the Parameters list(Under Config/Tuning in Mission Planner and Parameters in QGroundControl) and set Serial2_BAUD to 57. Note: Edit sub-parameters under SR2 to get other messages forward to the Telemetry 2 port.
4. On the Arduino, I went here(
https://github.com/alaney/arduino-mavlink) to get the arduino code and mavlink libraries. I had to get all the files in common folder and place same folder as ArduinoMAVLink.ino and then all files in pixhawk folder and place the into the same folder as my ArduinoMAVLink.ino file(I overwritten any duplicates).
5. When you open the ArduinoMAVLink.ino file, you would see FastSerial. If you can get it to work please let me know how but I have given up. Here is what I changed:
#include <FastSerial.h>
#include "../mavlink/include/mavlink.h" // Mavlink interface
FastSerialPort0(Serial);
with
#include <SoftwareSerial.h>
#include "mavlink.h"
#define RX_PIN 2 //used for Mavlink, reads input from Pixhawk
#define TX_PIN 3 //used for Mavlink, transmits to Pixhawk
SoftwareSerial MavSerial = SoftwareSerial(RX_PIN, TX_PIN);
Note 1: Serial port can either be pins 0 and 1 or the USB port. I wanted to use the Serial Monitor feature in Arduino application with the USB port so I did not use those pins but you can if you like.
Note 2: I use pins 2 and 3 for my Rx and Tx on the Arduino Uno but you can select other pins.
6. This is some simple code to verify if you are getting something from the telemetry port. I would comment out the other code in the "void loop" until you know you are getting data. As mentioned in the previous note, I get data from MavSerial and display the info on Serial which is displayed in Serial Monitor. Here is the code:
void setup()
{
Serial.begin(57600);
while (!Serial)
{
; // wait for port to connect.
}
MavSerial.begin(57600);
while (!MavSerial)
{
; // wait for port to connect.
}
Serial.println("Ready");
}
void loop()
{
while (MavSerial.available() > 0 )
{
Serial.print("Num Bytes: ");
Serial.println(MavSerial.available());
}
}
If you get nothing, check your connections (try reversing the Rx and TX on the arduino) or double check that Serial Baud is set to 57.
7. If you are getting data the remove the previous code in the "void loop" and uncomment the original code. After this, it is just playing with the Mavlink code(I spent about 2 weeks on this). I wasn't getting certain messages (example 42 - Mission Current) and couldn't figure out why. I eventually wrote my own decode code but I still use their packing/checksum code.
Regards,
Demetric