Continuous rotation servo jerks every 2 seconds- 20X2

Dave E

Senior Member
Hello all,
I am experimenting with a continuous rotation servo and noticed that when running it at slow speed, 150 +- 10, I notice a jerk about every 2 seconds.
My 'scope shows what looks like a longer pulse every 2 seconds but I am not able to actually capture the odd pulse.

My code is:
SERVO 0, 150 (SET TO STOP AT 150)
DO
SERVOPOS 0, 155
LOOP

I assume that it has something to do with the internal timer since it repeats every 2 seconds but was wondering if it is possible to eliminate the issue.

Another observation:
When setting the servo to stop at the 1.5 millisecond pulse (servopos 0, 150), I can get it to stop but every 2 seconds the servo moves very slightly forward then back. However, if I add a PAUSE statement after the SERVOPOS statement, the frequency of the jerk decreases. Using PAUSE 10, the jerk happens about every 6 seconds, PAUSE 20 - jerks every 30 seconds. Using PAUSE 50, I do not see the jerking motion at all.

I am pretty sure the two are related and assume that it has something to do with the internal timer.

Anyone else ever see this issue? Any ideas or explination?

Thanks for any input.
Dave E
 

goom

Senior Member
You do not need to put the SERVOPOS in a loop. Once you issue the command, it will output the required pulse every 20ms until you issue another SERVOPOS command. Try putting the loop after the SERVOPOS command (just to stop the program ending).

SERVO 0, 150 (SET TO STOP AT 150)
SERVOPOS 0, 155
DO
LOOP
 

Dave E

Senior Member
Thanks for the reply, goom.

When coded as you listed, the "jerk" happens about every second. However, if I add PAUSE 10 after SERVOPOS, the issue does not show up.

Dave E
 

goom

Senior Member
Perhaps it is something to do with the loop structure. Normally there is some conditional part to it to exit the loop. What if you just try a go to instead?
SERVO 0, 150 (SET TO STOP AT 150)
SERVOPOS 0, 155
DontStop:
GOTO DontStop:
 

Haku

Senior Member
A few of us have noticed glitching servos when using the servopos command, one workaround is to use the pulsout command but it needs to be continually used or the servo will stop being active - unmodified servos won't hold their position and continuous rotation servos will stop rotating.
 

Dave E

Senior Member
Had some issues at work today so I spent most of the day there.

Goom, you may be onto something there. I ran the code and it jerked twice then ran smooth after that. But, when I changed the speed to 153 from 155 the jerk per second returned.

Haku, Thanks for the info. The reason I am using a Picaxe for this "project" (robot car) is because of the ability to run a servo continuously without the update i.e. in the background. I am currently using another micro that does not have that ability. I may use a larger Picaxe for the whole project or a smaller one for a serially comunicated servo controller.

As things stand now it looks like the SERVOPOS command works OK as long as I add a large PAUSE after it. It may turn out that as I write the code, I may be able to eliminate the PAUSE.

Dave E
 
Top