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

Parallax Standard Servo Motor Problem

playinmyblues_nsccplayinmyblues_nscc Posts: 38
edited 2008-11-24 18:49 in BASIC Stamp
While using a Standard Servo motor I noticed that some particular combinations of commands cause the motor to strain at its limits.
Using the code from "What's a Microcontroller," Chapter 4, ACTIVITY #2: CONTROLLING POSITION WITH YOUR COMPUTER, the code given is:

FOR counter = 1 TO pulses
·· PULSOUT 14, duration
·· PAUSE 20

NEXT

The variable "pulses" is entered as an input with DEBUGIN and so is the "duration" argument. The "duration" is always within range when entered. When I changed the "PAUSE 20" command to "PAUSE 2," the motor strains. Why is that?

NOTE that the motor strains when "duration" argument is the same and the "PAUSE" command has changed as above.

Full Program:

' What's a Microcontroller - Servo Control With Debug Your Turn.bs2
' Send messages to the BASIC Stamp to control a servo using
' the Debug Terminal.
' {$STAMP BS2}
' {$PBASIC 2.5}
counter VAR Word
pulses VAR Word
duration VAR Word
DO
· DEBUG CLS, "Enter number of pulses:", CR
· DEBUGIN DEC pulses
· DO
··· DEBUG "Enter pulsout duration:", CR
··· DEBUGIN DEC duration
··· IF duration < 500 THEN
····· DEBUG "Value of duration must be above 499", CR
····· PAUSE 1000
··· ENDIF
··· IF duration > 1000 THEN
····· DEBUG "Value of duration must be below 1001", CR
····· PAUSE 1000
····· ENDIF
· LOOP UNTIL duration > 499 AND duration < 1001
· DEBUG "Servo is running...", CR
· FOR counter = 1 TO pulses
··· PULSOUT 14, duration
··· PAUSE 20
· NEXT
· DEBUG "DONE"
· PAUSE 1000
LOOP
·

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2008-11-24 18:46
    The "Pause 20" is a 20 millisecond pause, part of the Servo control signal. It's supposed to be 20 to 50 milliseconds between 'refresh' of the servo pulse signal.

    If you send it every 2 milliseconds, you're simply sending it too often.
  • playinmyblues_nsccplayinmyblues_nscc Posts: 38
    edited 2008-11-24 18:49
    Thanks. That makes some sense.
Sign In or Register to comment.