Servo's speed

Hello :) I searched for the same topic, as I am going to write, but I didn't find. So, I am going to do a robot and I need to change the speed of micro servo motors. I am using these micro servos: http://cgi.ebay.com/2X-Micro-9g-Servo-Futaba-Hitec-HS-55-GWS-walkera-RC-/290498904979?pt=Radio_Control_Parts_Accessories&hash=item43a3158393#ht_2675wt_1139

So, is there any possibility to control these micro servos speed?

Thanks for answering

Generally you don't control the speed of a servo. You can adjust the voltage slightly to make it run faster or slower but generally this is not an option.

Thanks for quick replay!

Another approach is to slice its movement up into small pieces, and spread those out over time. That is what I do for my hexapod.

I am thinking about this too. Could you give me some example, how does it look like?

thanks!

Could you give me some example, how does it look like?

Well, at its simplest, it is just a "for" loop with a delay.

for (int i = startAngle; i < endAngle; ++i) [
  myServo.write (i);
  delay (someDelayTime);
}

where someDelayTime is something like (totalTransitTime / (endAngle - startAngle)), though this simple method doesn't always work well for multiple servos.

And I did it slightly differently. I calculate where I want the servo to be every 20ms. I tell the servo to go there, and then wait for the next 20ms slick to come by.

This timing matches the frequency of the signal being sent to the servo, so it is about as smooth as a typical hobby servo can be.

Let me push a bit of code through and connect a servo, and I will show you what I mean.

The below might be of interest:

http://arduino.cc/en/Tutorial/Sweep

There is an established library available for the Arduino for controling servo speed. It can be found at: http://rapidshare.com/files/425318464/VarSpeedServo.zip.

I recently finished a project to control 7 RC servos to open and close model railroad turnouts (slowly, instead of snapping open and close) with this library as the core of the code.

Hope this helps!

David G.

I just wrote this after cobbling together several different sketches I found on the web and it seems to work fairly well:

// 4 button 2 servo controller w pot slew v 3.d
#include 

  Servo servo1;          // define servo aliases
  Servo servo2;
  #define leftPin 2        // define buttons attached to pins
  #define rightPin 3
  #define upPin 4
  #define downPin 5
  int pos1 = 90;          // set angle when inialitized
  int pos2 = 135;
  
     #define POT 3        // pot to analog pin 3
     int potValue = 0;    // variable for pot value
                          
void setup()
{
  servo1.write(pos1);  // Put servo1 at home position 
  servo2.write(pos2);  // Put servo1 at home position 
    
  servo1.attach(10);    // attaches the servo on pin 9 to the servo object
  servo2.attach(9);     // attaches the servo on pin 10 to the servo object

  pinMode(leftPin, INPUT);   
  pinMode(rightPin, INPUT);  
  pinMode(upPin, INPUT);     
  pinMode(downPin, INPUT); 
}

void loop()
{
//pot control  
  {
      potValue = analogRead(potValue);                // reads the value of the potentiometer 
                                                      // (value between 0 and 1023)
      potValue = potValue/4;                          // convert from 0-1023 to 0-255
       
  }
// left/right servo control
  if(digitalRead(leftPin) == HIGH)        // left button instructions  
  {
   // in steps of 1 degree
   if( pos1 > 0)
    --pos1;
    servo1.write(pos1);         // tell servo to go to position in variable 'pos1'
    delay(potValue);              
  }
  if(digitalRead(rightPin) == HIGH)       // right button instructions  
  {
   if( pos1 < 180)
     ++pos1;
    servo1.write(pos1);         // tell servo to go to position in variable 'pos1'
    delay(potValue);   
   }

// up/down servo control  

   if(digitalRead(upPin) == HIGH)         // up button instructions  
   {
   // in steps of 1 degree
   if( pos2 > 0)
    --pos2;
    servo2.write(pos2);         // tell servo to go to position in variable 'pos2'
    delay(potValue);              
   }
   if(digitalRead(downPin) == HIGH)        // down button instructions  
   {
   if( pos2 < 180)
     ++pos2;
   servo2.write(pos2);       // tell servo to go to position in variable 'pos2'
   delay(potValue); 
   } 
}

At first it was written so a numerical parameter was inserted in the int potValue = 0; section but my need requires me to adjust the speed on-the-fly.

I can send you the numerical sketch is you wish.

This sketch controls two servos but it can be pared down if needed.

Good luck.

Peace.

Hi everyone!!! Currently i am trying to use RC transmitter to control the speed of my servo from moving from left to right... Is this possible? & how would i going to write my code? Hope any kind soul will reply my question... Thanks!!! :)

Currently i am trying to use RC transmitter to control the speed of my servo from moving from left to right... Is this possible?

Yes.

how would i going to write my code?

Using the IDE works for most people. If you don't like it, you can use any external editor you like.