RC Servo Drive Circuit

I have a mate who not long ago dug out his old model railway stuff from when he was a kid and began to build a layout incorporating various technological refinements which had become practical in the intervening 50 years or so. He wanted to build some gadget which involved rotating a shaft between two positions 90 degrees apart when a contact was made. To do this he decided to use a servo unit such as are sold for use in radio-controlled models. Unfortunately, driving this thing proved to be a cunt.

The first problem was finding out what drive signal it wanted. There are various pages about this on the internet but most of them are fucking arse. The main problem appears to be that RC models are mostly built by thick people who just buy stuff and plug it together without either understanding how it works or bothering to find out, and those who do bother to try and find out are shit at it. And the manufacturers of these devices assume that they are only going to be used by thick people and don't bother to provide the information.

Apparently there are two types of RC servos, idiotically and unhelpfully referred to as "analogue" and "digital". Their drive requirements are different, but much of the material on the net either confuses the two or ignores the "digital" type completely. The servo that my mate had bought was a "digital" one. After far too much fucking around, it was established that it requires positive-going pulses at a repetition frequency of around 200-400Hz; a pulse width of 1.5ms apparently corresponds to centre position, and shorter or longer pulses cause it to rotate one way or the other from that position, with a 0.5ms change in pulse width causing 45 degrees of rotation. This is, as you can see, an analogue pulse-width-modulation signal. The servo calling itself "digital" does not mean that it requires a digital input - you don't send it a serial word to tell it what angle to go to or anything like that, you just send it PWM.

So, anyway, one might think that all that is required is to build an oscillator circuit with a 555 or whatever to provide pulses at the correct frequency, and switch the timing components to vary the pulse width while keeping the frequency the same. Well, as far as it goes, this is true. The problem is it doesn't work very well. The reason is that the servo can draw several amps under conditions of high acceleration (starting or reversing direction), and it's not several amps plain DC either, it's several amps switching at several kHz. So it puts vast amounts of shit on the supply rails and hefty filtering is required to keep it out of the oscillator supply, otherwise the fact of the servo operating buggers up the pulse timing and the servo jitters about all over the place like a cunt. (Yes, the 555 is supposed to be largely immune to power supply noise, but it isn't as immune as all that.)

In my attempts to find out what drive signal these things required I came across various pages which suggest that jitter can be a problem in standard usage as well - presumably there is a considerable dependence on the power supply having a low enough impedance to suppress noise, or some similar and comparably shite piece of corner-cutting. RC model enthusiasts then advise each other to try and sort the problem by experimenting with different types of servos until they find one that doesn't do it too much. The fucking things cost 80 quid a pop, so such a method is a horrifically shit and expensive way of doing things, but since RC model enthusiasts are too thick to understand what they're doing they just accept this method; the idea of adding power supply decoupling and filtering never occurs to them because they don't know what it is. Nor is there anywhere any indication of how much shit the servo puts on the power rails because it wouldn't mean anything to the standard thick and ignorant model builder.

Anyway, I managed to get the noise off the supply rails, but it turned out that my mate was intending to fit the circuit into a very tiny space which didn't have room for great big electrolytics and shit. So I changed my approach. How to make an oscillator that would be shit-hot at power supply rejection? Answer: use a crystal.

So I ended up with this.

Crystal controlled RC servo drive circuit for "digital" type servos

The crystal is a 32768Hz watch crystal (tuning fork cut) which I scrounged off an old motherboard. These things are a bit different from the cuts used for the MHz-range crystals that one usually comes across. Not only do they require much less drive, they are strongly inclined to oscillate in an overtone mode at six times their nominal frequency if you drive them too hard. Normally this would be a potential embuggerance, but in this case it was extremely useful.

The built-in oscillator circuits in PICs and other ICs that can generate their own clock, when used with the component values given in the datasheet (which are appropriate for non-tuning-fork crystals), do drive tuning-fork crystals too hard, and there are a a fuck load of posts on PIC-related forums from people who have tried to use a watch crystal with a PIC and are baffled by its insistence on oscillating at 197kHz (actually 196.608). This is why. It's being overdriven. You have to use a drive resistor of a few hundred k, in place of the usual few k, to stand a chance of having it go at 32768Hz like you expect it to. A resonant circuit tuned to 32768Hz in the drive leg is also a good idea.

In my case, I wanted it to go in overtone mode, but thought it desirable to avoid using sledgehammer drive. I ended up using a 47k drive limiting resistor and a resonant circuit at roughly 197kHz in the drive leg (it's actually nominally 193kHz, but with tolerances and stray capacitance it won't really be that, and it's close enough). With this setup it seems to be possible to rely on it oscillating at 197kHz as I want it to.

This frequency is then divided down by the 4060, and the value on the four outputs Q6-Q9 is then fed to a 4585 comparator which compares it with a value of either 2 or 5, according to whether the contact is closed or not, which produces output pulses of either 0.96ms or 1.92ms repeated at 195Hz. The servo seems to be quite happy with a PRF of 195Hz, and these pulse widths cause it to assume one of two positions which are 90 degrees apart, or at least sufficiently close to that that it makes no difference. It's pretty much exactly 90 degrees by the visual protractor, at any rate.

Measurements on the input of this particular servo suggest that it is probably connected via a 2.2k resistor to the base of an NPN transistor with its emitter grounded. Switching it onto the servo's positive supply rail for "high", and allowing it to float "low", seems to drive it just fine. I don't know whether this is the case for all servos - as with every other fucking piece of technical information on them, it is not published, because the people who most commonly use them are too thick to make use of it.

The servo requires a supply of no more than 6V so a 7806 regulator is used to provide this from the nominal 12V overall supply. This is, it must be admitted, a bit cruel to the 7806, since under high acceleration the servo takes enough current to drive it into limiting and its output voltage falls to 3-4V for brief periods. It doesn't seem to mind, though. It doesn't even get that hot under test conditions switching the servo between its two positions as fast as it will move, and does not need a heatsink. In service it will not be called upon to perform any more often than a single movement once every few minutes, under which conditions it will not heat up noticeably at all.

I don't suppose it is all that likely that anyone will want this circuit as is. After all, a device that runs off 12V and rotates 90 degrees and back can be made far more simply and cheaply by getting a windscreen wiper motor or something from a scrapyard and fitting a couple of limit switches to it. Situations that positively require something as horrifically bleeding overpriced as an RC model servo for 80 fucking quid are not all that common. I am mainly posting it for the value of the incidental information associated with it - the drive requirements of a "digital" RC servo, the horrendous amount of power supply noise an RC servo generates, and the interesting behaviour of tuning fork watch crystals. And also because it gives me an excuse to rant about stupid thick ignorant cunts who plug stuff together out of boxes without understanding how it works and without bothering to even try and find out. Fucksake people building radio controlled models used to be clued up enough to build the whole bleeding thing from scratch, from individual resistors and capacitors and transistors and shit. These days they are a bunch of clueless cunts who don't know anything beyond where to buy pre-built units and don't even know enough to see that 80 quid for a wee motor and some gears and a pot and a chip is a complete and utter fucking rip-off. And even worse, they don't bother to do anything about their ignorance. The way the modern world makes it acceptable for people to be stupid because they are too flaming bone idle to think makes me fucking sick.




Back to Pigeon's Nest


Be kind to pigeons




Valid HTML 4.01!