Thread Tools
Jun 07, 2018, 08:01 AM
Registered User
Thread OP
Discussion

Mavlink To FrSky Passthrough Converter


Welcome to the MavlinkToPassthru discussion thread

This thread was created for anyone building or planning to build the Mavlink To Frsky Passthru converter.

The GitHub project is here

VERSION 1.00 RELEASED

Whereas the Orange (and some other) UHF Long Range RC and telemetry radio systems deliver
19.2kb/s two-way Mavlink link, the FrSky Taranis and Horus hand-held RC controllers expect
to receive FrSky S.Port protocol telemetry for display on their screen. While excellent
firmware is available to convert Mavlink to the native S.Port protocol, the author is
unaware of a suitable solution to convert to the Passthrough protocol.

Recently some excellent Lua scripts for Taranis displays, like this one by yaapu
https://github.com/yaapu/FrskyTelemetryScript

This firmware converts APM or PX4 Mavlink telemetry to FrSky SPort passthrough telemetry,
and is designed to run on a Teensy 3.2, or cheap STM32F103 (with some small mods and a signal
inverter). The Mavlink procol telemetry can still be fed on to Mission Planner or other GCSs.

For now the Teensy 3.2 is prefered to the STM32 because of it's small size. It fits snugly
into the Orange LRS UHF RX/TX enclosure in the back bay of the Taranis, and requires no
external inverter.

FrSky telemetry is unlike regular telemetry. It evolved from a simple system to poll sensors
on a 'plane, and as the number of sensors grew over time so too did the telemetry requirements.
Synchronous sensor polling is central to the telemetry, and timing is critical.

On the other hand, most flight control computers manage internal and external sensors so
that the polling is handled internally. Telemetry is organised into meaningful records or
frames and sent asynchronously (whenever you like).

Originally written for use with ULRS UHF, which delivers Mavlink to the back bay of the
Taranis X9D Plus to provide Frsky Passthrough compatible telemetry to yaapu's outstanding
LUA script.

The converter can work in one of three modes: Ground_Mode, Air_Mode or Relay_Mode

Ground_Mode
In ground mode, it is located in the back of the Taranis. Since there is no FrSky receiver to
provide sensor polling, we create a routine in the firmware to emulate FrSky receiver sensor
polling. (It pretends to be a receiver for polling purposes).
Un-comment this line #define Ground_Mode like this.

Air_Mode
In air mode, it is located on the aircraft between the FC and a Frsky receiver. It converts
Mavlink out of a Pixhawk and feeds passthru telemetry to the frsky receiver, which sends it
to Taranis on the ground. In this situation it responds to the FrSky receiver's sensor polling.
The APM firmware can deliver passthru telemetry, but the PX4 Pro firmware cannot.
Un-comment this line #define Air_Mode like this

Relay_Mode
Consider the situation where an air-side LRS UHF tranceiver (trx) (like the Orange),
communicates with a matching ground-side UHF trx located in a "relay" box using Mavlik
telemetry. The UHF trx in the relay box feeds Mavlink telemtry into our passthru converter, and
the converter feeds FrSky passthru telemtry into the FrSky receiver (like an XSR), also
located in the relay box. The XSR receiver (actually a tranceiver - trx) then communicates on
the public 2.4GHz band with the Taranis on the ground. In this situation the converter need not
emulate sensor polling, as the FrSky receiver will provide it. However, the converter must
determine the true rssi of the air link and forward it, as the rssi forwarded by the FrSky
receiver in the relay box will incorrectly be that of the short terrestrial link from the relay
box to the Taranis. To enable Relay_Mode :
Un-comment this line #define Relay_Mode like this

Select the target mpu by un-commenting either //#define Target_Teensy3x or //#define Target_STM32

Battery capacities in mAh can either be requested from the flight controller via Mavlink, or
defined within this firmware. When it is defined within this firmware, an outgoing Mavlink
connection via the Orange trx to the flight controller is not necessay. This frees up the Orange's
RX (and TX) line for use for BlueTooth or other Mavlink connections. Alternatively, yaapu's LUA
script supports the entering of battery capacities for each model.
Uncomment this line #define Use_Local_Battery_mAh

Connections to Teensy3.2 are:

1) SPort S -->TX1 Pin 1 S.Port out to Taranis bay, bottom pin
2) Mavlink <--RX2 Pin 9 Mavlink from Taranis to Teensy
3) Mavlink -->TX2 Pin 10 Mavlink from Teensy to Taranis
4) Aux_Mavlink <--RX3 Pin 7 Auxiliary Mavlink From BT Module to Teensy
5) Aux_Mavlink -->TX3 Pin 8 NOT NECESSARY - wire direct from Orange TX to BT RX
6) Vcc 3.3V !
7) GND

Connections to STM32F103C are:

1) SPort S -->TX2 Pin A2 Serial1 to inverter/ convert to single wire then to S.Port
2) SPort S <--RX2 Pin A3 Serial1 To inverter/ convert to single wire then to S.Port
3) Mavlink <--RX3 Pin B11 Mavlink from Taranis to STM32
4) Mavlink -->TX3 Pin B10 Mavlink from STM32 to Taranis
5) Aux_Mavlink Not available
6) Aux_Mavlink Not available
7) Vcc 3.3V !
8) GND

