Pulsout and Pause Question
Hi All...
Fiddling with the servos on my Boe Bot and I've encountered something odd (odd to me anyway)!
I started sending a single pulsout to the servo to see how far it would turn.
PULSOUT 13, 850
PAUSE 20
Then hitting reset repeatedly to find one-quarter turn I find 12 pulses is real close to 90 degrees. So... 48 should give a full rotation. Ah... no. Sending...
for counter = 1 to 48
PULSOUT 13, 850
PAUSE 20
next
... gives me about 305 degrees of rotation. Changing 'counter' to 57 gives me close to 360 degrees. (If I send a single pulse 48 times with the reset switch, I get ~360 degrees.)
More fiddling...
Next, I tried changing increasing pause, thinking 'maybe' the servo needed more time to execute the pulsout commands. Setting pause at 26 lets counter = 40 complete ~ 360 degrees of rotation.
Reading somewhere you should not have a pause of more than 20, I inserted a short timing delay in the pulsout 'loop'.
FOR counter = 1 TO 48
PULSOUT 13, 850
PAUSE 20
FOR counter2 = 1 TO 8
NEXT
NEXT
This gives me ~ 360 degrees of rotation.
The setup is my 'Bot on a test stand. Batteries are new as are the servos. I have an 8 inch pointer attached to the servo so my angles are pretty accurate.
I'm somewhat befuddled! Can anyone point me to where I can find out more about how the servos work?
Many Thanks,
Amanda
Fiddling with the servos on my Boe Bot and I've encountered something odd (odd to me anyway)!
I started sending a single pulsout to the servo to see how far it would turn.
PULSOUT 13, 850
PAUSE 20
Then hitting reset repeatedly to find one-quarter turn I find 12 pulses is real close to 90 degrees. So... 48 should give a full rotation. Ah... no. Sending...
for counter = 1 to 48
PULSOUT 13, 850
PAUSE 20
next
... gives me about 305 degrees of rotation. Changing 'counter' to 57 gives me close to 360 degrees. (If I send a single pulse 48 times with the reset switch, I get ~360 degrees.)
More fiddling...
Next, I tried changing increasing pause, thinking 'maybe' the servo needed more time to execute the pulsout commands. Setting pause at 26 lets counter = 40 complete ~ 360 degrees of rotation.
Reading somewhere you should not have a pause of more than 20, I inserted a short timing delay in the pulsout 'loop'.
FOR counter = 1 TO 48
PULSOUT 13, 850
PAUSE 20
FOR counter2 = 1 TO 8
NEXT
NEXT
This gives me ~ 360 degrees of rotation.
The setup is my 'Bot on a test stand. Batteries are new as are the servos. I have an 8 inch pointer attached to the servo so my angles are pretty accurate.
I'm somewhat befuddled! Can anyone point me to where I can find out more about how the servos work?
Many Thanks,
Amanda
Comments
Always a source of great information. Thanks Mike! Guess I assumed that the servos were more of a precision device.
In my first foray into the forums, someone mentioned wheel encoders and Erco. Looks like some research is needed.
Thanks again!
Amanda
Analog servos can usually work with a fairly wide range of refresh rates, though anything under 25 Hz (PAUSE=40) will cause poor performance. Anything above 60-80 Hz may cause the motor to behave erratically, though this depends entirely on the servo.
You can get approximate distance measurement if you use a voltage regulated supply for the servos. Keep the refresh rate constant. The distances that are traveled will be approximate only, and will apply only to the make and model of servos you use. Expect an error of at least 10%, if not 20%. But it will get you in the ballpark for coarse distances.
As Mike says, for anything more wheel encoders are preferred, but even those don't detect errors caused by slippage. You need an optical or ultrasonic method for that.
-- Gordon