I bought several of these servos. They are externally powered and carry no load apart from a pointer glued to the horn. Then I wanted to check/calibrate them.
No matter if I use the servo.write(angle) (green dots) or servo.writeMicroseconds(ms) (dark blue dots) approach, the rotation positions are stretched/compressed as the servo rotates between 0° and 180° in steps of 10°. Can I compensate for this weird effect in code or are these servos that inaccurate by nature?
Anything I can do in code to get reasonably equal 10° steps? Must I buy different servos (which one should I get?). Thanks a lot in advance!
It sounds like you tested this by repeatedly commanding the servo to move 10° then making a mark where it moved to. So, to quantify the accuracy of your servo’s ability to repeatably move 10°, I found the difference (in degrees), between each of your marks then calculated the standard deviation of those differences. My calculation yielded a standard deviation value of about 1.1° for both of your data sets (the green dots and blue dots). Although servo manufacturers do not usually provide this type of information, I think this is about the accuracy that you should expect from hobby servos like this.
There are two main obstacles to compensating for this type of random error, neither of which can be overcome with your programming. First, the accuracy is going to be limited by the servos internal position control circuitry. Second, your testing setup to evaluate that accuracy seems susceptible to measurement error. It looks like your measurement accuracy depends on how well you can hold your marker normal to the surface to make the marks and your being able to make the mark without accidentally loading and deflecting the pointer.
If it is important for you to achieve more accurate motions, you might consider using one of our servos that provide access to the feedback voltage. Using the analog feedback, you can take the position accuracy into your own hands by making your own position control algorithm that will act in addition to the servo’s control circuitry. You can identify the servos with analog feedback on the table from our RC-Servos category page by looking for checks in the “Feedback?” column. The FEETECH FS90-FB servo has the most similar characteristics to the Power HD Micro Servo HD-1900A.
thanks for your in-depth reply!
In the end, noticing that all servos of this kind go to slightly different angles when using servo.write(#) - with angles instead of microseconds - I found a good programmatic solution. I recorded the microseconds for each of the 14 discrete positions to rotate to, and put them in an array. Then, in the program, I simply pull the number and use servo.writeMicroseconds(#) to have the servo rotate to that angle. This is straightforward and reliable. The only caveat is one has to do that for every servo.
But, yes, for future applications of this kind, I shall buy servos that provide feedback, so one can react to that in code.