Go Down

Topic: Newbie - HS-311 Servo 360 Continuous Rotation help (Read 3859 times) previous topic - next topic

fusion1275

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.
That is the worst idea in the history of entertainment since Abraham Lincoln said, "I'm sick of kicking around the house all day, let's go t

fusion1275

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.
That is the worst idea in the history of entertainment since Abraham Lincoln said, "I'm sick of kicking around the house all day, let's go t

fusion1275

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.
That is the worst idea in the history of entertainment since Abraham Lincoln said, "I'm sick of kicking around the house all day, let's go t

AWOL

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.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

cr0sh


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.
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

zoomkat

#5
Jan 19, 2013, 06:23 pm Last Edit: Jan 19, 2013, 06:25 pm by zoomkat Reason: 1
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

Code: [Select]

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

Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

fusion1275

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.
http://www.flickr.com/photos/randomskk/2569961787/in/photostream/

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  :)


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
That is the worst idea in the history of entertainment since Abraham Lincoln said, "I'm sick of kicking around the house all day, let's go t

zoomkat

Quote
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?
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

fusion1275

Here is the battery I am using:

http://www.amazon.co.uk/Duracell-Rechargeable-9V-batteries-EACH/dp/B0019M8HQM/ref=sr_1_2?ie=UTF8&qid=1358643837&sr=8-2

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.
That is the worst idea in the history of entertainment since Abraham Lincoln said, "I'm sick of kicking around the house all day, let's go t

joe mcd

Quote
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.

fusion1275

That is the worst idea in the history of entertainment since Abraham Lincoln said, "I'm sick of kicking around the house all day, let's go t

zoomkat

Quote
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.

Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

fusion1275

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
That is the worst idea in the history of entertainment since Abraham Lincoln said, "I'm sick of kicking around the house all day, let's go t

zoomkat

Code: [Select]
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.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

joe mcd

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

Go Up