Go Down

Topic: Servo movement speed (Read 953 times) previous topic - next topic

JimboZA

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?
"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

wildbill

Quote
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.

retrolefty

Quote
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

JimboZA

"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

zoomkat

You might check the below discussion.

http://arduino.cc/forum/index.php/topic,61586.0.html
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

JimboZA

#5
Dec 09, 2012, 05:25 am Last Edit: Dec 09, 2012, 05:33 am by JimboZA Reason: 1
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 cos2theta

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...
"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

zoomkat

Old Georgia Tech football game cheer: "dy..., dx..., to hell with that, we want sex!"
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

JimboZA

I'm guessing you didn't major in poetry....   ;)
"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

sbright33

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.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Go Up