Shop OBEX P1 Docs P2 Docs Learn Events
PAUSE: Question about delay times for servos — Parallax Forums

PAUSE: Question about delay times for servos

RoboticsProfessorRoboticsProfessor Posts: 54
edited 2008-12-22 19:17 in BASIC Stamp
My line follower uses something like...
Do
...ReadSensors()
...At intersection?
......Yes (Left-hand rule)
........."T" = turn left
.........straight-right = go straight
.........straight-left = go left
......No - Interpret sensors, set motor speeds
Loop

Thinking that I might speed up the robot a bit, I removed the PAUSEs after each motor command.
I figured that the other code for interpreting the sensors and setting motor speeds were effectively a delay anyway, so the loop itself had a built in pause.

It worked with no apparent change in the robot speed. So I was probably sending the pulses a little more often than the 20 ms, or maybe a little less often, but in either case there was no change in performance, so I left the PAUSEs out.

So the question.....
How can I find out exactly how often the servo pulse is generated?
In this case, it might not matter, but I would like to know how to do this.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Richard Vannoy

Programming and Electronics Instructor
www.PICRobots.com
www.SailingStrategy.info
www.TeachingTechnicalTraders.com
·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-21 22:00
    An oscilloscope or a frequency meter or another Stamp set up to count the number of servo pulses in a second or something like that would give you that information. You don't want the pulse rate to be much different from 50 per seconds, but the speed where you might have problems is not documented and probably varies from servo model to servo model.
  • FranklinFranklin Posts: 4,747
    edited 2008-12-21 22:33
    There is quite a bit of info on Mr. Allen's page www.emesystems.com/BS2index.htm including instruction timing guidelines.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • DJSandbergDJSandberg Posts: 56
    edited 2008-12-22 01:56
    I've read that reducing the pause time will increase current draw but I've never tested it. Other than that there is no harm done.

    I've used the pause time to scan sensors and check inputs. That way you don't include a pause, then waste a few milleseconds checking for inputs, then pulse, pulse,·then pause, etc. Saves a little bit of time if you are building a competitive robot or something that has to react quickly.

    Daryl
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-12-22 19:17
    Some servos are tolerant of pulses coming in faster than every 20 mS while others are not. The ones that are not often get very jittery, including reversing direction. As Mike said…if you scope the servo signal line you will see the pulse and be able to determine the refresh rate.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
Sign In or Register to comment.