Continuos rotation servos

Hi everybody,

I have two continuos rotation servos to move a structure Arduino is in. My aim is to create a robot and I'm going to succede in the project, but I have problems with these motors.

I read (and experimented) that a continuos rotation servo stop itself from moving when i write 90 (myservo.write(90)), mine stop themselves when I write 92, but only one of them stop, the other continues his movement; it makes some small movements that makes all the structure move. I tried everything without succeding in. If you need the source code, I'll upload it ASAP.

The energy is not supplied from arduino but from an external source (a 9V battery): I connected the ground of the battery to yhe motors and everything to the ground of Arduino and I connected the voltage of the battery to the motors.

Thanks a lot for your help.

Jymmy097.

Do both your servos stop at 92? They may be the same type, but still have a slightly different stopping point. If you can't get them both to stop using degrees, writemicroseconds will give you greater control to fine tune where the exact stop is on each servo.

Below is some test code that you can use to setup your continuous rotation servos. Generally. writeMicroseconds is used with continuous rotation servos for better control. If your servos still have pot adjustment available, then send the servo a 1500us command and then carefully adjust the pot until the motor stops turning. If you still have problems with the servos "creeping" when they should be stopped, then you could incorporate the servo attach/detached functions.

// zoomkat 10-22-11 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// for IDE 0022 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.

String readString;
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {
  Serial.begin(9600);
  myservo.writeMicroseconds(1500); //set initial servo position if desired
  myservo.attach(7, 500, 2500);  //the pin for the servo control, and range if desired
  Serial.println("servo-test-22-dual-input"); // so I can keep track of what is loaded
}

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) {
    Serial.println(readString);  //so you can see the captured string 
    int n = readString.toInt();  //convert readString into a number

    // auto select appropriate value, copied from someone elses code.
    if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

    readString=""; //empty for next input
  } 
}

zoomkat:
Below is some test code that you can use to setup your continuous rotation servos. Generally. writeMicroseconds is used with continuous rotation servos for better control. If your servos still have pot adjustment available, then send the servo a 1500us command and then carefully adjust the pot until the motor stops turning. If you still have problems with the servos "creeping" when they should be stopped, then you could incorporate the servo attach/detached functions.

// zoomkat 10-22-11 serial servo test

// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// for IDE 0022 and later
// Powering a servo from the arduino usually DOES NOT WORK.

String readString;
#include <Servo.h>
Servo myservo;  // create servo object to control a servo

void setup() {
  Serial.begin(9600);
  myservo.writeMicroseconds(1500); //set initial servo position if desired
  myservo.attach(7, 500, 2500);  //the pin for the servo control, and range if desired
  Serial.println("servo-test-22-dual-input"); // so I can keep track of what is loaded
}

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) {
    Serial.println(readString);  //so you can see the captured string
    int n = readString.toInt();  //convert readString into a number

// auto select appropriate value, copied from someone elses code.
    if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

readString=""; //empty for next input
  }
}

Hi,

I've tried the attach/detach option, but it doesn't work (I forgot to put it in the original post). I'll try your solution as soon as I can. Might be the problem caused by the external power?

Thanks a lot!

Jymmy097