Hardcoding Coordinates; is code reusable when swapping servo

Hi!

I would like to program a servo to move from an exact predetermined point A to point B, pause 3 seconds and then move from an exact point B to C, then back to point A.

Once I write my sketch (Arduino), and later swap out the servo after re-centering to it the same point where the previous servo was centered, will the new servo touch the exact same points (A,B,C) when the previous sketch runs, or will there be a difference in what the new servo thinks are points A, B, C ?

What if I swap out with 1000 different servos, one at a time… what is the precision or error rate among these types of servos where for example 70 degrees on one servo might be 72 degrees on another servo, so then I need to alter my sketch to adapt the new servo?

I am not looking for speed, slow movement is ok. Will digital servos bring more precision to such autonomous repeatable motion when replacing servos?

thanks in advance!
D.

“Precision” and “hobby servo” are not a good fit. You might get some repeatable performance from higher end digital servos, but your expectations probably exceed the performance of what is commonly available.

zoomkat,
Your reply is a very “safe” response.

To clarify. I have gotten repeatable precision from the same servo using the same sketch, as long as I “release” and re-“attach” the servo every few minutes, which is ok.

However, my question is what is the collective experience of the members of this forum where I create a 1000 copies of machine, which use these hobby servos. During the assembly process of this machine, I can recenter the servo correctly. But can I use the same code which tells the servo in various machines to go to points A, B, C. Will all servos in the 1000 different machines do that, or will 70 degree command translate to 72 degree command for another servo…

I was thinking for purchasing a servo protractor and trying it out … but my test would be limited to the 5 servos I have at hand. I wanted to see if anyone else has had good luck with utilizing the same code with points A, B, C coded in what ever degrees with hundreds of different servos…

thanks!
D.

Yes Zoomkat gave the safe and valid response. I think it is safe to say that with 1000 of them you will get some variation in positions. If you look up at any of the guides for any of the robots sold by Lynxmotion (and most other manufactures as well), you will almost always notice the next step after completing the assembly (or sometimes before you finish), it will have a step to calibrate the servos. Most of the time you are simply finding the zero points, but in some case like with Arms, you are also finding out the finding the appropriate value for specific positions… Obviously if the assumption was that all servos are equal, they would not have included this step…

Some more observations:

  1. It is not only the servos that change from machine(robot) to machine, but often the brackets or other hardware may also have variations, which impact this.
  2. If you change from one servo type to another, example: analog HS645 to a digital HS5645, the values will change as they have different ranges/conversion factors.
  3. With all servos, when you move back and forth, there will be some slop (dead-band), so they may not always get exactly to the same place each time…
  4. If you can find servos with optical encoders, my guess is you can get very repeatable performance. Note: I believe some Robotis servos have this, not sure about others and I have never tried one…

Hope that helps.
Kurt

Hi Kurt,
Thank you, that was quite helpful, however in my scenario:

I will use exact same servo make/model in all my machines, with exact same brackets.

I guess that still leaves the deadband as a variable in my situation. I am hoping someone will say the deadband should be the same for the servos of the same make/ model, but I suspect that may not be the case. I guess I will have to do trial and error.

I am avoiding the expensive digital servos for now.

Thanks!
D.

You’re right. The deadband/backlash of servos, even same makes/models will not be the same. Along what these other guys were saying: Every piece of these servos are made within certain tolerances. For example: a shaft diameter might have a tolerance of 3mm +/- 0.02mm. This piece could have a diameter between 2.98 and 3.02 and still be acceptable to the manufacturer. When you have dozens of parts all with their own tolerances, all falling in varying spots within their tolerances, and then all being assembled together in different combinations of variance, you’re not going to get results that are exactly consistent.

My advice would be to set a target tolerance for positional accuracy of your device then work from there. Setting a goal of “exact” is only going to frustrate you further.

Hi Marcham,
That is what I was thinking too.

I will create a variable in my code which will be a custom adjustment if needed for the servo in each machine with plus / minus “x” degrees.

As the machines are assembled, if I see a variance, I will simply change the “x” to compensate the servo movement on each machine. I hope this will help me avoid the expensive servos.

D.

Below is an old discussion with a picture of a simple servo protractor setup. Bottom picture is of a setup using a bamboo skewer you can try to test a servo’s resolution. If you are serious about your project with “1000 copies” then you should buy a couple of servos and do some real testing. A lot of undisclosed details of your project that will result in variables that you will need to sort out.

viewtopic.php?f=17&t=1767

http://web.comporium.net/~shb/pix/resolution1.jpg

they don’t have to be exactly the same, either calibrate them, or let them calibrate themselves.

Or go to stepper motors.

Alan KM6VV

Or…just try it out and discover what Zoomcat is telling you.