Problems controlling a 1 Turn Servo

Hi.

I have a servo that can do 360º (not a modified servo continuous rotation). It's called a 1T servo (there are also other models that can do six turns). From the manufacturer:

"The GWS S125 1T 2BB Sail Winch Servo is a unique servo (typically used for radio control sail boats) that can rotate a full 360 degrees, rather than the typical range of less than 180 degrees for most servos."

The problem is I'm trying to use the knob program with it. I thought it would be as easy as modifying the sketch to map the pot, instead of 180º, to 360º. It turns out, it's not that simple... When connected to a potentiometer, it behaves like a madman on crack.

Basically, what I want to do is have a full turn pot connected to a full turn servo. If this doesn't work, I'll have to use a dc motor and a PID, I guess.

Any ideas or experience with this kind of servo?

When connected to a potentiometer

How are you connecting it? What code are you running?

It should be simple enough to do.

Below is a servo test program I made with the help of others. Be aware that multiturn servos still use the same pulse duration range as standard servos (0-180deg or ~500-2500 us pulse duration), as they are used with standard RC equipment. You should be able to test your servo using this. also be aware that servos usually do not perform well if you try to power them from the arduino +5v pin, they need their own seperate power supply.

// zoomkat's servo test setup using serial monitor 7/29/10
// key in a position between 0 and 180 followed
// by a period, then click send or hit enter key

#define MAX_LINE 20
boolean eol = false;

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

void setup()
{
      Serial.begin(9600);
        myservo.attach(9);  // attaches the servo on pin 9 to the servo object 

}

void loop()
{
        char line[MAX_LINE + 1]; // must be at least 1 char > MAXLINE

        //do something other than waiting for serial transfer
      if (lineAvailable(MAX_LINE,line))
      {
        Serial.write(line);       // echo back the line we just read
        Serial.write("\r\n");

          int     n;
          n = atoi(line);  //apparently converts string into number

         myservo.write(n);   // tell servo to go to position in variable 'pos' 
         
         eol = false;               // get ready for another line
                 
      }
      //do something other than waiting for serial transfer
}

boolean lineAvailable(int max_line,char *line)
{
      int c;
      static int line_idx = 0;
      if (max_line <= 0)    // handle bad values for max_line
      {
        eol = true;
        if (max_line == 0)
          line[0] = '\0';
      }
      else                // valid max_line
      {
        if (Serial.available() > 0)
        {
          delay(15); 
            c = Serial.read();
          if (c != -1)  // got a char -- should always be true
          {
            //if (c == '\r') //use with terminal programs and such
                if (c == '.')  //use with the serial monitor
              eol = true;
            else
              line[line_idx++] = c;
            if (line_idx >= max_line)
              eol = true;
            line[line_idx] = '\0';     // always terminate line, even if unfinished
            if (eol)
              line_idx = 0;           // reset for next line
            }
          }
        }
        return eol;
}

I'm connecting it with the center pot pin to the analog 0 pin on the board. The servo is connected all right (I guess): red to positive, brown to negative, orange to digital 9. I'm powering it with a 12V external power supply (I quickly noticed the USB supply doesn't quite do the job with servos ;) )

I'm using the servo with the knob program, and it's actually working like a DC motor: if I turn the pot in one direction, it'll turn one way, if I turn the pot in the other direction, it'll turn the other way, and go faster if I go all the way on the pot.

I'm really very new to this, but this is the project I intend to build in the end, so I just wanted to try, and to say the least I'm confused...

Zoomkat, I don't really know what to do with your program, but once loaded and running, the servo starts turning counter-clockwise, until I disconnect it.

I'm powering it with a 12V external power supply

Well, if you are supplying the below servo with 12v, I'm supprised it hasn't burned up. It normally uses 4.8-6v.

http://www.pololu.com/catalog/product/522/specs

Zoomkat, I don't really know what to do with your program, but once loaded and running, the servo starts turning counter-clockwise, until I disconnect it.

In my program if you put "90." (without the quotes) in the serial monitor, and send it to the arduino, the servo should position to the 180 deg position. My code assumes the servo control line being used is pin 9 on the arduino.

No, I mean I'm powering the Arduino with the 12V! The servo is getting 5V, and turning allright (quite torquey, actually)

Something you might do (just to eliminate any power issue) is power the servo off its own 4.8-6V supply (-not- the Arduino's 5V regulator)...this may or may not be your issue, but let's eliminate it now.

:)

Okay, it seems it's a known issue with this model:

http://www.youtube.com/watch?v=FQdnpQkhpeg

I took it apart, and sure enough, when I applied a bit of force with my nail, the pinion rotated on its own!

Any advice on how to attach it back together? Superglue comes to mind...

You could clean any oil/grease from the gear/shaft, then try a little super glue inside the gear before putting it on the shaft. Another approach might be to pass a thin piece of thread thru the gear before putting it on the shaft to get a tighter interference fit. Careful as small parts like that can get lost quickly. Also, make sure the gear should fit tightly on the shaft and is not a free spinning idler gear.

Okay, solved! I dunno how long it'll last, but that's another problem...