Pages: [1]   Go Down
Author Topic: Continuous Rotation Servo help!  (Read 2174 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys, I'm new to arduino and for my first project I want to automate my window shutters. I picked up an Arduino Uno + 3 "fitech FS5113R" Continuous Rotation Servos from http://iprototype.nl/products/robotics/servo-motors/servo-360-metal-gear

According to the arduino servo reference guide myservo.write(90) should be the "center" or no movement zone.
myservo.write(0) should be full speep one direction and myservo.write(180) full speed the other direction.

I'm having trouble getting my servos adjusted to come close to being idle when myservo.write(90). Also when myservo.write(0) the servo does exactly what i want it to, which is turn at full speed one direction. but when I set myservo.write(180) to go the other direction it starts to jitter at random intervals and turns the other way for a bit. This is what is driving me insane. I can't seem to figure out why its doing this and why only when I turn counter-clockwise. It does this with all 3 servos.
Here's a video of the jittering http://youtu.be/HKmfJvZoliQ

Any help would be much appreciated!
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9636
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
Any help would be much appreciated!

First you need to show the code you are using (use the # on the tool bar to put the code in a code box). Second, you will need to use the writemicroseconds option or detach the servo to get a stable stopped condition.
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: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
Any help would be much appreciated!

First you need to show the code you are using (use the # on the tool bar to put the code in a code box). Second, you will need to use the writemicroseconds option or detach the servo to get a stable stopped condition.

Right now I'm just using some really basic code just to test the servos. I manually change the myservo.write(180) value form 180/90/0. I've also tried writemicroseconds 1000/1500/2000 with the same results. My biggest issue right now is that whenever i rotate counterclockwise the servo just randomly jitters and turns the other way for a bit before continuing like in the video i posted

Code:
#include <Servo.h>
 
Servo myservo;


 
void setup()
{
  myservo.attach(9); 
  myservo.write(180);
}
 
 
void loop()
{
}
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 67
Posts: 3702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How are your servos powered - hopefully not from the Arduino. Try experimenting with some different values in the call to write - you'll need to do this around 90 to find the exact number that stops the servo, but what do you get for say 135? As zoomkat says though, you may need to do a similar experiment with writeMicroseconds to get precise control.
Logged

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

Right now I'm powering the servo off the 5v lead from an old PC powersuply. I've tried using writeMicroseconds with different values(1000~2000+), with similar results. Also calibrating the servo with the adjustment screw. My biggest issue is the random servo jitter when rotating counter clockwise like in the video, why would it randomly get "confused" and start turning the otherway before continuing turning again repeatedly?
« Last Edit: April 18, 2012, 08:11:17 pm by dcptn » Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 206
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looked at your video and it looks like there might not be a common ground between the arduino and the breadboard where the servo hooks up.

In other words the Arduino , servo , and the power supply must have their grounds shared.
« Last Edit: April 18, 2012, 09:11:45 pm by justone » Logged

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

You're right! I'm going to give it another try when I get home from work later tonight.
Logged

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

I'm sorry I am so late to this conversation. I have the same exact issue. When rotating my servo < 90 or < 1500 (microSeconds) my servo studders terribly. Going > 90 or > 1500 it is smooth or at least not noticeable.

Did you ever get your issue resolved. I'm at a loss as to what to do I have tried the most basic of applications and both write and writeMicroseconds with no resolve.
Logged

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3032
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Most servos do not actually go to 180 degrees.   Most of mine have a range of only about 140 degrees.

For some annoying reason,  the specs of the servos never say this. smiley-mad

You need to do some experiments to find how far yours will actually go,  and then only drive them that far.
Logged

0
Offline Offline
Shannon Member
****
Karma: 207
Posts: 12200
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Most servos do not actually go to 180 degrees.   Most of mine have a range of only about 140 degrees.

For some annoying reason,  the specs of the servos never say this. smiley-mad

You need to do some experiments to find how far yours will actually go,  and then only drive them that far.

Perhaps you could contemplate the meaning of "continuous rotation" a bit more!!
Logged

[ I won't respond to messages, use the forum please ]

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

First you have to calibrate your servo if you want to know what the rest position is. I have just done this manually before

put a 1 second delay start at 70 and increment until you see it stop and notice when it starts back up

you could write code to do this for you reading the voltage difference across a shunt resistor that is between your servo and the ground (you connect A0 to the front of the resistor and tie your arduino ground after the resistor) then tyring various values until you arrive at the lowest current draw

that way you could have it calibrate every once in a while

the jitter is part of the booting up process, some people have said putting a resistor somewhere in the line (i dont remember where) can help with that but the way I deal with it (which may or may not seem hacky) is to put the servo on a relay and be sending the pwm signal you want to it before you turn the relay on. This should ensure that you are getting the rotation you desire and I do not notice any jittering when I power it up after starting the pwm signal)
Logged

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

Hi guys,

I would recommend you to take a look at the Servo.h library. the servos may not turn full 180 degrees because the library constrains the input of microseconds from 544 to 2500.
My servos had the same problem, I had to experiment with it for a little while until i found out that the range of my servos in is from 500 to 2600 microseconds, than it turned ~ 185 degrees
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9636
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Simple servo test code you can use with the serial monitor to test the servo setup.

Code:
// 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
  }
}

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: