OpenTx - Key Concepts

Mike Shellim 25 July 2014
Last updated: 20 Aug 2018

Para nuestros amigos hispano-hablantes: traducción al español en formato PDF. Muchas gracias a Jorge Brun.

Introduction

OpenTx is a uniquely flexible system. However if you've come from a brand like Futaba or Spektrum then you'll find the way of working a little unfamiliar. My aim with this article is to shed some light on how it works, and to enable you to design your own setups with confidence. I'll cover the following topics:

Examples will be illustrated either with screenshots or as text boxes, as appropriate.

Background

OpenTx has just seven programming menus, and each is completely generic. This concept of generic simplicity extends to the mixers. Rather like Lego, a small number of simple elements can be used to build powerful solutions.

OpenTx: the processing loop

The core of OpenTx (as with any RC system) is the processing loop. This is a sequence of operations repeated several times a second - fast enough to provide a smooth response.

With each cycle, the position of all the controls are read, mixing is applied, and the commands for each channel are calculated. At the end of the cycle, the channel commands are passed to the RF module for transmission.

flow

The three key processing steps are marked in blue. Each of these has an associated menu ('INPUTS', 'MIXERS' and 'OUTPUTS'). A change at one level propagates to levels lower down.

The starting point: Sources

OpenTx is a computer program, and like all programs it needs data to work with. The data comes from your transmitter's sticks, trims, knobs and switches. A generic term for these is sources. Each source has a unique identifier, for example,

The naming of sources is broadly similar between different FrSky transmitters, but there are some differences, e.g. knobs are generally S1 and S2, except on the X9E where they are F1 and F2.

At the start of the processing cycle, OpenTx reads each source, and assigns a value between -100 and 100 according to the position. Zero corresponds to centre; for sticks, left/down is negative; right/up positive. For switches, up is negative, down is positive.

So for example,

Source values can be monitored in real time in the ANALOG INPUTS menu.

Note: channels, Lua scripts and telemetry can also be used as sources, however they will not be considered further in this article.

Channels (OUTPUTS menu)

The Taranis can command up to 32 channels. Channels may be freely assigned. The lowest numbered ones normally refer to devices such as servos, ESCs, flight controllers etc. A channel which is not assigned to a device may be left unused, or employed as a 'high channel'.

Management of channels is split between the OUTPUTS and MIXERS menu. We'll consider the MIXERS menu later.

The OUTPUTS menu is where channels are named, and their operating limits and centres defined. Here's the OUTPUTS menu showing a configuration for a simple sailplane. The first three channels have been named 'Rudder', 'Elev' and 'Spoilr'. Subsequent channels are not used in this simple example.

Outputs

Note that this menu doesn't say anything about how each channel is driven - or even that it's driven at all! For that, we need to define some mixers...

Introduction to Mixers

So far we've looked at sources and channels, but only in isolation. We need some way to connect them; this is the job of the mixer.

Mixers act as the 'wiring' between sources and channels; they define which channels should respond as you move a stick, also how the channels should respond. Unlike other RC systems, an OpenTx mixer is a very simple construct:

A typical setup will involve several mixers layered one over the other.

The MIXERS menu

The MIXERS menu displays the list of channels and any associated mixers. A long press on a mixer line takes you to the mixer editor window. In the screenshot below, there's a single mix, from the aileron stick to channel 1:

The first column is the channel number. The next column is the mixer weight expressed as a percentage. The weight represents the volume or strengh of the mix. 100% means maximum effect, 0% means zero effect. A negative weight reverses the effect. Column 3 is the source of the mix (stick, knob etc).

Three mixing scenarios

Let's now look at three generic mixing scenarios. These will form the building blocks of your setup.

Scenario 1: One source -> one channel

This is the simplest, and we've already looked at it above - the aileron stick drives CH1. Note that 100% of the aileron command is passed to the output stage:

Scenario 2: One source -> multiple channels

A single source can drive more than one channel. In the example below, the aileron stick drives both CH1 and CH5. This is a popular configuration for dual ailerons:

This configuration emulates a Y-lead but is more flexible since each channel can be individually adjusted for direction, travel and centring via the OUTPUTS menu.

Scenario 3: Multiple sources -> one channel

A common example of this is a V-tail channel - the surface is controlled simultaneously by Rudder and Elevator sources, as in the following example:

Note the '+' sign against the Ele line, this indicates that the rudder and elevator inputs are added to produce the output. When using the add operator, the order of the mixers doesn't matter. Other operators like multiply and replace can also be used, and the order for these is important (we'll look at those later).

