Newbie - HS-311 Servo 360 Continuous Rotation help

Hello all,

This is my very first post so please be gentle.

I have started to tinker around with servos and got hold of a couple of hitec hs-311 standard servos from fleabay. I found that I can mod them using an online tutorial which was simply taking it apart, finding the center point adjusting the pot and then cutting and gluing in place. Then snipping the bit on the gear.

Anyway, I did all that and went to plug it in and I can confirm it can now do 360. But it doesn't stop... it goes round and round even when I play around with the servo example sketches and adjust angles etc etc.

Any help would be greatly appreciated. As I said I am new to this so this is all learning for me.

OK so update time....

I have found a wiring diagram that was different to my set up. I have followed that and have new results. Now when I run the sweep example all I get is a "hum" from the servo and no movement.

Now I am going to look inside to make sure I haven't chewed up the gears from previous tests.

Still would like advice please.

Nothing wrong with the gears.

Here is my setup:

Arduino Uno R3
Breadboard
9V battery
HS-311 Servo (modded)

I have the 9v on the breadboard power rail
I have earth over to earth to the servo
I have earth over to earth on the arduino uno
I have live over to live on the servo
I have signal from the servo on the breadboard to pin 9 on the arduino

I load up the standard sweep sketch and I get 6 full revolutions of the servo, it stops for a split second and starts again in the same direction. And that repeats.

Now I am totally baffled.

What position did you leave the pot in when you modded it?
Zoomkat has a useful sketch he posts to allow keyboard controllers of a servo.
Have a hunt around for it.

fusion1275:
Nothing wrong with the gears.

I can't say as to why you are getting the results in your last post, but as far as you first post...

The modification you performed was not to make it a "positionable 360 degree servo" - it was to make it a "continuous rotation servo" - aka, a gear-motor (alright, one with built-in h-bridge, simplified control scheme, and a bit of speed control).

If you set the potentiometer properly, then using the standard Servo library, "90 degrees" should keep it close to "non-moving" (you may either have to adjust the potentiometer for this to be perfect, and/or some settings in the library as well - they vary servo-to-servo). Setting it to "0 degrees" will cause it to rotate at it's fastest speed in one direction, and setting it to "180 degrees" will cause it to rotate at it's fastest speed in the opposite direction.

