Just a few quick “electronics geek” ramblings for the day.
If you’ve ever wondered how servos are controlled, well it’s all in the timing. As we know, servos have three electrical connections; power, ground, and a control signal. Power and ground are usually provided by the receiver and are constant. The receiver, in turn, is powered from a dedicated radio system battery or by something called a BEC / UBEC (but that’s an article for another day).
The signal wire is where all the magic happens, but first let’s firmly understand some basic units of time. Seconds is a unit of time we’re all generally happy with. We know what they are and, if you don’t, then stand next to a clock for a while and listen for a ticking noise. Good. Let’s move on.
A millisecond is one one-thousandth of a second. Or, to put it another way, there are 1000 milliseconds in a second. To write it down, you’d write “1 ms” because “millisecond” is a long and tedious word to write, and we are all really quite lazy these days. To add some real life context, it takes the average human about three or four tenths of a second to blink. In our newly discussed unit of time, that’s 300 to 400 milliseconds (300 ms to 400 ms). A microsecond is one one-thousandth of a millisecond. Or, if you prefer, one one-millionth of second. And so there are one million microseconds in a second, and we write it as “1 us”. Still with me? Good, because we are now discussing the lengths of time that servos care about; microseconds.
A receiver talks to a servo using a digital stream of pulses, which simply means that the receiver is turning the voltage in the signal wire on and off very quickly. Imagine, if you will, turning your kitchen light on and off. Suppose it’s off for most of the time, but somehow you could flick the switch on and off again quickly enough that it was only on for 1 millisecond. You won’t actually be able to do it because your fingers aren’t quick enough, but just imagine you could! Well that’s a digital pulse that you’re sending along the wire. Now imagine that your kitchen lightbulb was able to measure the amount of time that it was switched on. And then let’s also imagine that your kitchen lightbulb had and independent power source, and the length of the off-on-off pulse that you sent it was what told it how bright it should glow. Maybe let’s say that if you sent it a 1 ms pulse from the switch, the lamp would be turned off, a 2 ms pulse and it would be turned fully on, and a 1.5ms pulse would make it glow at half brightness. That’d be cool, right? You’d have a one wire system that would allow us to send basic commands from one place to another. Well that’s PRECISELY how servos are controlled.
A servo measures the length of the “on” pulse on the signal wire (in electronics terms this is called the “pulse width”), and then sets the position of the servo accordingly. 1 ms makes the servo arm move fully one way, 2 ms makes the arm move fully the other way, and 1.5ms makes the arm sit right in the middle. Any position of the arm can be set, simply by adjusting the width of that pulse. The pulses are sent from the receiver about 20 times per second, and that’s why you usually get a decent response time from your servos.
That’s it! No other magic. That’s how servos are controlled.