So, how IS a RC servo actually handling the control signal?

Go To Last Post
23 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Friends!

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.

Cheers,
Johan

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would guess that RC servos first came on the market when you just had SN7400 TTL series.

A capacitor would charge for the on period of the pulse.
At the end of the pulse, the capacitor voltage is fed to a Comparator. (the other side of the comparator is from the position potentiometer)

Nowadays, you can be a lot more sophisticated.
Pure speculation. I guess that Google or Wikipedia can find the original schematic of the first RC Servo. It may be Analog throughout. After all TTL was expensive !

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

A capacitor would charge for the on period of the pulse.
At the end of the pulse, the capacitor voltage is fed to a Comparator. (the other side of the comparator is from the position potentiometer)

That's pretty much spot on. There's a lot of sites on the internet that go into this in detail but it is all analog with the pulse building a charge and a comparator. The output arm of the servo is also connected to a variable resistor in the servi that feeds back a "current position" voltage to the comparator. They way servos eventually fail (if you don't simply chew the plastic gears) is that the wiper arm of that potentiometer starts to be intermittent as a result of mechanical wear.

Johan, remember of course that in a real R/C system (that predates 2.4GHZ DSS - so 35/72MHz PPM) that the 1..2ms stuff appears in two places.

First you have a controller in your hand offering to control as many as 8 or 9 channels of servo. You move the sticks, slider, rotary knobs and buttons and a small micro gathers all this info then multiplexes it all onto a single radio channel. Channels number from 1 not 0 (this is aimed at humans not computers!) so You might typically have ailerons on channel 1, elevators on channel 2, throttle on channel 3, rudder on channel 4, flaps (if available) on channel 5. Perhaps gear control on channel 6 and so on (different for helis, cars and boats of course). There's nothing that dictates this channel ordering but it is typical.

So the radio is going to generate a signal that carries a 20ms control frame. For channel 1 it will go high and remain high for 1ms then drop somewhere between 1ms and 2ms. At 2ms it will go high again for channel 2 and then drop somewhere between 2ms and 4ms. At 4ms it will go high for channel 3 then drop between 5ms and 6ms and so on.

When this FM (I think it is) signal gets to the receiver in the plane (or whatever) it demodulates the signal off the 35Mz/72MHz carrier so that it has a 20ms multiplexed frame with (up to) 8 or 9 active 2ms "windows" in this.

A demultiplexer then splits this into component parts (again I think this is achieved using analog circuitry not digital) so it then funnels off the "channel 1" signal and outputs that on pins for "channel 1" that the user will then have connected to his aileron servo(s). The next "bite" will be channel 2 and is routed to the channel 2 header pins that the user connects to the elevator and so on.

So each of the receiver channels comes out on separate channel 1,2,3,4,5,6... header pins. Each shows ONLY the 1..2ms of activity in 20ms relevant to that channel and each lags (is staggered) with respect to the previous channel number.

The control circuitry in the servo is pretty much as David describes. It needs to get a "reinforcing" positional pulse every 20ms otherwise it's ability to hold position becomes "soft".

So that's the origin of servo control. These days the radio connection is on 2.4GHz is filly digital (it even transmits GUID's in the data so that the paired transmitter/receiver "know" each other and won't be interfered by other digital data on the channel). It has the capacity to convey far far more channel information so there's no longer an 8-9 channel limit imposed by the old multiplexed 20ms frame. The most I've read about so far is 16 channels but you do begin to wonder how many fingers/thumbs you would need to operate a controller that had more knobs/sticks and buttons!

This doesn't entirely answer your questions but I think it's important to understand where these 20ms/1..2ms and 8-9 channel limits originated to see the big picture. The control decisions weren't arbitrary. Presumably the 20ms frame time is chosen because the analog comparator in the servo needs to get a "bolstering" signal that often. The 1ms..2ms is presumably dictated by the timing constant of the BFC that holds the charge. The 8..9 servo limit was just how many 1-2ms slots you could get away with in 20ms and still have time for a "sync" of the multiplexer that splits the received channel info.

PS knowing some of the keywords like "fm ppm demultiplexer allows one to quickly Google to relevant stuff. For example that search gives this:

https://wiki.paparazziuav.org/wi...

as that top hit. That tells you that the demultiplexing is typically done with a CMOS 4015

The second hit was actually about Arduino (of course!):

http://rcarduino.blogspot.co.uk/...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Who needs Wikipedia when we have clawson ?

David. (feeling smug that his guesses were not far wrong!)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

http://www.seattlerobotics.org/e...

Practical Electronics had some RC projects back in the 70's - lots of transistors.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I took one apart in '74 and it had a little pc board and a pot. I agree that one uses an RC to cvt pulse width to analog. The rest is a classic position feedback servo.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So my two main assumptions where correct? (I'm trying to get as catergorical yes/no answers here as possible. I kno, for most everything it always depends, but still..):

1. The "stipulated" length of 20 ms of the period can be abused somewhat w/o the position of the servo being affected. (To what extent? +/- 1 ms? 2? 5?. Anyone know or have done any experiments?)

2. It is the on-time of the pulse that determines the position of the servo, not the duty cycle.

Correct?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If memory serves...google national semiconductor LM1871 and LM1872.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

1. The "stipulated" length of 20 ms of the period can be abused somewhat w/o the position of the servo being affected. (To what extent? +/- 1 ms? 2? 5?. Anyone know or have done any experiments?)

Some very interesting analysis here:

http://www.pololu.com/blog/17/se...

He shows what happens if you extend the 20ms so that the servo gets the "bolstering" position pulse longer and longer apart. Basically the servo torque becomes "soft". The opposite is true - you can actually energise the control signal more often for a very "firm" control.

Quote:

2. It is the on-time of the pulse that determines the position of the servo, not the duty cycle.

Yes. The actual off time does not seem to matter. I guess there has to be some gap but it's probably less than 18ms that will work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yea, you can stretch or shrink the 20ms quite a bit and the servo will behave. Some modern servos are smoother with more frequent pulses. "Digital" servos can take a faster pulse train and respond faster. Of course, we used to call this analogue system "Digital" 'cause we made it out of 74ls parts.

We used to buy a 2 channel receiver kit for about $20 and add a second 74LS flip flop chip by bending a couple pins up, soldering it on top of the one on the board and adding a jumper to make it a 4 channel receiver. I flew lots of these in the early 80s.

I never bothered to pay attention to which pulse operated which servo which way. I just turned the thing on, wiggled a stick and saw which responded. "Ok, this one's aileron, this one's elevator..." and plugged the servos in to make them work the way I wanted.

Marlin flew his helicopters by putting the tail rotor on the right stick with the fore and aft cyclic, and the right and left cyclic on the left stick with the collective. I never managed to control one that way, but it wasn't hard to learn with the controls set up they "usual" way.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

by putting the tail rotor on the right stick with the fore and aft cyclic, and the right and left cyclic on the left stick with the collective.

Okayyyy.... I have now read that ten times, and all I hear between my ears is "snfölgk fljgsjgwe iouruer kdfehrh oiujfgöpo eepoåhjetyl". I once had a teeny-weeny bit of grip re the cdifferent controls of a helicopter but I see that I need to re-read some of the stuff on this. :D

Apart from that the above answers are very interesting! I will go look up those LMs tonight.

No practical experiments right now: Since I cant find the cheap servo I bought last year when I couldn't find the cheap servo that I bought the year before that I will have to buy a new cheap servo this year. Perhaps just get a bag of'em from Ebay.. :roll:

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hehe I'd send you one 'cept the shipping to Sweden would be higher that if you just bought one yourself.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

by putting the tail rotor on the right stick with the fore and aft cyclic, and the right and left cyclic on the left stick with the collective

Mode 1? Uggh!

I have and always will fly Mode 2. There's something a little obscenely perverse about Mode 1!

http://rchelicopterpage.weebly.c...

(no one uses 3 or 4!)

Only 2 and 3 make any sense as they have all the cyclic on one stick but who ever heard of controlling the throttle with your right thumb?!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Being dissatisfied with the code currently out there to drive servo I to have been playing.

I took apart a decent looking RC servo to see what was inside. It contained a Mitsubishi M51660L chip doing all the work. The datasheet is out there.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lots of useful info in the attached document.

Attachment(s): 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

The datasheet is out there.

I found a 5-pager. I see nothing about what is being discussed here. With a quick read I just see that the "input" must be 3V.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I see nothing about what is being discussed here.

I see some. In a haze...

"Connect a capacitor that will generate a triangular wave", but nothing about typical timings for typical F's..

"Connect a resistor that will determine the value of the cobstant current of pin 2. A resistor of 18 kOhm will yield a current of 1.0mA..", but nothing about what this current is used for..

A "pulse stretcher" is present in the block diagram and mentioned in the text. Nowhere is an explanation of what this does given. (If you answer "it streches pulses" I will locate you in person and kick the knee-caps off you :wink:)..

But .. this sort of detective work is exactly what I anticipated and I find it great fun as long as there is some movement ahead. And there is! At least ATM.

Attachment(s): 

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This page...

http://www.seattlerobotics.org/e...

has a diagram of the internals of the NE544 which is the forunner of the M51660

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Johan,

Short answer (already stated) (this is for 'normal' i.e. cheap analogue servos) - you can *usually* drop the repetition rate down to the nominal 2ms pulse frame. The 20ms is for the benefit of the receiver that has to parcel out the signals to individual servos.

You can parallel servos on the same signal - they will all do the same *sort* of thing but aren't guaranteed to do it to the same amount. The feedback is all internal.

You can remove the feedback pot and you will then get a pulse-width controlled motor. Nice for robot wheels.

You can message me your address and I'll stick a couple of little ones in an envelope for you; I have rather more servos than planes at present.

Captcha: ulaut <-- someone stole the 'm'

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, so I got another cheapo servo. Digital, it turned out - might have implications.

It is supposed to have a travel of >= 150 degrees.

Signal is specified as

Quote:
PWM input range: 20 +/- 2 ms, Pulse positive 1 ~ 2 ms

My practical experiments:

Using the specs above the servo travels less than 90 degrees end to end.

Ti get to around 150 degrees I have to have an on-time of 0.5 - 2.5 ms.

Is this reasonable? Or should I go for debugging? Or fault-seeking electronics aspects?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Im not an expert but this works for me :

https://www.servocity.com/html/h...

1ms = pos 0
1.5 = 50% travel
2ms = 100% travel

(its a noname brand 200deg mini travel servo )

Stupid question + answer = WIZ++

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
OK, so I got another cheapo servo. Digital, it turned out - might have implications

In true Freaks style: "model number? Link?" ;-)

BTW a good description of how digital differs from analogue here:

http://www.rcgroups.com/forums/s...

Digital servos tend to be used for helicopter tails where making fast and accurate adjustments is particularly important (especially when a digital gyro not a human is in control).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

In true Freaks style: "model number? Link?" Wink

E-Sky 000155

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]