Pages: [1]   Go Down
Author Topic: Continuous servo running irregular at low speed?  (Read 663 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I'm having a problem with my continuous servo's. They move irregular and not smooth, especially at lower speeds.
I apply an external powersource of 6V and use simple code with writeMicroseconds to test it. However, it seems that the servo is accelerating and at a certain point it jumps to a lower speed.

Video of problem explains enough I think: http://www.youtube.com/watch?v=c9VEknZ7IjQ&feature=youtu.be
It's not the problem of the servo being broke, as it happens with multiple.

Hope somebody knows what the problem could be.
Thanks!

Code:
#include <Servo.h>

Servo myservo1;

void setup()
{
  myservo1.attach(9);
}

void loop()
{
  myservo1.writeMicroseconds(1520);
}
« Last Edit: December 08, 2012, 10:10:47 am by Chilus » Logged

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

The myservo1.writeMicroseconds(1520); sets the stop state for the servo and you will have to find the exact microsecond value for each specific servo you use for it's exact stop value. It's nominally 1500 usec but will vary a little + or - for each servo.

Lefty
« Last Edit: December 08, 2012, 11:38:27 am by retrolefty » Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Servo test code you might try to see if the speed issue occurrs with this code.

Code:
//zoomkat 11-22-12 simple delimited ',' string parce
//from serial port input (via serial monitor)
//and print result out serial port
//multi servos added

String readString;
#include <Servo.h>
Servo myservoa, myservob, myservoc, myservod;  // create servo object to control a servo

void setup() {
  Serial.begin(9600);

  //myservoa.writeMicroseconds(1500); //set initial servo position if desired

  myservoa.attach(6);  //the pin for the servoa control
  myservob.attach(7);  //the pin for the servob control
  myservoc.attach(8);  //the pin for the servoc control
  myservod.attach(9);  //the pin for the servod control
  Serial.println("multi-servo-delimit-test-dual-input-11-22-12"); // so I can keep track of what is loaded
}

void loop() {

  //expect single strings like 700a, or 1500c, or 2000d,
  //or like 30c, or 90a, or 180d,
  //or 30c,180b,70a,120d,

  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ',') {
      if (readString.length() >1) {
        Serial.println(readString); //prints string to serial port out

        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);
          if(readString.indexOf('a') >0) myservoa.writeMicroseconds(n);
          if(readString.indexOf('b') >0) myservob.writeMicroseconds(n);
          if(readString.indexOf('c') >0) myservoc.writeMicroseconds(n);
          if(readString.indexOf('d') >0) myservod.writeMicroseconds(n);
        }
        else
        {   
          Serial.print("writing Angle: ");
          Serial.println(n);
          if(readString.indexOf('a') >0) myservoa.write(n);
          if(readString.indexOf('b') >0) myservob.write(n);
          if(readString.indexOf('c') >0) myservoc.write(n);
          if(readString.indexOf('d') >0) myservod.write(n);
        }
         readString=""; //clears variable for new input
      }
    } 
    else {     
      readString += c; //makes the string readString
    }
  }
}

Logged

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

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

@Lefty,  I am well aware of this fact that each servo has it's own stop value, but this was not my problem. My problem occures when I want to drive my servo slowly, so with a value close to the stop value. When I do this it starts of slow but it speeds up which it shouldn't suppose to do. The speed is irregular at almost every speed except for the maximum speed. It's strange, it slows down and speeds up, slows down and speeds up.

@zoomkat, Thanks for the help but the code you gave didn't work.

I figured that it might have to do something with the servo circuit itself. I think the controlling mechanism malfunctioning. It almost seems like the internal capacitor of the servo are getting 'filled' which give the acceleration during the movement. What I did was 'fooling' the servo by the following code:

Code:
void loop()
{
  myservo1.writeMicroseconds(1510);
  myservo1.writeMicroseconds(1505);

}

This resulted into a smooth, slow and steady movement BUT now the servo get's hot after a moment. I think due to the quick sequence of writeMicrosecond commands in the void loop the pulsewidth is being distorted, which causes the pulsewidt to be larger than 2.4ms (basically the limit for every servo).

Any thoughts on this?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Resolved! I guess

The trick with writing the microSeconds in sequence worked.
I also have the feeling that the heat is less when putting the sequence of commands in a for loop
This workaround works good enough for me.

In the end it was a simple solution/trick, but I couldn't find anybody with similar problems.


Cheers,

Code:
void loop()
{
  for (int i=0; i<6; i+=5) {
  myservo1.writeMicroseconds(1490+i);
 
  }
|
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I also have the feeling that the heat is less when putting the sequence of commands in a for loop

Heat? If the servos are hot and not under much load, then you probably don't have the servo and arduino grounds connected together properly.
Logged

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

Pages: [1]   Go Up
Jump to: