Servo Jumping/Jitter

alhoop

Member
I have read several posts here on the forum about servo jitter when using a Picaxe.
I am using a 08M2 to control a model railroad semaphore with a servopos value of 80 to drive the servo to the up or 0 deg position, a value of 90 to go to the 45 deg position and a value of 100 to go to the 90 degree position.
I was having trouble with the servo jumping once every 28 seconds(regular as clockwork) in the servopos 80, hardly ever in the servopos 90, and every 10-20 seconds in the servopos 100 position.
I found this on another forum"
http://letsmakerobots.com/node/3541?page=2
The sertxd command completely stops the jitter - I didn't try setting the servo line low after each servopos command, I'll just go with the sertxd command. Not elegant I know but I have plenty of memory.
Al
Added 5-01-14
Code:
'semaphore program
;08m2
symbol cnt = b0:symbol temp = b1
symbol up = b2
symbol lev = b3
symbol dwn = b4
servo 2,125
temp = 125:up = 125:lev = 140:dwn = 150
start:
;down red
if pinc.4 = 1 then div
high c.1:low c.0
if temp = dwn then cont
if temp = lev then 
for cnt = lev to dwn
servopos 2,cnt:pause 100:next cnt
else for cnt = up to dwn:servopos 2,cnt
pause 100:next cnt
endif
temp = dwn
cont:
servopos 2,dwn
pause 100
goto start
;up
div:
if pinc.3 = 1 then st
high c.1:high c.0
if temp = lev then cont1
if temp = up then
for cnt = up to lev :servopos 2,cnt:pause 100
next cnt
else for cnt = dwn to lev step - 1
servopos 2,cnt:pause 100:next cnt
endif
temp = lev
cont1:
servopos 2,lev
pause 100
goto start
;level yellow
st: 
high c.0:low c.1
if temp = up then cont2
if temp = lev then 
for cnt = lev to up step -1
servopos 2,cnt:pause 100:next cnt
else  for cnt = dwn to up step - 1
servopos 2,cnt:pause 100:next cnt
endif
temp = up
cont2:
servopos 2,up
pause 100
goto start
Back again with the same problem - jumping every 22.67 seconds . This sets a semaphore up if a turnout is thrown for a straight route, set at 45 degrees if the turnout is thrown for diverging route and sets horizontal if the block ahead is occupied.
The code under Div: seems to be the worst offender: Reading here and on the net this seems to be a common problem.
Al
 
Last edited:

flyingnunrt

Senior Member
Although this won't fix your jitter problems, however
the values you are using for servopos seem to be a bit narrow.
The servo may be more stable if the range was say 100, 150, 200
 
Top