# 4WD Servo speed

Hi everybody,

I’m quiet new in Arduino World so that i have a few questions.
I have modified 4 Servos buyed in Germany from conrad with the name RS 2 JR and i have one Arduino 2009 Board.
I removed Pots and put 2 x 2.7KOhm resistor to get my Servos driving.

Result:
Servo Standing:
Servo1 = 65
Servo2 = 65
Servo3 = 66
Servo4 = 64

I actually thought that the Degree where my servos are still had to be somewhere between 80-90 degrees.
My Servos are still with cca 60 Degrees.
Wenn i opened Servos i so that the plastic barier is allowing cca 120 Degrees (i removed this).
Can it be that my servo was made to go 120 Degrees instead 180 and that now i have a middle point at 65 ?

Second Problem i so is that those servos are not spinning with the same speed!
Its allmoust the same speed but not exactly the same.
How can i make them turn exactly the same speed?

Here is my Code I am using:

//**********
#include <Servo.h>

#define FRONTLEFTSERVOPIN 3
#define FRONTRIGHTSERVOPIN 11
#define BACKLEFTSERVOPIN 6
#define BACKRIGHTSERVOPIN 9

Servo frontLeftServo;
Servo frontRightServo;
Servo backLeftServo;
Servo backRightServo;

int robotSpeed = 100;
int rightSpeed = 100;
int leftSpeed = 100;

int delayParam = 50;

void setup()
{
robotSetup();
}

void loop()
{
goForward();
delay(delayParam * 100);
goStop();
delay(delayParam * 100);
goBackward();
delay(delayParam * 100);
goStop();
delay(delayParam * 100);
goLeft();
delay(delayParam * 100);
goStop();
delay(delayParam * 100);
goRight();
delay(delayParam * 100);
goStop();
delay(delayParam * 100);
}

void robotSetup(){

setSpeed(robotSpeed);
pinMode(FRONTLEFTSERVOPIN, OUTPUT);
pinMode(FRONTRIGHTSERVOPIN, OUTPUT);
pinMode(BACKLEFTSERVOPIN, OUTPUT);
pinMode(BACKRIGHTSERVOPIN, OUTPUT);

frontLeftServo.attach(FRONTLEFTSERVOPIN);
frontRightServo.attach(FRONTRIGHTSERVOPIN);
backLeftServo.attach(BACKLEFTSERVOPIN);
backRightServo.attach(BACKRIGHTSERVOPIN);

goStop();
}

void setSpeed(int newSpeed)
{
setSpeedLeft(newSpeed);
setSpeedRight(newSpeed);
}

void setSpeedLeft(int newSpeed)
{
if(newSpeed >= 100)
{
newSpeed = 100;
}
if(newSpeed <= 0)
{
newSpeed = 0;
}

leftSpeed = newSpeed * 0.65;
}

void setSpeedRight(int newSpeed)
{
if(newSpeed >= 100)
{
newSpeed = 100;
}
if(newSpeed <= 0)
{
newSpeed = 0;
}
rightSpeed = newSpeed * 0.65;
}

void goForward()
{
frontLeftServo.write(65 + leftSpeed);
frontRightServo.write(65 - rightSpeed);
backLeftServo.write(67 + leftSpeed);
backRightServo.write(64 - rightSpeed);
}

void goBackward()
{
frontLeftServo.write(65 - leftSpeed);
frontRightServo.write(65 + rightSpeed);
backLeftServo.write(66 - leftSpeed);
backRightServo.write(64 + rightSpeed);
}

void goRight()
{
frontLeftServo.write(65 + leftSpeed);
frontRightServo.write(65 + rightSpeed);
backLeftServo.write(66 + leftSpeed);
backRightServo.write(64 + rightSpeed);
}

void goLeft()
{
frontLeftServo.write(65 - leftSpeed);
frontRightServo.write(65 - rightSpeed);
backLeftServo.write(66 - leftSpeed);
backRightServo.write(64 - rightSpeed);
}

void goStop()
{
frontLeftServo.write(65);
frontRightServo.write(65);
backLeftServo.write(66);
backRightServo.write(64);
}
//**********

You may be able to get finer control using the "writeMicroseconds" Servo object method. Just noticed that you can use pulse widths directly with the Servo::write method. Valid pulse widths start at 544us up to 2400us[/edit]

Each servo will have a slightly different point when they are at rest. When I have modified servos in the past I have used a variable resistor to trim the point. You can then change the resistence with the VR till they are stationary at 90.

Replace the resistors with a single variable resistor. Use the center tab of the VR where you connect the two resistors together and the outer tabs for the other connections. I glued the VR to the outside of the case so I could easily adjust it. I cant find a link to detailed instructions and cant remember off hand what value the VR should be. I think I used a 10k VR.

Gordon

@AWOL OK. THX i will try it tonight.

@Gordon Nice Idea but I opened my servos allready 3 times so i dont want to do any adjustment anymore. Those servos are not really quality ;-)

With my next servo mod i will leave the original Pots and just put them at middle point, cut a head and glue it with plastic gun i think.