Recent events here has nudged me into some paper-and-pencil programming for RC servos. It might eventually lead to some practical experiments.
Short version: How do they actually work? :D
Loooong version, with background and more specific questions:
If I get it right the control signal to a RC servo is actually not a "true PWM". I seem to recall from previous posts, which I can no longer locate, that:
1. It is the on-time of the signal, rather than the duty cycle, that determines the servo position.
2. The period of the signal is not that critical. The 20 ms "specs" is what it is so as to accomodate for 10 interleaved "slots" to control 10 individual servos.
3. Or rather, again as I recall, 9 individual servos. The tenth slot is always low, serving as a sync.
If I'm correct so far, then there are some more detaild reasoning I would like to have confirmed or corrected:
4. Since a sequence of "slots" in "the combined signal" might be all high (several servos driven to one end position), then the signal might not at all go low between slots.
5. From that I reason that the sync is necessary, and it it with respect to this sync (as in the signal goes high after 2 ms of low) that all that follows in the cycle is interpreted. E.g. if, after the sync, the signal is high for 5 ms this indicates servo 1 and 2 driven to one endpoint and servo 3 to the middle position. Point: There is no way to sync for each servo, only for the complete cycle of the combined signal. After the sync everything is done by "dead reckoning" w r t time passed.
6. Thus it is the on time that must be accurate when you control a servo through an AVR pin.
Practicalities and more questions:
7. So how in-accurate can the total period be? Assuming that the servo is dead-in-the-middle with a signal with 1.5 ms on-time, and a 20 ms period: How far can you press the period one way or another? Will the servo immediately start to move if the on-time is kept but the period is changed to e.g. 21 or 19 ms? Or will it stay put, and when the period is changed more and more off specs there will be a point where it suddenly does something "out of control"?
8. Could anyone with insight give a reasonable picture of the internal circuitry of the servo? If my speculations are correct I can sort-of envision one way to do this: The voltage divider on the axle of the servo is fed to something converting it to something in the time domain, and this is compared to the control signal and then.. Yeah, then what? I'm not great at analog electronics so this is the level to which my brain can transcend.. :D But the RC servo questions come up here quite often, and it triggers my want for a better understanding of how it works. Ultimately, it affects the way you form a control signal from e.g. an AVR.
9. All of this above for an "analog servo". What about the digital ones? Are they mimicking the analog ones but have emerged simply because it is now cheaper to have a uC do most of this stuff - sampling the control signal, timing it and comparing it to some kind of encoder on the physical shaft of the servo?
Long post, a lot of questions.. But I would find any discussion or knowledge transfer quite rewarding.