This simple bi-directional inverter to single-wire S.Port converter works well for me (revised Feb 2019):





Example of the Taranis display:



Below is a close up of the Teensy 3.2 wiring:




Below is the final wiring diagram for GROUND-SIDE version. The BlueTooth module is optional, of course [/CENTER]







Below is the wiring diagram for AIR-SIDE version:



Below is the wiring for testing the HC-05 BlueTooth module. Note the elegant 433MHz "dummy load" antenna



The little black blob on the red wire from the Taranis 8.4v supply is a small 7805 linear regulator to feed 5v to the HC-06.



Here is final alternative 5v wiring option

[

Last edited by zs6buj; Feb 22, 2019 at 09:34 AM.
Sign up now
to remove ads between posts
Jun 07, 2018, 10:19 AM
Registered User
So glad you created this thread. Brilliant project.

I have posted in the DL thread to request the simple firmware mod required so all Dragon Link v3 users can use your project.

Can this work passively using only the TX line? I understand that you are also grabbing the battery capacity from the autopilot. Is this why we need to connect to the RX so we can communicate with the autopilot? Can this value be input directly into the LUA on the LUA setup screen.
Last edited by Marc Dornan; Jun 07, 2018 at 10:32 AM.
Jun 07, 2018, 11:15 AM
Registered User
Thread OP
Quote:
Originally Posted by Marc Dornan
So glad you created this thread. Brilliant project.

I have posted in the DL thread to request the simple firmware mod required so all Dragon Link v3 users can use your project.

Can this work passively using only the TX line? I understand that you are also grabbing the battery capacity from the autopilot. Is this why we need to connect to the RX so we can communicate with the autopilot? Can this value be input directly into the LUA on the LUA setup screen.
Hi Marc, thanks for the kind words. Yes you can use the TX in passive mode, and yes I use Teensy TX to Orange RX to request battery capacity parameters.

Yes, the mAh can be input directly into the LUA.
Jun 07, 2018, 12:21 PM
KD2PBU - Fly No Evil
davidbitton's Avatar
Is this the same protocol that the Craft&Theory code runs against?
Jun 07, 2018, 02:49 PM
RC fanatic
Quote:
Originally Posted by davidbitton
Is this the same protocol that the Craft&Theory code runs against?
I hope I can do this answer justice! The passthru protocol is indeed the same one that was developed by C&T. It is actually integrated within the Ardupilot code now, and also inside the LUA interpreter of OpenTx 2.2, such that by setting SERIALx_PROTOCOL = 10 will output the FrSky passthru protocol from the chosen (x) serial port on the flight controller running AP, and if connected to the smartport of X series Frsky Rx, ends up on the Taranis/Horus, accessible via a suitable LUA telemetry script - such as either the C&T script, or the free one in the OP by yaapu - its pretty awesome! (not tested this on the C&T script myself - maybe someone else can chime in if they have?

The difference between this project's implementation and the C&T code in Ardupilot, is that this one converts a standard Mavlink telemetry stream to FrSky passthru protocol, whereas the C&T code in Ardupilot accesses its data from not just Mavlink but also from other sources within the ardupilot code directly before it reaches Mavlink - so theoretically it has more scope for data access. The beauty of this project however is that it takes the conversion process to the external teensy module, which if placed airside, it allows the PX4 flight stack to produce Frsky passthru (which it doesn't currently support), and more importantly (for me at least) it allows ground side placement of the teensy on my ULRS system, meaning I can pass down the regular mavlink 1 data stream from Ardupilot, over the ULRS serial port, feeding this into the teensy ground side, resulting in both mavlink and passthru protocol access at the ground station - passthru to the Taranis LUA screen, and Mavlink via Bluetooth for Mission Planner/QGroundControl etc on a laptop. So its a great solution providing a lot of scope!
Jun 07, 2018, 06:56 PM
Registered User
can you publish file hex for stm32f103 ? i can not compile source code
Jun 08, 2018, 08:44 AM
Registered User
Thread OP
Quote:
Originally Posted by rc my life
can you publish file hex for stm32f103 ? i can not compile source code
Ok, I tidied up the STM32F103C version, and added the binary to GitHub

I built it as a ground mode version, with Emulation_Enabled, and NOT Aux_Port_Enabled.

Let us know how it works out
Jun 08, 2018, 06:24 PM
KD2PBU - Fly No Evil
davidbitton's Avatar
Quote:
Originally Posted by zs6buj
Ok, I tidied up the STM32F103C version, and added the binary to GitHub

I built it as a ground mode version, with Emulation_Enabled, and NOT Aux_Port_Enabled.

Let us know how it works out
Which board are you using for this chip? Perhaps an old flight controller? Reduce, reuse, recycle.
Jun 08, 2018, 06:27 PM
KD2PBU - Fly No Evil
davidbitton's Avatar
Quote:
Originally Posted by athertop
ULRS system
If by that you mean Dragonlink, I tried passing FrSky Passthrough using the RS232<->TTL adapter w/ no luck.
Jun 09, 2018, 12:32 AM
Registered User
Thread OP
Quote:
Originally Posted by davidbitton
If by that you mean Dragonlink, I tried passing FrSky Passthrough using the RS232<->TTL adapter w/ no luck.
I'm personally using the Teensy 3.2 and an Orange 1W UHH unit. I included the STM32F103C because they are much cheaper and generally available, like here

Since this STM32 serial port/uart can't switch to single wire inverted mode, you need an outboard inverter, but it must be capable of half duplex operation. In other words, it must pass telemetry both ways, like this


Jun 09, 2018, 10:57 AM
KD2PBU - Fly No Evil
davidbitton's Avatar
Quote:
Originally Posted by zs6buj
I'm personally using the Teensy 3.2 and an Orange 1W UHH unit. I included the STM32F103C because they are much cheaper and generally available, like here

Since this STM32 serial port/uart can't switch to single wire inverted mode, you need an outboard inverter, but it must be capable of half duplex operation. In other words, it must pass telemetry both ways, like this


interesting
Jun 10, 2018, 09:47 AM
RC fanatic
Quote:
Originally Posted by zs6buj
I'm personally using the Teensy 3.2 and an Orange 1W UHH unit. I included the STM32F103C because they are much cheaper and generally available, like here

Since this STM32 serial port/uart can't switch to single wire inverted mode, you need an outboard inverter, but it must be capable of half duplex operation. In other words, it must pass telemetry both ways, like this


Might be worth noting - the Pixracer FC has a dedicated FrSky telemetry port which has an integrated inverter for this very purpose. Alternatively I have built inverters very cheaply, and very easily using just 2 components which are available from aliexpress:

1. RS232 <-> TTL converter Link here
2. diode Link here

And this is how its wired:
Name: 35470481-8663e486-034a-11e8-80c5-00538f5c835d.JPG
Views: 130
Size: 274.9 KB
Description:

Looking at the Craft&Theory adapters, it appears that they are using these exact components also!

Cheers, Paul
Jun 10, 2018, 10:11 AM
RC fanatic
Quote:
Originally Posted by zs6buj

Here is an alternative 5v wiring option



I use these regularly in RC (in place of your 7805 regulator) it supplies up to 3A with variable voltage (just dial in what you need on a tiny pot, then drop a dod of CA on it to fix it from changing). Find it great in place of a BEC also as good enough to power Rx and a couple of 9g servos (usually dial in just under 6v for this), for say a small flying wing.
Jun 12, 2018, 03:56 AM
Registered User
Thread OP
urlu75 has requested support for a Relay Mode. I recall reading about athertop proposing a "repeater station" here along the same lines.


Consider the situation where an air-side LRS UHF tranceiver (trx) (like the Orange),
communicates with a matching ground-side UHF trx located in a "relay" box using Mavlik
telemetry. The UHF trx in the relay box feeds Mavlink telemtry into our passthru converter, and
the converter feeds FrSky passthru telemtry into the FrSky receiver (like an XSR), also
located in the relay box. The XSR receiver (actually a tranceiver - trx) then communicates on
the public 2.4GHz band with the Taranis on the ground. In this situation the converter need not
emulate sensor polling, as the FrSky receiver will provide it. However, the converter must
determine the true rssi of the air link and forward it, as the rssi forwarded by the FrSky
receiver in the relay box will incorrectly be that of the short terrestrial link from the relay
box to the Taranis.

Here is urlu75's diagram:


So the three modes now supported from v0.37 are:

Ground_Mode
In ground mode, it is located in the back of the Taranis. Since there is no FrSky receiver to
provide sensor polling, we create a routine in the firmware to emulate FrSky receiver sensor
polling. (It pretends to be a receiver for polling purposes).
Un-comment this line #define Ground_Mode like this.

Air_Mode
In air mode, it is located on the aircraft between the FC and a Frsky receiver. It converts
Mavlink out of a Pixhawk and feeds passthru telemetry to the frsky receiver, which sends it
to Taranis on the ground. In this situation it responds to the FrSky receiver's sensor polling.
The APM firmware can deliver passthru telemetry, but the PX4 Pro firmware cannot.
Un-comment this line #define Air_Mode like this

Relay_Mode as described above. To enable Relay_Mode :
Un-comment this line #define Relay_Mode like this
Last edited by zs6buj; Jun 12, 2018 at 04:04 AM.
Jun 16, 2018, 05:59 AM
RC fanatic
Hoping this might help someone with wiring. My test bed.


Quick Reply
Message:

Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Mavlink on 9xr via 3dr radio without frsky or openlrs. jt41time Multirotor Drone Electronics 4 Oct 17, 2014 07:51 PM
Discussion 9XR mavlink mod help.... No modules, No FrSky... jt41time Multirotor Drone Electronics 6 Aug 28, 2014 06:42 PM
Discussion Anyone know how to convert DX7 to FrSky 2.4Ghz using the DIY module from FrSky?? roberted5 DIY Electronics 6 Sep 09, 2011 10:43 AM