Pages: [1]   Go Down
Author Topic: Servo movement speed  (Read 872 times)
0 Members and 1 Guest are viewing this topic.
Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 105
Posts: 4660
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

New Jersey
Offline Offline
Faraday Member
**
Karma: 70
Posts: 3726
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 105
Posts: 4660
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks guys
Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9675
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You might check the below discussion.

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

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 105
Posts: 4660
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-razz)

* or math singular depending on where you live...
« Last Edit: December 08, 2012, 11:33:48 pm by JimboZA » Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9675
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 105
Posts: 4660
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm guessing you didn't major in poetry....   smiley-wink
Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Offline Offline
Edison Member
*
Karma: 8
Posts: 1341
If you're not living on the Edge, you're taking up too much space!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Pages: [1]   Go Up
Jump to: