APM Mavlink over FrSky and then back to Mavlink

Hi guys!
Who wants to transmit APM Mavlink telemetry data to ground station using FrSky only? (e.g. without 3DR radio)

Using two Arduinos I have made this possible. One Arduino ("sending part") is on the plane between APM telemetry UART and FrSky receiver RX. Second arduino ("receiving part") is on ground on the transmitter reading its UART, converting data and sending it to ground station running Mavlink compatible software.

Source code can be found on github, here
https://github.com/CzechUavGuy/APM-Mavlink-to-FrSky

I have even included a demoversion - special firmware for receiving arduino that generates "fake" telemetry data of virtual airplane flying above Prague..

Receiving Arduino receives not only telemetry from APM, but can also read internal FrSky frames that contain RSSI and voltage - if you have a FrSky voltage regulator.

How it works:
Sending part reads data from APM, caches them in global state, and periodically generates proprietary two byte messages and sends them to FrSky UART. Various data are send using different frequency: For example plane attitude (roll, pitch and yaw) is being sent more often than GPS coordinates. See attached image on how the sending part is wired.

Obviously, not all MavLink messages are transferred to ground. Effective bandwidth of FrSky downlink is only about 1200 bps! Currently, only those telemetry information are sent: roll, pitch, yaw, altitude (only 1x, not relative - that could be computed on ground), speed (only vGND), GPS lat, GPS lon. FrSky adds battery voltage and RSSI. More messages can be added, maybe at the cost of lowering frequency of the previous messages.

Two byte protocol works like this: First byte starts with bit 1, second byte starts with bit 0. Bits 2-5 of first byte contain information of data type being sent (ie. only 16 different telemetry types are possible). Rest 10 bits from the first and second byte contain useful data.

Receiving part reads data from FrSky transmitter (I use DIY FrSky module), unpacks it and immediately generates MavLink message that is sent to output UART (USB to computer MissionPlanner or OTG cable to Android ground control station like DroidPlanner/AndroPilot).

On airplane I use Arduino Pro Mini, on ground I prefer Arduino Nano since it already has FTDI converter co it can be connected to PC/Android directly.

Current limitation:
Using FrSky it is only possible to download data from plane to ground control station. Uplink is not possible as far as I know. I am working on a hacking project that will make it possible to encode a few bps on channel 7 and 8 so that even uplink will be possible. Will post when I finish this.

sending_part_connection.jpg

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • 1. Yes Arduino Pro Mini clone

    2. Yes

    3. Yes I uploaded blink and modified it to blink 3x just to make sure everything worked.

    4. This was the problem initially. I right clicked and hit save as on each file which made the ' character do weird things. I found the download button for the whole project and that solved that issue. I had clicked on the "receiving_part_test" on the github and missed the "clone or download button" initially. 

    The next issue was missing libraries. I downloaded the project that this one is based off of and copies his libraries into my libraries folder. After that I ended with the following, http://pastebin.com/UXSzfTBU.

  • The error is so fuzzy I am really not sure whats going on. Please explain your steps in bigger detail:

    1) do you have Arduino Pro Mini?

    2) do you have Arduino IDE?

    3) can you A) compile and B) upload a very simple arduino program to your arduino? (like e.g. blink?)

    4) have you pulled correctly my source code from Github? From the log it seems that there is </div> in a .CPP file which is really not supposed to happen. You can download the complete code easily by pressing the green button "Clone or download"

  • Ok just soldered up a board and tried to upload the test sketch. It looks like there are some language issues but the code end of thing is a bit out of my realm so I'm probably wrong. I uploaded the log to pastebin. http://pastebin.com/39FNuMFP

  • That's too bad. It would be nice to be able to upload missions through the link, but that's a bit much to ask for. Being able to output information onto an i2c display would be pretty sweet though. Right now my fld-02 doesn't display the volts and amps on the same screen which is really frustrating. The code is already reading the values of the sensors so displaying them on a 20x4 lcd shouldn't be too bad. My 9xr screen is ok, but being able to configure the display however I want it sounds nice.

  • I didn't make any serious progress. What I have done is this: I have disconnected one potentiometer on my transmitter, and instead I have connected arduino with external DAC. So the  transmitter thought the original potentiometer was still connected. Unfortunately I do not have any publishable results - the precision was low (5 bits maybe?), speed was low and unreliable (I think that I needed 3-4 cycles (60-80ms) to send one datagram (5 bits) reliably. It could be done, but I gave up - at least for now.

  • I'm really looking forward to getting it working. I'll deff let you know if I have any trouble. Were you able to get any upload working? 

  • Its great to hear that another person is going to use it. Good luck, I think you could make it. If you had troubles, feel free to ask!

    As a starter, I would recommend trying the "demo" project and there you will see whether the decoding part works fine.


    Zach said:

    I just ordered a few mini's to try this out. My goal is to display the data on my 9xr which is already modified for mavlink. On github you say this isn't supposed to be used this way, but hopefully it still works. When I fly I don't like juggling a second device.

  • I just ordered a few mini's to try this out. My goal is to display the data on my 9xr which is already modified for mavlink. On github you say this isn't supposed to be used this way, but hopefully it still works. When I fly I don't like juggling a second device.

  • This is something amazing good, i was expecting this solution for a long time. I really don't understand why bothering with another 433Mhz modem and antenna when frsky has already a  good telemetry link.

    I hope sending back data to uav can be achieved. A fully customizable telemetry link over radio link is implemented in OpenLRS NG. Is any other radio link able to transport telemetry also?

    I'll build your setup, a wiki with more details woud do really good to this great project.  

    Thank you!

  • Congrats!

    This is something i was looking for. Did you think about skipping the ground station hardware and do the protocol conversion in software?  

This reply was deleted.

Activity

sam liked Jimmy Oliver's profile
Aug 25
Mike Whitney liked Mike Whitney's profile
Jul 19
Abdulatif Tlaib liked Ryan's profile
Jun 24
More…