Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Problem with controlling servos

Hi there, I am a complete newbie with the Pololu and I’m building a machine based on a haunted house working model from the 1940’s: Coin Operated Haunted House Working Model Amusement Arcade Machine - YouTube

I’m running a Pololu Maestro 24

In the machine I’m building, I have a cam microswitch drive that needs to run very slowly throughout the whole sequence to make certain items switch on and off and I can’t work out how to make one servo run slowly throughout the sequence and have all the other servos make quick jumpy movements at the same time. I know I can use the Pololu to turn on and off lights, LED’s etc but all the channels are tied up with servos. How do I create a script/sequence that will allow this to happen? For clarity, the problem I am having at the moment is if I choose a long time for the timer servo to run (ie 40000ms) Then all of the other servos in that first frame will take that long (or wait that long until the next frame). As you can see I don’t really understand what I’m doing so any help you can give me will be really appreciated. Many thanks

Welcome Keiron1
I watched you tube video, but wondering when you said your m24 is all tied up with servos.
Are you sequencing 24 servos?
Are you still also using a rotator cam switch as well.

Hi Jim,

Thanks for your reply. I hope you’re well. Just to clarify that the YouTube video is not mine and I’m building something similar but a lot more complicated. My machine has actually got about 28 servos in it so I’m using most of the servo outputs on the Maestro (I’m using one as an on off switch) and the board triggers another board to drive the remaining servos. One of the servos on the pololu board is driving the cam timer (this is something that I’ve built and it activates ten microswitches to turn lights on and off etc. The problem I have is that the servo I am using to drive the cam timer needs to turn (a half turn) really slowly (about 1.18 mins) and I can’t work out how to make 1 servo turn slowly while the others move faster.

As I understand it with frames you have to set a time that that frame lasts for so if the servo motor (for the cam timer) is set for (for example) 40000ms) then either all the other servos in the first frame will have to wait that long before they can move on to their next action. I don’t really understand how to separate the timing and actions of individual servos so they can have their own timing.

Related to this issue is that I want some of the other servos in the sequence to have different timings so (for example) a servo may take 4 seconds to move it’s action at the same time that another takes 2 seconds (I understand you can slow servos down using the speed and acceleration tabs but if they are in the same frame surely each servo would have to have the same timing for that part of the sequence??

I am very inexperienced with this sort of thing so I’m really struggling to understand how to do this. I’ve never coded so that would be something that is a complete unknown to me.

Apologies if this is not too clear but I’m very happy to explain further.

Thanks so much for any help you can give me.

Many thanks.



It sounds like there are a couple things you are misunderstanding about how the Maestro and Maestro Control Center work.

  1. The “duration” of a frame is not related to the speed of a servo or how long it takes to move from one position to another. It is simply how long you want the sequence to delay before calling the next frame.

  2. The Maestro Control Center’s sequencer does not save speed or acceleration settings between frames. It essentially just saves a snapshot of the target position for each channel when a frame is saved. When the sequence is played back, it will use whatever speed and acceleration the servo channels are currently configured with. You can set the default speed and acceleration of each channel in the “Channel Settings” tab of the Maestro Control Center, but if you need the speed or acceleration of a specific channel to change throughout the sequence, you will need to copy the sequence to your script and manually add the SPEED or ACCELERATION commands where desired. (Please note that all subsequent movements on the specified channel will use those settings until the Maestro is reset or you change them again).

For your original question about having a servo move 180-degrees slowly throughout your sequence, instead of having a frame specifically for that servo, you should set the channel’s speed to 1 and have that channel set to the desired final position the whole time (i.e. in all of your other frames). Since that servo’s target isn’t changing, you can just leave it set to the desired final position in each frame and the Maestro will continue driving it toward that target at the specified speed.

On the Mini Maestro, with the default period setting (20ms), the speed is in units of 0.25 μs / 10 ms, so it will change by 25μs per second. This means to get from 1000μs to 2000μs will take 40 seconds. You might be using a slightly wider pulse width range to get 180-degrees from your servo, but if you need the servo to move even slower than that, you could try increasing the period slightly. Please note that the period controls several aspects of the Maestro servo channels (such as the frequency and allowable pulse width range), so you should be careful when changing it. You can find more information about the speed and period settings in the “Channel Settings” section of the Maestro user’s guide.

By the way, since you are new to the Maestro, I recommend taking it slow at first. For example, maybe try making some smaller sequences that only use a few channels. Then, you can use that to practice adding speed changes in a script and get comfortable with that before trying to do a full 24-servo sequence.