Servo movement speed

Hi gang...

Servo movement speed seems to be an intrinsic characteristic of the model of servo.

So, if I want to slow the movement, I guess I have to cheat. I could calculate, for example, the number of degrees to move and then use some simple loop delay approach. On the face of it that would work, but calibration will be a pain in the @$$.

Are there any standard techniques for controlling the speed of a servo?

Are there any standard techniques for controlling the speed of a servo?

Not that I know of - all I've seen is your suggested delay loop, or derivatives of blink without delay.

Are there any standard techniques for controlling the speed of a servo?

Not built into the servo library. Using simple time delays as you describe will work if you are using just one servo and there is nothing else in the main sketch that needs servicing faster then the use of the blocking delay() statements. If you use millis() for tracking elapsed time you can avoid the blocking action of delay() and control the speed of many servos as well as assuring your main loop cycle time is fast enough to handle all else you are doing. See the blink without delay sketch example for how that method can be applied.

There has been a poster (or two?) that said they are working on modifying the servo library (or writing a new one) to use a optional velocity value for the servo.write() command. That would be very useful.

Lefty

Thanks guys

You might check the below discussion.

http://arduino.cc/forum/index.php/topic,61586.0.html

Thanks zk....

If anyone's interested here's why I want to control the speed. I set myself a rather academic exercise, to move a laser pointer along a wall at constant linear speed. Of course with constant angular speed, the linear speed increases at the sides. The incremental angle dtheta subtends a smaller distance along the wall when it's normal than it does at the sides.

If my calculus is right, for constant linear speed I get that

dtheta/dt = k cos[sup]2[/sup]theta

With theta = 0 (beam normal to wall), cos theta is 1 and dtheta/dt is maxed, and it decreases towards the side.

(Even if the maths* is wrong I know qualitatively that the angular speed needs to be maxed when the beam is normal to the wall and decreases towards the sides :P)

  • or math singular depending on where you live...

Old Georgia Tech football game cheer: "dy..., dx..., to hell with that, we want sex!"

I'm guessing you didn't major in poetry.... :wink:

You can write a script in an array to control the speed every 70ms.
http://arduino.cc/forum/index.php/topic,85335.45.html
Reply #48

See the example code. Use Excel to calculate 1/speed that you want.
The same script will drive a geared stepper motor which would be just as smooth.