OpenTx - Key Concepts

Mike Shellim
Last updated 24 June 2022

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

Introduction

OpenTX is a wonderfully flexible operating system. However if you've come from a brand like Futaba or Spektrum, it can seem strange and difficult. My aim with this article is to explain how OpenTX works, and how to design your own setups.

I'll cover the following topics:

Examples will be illustrated with screenshots and text.

OpenTx: the processing loop

Okay, so let's start at the beginning.

Like all RC systems, OpenTX executes a processing loop several times a second. With each pass, the control positions are read, mixing is applied, and channel values are calculated. All this is done fast enough to provide the illusion of a smooth response.

The graphic below illustrates the processes and data flows:

flow

In the graphic above,

The boxes represent the three stages of processing:

The starting point: Sources

All computer programs need data to work with. With OpenTX, the data are your sticks, switches, inputs, trims and so on. The general term for these is sources.

Each source has a unique identifier, for example:

Each source carries a value between -100 and 100 according to its position. Zero represents the centre. Examples:

You can monitor the values of analog sources (that is, sources using potentiometers) in the SYS->HARDWARE menu - this is useful for checking that they're calibrated correctly.

In the following sections, we'll see how these source values are collected, transformed and finally output as PWM values, one for each servo channel.

Special sources

Before we leave the topic of source, I'll mention a couple of special ones:

Note 1: Source names may differ slightly between transmitters, for example knobs are 'S1' and 'S2' on the X9D, but 'F1' and 'F2' on the X9E.

Note 2: channels, Lua scripts and telemetry values can also be used as sources, however they are outside the scope of this article.

Mixers

Mixers are the brains of your setup - they determine how your stick inputs are converted to channel commands. Mixers are managed in the MIXERS menu.

Unlike other radios, there's only one type of mixer in OpenTX, and it's extremely simple:

You can think of it as the ultimate 'free mix'! A setup will contain anything from a couple (for a simple RE sailplane) to dozens of mixer (for an F3X ship).

Your first mixer

The screenshot below shows a single mixer. The source is the aileron stick, and the output is Channel 1. Read the line as "Channel 1 is affected by the aileron stick, with 100% effect":

Try programming it in your trasmitter. As you move the aileron stick, the servo on CH1 will move in response.

Channels

We've seen that mixers send their output to a channel, so let's say a few words about these. (Note that the terms channels and outputs are often used interchangeably.)

In OpenTX, a channel has a wider meaning than with other systems. Key points:

Channels example

The screenshot below shows the OUTPUTS menu, where channels are managed.

In this example, channels 1, 2 and 3 are servo outputs, and have been assigned meaningful names:

Outputs

The columns to the right of the name refer to centre and end point adjustments. That's all we'll say about the OUTPUTS menu for now - we'll visit it again later.

More about mixers: the three building blocks

In this section we'll look at the three basic mixing schemes. These will form the building blocks of your setup.

Scenario 1: One source -> one channel

The simplest scenario. We've already seen this, where a single source drives a single output. In this case, the source is the aileron stick, and the output is CH1:

Scenario 2: One source -> multiple channels

In this scenario, a single source drives multiple outputs.

The example below is for dual aileron servos. The source is the aileron stick, and the outputs are CH1 and CH5. The negative sign on CH5 indicates that the mixer effect is reversed (ailerons travel in opposite directions).

TIP: Using two separate channels is better than a Y-lead, since each channel can be individually adjusted for direction, travel and centring.

Scenario 3: Multiple sources -> one channel

In this scenario, a single servo is driven simultaneously by more than one stick.

This example shows a V-tail servo on CH5 being driven by both the rudder and elevator sticks:

The '+' sign against the Ele line indicates that mixer outputs are added. In other words, each stick makes an independent, additive contribution to CH5.

When using the '+' operator, the mixer order 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 mixer scheme for your model

In this section, I'll describe a simple method of designing a setup, in four steps. In fact, the same method can be applied to any model, regardless of complexity!

