RC Servo Code
Joe Fishback
Posts: 99
I am using a standard Parallax Servo and·BOE with BS2. I understand controlling the servo using the PULSOUT command and the examples in the Basic Stamp manuals. I have two questions.
First, when you use the values for PULSOUT command of 500 or 1000 to get the 1·or 2 ms mentioned in the manuals as min and max values, you only get about 90 deg of servo rotation. To get the full 180 degrees rotation, I had to use values far from these values. Attached is a code that I used to gets the max of 180 degrees of rotation. Will this burn out the Servo? Why am I having to use these values? These values do not seem to make the Parallax continuous rotation Servo run any faster.
Second, with the standard Servo, is there any way to slow the rotation speed?
Joe Fishback
First, when you use the values for PULSOUT command of 500 or 1000 to get the 1·or 2 ms mentioned in the manuals as min and max values, you only get about 90 deg of servo rotation. To get the full 180 degrees rotation, I had to use values far from these values. Attached is a code that I used to gets the max of 180 degrees of rotation. Will this burn out the Servo? Why am I having to use these values? These values do not seem to make the Parallax continuous rotation Servo run any faster.
Second, with the standard Servo, is there any way to slow the rotation speed?
Joe Fishback
Comments
If you want to slow rotation speed with a STANDARD servo, you would use some form of looping and stepping....for instance you could change the position a little at a time with a pause between pulses...this would give the effect of 'slowing' the speed. To learn more about this you can also read about 'ramping' the servos....ramping helps keep you from jerking the servos into position, by 'mildly' positioning the servo. (Check out chapter 2 of the Boe Bot book: Servos- especially page 79, 80 etc...)
Not every servo is going to hit dead center at 1.5ms- just as there is not always a true 180 rotation...it is usually a little more than that...from your code it looks like center is 1.3ms (-0.2 ms)
Ryan
Radio controllers have adjustments that account for the slop in servos' slightly differing responses to the same signals. You have essentially performed the same adjustments with your code.
To make a standard servo rotate slowly, you can use a loop like this (based on the values in your program):
FOR reps = 175 to 1120
· PULSOUT 15, reps
· PAUSE 20
NEXT
To speed it up a bit from there, add STEP 2 after the 1120.
Standard servos use the servo's position as feedback to tell the motor what to do to keep the horn at a particular position. This feedback mechanism has been removed from continuous rotation servos. Without the feedback, the continuous rotation servos turn at full speed by the time you get to PULSOUT duration values of 650/850 (clockwise/counterclockwise). Values between about 700 and 800 will give you linear control over speed. The closer you get to 750, the slower they will turn.
Post Edited (Andy Lindsay (Parallax)) : 7/15/2005 7:34:06 AM GMT
Thanks for the help on servo rotation speed. It runs like a charm.
Joe Fishback