increasing servo start position error using a series of steps
graffix
Posts: 389
I wrote a quick code for increasing the step pattern of a servo.As the program progresses through the start position moves slightly.Any ideas how to correct this cumulative error?I suspect its a timing problem.I tried adding an extra pause in different spots with different values,but it effected the step speed.
FYI:the test servo is not a parallax brand
' {$STAMP BS2} ' {$PBASIC 2.5} ramp_start_end_position VAR Word FOR ramp_start_end_position = 175 TO 1120 PULSOUT 15, ramp_start_end_position PAUSE 20 NEXT FOR ramp_start_end_position = 175 TO 1120 STEP 2 PULSOUT 15, ramp_start_end_position PAUSE 20 NEXT FOR ramp_start_end_position = 175 TO 1120 STEP 3 PULSOUT 15, ramp_start_end_position PAUSE 20 NEXT FOR ramp_start_end_position = 175 TO 1120 STEP 4 PULSOUT 15, ramp_start_end_position PAUSE 20 NEXT FOR ramp_start_end_position = 175 TO 1120 STEP 5 PULSOUT 15, ramp_start_end_position PAUSE 20 NEXT FOR ramp_start_end_position = 175 TO 1120 STEP 6 PULSOUT 15, ramp_start_end_position PAUSE 20 NEXT FOR ramp_start_end_position = 175 TO 1120 STEP 7 PULSOUT 15, ramp_start_end_position PAUSE 20 NEXT FOR ramp_start_end_position = 175 TO 1120 STEP 8 PULSOUT 15, ramp_start_end_position PAUSE 20 NEXT
FYI:the test servo is not a parallax brand
Comments
PULSOUT 15, ramp_start_end_position
PAUSE 20
That PAUSE has to be 20ms - the PULSOUT time or you'll blow the 20msec period.
*** You likely need to loose a few msec for code execution time, too, a little 'fudge factor'.
So you PAUSE for 20msec - the time of the PULSOUT (previous) - x_msec (2-3?)
I don't have the PBASIC reference here in fron of me (PULSOUT x = ??usec), is it 2?
So the ramp_start_end PULSOUTs should range 500-1000.
PAUSE 17 ought to get you there, +/-.
for b0=1 to 30' adjust this number of loops to make sure the servo has time to return to the initial position
pulsout 15,175
pause 20
next
perhaps writing a whole code that does what I want would help.I was under the impression that the 175 was a start point for the servo.To get a full range of motion in the first loop.I know you dont like doing it.
After my last post earlier I had to go to my real job:)Also that project was how long ago?6months I've remodeled most of the house I just sold.Done major renovations on the house I live in now.While caring for three kids two of which are under the age of two.A blind grandmother who just past away end of August.Amongst other things.Most of the time I'll get ten minutes here and there in between that stuff or lose sleep trying to do it at night after work.yes I forgot some thanks.-1