Servo stops in different place depending on travel direction
The Doctor
Posts: 37
I am trying to get a servo to stop in the center of it's travel.· Assuming 180 degrees, I want the servo to stop at 90.· The servo is connected to pin 14 of a basic stamp, and I am using this routine:
X·VAR Byte
FOR·X = 1 TO 20
···· PULSOUT 14, 720
···· PAUSE 20
NEXT
What happens is this - If the servo is traveling counter-clockwise, the above·routine will stop it right at 90 degrees.· However, if the server is traveling clockwise, it will stop about 95 degrees.· I have to change the PULSOUT duration to 800 to get the servo to stop at 90 when traveling clockwise, but that will make it stop about 85 when traveling counter-clockwise.
Tried this with two separate servos, one a Futaba and one an Airtronics.··I also tried varying the pause statement.· Same result.· Any idea what would cause this, and how I can compensate for it?
·
X·VAR Byte
FOR·X = 1 TO 20
···· PULSOUT 14, 720
···· PAUSE 20
NEXT
What happens is this - If the servo is traveling counter-clockwise, the above·routine will stop it right at 90 degrees.· However, if the server is traveling clockwise, it will stop about 95 degrees.· I have to change the PULSOUT duration to 800 to get the servo to stop at 90 when traveling clockwise, but that will make it stop about 85 when traveling counter-clockwise.
Tried this with two separate servos, one a Futaba and one an Airtronics.··I also tried varying the pause statement.· Same result.· Any idea what would cause this, and how I can compensate for it?
·
Comments
If you really need to end up at the target without any overshoot in either direction, then you need to compute the amount of backlash in your servo ('sounds like about 80) and use this as a compensating factor when you change the direction of movement.
There's nothing wrong with your servos or the electronics. Backlash and hysteresis are a fact of life that we just have to deal with. For something that costs less than $20, five degrees really isn't all that bad.
-Phil
Any other ideas?
1. When you're trimming the control surfaces, you're making adjustments with the transmitter by hand. It could be that you're compensating for any backlash/hysteresis subconsciously. It seems reasonable that having to deal with the actual numbers makes manifest a condition of which you were heretofore unaware. You can test this theory by using your BASIC Stamp and PULSIN to measure the pulse widths going to the servo as you trim from both directions.
2. In flight, the servos that operate the control surfaces are acting against aerodynamic forces, not just flapping around without resistance. This extra force may be enough to take up and counteract any inherent slack in the total system linkage. You can test this theory with your BASIC Stamp servo by attaching a rubberband to the servo horn to keep tension on it. Then run your experiment again.
I might be completely off base, and it won't be the first time (or the last), but at least now you have a way to verify it one way or the other.
One other thing you could try, to make your scenario more similar to trimming an RC plane, is to change the pulse width gradually to reach the target value, rather than just setting to that value all at once.
-Phil
1. What battery voltage do your RC servos operate from? If it's more than 5V, you might try to match that with your BASIC Stamp servo to see if it helps. If a servo is close to its destination, it will be merely "tickling" the motor to nudge it into position. If the battery voltage is too low, that tickling may be ineffective.
2. What is the relative quality/cost of your Stamp servo vs. your RC servo? Some servos are simply built better than others. The RC enthusiasts I know spare no cost in getting the lightest, highest precision servos they can get their hands on. You might try controlling one of your RC servos with the Stamp to see if behaves better than the one you're trying to use.
-Phil
A couple of things here. PULSOUT is different, depending on which Stamp you are using. The BS1 is 10 microseconds for each unit. The BS2, BS2e,BSpe its 2 microseconds per unit. The BS2sx, BS2p, Bs2px its 0.8 microseconds per unit.
Servos maximum angle of travel is about 90 degrees, not 180 degrees. The pulse width must be between 1 millisecond and 2 milliseconds. 1 millisecond being one maxumum end of travel and 2 milliseconds being the other max end of travel.
If you have the BS2 then PULSOUT 14, 500 is a 1 ms pulse width and PULSOUT 14, 1000 is a 2 ms pulse width. In this example, you will need to keep the PULSOUT statement between those values.
Finally, you should have a LOW 14 statement ahead of any PULSOUT statement to ensure the pulse is positive going.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Try:
If this works, then that was your problem.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Is there something I'm missing here?
Otherwise, you are correct, having REACHED the center position, if it's not under load, and you stop giving it pulses, it won't move out of that position. But that's a different situation from expecting it to reach center position in the first place with one pulse. It really can't move very far in 20 mSec.
Jeff T
EDIT looking at the specs for the standard servo it states 1.5sec to travel 180 deg so one pulse may move the servo very quickly ,close , but probably not to the intended position hence a loop.
Post Edited (Unsoundcode) : 8/20/2007 3:09:39 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PhiPi, when trimming a servo, you are simply adjusting the center position of the POT in the transmitter to center the servo when the control stick is centered. There is no "unconcious" adjustments going on. Once trimmed, whether I move the control stick up or down, moving the servo either clockwise or counter-clockwise, when I center the stick the servo returns to center.
PhiPi, the servos run at either 4.8V or 6V depending on if you are using NiCad or Alkaline batteries. My testing is being done at 5V.
PhiPi & Franklin, this is one of my aircraft servos. I commandered parts from an unused plane to build this.
LILDI, this is a BS2, so my 720 is 1.44 MS. Also, a standard servo will turn a little over 1/2 circle from one extreme to the other, which is 180 degrees.
D Faust, no, it is not a timing issue. Even if I increase the number of time through the loop to 40, I still get the differing positions depending on servo travel direction.
Good discussion, folks. Any other ideas?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Joy_stick_left:
pulse_value=720
GOSUB move_servo
Joy_stick_right:
pulse_value=800
GOSUB move_servo
move_servo:
PULSOUT,14,pulse_value
put the pulsout in a loop that·gives the desired effect
Jeff T.
Gr,
Mightor
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
| To know recursion, you must first know recursion.
Jeff T
I tried your experiment using a Parallax servo and the following code:
Attached is a movie of the result. Short story: I don't see what you're observing.
What, exactly, are you using for servo power? I know you said 5V, but at what current capacity, and how is it being filtered? Can you measure the voltage as the servo is moving or, better yet, observe it on a 'scope?
-Phil
_____________________________________________
P.S. Mightor, were the readings you've graphed taken with the servo in motion? Or stopped at each station? It will make a difference, independent of the servo's characteristics, for two reasons:
1. If in motion, there will be a delay between the pulse width you're sending and the servo reaching that position.
2. There's an additional delay for the echo to return.
Both will conspire to make the commanded angle seem different from the actual angle.
Jeff T.
I will try your code as-is when I get home tonight and let you know what I find.
On an additional note, I was reading through one of my other robotics books last night and found a note about Futaba servos, stating that Futaba used a 1.5 ms pulse width instead of a 2.0 ms. Anyone out there working with Futaba servos that can test PhiPi's code?
-Phil
PhiPi, I will quote the appropriate passage this afternoon.
You probably wouldn't see the bounce-back if you approached the stopping point with pulse widths that ramp to the destination, rather than sending the destination pulse widths from the start.
-Phil
One more question/myth about servos. Shouldn't the servo slow down on its own as it approaches its destination from a far away position?
-Phil
"I am assuming you are going to use standard and not Futaba servos.· Standard servos are controlled by a 1 ms to 2 ms pulse (with 1.5 being the center), whereas Futaba servos are controlled by a 1 ms to 1.5 ms pulse.· If you are using Futaba servos with the application, make sure you change the data values accordingly."
My Futaba servos, however, do not agree with this.· I am wondering if anyone else has more details, or if Myke was wrong in this statement?
Attached is my test video using the following code: Note that this is PhiPi's earlier code, just modified for a BS2.· Note how my servo travels beyond it's stop point then comes back, but only when traveling counter-clockwise.· Also notice that although I am using the supposed full range of 1 to 2 ms, the servo only travels a total of 90 degrees.· I have to increase the up side to 1200, and the down side to 360, to get a full 180 degrees.· And, once·I do that,·I am back to the servo not returning to the same place· depending on travel direction.· I even tried raising the loop count to 200.· There is an obvious pause, so I know the loop is long enough.
PhiPi, in your earlier video I noticed your servo only traveling 90 degrees, 45 each way.· You were using the code you posted, right?· What happens if you lower your numbers below 500 or above 1000?· Do you get longer travel?· Do you still hit center both ways?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