To obtain what you seem to have wanted (a true 360 degree positionable servo), you would typically need to get a "sail winch" servo (which tend to be larger than regular servos - though I haven't looked lately; maybe they make smaller ones now?), which can typically rotate multiple times - but eventually will come to a stop. You can also get "extended travel" servos, which have the ultimate end-stops in such a location so that you can -almost- get 360 degrees. For both of these servos, you need to either use what is called a "pulse stretcher" - or mod the Servo library settings to allow for the greater travel (in your case, the latter would likely be best).

For a "true" 360 degree positionable servo - you may want to look into something like a Dynamixel AX-12 or similar digital bus servo; you can't use the Servo library for these servos (I'm honestly surprised that nobody has made extensions to allow for it) - they use a special serial bus protocol to operate (I'm sure there is a standalone library for the Arduino to communicate with them, though); but what you gain is programmability, feedback and higher precision (they are essentially like a continuous rotation servo that is more accurate, with a high-precision encoder for position control and feedback. They aren't cheap, though.

Code for testing and setup of servos. For my DIY continous rotation servos I send a 1500us position signal to the servo and tweek the pot until the motor stopps turning, then secure the pot in place. the below sail servo might be of interest, but is $$$.

http://www.robotshop.com/ca/hitec-hs785hb-servo-motor-2.html

// 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);  //the pin for the servo control 
  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 Guys,

I would just like to firstly say thank you for your help so far. It has been quite taxing trying to understand all of this I must admit.

Let me reply to you:-

AWOL - When I did the mod, I set the servo running on the "knob" sketch and using the code mentioned in the comments here in the instructions.
Imgur

When the servo was running I got a tiny flat head screwdriver, turned the potentiometer either ways until I got to a 0 point where the gears stopped moving in either direction.

Then I disconnected it, snipped it, glued it and let it set.

Then plugged it in and here I am, scratching my head :slight_smile:

cr0sh - Now that explains a lot to me. Seems I have been barking up the wrong tree for what I am actually needing. I knew it was able to be continuous but was not aware that I could not control the servo in degrees of motion now. Buying some expensive servo is not on the list at all.

What would happen if I had the servo, instead of playing around with the potentiometer, all I did was cut the "stop" off the gear and put it back together again? That would open it for 360 rotation and I would still of been able to control it via sketches? Right or Wrong??

zoomkat - Yikes that looks complicated. Im still learning this stuff so I will have to break that down and see how I go about using it. Thank you very much for providing it.

Basically what I am after is getting my HS-311 servo to be able to turn 360 degrees but also I am able to program/control its motion via sketches using the arduino IDE and eventually Processing. But thats a long way away it feels right now.

Cheers

fusion1275

9V battery

If this is a transistor radio type 9v battery, it is probably pretty much already dead. How are you trying to power the servo?

Here is the battery I am using:

I check via a multimeter if there is still life in it. If its dead I just swap it with the other one I have on charge. (saves cash!!)

As for the setup. Please refer to my description in a post above. I have the 9v on the power rail on the breadboard and the servo is wired into that. Ground is also on the same power rail and it is wired to the gnd pin on the arduino. The signal is from the breadboard (yellow wire from servo) to D9 on the arduino.

Hope that makes sense?? Actually hard to describe in detail with words.

What would happen if I had the servo, instead of playing around with the potentiometer, all I did was cut the "stop" off the gear and put it back together again? That would open it for 360 rotation and I would still of been able to control it via sketches? Right or Wrong??

If you remove the stop, the servo will be 'stopped' by the potentiometer which will probably break. Or perhaps you will strip some gear.
You have not indicated the nature of your application. Perhaps a stepper motor is a better choice. You can also buy gear boxes that extend the range of hobby servos but they tend to be expensive. Check out stepper motors.

Hi Joe, thanks for the reply.

My project at the moment is a very simple one.

I have the 2 DOF pan and tilt brackets which requires 2 standard size servos. For the bottom servo I want 360 rotation which will be controlled manually (eventually). For the top servo I want just the normal 180 degree motion. So an everyday servo would suffice for this.

http://www.google.co.uk/imgres?um=1&hl=en&safe=off&sa=N&tbo=d&biw=1920&bih=912&tbm=isch&tbnid=3mcqKTEE6SctbM:&imgrefurl=http://www.goodluckbuy.com/2-dof-long-pan-and-tilt-robot-joint-with-mg995-servos-sensor-mount-kit-for-arduino-robot.html&docid=uTvts9z2yNdBqM&imgurl=http://www.goodluckbuy.com/images/detailed_images/sku_84803_2.jpg&w=600&h=600&ei=N0X7UPCYIaS80QXQ44HQDA&zoom=1&iact=hc&vpx=1658&vpy=112&dur=4&hovh=225&hovw=225&tx=200&ty=116&sig=117312181707956783316&page=1&tbnh=140&tbnw=140&start=0&ndsp=55&ved=1t:429,r:10,s:0,i:112

Sorry for the craaaazy long URL

If you remove the stop, the servo will be 'stopped' by the potentiometer which will probably break.

The pots in the servos I've modified haven't had stops. They relied on the gear stop. Typical servo wiring. Most servos are rated for 6v as normal max voltage value.

zoomkat, Thanks for that and the illustration. Pictures are always good.

Just out of interest... I have a motor shield with 2x servo contacts on it. I havent opened it up yet as I have spent my time looking inside the servo. Would the shield get the current needed to run the servo or do I still need an external power source?

If I do need an external source, what is everyone using? Is it one of those plastic 4xAAA battery packs??

Thanks for your help

Is it one of those plastic 4xAAA battery packs??

Most use external power supplies with regulators or UBEC type devices. A four cell battery holder with rechargable batterys should be a reasonable starting point.

You might consider Dynamixel servos which claim 300 deg or continous and provide position feedback. Popular in robotics, they use serial communications.

Or you can resort to extra gears such as
http://www.servocity.com/html/spg400a-360_360o_rotation.html

zoomkat:
Code for testing and setup of servos. For my DIY continous rotation servos I send a 1500us position signal to the servo and tweek the pot until the motor stopps turning, then secure the pot in place. the below sail servo might be of interest, but is $$$.

http://www.robotshop.com/ca/hitec-hs785hb-servo-motor-2.html

// 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);  //the pin for the servo control
 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
 }
}

This code works great! Just purchased a HS-311 from ServoCity and it had a POT. I had no idea what it did and now I see it simply sets the STOP point depending on the value inputted from the keyboard. Thanks for this.

If you remove the stop, the servo will be 'stopped' by the potentiometer which will probably break. Or perhaps you will strip some gear.

The pots in the servos I've taken apart and modified do not have stops. The only mechanical stop has been the plastic tab on the output shaft. Soon I plan to just remove the servo plastic stop tab and then do some testing with the servo.

A HITEC HS-311 is rated for 4.8V-6V. As you mentioned that you have provided with 'live' , which I am assuming is 9V, you might have probably damaged the HS-311 circuit. You should connect the 9V to the Vin of the Arduino and 5V of the Arduino to the 'live' of the Servo Motor.

Please guide me i am using Hitec hs 311 but it only goes toward a angle 180 degree whatever the input is and cannot goes to a angle which i desire i have tried different codes but problem is same help me please.
i am using arduino uno r3 board :disappointed_relieved:

and cannot goes to a angle which i desire

Most continuous rotation servos can not be commanded to stop at an "angle".