Speed = (old pos - new pos)/time

Hi, I am having trouble getting my micro serial servo controller to arrive at a set position at a specified time. If I want to move from 1000 to 3000 in 3 sec, how does this equate to my speed values from 0 to 127 ? 3000 - 1000 = 2000 / time (3000 millis) = .6667 to set my speed to achieve this do I 128 x .6667 = set speed to 85. This doesn’t seem to be right, can you give me any pointers.
Cheers Conor


The calculation you are doing is not valid. When you say 1000 to 3000 you aren’t saying what units you are using. Do you mean 1000 to 3000 microseconds? That would be the only reasonable unit you could use for most hobby servos. If you are talking in microseconds, it doesn’t make sense to divide by milliseconds.

The information you need to do this calculation correctly is available in the user’s guide.

You want to move 2 milliseconds in 3 seconds. This is 666 microseconds/second. From the user’s guide a speed of 1 is 50 microseconds/second and a speed of 127 is 6350 microseconds/second. Assuming the speed is a linear function, (6350 - 50) / 127 is about 50 microseconds / second per speed increment. 666/50 = 13.32. So you should set your speed to 13 or 14.

- Ryan

Thanks very much Ryan.