Overview request, script help, two servos, rc landing gear

I have just started working with the 6 channel servo controller. A great product!!

I would appreciate some direction.

I have an RC switch for my transmitter to turn an external circuit on and off.

I have two servos with 180 degree travel and bought the Pololu server controller to limit the travel to a 90 degree arc.

Everything is perfect on the USB interface.

What I think I should be doing is using the RC switch as an input on the servo controller. The servo controller would be powered on as long as the main battery is connected.

The RC switch will be +5v or 0v depending on which way it is flipped.

When the +5v is detected, I would like both servos to move from what is for my purposes, 0 to 90 degrees, and when the +5v is turned off, I would like both servos to move from 90 to 0 degrees.

Can this be done, and can you provide a high level guideline for me on how I should approach this? I’m sure I can figure out the script if I have a direction to follow.

Monitor Input x
If x = 1
send command to move servo from 0 to 90
test for servo at 90
If x = 0
send command to move servo from 90 to 0
test for servo at 0

All suggestions / comments welcome.


Hello, TimV.

From your description, it sounds like that should be possible with a Maestro script. It sounds like you might not be familiar with the Maestro scripting language. The Maestro scripting language is based on a programing language called Forth. I recommend reading through the “The Maestro Scripting Language” section of the Maestro User’s Guide as well, particularly the “Command Reference” and “Example Scripts” sub-sections.

For your application, you will need to configure one channel (the one used for monitoring the input from your RC switch) to be an “Input”. The mode for each channel can be set from the “Channel Settings” tab of the Maestro Control Center. In your script, you can use the GET_POSITION command to read the input on that channel.

As far as moving the servo 90 degrees, you will need to determine the pulse width range that correspond to the movement you are interested in. To do this, you can use the sliders in the “Status” tab of the Maestro Control Center to change the target positions of your servos and find out which ones are appropriate. Please note that the “Target” value shown in this tab is in units of microseconds while the value used to set the target with the SERVO command in a script should be in units of quarter-microseconds (e.g. 1000 microseconds becomes 4000 quarter-microseconds).

If you try writing a script and run into problems, you can post what you have so far here, and I would be glad to help.


Hello BrandonM:

Thank you for your reply. I have read through the scripting language
section and many, many years ago I worked with Forth on a mainframe :slight_smile:

I will look through the examples again now that you have explained the
difference between microseconds from the Windows UI and
quarter-microseconds in the scripting. I had noticed the larger numbers
in the script examples without knowing why they were larger. That
allows for some very high precision movement!

Thanks for the information on Input and GET_POSITION to read the value.
That sounds like the missing link for what I want to do to trip the
start from the RC switch.

My flight controller is a Quadrino which obviously uses the Arduino
scripts. I had written the code to drive these same servos in a pan /
tilt setup in the past, so I considered adding the servo code to the
existing flight controller. I chose not to do that since the code loop
is tight to keep the drone under control and I didn’t want to add a bug
that would potentially crash the program (and the drone).

When I saw the servo controller you folks had, it was a done deal for me.

Before I get too far along, should I order the 12 port instead of the
6? I think I read something about some things that couldn’t be done on
the 6 port model and I’d hate to start over from scratch.

Best regards,


Hi BrandonM:

I got an error message from the email server on the way out, so I wanted
to try again to make sure you got a response from me.

Thanks for the info. The Input / Get_Position looks like what I need to
get started.

I appreciate knowing about microseconds for the Windows UI and
quarter-microseconds for the script. Pretty fine resolution available
in scripting!

Best regards,


Hi BrandonM:

Thanks for your help yesterday getting me started. I’m all good now!

The two servos are combined onto Channel 1 with a Y cable.
They are mounted opposite each other for alignment so they operate like windshield wipers.
The Servo section of the board is connected to +5V and gnd on a power distribution board in the drone.
A 10K resistor is mounted from the + terminal of the Pololu board to the Signal pin for Channel 0 which ties Input 0 high
A wire runs from the signal pin of Input 0 on the pin side of the resistor to one side of the RC switch controlled by the transmitter.
Another wire runs from the other terminal on the RC switch to a gnd terminal on the Power Distribution Board in the drone…
When the appropriate switch on the transmitter is flipped, the terminals in the RC switch close which takes Input 0 to gnd.
A jumper wire runs from the Servo power in pin to the plus terminal where the resistor is installed to supply power to the Pololu board

The following code is on the Pololu and set to start on power up.

  0 get_position    # Read Input Value of Channel 0
  512 less_than
    4600 1 servo   #Raise Gear
    7650 1 servo   # Lower Gear

Best regards,

edited for spelling
twice, and to add the jumper wire to power the board.

I’m glad you were able to figure it out and write a script that does what you want. Thank you for sharing your code (by the way, I added code tags to your post to make it more readable). Your project sounds really neat; you might consider sharing more about it on the “Share your project” section of our forum.

As you mentioned, there are some extra features on the Mini Maestro boards that are not available on the Micro Maestro (beyond just having more channels). For your application, I suspect a Micro Maestro is enough. Some of the benefits of the Mini Maestros include more memory space, a PWM output channel, additional serial commands (e.g. set multiple targets, get moving state, set PWM), additional script commands (e.g. PEEK, POKE, PWM, SERIAL_SEND_BYTE), and the ability to send serial bytes over the TTL serial output pin from a script (via the SERIAL_SEND_BYTE command).


Hi BrandonM

I am going to have to come up with another solution for my landing gear.

When power is removed, the servos release and the weight of the drone is like hand positioning the servos. There is nothing to stop them from freely turning and the drone settles to the ground.

On to plan D…

Best regards,