The basic idea is to identify all the interactions between stick and output channels, and to convert these into mixer definitions.

Example: a flying wing

We'll use the example of a flying wing. This has two channels for elevons. The elevator stick drives them in the same direction, the aileron stick in opposite directions.

Step 1. Assign channels

The first step is to name the channels. We can do this directly in the OUTPUTS menu.

Outputs

Step 2. Identify stick/servo interactions

Next, we identify the interactions between sticks and channels. For each stick, we make a list of the channels which are affected when moving the stick.

Starting with the aileron stick:

Note the negative sign in CH2. THis is because the elevons move in opposing directions in response to aileron commands.

And for the elevator stick:

No negative sign is needed, since the elevons move in the same direction in response to elevator commands.

Step 3: Convert interactions into mixer lines

Next, write the interactions in reverse format:

So now, each line reads as "[channel] is affected by [source]". This corresponds to the way mixers are entered.

Step 4: Enter mixer definitions

Finally, in the MIXER menu, create a mix for each interaction. The weight is set to 100%, in other words full rate - we'll see how to adjust this later. Note also that the negative aileron rate translates to a negative weight (−100%).

If you want to try this, just set the source parameter, leave the other fields at their defaults.

mixers

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

That's it, done!

Except, there's just one problem: we have assumed 100% rates for both the aileron and elevator sticks.

We could adjust the rates by adjusting the mixer weights. However, it would mean two adjustments for the aileron stick, and two adjustments for the elevator stick - that's four adjustments in all, just to adjust two rates.

A much better way is to use inputs. We'll look at this in the next section.

INPUTS

Inputs are based on regular sources like sticks and sliders. However, inputs incorporate rates and expo in their definition.

Inputs are very useful for the main flight controls (aileron, elevator and rudder). They allow you to adjust stick rates quickly and easily through a single adjustment.

Inputs are managed in the INPUTS menu.

Inputs are not built in - they must be created first. Each input has a name (max 3 characters), a source (stick, slider etc.), a weight, and optionally an expo value. The names are shown with a prefix of '[I]' in the menus, to distinguish them from the raw sources.

Did I say you have to create your own inputs? Well conveniently, when you create a new model, OpenTX creates four inputs [I]Ail, [I]Thr, [I]Rud and [I]Ele.

Inputs example

Using our flying wing example, we'll define a couple of inputs for the aileron and elevator controls. We'll assign a weight of 90% to the aileron stick, and 30% for the elevator. We'll set the expo to 10%. The INPUTS menu will look like this:

inputs

Next, we must go back and edit the mixers, so the source refers to these inputs:

mixers

To alter the aileron rate, we only need to alter a single input, instead of two mixers.

Note that OpenTX precedes the input names with an 'I', to distinguish them from regular sources.

Note also that I have set the mixer rates to 100%. This is good practice when when the source of a mix is an input.

Choosing between inputs and sticks.

You don't alway have to use inputs. Sometimes it's more appropriate to use the regular sticks directly.

More about inputs

Inputs are an important part of OpenTx, and you can read more about them here.

How stick commands are processed

In this section, you'll learn how your commands are processed. A good understanding is useful for troubleshooting your setups.

The first thing to remember is that weights are applied cumulatively from inputs to mixers to outputs.

Let's take the flying wing example. We'll consider just the inputs and mixers:

inputs

mixers

Taking the inputs first:

[I]Ail = Ail_Stick x 90%
[I]Ele = Ele_Stick x 30%

Next, the inputs are aggregated in the Mixers:

CH1 = [I]Ail + [I]Ele = (Ail_Stick x 90%) + (Ele_Stick x 30%)
CH2 = -[I]AIl + [I]Ele = (Ail_Stick x -90%) + (Ele_Stick x 30%)

So let's see what happens as we move the sticks:

S T I C K S M I X E R  O U T P U T 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": the mixer output for Channel 1 is 120. In fact, mixer outputs are clipped to +/- 100 in the OUTPUT stage. More on that later.