Designing a complete system

It's one thing to know how mixers work, but quite another to understand how to combine them in order to build a complete working system. So here's a simple 6-step design method which I use and recommend. It can be applied to applications of any complexity.

To illustrate the method, I'll use the example of a 2-channel flying wing. While almost trivially simple, it shows the elegance and power of OpenTx's mixing model.

Step 1. List the sources

The first step is to list all the controls that will be used to control the model. These will include sticks, sliders and knobs (e.g. for camber control).

Our flying wing uses just two controls, the aileron and elevator sticks:

Trims are included by default, so there is no need to list these separately. Also, ignore any special switches, flight modes etc.

Step 2. List the servo channels

The second step is to name the servo channels. This is done in the OUTPUTS menu. The numbers in the first column correspond to the channel numbers on the receiver.

For our flying wing, we'll assign the first two channels, and call them 'RtEvon' and 'LtEvon' like so:

Outputs

Step 3. Identify interactions

In this key step, we must identify all the interactions between the sources and the channels:

For our flying wing, the first source is Ail and it affects both channels. So the interactions can be written as:

Similarly, the interactions for the second source (Ele) are as follows:

So for our flying wing there will be four mixes in total. In this step we're not interested in how the channels are affected, just the fact that the interactions exist.

Step 4: Convert interactions into mixer definitions

Next, swap the left and right sides of each interaction so that they read as "channel is affected by source".

Step 5: Reorder interactions by channel number

Now, re-order the mixer definitions so that they're grouped by channel.

Step 6: Enter definitions into the MIXER menu

Finally, enter the interactions as mixer definitions:

mixers
The '+=' means on each line shows that the mixes are additive.

Adjusting control surface travel using weights

So far we haven't said anything about control surface travel. Travel is controlled via the weight parameter which appears in both the INPUTS and MIXERS menus. In this section, we'll consider the MIXERS menu.

Control surface movement is also influenced by the OUTPUTS layer which applies a final scaling and offset. This is where you set the control surface centres and end points - and compensate for mechanical differences. We'll look at this later.

Returning to our flying wing example, roll commands requires more movement than pitch. We therefore set a higher mixer weight for the Ail source and a lower weight for Ele. Typical values might be 90% and 30% respectively:

Note that the Ail weight is negative for one of the mixes and positive in the other. This is because ailerons move in opposite directions.

That's our flying wing setup completed! But hey, it can be improved...

Using Inputs (INPUTS menu)

Our flying wing setup will work, but it has a shortcoming: in order to adjust the aileron or elevator rate, we have to alter the mixer weights twice, once for CH1, and again for CH2:

Wouldn't it be nice if we could make a single adjustment? Well we can - by using Inputs (introduced in OpenTx v. 2.0). An input is the same as a regular source, except it has weight and expo included.

Let's modify our flying wing to use inputs. In the INPUTS menu, we define two inputs and name them '[I]Ail' and '[I]Ele'. We set the input source to Ail and Ele (the raw stick sources). We set the weight to 90% for the [I]Ail input, and 30% for the [I]Ele input, with 10% expo.

inputs

Having defined these two inputs, we can now use them as mixer sources. They will behave exactly as the "raw" ail and ele sources, but with reduced weight and with 10% expo. And if we want to alter the travel, we only need to alter the weight in the INPUTS menu - that's a single adjustment.

Since the rates are now implicit in the [I]Ail and [I]Ele inputs, we can reset the mixer weights to +/-100%.

mixers

The OUTPUTS menu remains unchanged:

channels

More about Inputs

Inputs are a key component of OpenTx. Inputs are manged in the INPUTS menu. OpenTx provides a maximum of 32 inputs. Each input has a label of the form [I1], [I2] (the number is an internal index, and is unrelated to channel numbers).

In order to do anything useful, an input should have:

When you create a new model, OpenTx automatically sets up inputs for the main flight controls: [I1]Ail, [I2]Ele, [I3]Thr, [I4]Rud. It also creates four mixers to link these inputs to specific channels. You can alter the mapping between inputs, mixers and channels. You can also define your inputs, and clear any which are not needed.

The use of inputs is optional; just because they're defined doesn't mean you have to use them - you can still use the raw stick as source where it's more appropriate. Futhermore, it's a good idea to clear unused inputs so they don't clutter up the INPUTS screen.

Note: Inputs may include more than one detail line, each dedicated to specific switch and/or flight mode. However, for this article we will only consider inputs with a single line

 

