How to make a sequencer (it's easy!)
Introduction to sequencers
Sequencers are a cool way of getting servos to follow a predefined path. They're great for retractable undercarriages, swing wing systems, turbine startup sequences, and bomb dropping mechanisms.
In this article I describe a simple method for programming a sequencer from scratch. I'll use the example of an undercarriage sequencer for the gear and door channels.
Unlike other methods you might see on YouTube, it doesn't rely on complicated delays and logical switches. Instead, it uses a time-based system which is simple, flexible, and easy to extend. The method supports:
- multiple servos
- complex motions including pauses and jumps
Time-based sequencing method
There are just two key elements:
- A timebase controlled by a switch
- A time/position curve for each servo
So let's get started with a real life example...
Example: an undercarriage sequencer
As an example, we'll make a sequencer for a retractable undercarriage. The retract switch is SF, and it'll sequence two servos - one for the door, the other for the gear. The total transit time is 6 seconds.
The goal is to achieve the following sequence pattern:
- SF↓
- doors open
- pause
- gear drops
- SF↑ reverses the sequence:
- gear retracts
- pause
- doors close
Sound tricky? Well no, it's actually pretty simple! In the following sections we'll build a complete solution.
Create the timebase
For our undercarriage example, we'll use CH1 as the timebase. The mixer source is the retract switch SF. Let's say it should take 6 seconds to open the doors and drop the gear, then slow↑ and slow↓ should each be set to 6 seconds (same speed in both directions).
CH1:Time
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 source of each of them is the Timebase channel.
CH2:Door
Source=CH1:Time, Weight=100%
CH3:Gear
Source=CH1:Time, Weight=100%
If you try it, you'll see that both outputs follow the timebase, that is to say they ramp between -100% and +100% over 6 seconds as SF is switched. In order to follow an irregular motion, we need to add a couple of curves...
Create the motion curves
Finally, 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
Set the curve type to 'custom', so you can set custom x values.
Now set the number of points, which is 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. 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.
Curves for the u/c example
Below are the curves for our undercarriage example. The LH end is Tzero (SF up). The RH Tzero + 6 seconds (SF down).
Note the vertical segment in the Gear curve - this will cause the gear servo to jump. This is just by way of demonstration - in practice, you would slow down servo, by introducing a slope into that segment.
Here's a screengrab of Companion showing the final mixer configuration including the motion curves:
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. In fact, the complexity of the motion is limited only by the maximum number of segments.