The mixers monitor

Once you've designed your setup, you'll want to check that it works as intended. You can do this on the transmitter, or in the in Companion simulator, using the Mixers monitor.

On the X9D, To activate the mixers monitor, go to the splash screen press and press {Page} until you get to the channels monitor, then press Enter.

The values are percentages of available travel on each channel. The available travel is set later in the OUTPUTS.

Designing your mixers: best practice

When designing your mixers, focus on the transmitter controls and how they interact. Don't be concerned about the linkages or left/right imbalances - these will be dealt with later, when you calibrate the Outputs.

More about mixers

Mixers are the key to mastering OpenTx, and you can read more about them here.

OUTPUTS

The Outputs stage is the final stage of processing prior to transmission. the process is controlled in the OUTPUTS menu is where you adjust the direction, end points and centres of each servo.

Another way of thinking about the outputs: it's where your mixer logic hits the real world of servos and linkages.

OpenTX does two key things in the Outputs stage:

  1. Clips (limits) the incoming channel values
  2. Maps (converts) the clipped channel values to PWM values. These represent actual servo deflections.

Let's look at each step in more detail:

Clipping

Recall how mixer outputs are aggregated from individual mixer lines:

CHx_MixOutput = SUM (CHx_MixLine1, CHx_MixLine2, ...)

If several mixers are active, and aggressive stick movements are applied, then clearly the command could exceed the mechanical limits of the servo. To prevent this, the Outputs stage clips mixer values which exceed bounds of -100 and +100.

Mapping to PWM

Next, the clipped channels are mapped to PWM values according to the parameters in the the Outputs menu:

outputs

The key parameters are Min, Max, Subtrim and Direction. Together these define a three-point curve.

Since the incoming channel values are clipped to +/−100%, Min and Max also represent absolute servo limits - think of these as electronic end stops.

PWM values

You may have noticed that Min, Max and Subtrim are entered as percentages, while they actually represent PWM values. The relationship between the units is as follows:

Min/Max/Subtrim PWM
-150% 732 μs
-100% 988 μs
0% 1500 μs
100% 2012 μs
150% 2268 μs

PWM values outside the range 988 - 2012 μs are only available if Extended Limits are enabled (in the Model menu).

Calibrating the outputs

To calibrate your servo limits, generate mixer values of -100 and +100, then adjust Min and Max as required. Similarly to calibrate the servo centre, generate a mixer value of zero, then adjust Subtrim.

Channels monitor

You can monitor the final output values using the Channels monitor.

Advanced topics

Mixer operators

We've seen how mixer line values are aggregated via addition. In fact OpenTx offers a lot more flexibility, by means of Multiply and Replace operators. The operator is specified in the Multiplex parameter:

 

Okay, so let's see how these operators are applied.

At the start of the processing loop, the channel values for all channels are reset to zero. Next, the mixers are then processed in the order that they appear in the MIXERS menu.

As each mixer is processed, its associated channel is updated as follows:

Note: if a mix is disabled, it's ignored entirely, as if it wasn't there at all.

The following examples illustrate the effect of the various operators. Note the importance of mixer order when using 'REPL' and 'MULT'!

Src = I1, op=ADD

Src = I2, op=ADD

result = I1 + I2

Src = I1, op=ADD

Src = I2, op=ADD

Src = I3, op=MULT

result = (I1 + I2) * I3

Src = I1, op=ADD

Src = I2, op=MULT

Src = I3, op=ADD

result = (I1 * I2) + I3

Src = I1, op=ADD

Src = I2, op=MULT (disabled)

Src = I3, op=ADD

result = I1 + I3

Src = I1, op=ADD

Src = I2, op=REPL

Src = I3, op=ADD

result = I2 + I3

Src = I1, op=ADD

Src = I2, op=REPL

Src = I3, op=MULT

result = I2 * I3

Src = I1, op=ADD (disabled)

result = 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).