Go Down

Topic: Servo motor speed adjust (Read 3 times) previous topic - next topic

zoomkat

Try the "sweep" servo code example to see how it makes the servo move slower than usual.
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

retrolefty

The maximum speed a servo can move is strictly a function of the servo's design and what mechanical load it is attached to. However in your software you can make the servo move slower by issuing smaller step changes in position commands from start to ending desired position, and by waiting the appropriate amount of time between those issued incremental position commands. It would be pretty simple to write a user general purpose function such as:

void moveServo(int finalPosition, int stepTime);


Lefty

oric_dan

Quote
void moveServo(int finalPosition, int stepTime);


The hard part is integrating this thing into the rest of the program, so the updates are made on
nice even 20-msec time intervals, but it doesn't impact operation of other routines. Probably need
a timer interrupt to call the update code.

retrolefty

#13
Nov 15, 2012, 07:12 pm Last Edit: Nov 15, 2012, 07:16 pm by retrolefty Reason: 1

Quote
void moveServo(int finalPosition, int stepTime);


The hard part is integrating this thing into the rest of the program, so the updates are made on
nice even 20-msec time intervals, but it doesn't impact operation of other routines. Probably need
a timer interrupt to call the update code.


The best solution is if the servo library (class) had such a function built into it so that it might be made non-blocking and closely synced up with the automatic servo framing rate being generated so that step change timing could be a even number of frame rates, 1 to 'very slow' . But alas I'm not up to the task as I just play being a programmer on this site, as solder is my real programming language.  ;)

Lefty

oric_dan

luis, what Arduino board are you using?

Go Up