OpenTx - Key Concepts

Mike Shellim 25 July 2014
Last updated: 03 Feb 2019

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 freely assignable channels. The lowest numbered channels will be normally used for 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. The OUTPUTS menu is where channels are named, and their operating limits and centres defined.

Here's the OUTPUTS menu for a simple RES sailplane. The first three channels have been named 'Rudder', 'Elev' and 'Spoilr'. These are the only channels 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 the roles of sources and channels, but in isolation. In order to do anything useful, we need 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 to stick movements, also how the channels should respond.

Unlike other RC systems, an OpenTx mixer is a very simple construct:

A typical setup will involve anything from a few to dozens of mixers.

The MIXERS menu

The MIXERS menu displays the list of channels and mixers. In the screenshot below, there's a single mix, from the aileron stick to channel 1:

Read this as "Channel 1 is affected by the aileron stick, with 100% effect".

In the screenshot above, column 1 is the channel number. Column 2 is the mixer weight expressed as a percentage. The weight represents the volume or strength 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:

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. The basis of the method is to define the sources, outputs and mixes in that order.

To illustrate the technique we'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 make a list of sources controlling the main functions of the model. The list will normally include Rud, Ail, Ele as well as sliders for camber control, tow release etc - anything which requires a servo or ESC to respond.

Do not include flight mode switches or rate switches. Also, do not specify trims separately (by default trim values are included with their parent control).

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

Step 2. List the servo channels

In this step, we assign the servo channels. This can be done directly in the OUTPUTS menu.

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 identify the interactions between the sources and channels defined above. For each source, list the channel numbers which must react when the source is moved. Write in the form 'source -> channel'

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 min/max/subtrim settings in the OUTPUTS menu. These are for adjusting servo centres and end points. 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, sitting between sources and mixers. Inputs offer simple adjustment of stick rates and expo. Their use is optional.

Inputs are managed 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_1 = Ail_stick_value x 90%

mix_2 = Ele_stick_value x 30%

 

Channel 2

mix_1 = Ail_stick_value x -90%

mix_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 = (Ail_stick_val x 90%)+(Ele_stick_val x 30%)
ch2 = (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
Ail stick Ele stick 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.

Mixer offset

The offset parameter is commonly used anywhere where an asymmetric response is required. In other words, when the mixer output must be non-zero with the stick in the centre position. Offset is applied after weight:

Mixer output = (Source * weight) + Offset

In the following example, S1 has an asymmetric response. The output varies from -80 to +120 as S1 is rotated. With S1 in the centre, the output is 20.

MIXERS menu

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

Example: motor-elevator compensation. Offsets are commonly used for crow and motor mixes, in particular 'compensation' mixes. For these mixes, the output must be zero at the 'idle' end of stick travel.

The example below shows how to implement a motor-elevator compensation mix. The first line is the standard elevator mix, the second line is for motor compensation.

MIXERS menu

CH2 (elevator)

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

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

Note how weight and offset are the same value - this ensures that the output is zero when the throttle stick is at back/idle (-100). At full throttle (+100) the output will be 2 * weight = 40. To reverse the stick, 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 obvious - but wrong! - way to do 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 to the input, so the aileron stick will have a higher rate on one side than the other. This is not what we want!

Instead, diff must be applied separately to each aileron channel:

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.

Default mixer settings

A mix is created with initial settings of weight=100% and offset=0, diff/expo=0 and no curve. The source value is therefore passed through unchanged.

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)

The final step in the processing loop is to apply a scaling and offset to the channel value. This provides a mechanism for calibrating servo limits and centres. The process is controlled in the OUTPUTS menu.

outputs

How it works

The Output layer operates on the unclipped channel values. It first clips the value so it lies in the range -100 to +100 (to keep the command within acceptable bounds). It then applies an optional curve (specified in the Curve field). Next, the command is scaled according to MIN and MAX. Finally SUBTRIM is added as an offset.

Notes:

Where to adjust weights

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. Initialise all weights in MIXERS and INPUTS to 100%.
  2. Calibrate the servo centres and end points. To do this, go to the OUTPUTS menu. Move each control to one or other end stop and adjust MIN/MAX to achieve maximum possible control surface travel. Then adjust SUBTRIM for correct centres.
  3. The control surface movements after step (2) will be excessive. To achieve the movements required for flight, adjust the weights in the INPUTS menu.
  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).