Shop OBEX P1 Docs P2 Docs Learn Events
Standard Servo Question — Parallax Forums

Standard Servo Question

PINGRulesPINGRules Posts: 2
edited 2011-12-06 13:21 in General Discussion
I'm doing a project for my robotics class. My team wants the head to turn 180 degrees. Okay. I have that. The only problem is that it jerks at the start. Is there a command that could send the value a servo is at back to the code?
' {$STAMP BS2}
' {$PBASIC 2.5}
'---[Variables]---
counter VAR Word
'---[Main Routine]---
FOR counter = 750 TO 350 STEP 5
   PULSOUT 14, counter
   PAUSE 10
NEXT
DO
   FOR counter = 350 TO 1150 STEP 5
      PULSOUT 14, counter
      PAUSE 10
   NEXT
   FOR counter = 1150 TO 350 STEP 5
      PULSOUT 14, counter
      PAUSE 10
   NEXT
LOOP

Comments

  • LeonLeon Posts: 7,620
    edited 2011-12-05 13:38
    You need something like a shaft encoder, which will provide the servo position. You might be able to use a pot, or read the servo pot by attaching a wire to it.
  • ercoerco Posts: 20,259
    edited 2011-12-05 14:31
    All servos twitch a bit when you first turn them on, even if they're already positioned right where they are being commanded to go (even if you add an encoder). If they are far from where they are commanded to go, they will obviously slam violently to the commanded spot. Your program starts at 750 (approx center of travel), so you'll get the smallest twitch when it is physically located there at powerup. You could carefully manually rotate in there before powerup, or have your program park it at 750 when you power down.

    Might be better to park it and wake up from one extreme position, either 350 or 1150, whichever works best.

    You can also try adding a second on/off switch. One switch powers up your electronics only, and the other supplies power to your servo(s). You might try switching them on in whatever sequence works best, usually electronics first.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2011-12-05 15:48
    Even though this was written using a Propeller, it could be implemented on a Basic Stamp. It's a way that allows you to initially read the position of a standard hobby servo without moving the servo. Once you determine the position, then you could send the appropriate signal to the servo, thus minimizing the amount of 'jerk' that you describe.

    http://forums.parallax.com/showthread.php?84991-Propeller-Application-Proportional-feedback-from-a-Standard-Hobby-Servo-%28Upda
  • PINGRulesPINGRules Posts: 2
    edited 2011-12-06 13:21
    Even though this was written using a Propeller, it could be implemented on a Basic Stamp. It's a way that allows you to initially read the position of a standard hobby servo without moving the servo. Once you determine the position, then you could send the appropriate signal to the servo, thus minimizing the amount of 'jerk' that you describe.

    http://forums.parallax.com/showthread.php?84991-Propeller-Application-Proportional-feedback-from-a-Standard-Hobby-Servo-(Upda
    That is basically what I wanted thanks! Now I just have to decifer it. :)
Sign In or Register to comment.