Shop OBEX P1 Docs P2 Docs Learn Events
RC Servo Code — Parallax Forums

RC Servo Code

Joe FishbackJoe Fishback Posts: 99
edited 2005-07-15 22:32 in BASIC Stamp
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

Comments

  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-07-15 07:24
    With a continuous rotation servo you are going to reach a 'max speed' as it turns....the way the continuous rotation servos work is that they 'think' they are trying to reach a position (that they never will)- hence they keep rotating....

    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
  • edited 2005-07-15 07:25
    As long as your servo is not pushing against its mechanical stoppers, it's not damaging the servo. To find the positions of the mechanical stoppers, disconnect the setup from power and gently rotate the servo horn until you feel that it has reached its mechanical limit. They should be at around +/- 100 degrees from center.

    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
  • Joe FishbackJoe Fishback Posts: 99
    edited 2005-07-15 22:32
    Ryan and Andy,

    Thanks for the help on servo rotation speed. It runs like a charm.

    Joe Fishback
Sign In or Register to comment.