Hello everyone! I looked through the forums and was unable to find anything on this subject, so I apologize if I missed something. I using an Arduino to control two servos at the moment, and I need to have precise control over the number of degrees they rotate. Currently I am using the MegaServo library on Arduino 0013, on a Duemilanove board. I am using the Mega library because my future plan involves many more servos, and I cannot seem to get the Servo library to work no matter how many times I download it.
Anyway, the question I have is simple. As i mentioned before, I need precise control over my servos, within a degree. I have now tried the HiTec HS-81 servo, E_sky 8g and the JR DS285 (servo we had laying around), and all of these servos dont seem to work the way I expect them to. My code is quite simple
So, this is the max range I can get out of this servo. I "confirmed" the 500 to 2400 range of the pulses by setting the max and min pulses higher or lower by 100 until the servo made funny noises and stuttered. So with the above code I get about 160 degrees of motion. After a similar expirement with the HiTec I found it to have almost the same range, not quite 180 degrees. The JR seemed to only go about 60 degrees.
So , after all that, here is my question. It seems, from my limited experience, that these "typical" servos only have about 160 degrees of motion, so is this the case with most servos? If it is not the case, am I not utilizing the code correctly? I feel like because all three of these servos (the only servos i have tried!) don't exactly map as they should that perhaps I am missing something. Any feedback would be awesome!
Most Hobby servos have the output shaft directly coupled to a potentiometer that provides the positioning feedback the servo's controller needs. Since there's a mechanical limitation to how far a potentiometer can turn since the wiper has to sweep through an area, there's a mechanical limitation to how far the servo can turn. Also, hobby servos are typically used to push/pull linkages, and in that configuration the servo arm will pass center and potentially bind the entire mechanism if it turns more than 180, so the limitation is sort of a good thing.
As far as getting around this, you may be able to find servos with a larger range of motion, or you could add a bit of downstream gearing, but that will cost you precision (since a given range of input values will be mapped to a larger mechanical range) and accuracy (since additional gear-gear interfaces after the feedback potentiometer will introduce gear-lash).
You may need to roll your own solution with encoder-calibrated stepper motors or somesuch if you need large range and close precision.
It's possible that the reason you're having problems with the Servo library in 0013 is that it has bugs. Have you checked the revision history for recent fixes?
On Linux, it's easy to keep two versions of the IDE side-by-side. If that's also the case on the OS you're using, you could try installing 0015 to see whether that fixes your problems, but still be able to fall back if it causes new ones.
Clarence, I don't think you will get an accuracy of one degree from a hobby servo. The internal potentiometer the servo uses for positional feedback has nowhere near that kind of accuracy. What are you making?
To answer your question, hobby servos are typically used in radio control applications over a much more limited range, typically 1000 to 2000 microseconds which is not much more than 90 degrees. There is no standard for how much angle a servo will turn for a given pulse width and as you have found, they will vary. I realize that the Arduino servo documentation makes it look like they should turn 180 degrees but because this may not be the case I will suggest to the Arduino team that they amend the wording so it is clearer
The reference says:
Standard servos allow the shaft to be positioned at various angles, usually between 0 and 180 degrees.
Perhaps it should say something like:
Standard servos allow the shaft to be positioned at various angles, usually between 0 and 180 degrees. Some servos have a limited range and may need to have larger minimum and smaller maximum pulse width values (see the attach() method)
newtoduino, try reducing the min and max range until your servos stop chattering at the extremes. If you don't get 180 degrees then you may need to try some other servos.