Shop OBEX P1 Docs P2 Docs Learn Events
Erratic Behaviour with Servo — Parallax Forums

Erratic Behaviour with Servo

ZackaryZackary Posts: 10
edited 2006-01-13 03:14 in General Discussion
Problem: (See title)

Description: Servo behaves irratically. Sometimes it moves step, step, step, step, but then it goes crazy. Step, step, dies. (Long wait) Step, craziness etc.

Equipment
- PIC16F877A
- Parallax continuous servo
- Coding in assembly (with MPLab)
- 5 V on everything (except the microcontroller)

Could it be a faulty servo? Umm, I was new with servos, so I tapped the signal wire to power (5 V), to see what would happen. Could that have killed it? I also turned the servo by hand. Could that damage the unit?

I should mention my pseudocode:

Initialize
For inifinity
_____For 4 times
_________Pulse servo for 1.25 ms
_________Wait 18 ms
_____Pause for a second
_____For 4 times
_________Pulse servo for 1.75 ms
_________Wait 18 ms
_____Pause for a second
Repeat

Sorry about "hijacking" the other thread. Newbie.

Thanks to Mr. Baker. I'll try it out when I get home.
So if I keep pulsing it at say 1.25 ms with 20ms width, will it move to a constant position or will it rotate·with a constant speed?

Comments

  • Tom WalkerTom Walker Posts: 509
    edited 2006-01-12 20:26
    To answer your last question, it should rotate continuously in one direction. For a standard servo, it would move to a particular position, but with a continuous, it should just rotate at a constant rate.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • rockin_rickrockin_rick Posts: 32
    edited 2006-01-13 00:04
    You should be sending a (say) 1.25ms long positive pulse once every ~20ms NON-STOP. If you are pausing for 1 sec between sending pulses then it won't work right. IOW - the servo doesn't latch the pulse width value.

    With a modded servo (to continous rotation) then the speed of rotation is determined by the pulse width. A constant pulse width = constant speed. Larger PW = faster constant speed.

    Turning it by hand shouldn't be a problem, if the power is off.

    Rick
  • ZackaryZackary Posts: 10
    edited 2006-01-13 03:07
    Thanks for the responses.
    I've tried the suggestions. The pseudocode reads

    Loop
    ____Set servo pin high
    ____Delay 1.25 ms
    ____Set servo pin low
    ____Delay 18.75 ms
    ____Repeat

    It still behaves erratically. (See above)

    I find it hard to debug, because
    a) I have never had a working servo before, so I don't know what to look for
    b) I can't see a pulse that's 20 ms long (and only high for a fraction of that) [noparse]:)[/noparse]

    Debugging Attempts
    1) I connect the servo pin to an LED
    - I know its brightness when at a constant 5 V
    - so I assumes it's pulsing when the LED is slightly less bright

    2) I also have a counter IC so I can verify that it is pulsing

    What I know
    - how a servo works (from what I read from http://forums.parallax.com/forums/default.aspx?f=6&m=104381 )
    - that the servo I have "works" (i.e. if I tap the signal wire to power, I can make the servo move)
  • ZackaryZackary Posts: 10
    edited 2006-01-13 03:09
    Thanks for the responses.
    I've tried the suggestions. The pseudocode reads

    Loop
    ____Set servo pin high
    ____Delay 1.25 ms
    ____Set servo pin low
    ____Delay 18.75 ms
    ____Repeat

    It still behaves erratically. (See above)

    I find it hard to debug, because
    a) I have never had a working servo before, so I don't know what to look for
    b) I can't see a pulse that's 20 ms long (and only high for a fraction of that) [noparse]:)[/noparse]

    Debugging Attempts
    1) I connect the servo pin to an LED
    - I know its brightness when at a constant 5 V
    - so I assumes it's pulsing when the LED is slightly less bright

    2) I also have a counter IC so I can verify that it is pulsing

    What I know
    - how a servo works (from what I read from http://forums.parallax.com/forums/default.aspx?f=6&m=104381 )
    - that the servo I have "works" (i.e. if I tap the signal wire to power, I can make the servo move)
  • ZackaryZackary Posts: 10
    edited 2006-01-13 03:14
    If anyone knows PIC assembler, I have·attached·my code.

    Thanks in advance!
Sign In or Register to comment.