How to make a sequencer (it's easy!)
Introduction to sequencers
Retractable undercarriages, swing wings, and bomb dropping mechanisms... these all have one thing in one thing in common, namely the need to coordinate the movement of multiple servos. The way this is done is via a sequencer.
In this article you'll learn a simple and intuitive method for programming sequencers. Unlike the methods you may have seen on YouTube, the technique doesn't rely on complex delays and logical switches. Instead, it uses a time-base and time/position curve.
The method supports:
- multiple servos
- complex motions including pauses and jumps
Time-based sequencing method
The method comprises :
- A timebase controlled by a switch
- A time/position curve for each servo
So let's get started!
Example: an undercarriage sequencer
As an example, we'll design a sequencer for a retractable undercarriage.
Our u/c has two servos operating the gear and doors. The retract switch is SF. Our goal is to achieve the following sequence:
- SF↓
- doors open
- pause
- gear drops
- SF↑ reverses the sequence:
- gear retracts
- pause
- doors close
The total transit time is 6 seconds.
Sounds tricky? Well no, it's actually quite simple! In the following sections we'll build a complete solution.
Create the timebase
The first task is to create the timebase in CH1 (though it could be any unused channel).
First, we create a mixer with source set to the retract switch SF. The slow↑ and slow↓ parameters are set to 6 seconds (same speed in both directions).
CH1:Timebase
Source=SF, Weight=100%, slow↑=6, slow↓=6
Create mixers for door and gear
With the timebase completed, it's time to turn our attention to the door and gear mixers. The sources are the timebase channel. The weights are set to 100%.
CH2:Door
Source=CH1:Time, Weight=100%
CH3:Gear
Source=CH1:Time, Weight=100%
The outputs of CH1 and CH2 follow the timebase, in other words: they ramp linearly between -100% and +100% as SF is switched. In order to follow an irregular motion, we need to add a couple of motion curves...
Create the motion curves
Lastly, create the motion curves for the door and gear mixers. The x-axis is time (since the mixer input is the timebase), and the y-axis is position.
- x = −100% corresponds to T0
- x = 100% corresponds to T + timebase period
- y = servo position in the range -100 to +100
To implement this, first go to the Curves menu. Create a curve of type 'custom' (this allows us to set custom x values). Set the number of points to one greater than the number of segments (distinct motions). For our example, the door requires two segments which means 3 points. The gear requires three segments, so 4 points.
Setting the segments
Okay, so now define each point on the curve. Note that:
- The steeper a segment (the line joining adjacent points), the faster the commanded speed.
- A horizontal segment generates a pause.
- A vertical segment generates an instantaneous jump. (To create a vertical segment, set identical x-values for the end points.)
Below are the curves for our undercarriage example. The left hand end is the resting position when SF is up. The right hand end is 6 seconds after SF is moved down.
Note that I've put a vertical segment in the gear curve where the gear drops. In practice servos are not infinitely fast, so a slope at that point would be better. That way the servo can keep up with the sequence.
Here's a screen grab of Companion showing the final mixer configuration:
Note the simplicity of the solution!
Adjusting the servo limits and centres
The servo directions, travels and centres should be adjusted in the Outputs menu. Keep the mixer weights at +100%.
Maintaining sync at startup
When the radio is switched on, the retract state and switch must be in sync otherwise the servos will jump suddenly, potentially causing a clash. (This is not a limitation of this particular sequencing method... it's because our radios have no way of knowing the actual position of the servos!)
To ensure a safe switch-on: (a) always put the u/c in the same state (retracted or deployed) before switching off, and (b) always put the retract switch in the corresponding state when the radio is switched on - use EdgeTX's startup checks to remind you.
Undercarriage sequencer video
Here is a video of the sequencer running in the Companion simulator.
Expanding the sequencer
The method can be easily expanded for additional servos, or more complex paths. For example, you could arrange for the doors to close again, after the gear is deployed - it's just an additional segment. For dual retracts, you could add another two servos and stagger their motions. In fact, the complexity of the sequence is limited only by your imagination!