Choosing between raw sources and inputs

When specifying the source of a mix, you'll need to decide whether to use a raw source (Ail) or an input ([I]xxx). So which to choose? A good rule of thumb is as follows:

Mixer and channel outputs

In this section we'll look in more detail how OpenTx converts stick movements into position commands. An understanding will be useful when debugging.

OpenTx performs two stages of calculation, first at the level of the mixers, and then for the channel as a whole.

Mixer output values

For each mix, OpenTx calculates the mixer output according the weight (and other parameters we'll look at later). Taking our flying wing example, at any moment the mixer outputs are as follows:

Channel 1

mix_output_1 = Ail_stick_value x 90%

mix_output_2 = Ele_stick_value x 30%

 

Channel 2

mix_output_1 = Ail_stick_value x -90%

mix_output_2 = Ele_stick_value x 30%

Channel values

OpenTx then aggregates the mixer outputs for each channel. The result is the channel output value. This represents the commanded position. Using our flying wing:

ch1_output = (Ail_stick_val x 90%)+(Ele_stick_val x 30%)
ch2_output = (Ail_stick_val x -90%)+(Ele_stick_val x 30%)

Here are the numbers for our flying wing example:

S T I C K S C H A N N E L S
Aileron Elevator CH1 CH2
(centre) 0  (centre) 0 0 0
(full  right) 100% (centre) 0 90+0=90 -90+0=-90
(full left) -100%  (centre) 0  -90+0=-90 90+0=90
(centre) 0 (full forward) 100% 0+30=30 0+30=30
(half right) 50% (half forward) 50%  45+15=60 -45+15=-30
(full  right) 100% (full forward) 100% 90+30=120 -90+30=-60

The last line shows the effect of "stick in the corner" - note the commanded position for Channel 1 is 120. In fact, OpenTx automatically clips servo commands to +/- 100, in order to keep servo travel within defined bounds. More on that later.

More about mixers

OpenTx offers a number of mechanisms for conditioning the output of a mix. We've already looked at weight. We'll now investigate offset, expo, diff, functions and curves.

Offsets

The offset parameter adds a positive or negative value after the weight has been applied. The governing equation is:

Output = (Source * weight) + Offset

In the following mixer line, the output varies from -80 to +120 as S1 is rotated.

Src = 'S1', wt=100%, offset=20

When you create a new mix, default are: weight=100% and offset=0 i.e. the source value is passed through unchanged.

Offsets example

When motor is used as the source of a mix, we usually want the mix to have no effect when at the idle position (-100). In order to do this, we must specify an offset and modify weight. Typically we'll set both weight and offset to the same value.

Example: elevator channel on an electric sailplane.

The elevator channel in an electric model will typically have two mixes:

MIXERS menu

CH2 (elevator)

Src=Ele, wt=100%, offset = 0

Src=Thr, wt=20%, offset=20

To reverse the idle position, change the sign of weight.

Note: offsets should be used sparingly! Never use them to make ad-hoc adjustments to your servo centres - use subtrim for that.

Diff, expo, functions and curves

In addition to weight & offset, OpenTx provides one additional option from the following:

The 'Curve' option provides the most granularity - it can implement all the other options, but requires the most data entry.

Using the 'diff' option

Gliders often use aileron differential, in order to reduce the travel of the downgoing aileron. First, here's the wrong way of doing it:

INPUTS menu

[I1]Ail

Src=Ail, wt=90%, expo=10, diff=20

 

MIXERS menu

CH1 (right elevon)

Src = [I1], wt=100%

 

CH2 (left elevon)

Src = [I1], wt=-100%

The problem: diff is applied at the input level, so the aileron stick will have a higher rate on one side than the other.

The correct way:

INPUTS menu

[I1]Ail

Src=Ail, wt=90%, expo=10, diff=0

 

MIXERS menu

CH1 (right elevon)

Src = [I1], wt=100%, diff=20%

 

CH2 (left elevon)

Src = [I1], wt=-100%, diff=20%

To summarise: specify diff separately for each aileron channel. Do not specify diff at the Input level.

TIP: Use a GVAR to supply the diff value. That way, you can set diff for both channels with a single adjustments.

Including/excluding trims

By default, trim values are included in sources. You can exclude trims on a per-mixer basis by unchecking "Include Trim" in the mixer dialog.

For our flying wing example, aileron and elevator trims must always be active, so we'll use the default settings.

Order of processing

When calculating the output of a mix, OpenTx first applies source trims (if enabled for the mix). Then it applies the function (diff, function, curve, expo), followed by weight, and finally adds the offset. Order may be important when combining operators especially where offsets are involved.

Channel clipping

We've seen how the channel output is calculated as the sum of all these the mixer outputs:

CHxOutput = SUM (CHxMixerOutput1, CHxMixerOutput2, ...)

If a channel has several mixers active, then the commanded position could potentially exceed the safe limits of the servo. To avoid this, OpenTx limits ('clips') channel values to +/- 100 before passing them to the OUTPUTS stage. Clipping manifests itself as deadband at the transmitter control.

Only the aggregated channel values are clipped. Individual mixer outputs are not clipped.

Channel scaling (OUTPUTS menu)

In the final stage of the pipeline, OpenTx applies a scaling and offset to each channel. This is very useful for compensating for linkage mismatches. Below is a screenshot of the OUTPUTS menu on an X9D:

outputs

Key fields:

By setting appropriate centres end points, you can prevent damage to your linkages from excess servo movement. You can also balance up the servo responses between the left and right sides, compensating for mechanical differences.

Where to adjust weights

Each of the three processing layers (Inputs, Mixers, and Outputs) apply a weight to their inputs. As a source value propagates through these layers, each rate is applied to the result of the previous layer. The the final servo command will be the product of at least three rates:

OutputValue = SourceValue x Rateinput x Ratemix x Rateoutput

Clearly there is an infinite combination of rates which will produce the same movement at the servo. So where should you set them? This is the procedure I recommend:

  1. Set all weights and all min/max to their default values (100%).
  2. Calibrate your servos first. This will entail setting up Min/Max/Subtrim in the OUTPUTS menu. The aim is to define the widest possible operating range of your control surfaces consistent with left/right and up/down symmetry. Calibration should be done with inputs and mixer weights at their defaults (100%), and all trims to centre.
  3. Set desired control rates in the INPUTS.
  4. Any remaining mixer interactions can be adjusted via weights in the MIXERS menu.

More advanced stuff

Mixer operators

So far, we've assumed that mixer outputs are always added together in order to calculate the channel output. In fact OpenTx is a good deal more flexible - it also permits multiplication and replace operations on mixer outputs. These can be extremely useful. For example, multiplication is key to implementing in-flight adjusters, and 'replace' can be used to implement throttle safety switches.

The mixer operation is specified in the mixer's MULTIPLEX parameter. The options are 'ADD' (the default), 'REPL' and 'MULT'. When calculating a channel value, OpenTx steps through the active mixers, starting with the first mix in the channel:

Note:

Example: The following mixer lines illustrate the effect of the various MULTIPLEX parameters and the importance of mixer order.

Src = I1, op=ADD

Src = I2, op=ADD

output = I1 + I2

Src = I1, op=ADD

Src = I2, op=ADD

Src = I3, op=MULT

output = (I1 + I2) * I3

Src = I1, op=ADD

Src = I2, op=MULT

Src = I3, op=ADD

output = (I1 * I2) + I3

Src = I1, op=ADD

Src = I2, op=MULT (disabled)

Src = I3, op=ADD

output = I1 + I3

Src = I1, op=ADD

Src = I2, op=REPL

Src = I3, op=ADD

output = I2 + I3

Src = I1, op=ADD

Src = I2, op=REPL

Src = I3, op=MULT

output = I2 * I3

Src = I1, op=ADD (disabled)

output = 0

The 'MAX' source

MAX is a special source which doesn't correspond to a physical control. Instead, MAX supplies a fixed value of +100. In conjunction with weight, it can be used to simulate the effect of a fixed stick position.

Src = MAX, wt =100 -- output = 100%

Src = MAX, wt=50 -- output = 50%

Src = MAX, wt=-100 -- output = -100%

Here's a simple example, showing a crude motor arming system. The motor is armed when SA is down.

MIXERS menu

CH7 (motor)

Src = Thr, wt=100%,

Src = MAX, wt=-100%, switch=!SA_down, multiplex = REPL

F3X sailplane mixer scheme

If you're familiar with F3X sailplanes, you may wish to look at interactions and mixes for F3X sailplanes. Such a scheme will normally be optimised by means of Inputs (described later in this article), GVARs and cascading mixers.

Links

LapinFou has produced some useful data flow diagrams which describe the internal workings of OpenTx (Note: at the time of writing, there are one or two errors in the order of processing of curves).