Servos rotating differently

Hello, I modificated my two servos TowerPro SG 5010 to continuous rotation servos. The problem is that I’m planning to use them as wheels for my robot but using Servo.writeMicroseconds() command I can’t get them to rotate at same speed… There’s always one servo which rotates faster… I have been trying to find values for speeds for two hours now… Is there any solution for this?

manic9:
Is there any solution for this?

Well seeing as your trial end error approach didn’t work, the way open to you is probably to fit encoders and measure the actual speeds. Then choose one as the “right” speed and adjust the other one up or down till it’s the same.

I will try to do this, thanks :)

What code are you using? Have you "calibrated" the servos for their no rotation control point?

Code itself is very simple. Their no moving point differ by a bit it is ~2100.

#include <Servo.h>
Servo myservo1;
Servo myservo2;



void setup() 
{ 
    myservo1.attach(9);
    myservo2.attach(10);
    
  myservo1.writeMicroseconds(3000);
  
  myservo2.writeMicroseconds(180);
  
  
    
} 

void loop() {
  
  
  
 
}
  myservo1.writeMicroseconds(3000);
  
  myservo2.writeMicroseconds(180);

Note that the servo library has set low/high defaults at something like 554us on the low side and 2400us on the high side unless you change them in your code. Generally speaking DIY continuous rotation servos with a stop command position adjusted to 1500us will be at max rotation speed at ~1400us and ~1600us. below is some servo test code you might use to identify your current no rotation us value and speed/direction control range.

// zoomkat 3-28-14 serial servo incremental test code
// using serial monitor type a character (s to increase or a 
// to decrease) and enter to change servo position 
// (two hands required, one for letter entry and one for enter key)
// use strings like 90x or 1500x for new servo position 
// for IDE 1.0.5 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.

#include<Servo.h>
String readString;
Servo myservo;
int pos=1500; //~neutral value for continous rotation servo
//int pos=90;

void setup()
{
  myservo.attach(7, 400, 2600); //servo control pin, and range if desired
  Serial.begin(9600);
  Serial.println("serial servo incremental test code");
  Serial.println("type a character (s to increase or a to decrease)");
  Serial.println("and enter to change servo position");
  Serial.println("use strings like 90x or 1500x for new servo position");
  Serial.println();
}

void loop()
{
  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }
  if (readString.length() >0) {
    if(readString.indexOf('x') >0) { 
      pos = readString.toInt();
    }

    if(readString =="a"){
      (pos=pos-1); //use larger numbers for larger increments
      if(pos<0) (pos=0); //prevent negative number
    }
    if (readString =="s"){
      (pos=pos+1);
    }

    if(pos >= 400) //determine servo write method
    {
      Serial.println(pos);
      myservo.writeMicroseconds(pos);
    }
    else
    {   
      Serial.println(pos);
      myservo.write(pos); 
    }
  }
  readString=""; //empty for next input
}

wow this really helped, when I added the range from 400 to 2600 as in your skecth I can actually get same speeds by putting one on speed of 2600 and other on 400... Thanks :)

Hi, it sounds like when you modified the servo, you did not fix the wiper of the feedback pot in the mid position.
Another way to modify is to remove the pot, measure its total value and replace it with two resistors, each about half the value of the total pot.Connect the wiper wire to the junction of the two resistors.

Tom… :slight_smile:

I have set pot to the mid position in both servos. I probably will have to remove it later...

manic9: I have set pot to the mid position in both servos. I probably will have to remove it later...

To calibrate the servo, send it a 1500us command, then very carefully adjust the pot until the servo stops rotating.