Go Down

Topic: How does a servo work (PWM or PPM)? (Read 117430 times) previous topic - next topic

Aniss

Hi Mem,

Point understood!

However I've been programming for many years (for fun and professionally) but frankly 6-8 weeks ago I barely knew what a circuit, microcontroller or a servo was. And it's been a very slow and painful process learning about these things. Not least because people use different terms for the same concept OR the same term for different concepts.

In that sense I very much agree with lefty that "analogWrite" should be called "pwmWrite". Simply because that's more correct but MAINLY because the term "analog" is allready reserved for an entirely different concept. The current mixup made it a lot harder (for me atleast) to understand the whole ordeal.

Besides even if 2 persons both understand a given concept it's still difficult to talk about it if they don't share a common nomenclature. If working as a programmer/systems developer has taught me anything it's that nomenclature is important, if not a must, for meaningful communication..

Hope you see my point too :)


Thanks again for your input

Aniss

Aniss

And just one more noob question...

The "servo feedback circuit" (that Mem mentioned) is that the same as/another term for/related to a PID loop/controller?


PS: Regarding PPM vs. PWM: I think I'll just reffer to it as SERVO SIGNALS from now on.. as a guy on the other forum suggested :D

mem

Quote
Hope you see my point too

I do see your point about using correct termonology, and if Arduino was primarily aimed at programmers/system developers then I would wholeheartedly agree.

But arduino is a platform intended for artists, designers and hobbyists. And although it is also highly attractive to trained software engineers like you and me, we should to be tolerant to the bending of some technical terms in the interests of making the technology more accessible to non-technical people.

I also take the point about potential confusion over the differences between analog inputs and analog outputs. But whatever you call the output function, the differences between changing the intensity of an LED and reading the intensity of a light source still needs to be adequately explained - things don't get any clearer to the non-technical person by renaming the function pwmWrite.

I can see many reasons why the analogWrite should not be changed to pwmWrite:
1. (as mentioned in an earlier post) analogWrite is more expressive of the affect when driving things like LEDs. PWM has little or no meaning to non-technical people.

2.  It would increase the likelihood for confusion over its suitability for driving servos (particularly if people persist in referring to servo control signals as PWM).

3. Even if there was a better name for analogWrite, so much material refers to that name (25,000 hits on google) that changing it would create considerable consternation.

westfw

On further thought, I think the main problem with PWM vs PPM is with the "M"; properly speaking, the servo control signal is not "modulated", it is merely "encoded."   Especially as used by microcontrollers.

mem

westfw,  if you want the most technically correct term and I want the term that causes the least confusion among Arduino users, can we at least agree not to use PWM in relation to servo encoding signals on the  grounds that the encoding is not based on modulating the proportion of on time to off time and has nothing to do with the PWM output from analogWrite and the current Arduino servo library does not use hardware PWM to produce the servo pulses.

Aniss

#20
Sep 19, 2009, 11:18 am Last Edit: Sep 19, 2009, 11:30 am by Aniss Reason: 1
Hi again Mem,

Just to round of the discussion..

Had some time to research the concepts "duty cycle" and "modulation" and I finally understood your explanation:

www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1253149521/6#6

I see you have a point that PWM may not be the appropriate term for describing servo signals/pulses. However I still don't see that PPM is any less wrong (as I've understood PPM). But let's leave it at that. I learned my lesson and it would seem that most people (on other forums) all agree to call it PWM anyway. Personally I'll call it servo signals/pulses from now on :)

And you're right that it would cause too much confusion changing the name "analogWrite" since it's allready well established. But I still think it was a bad idea to call it that to begin with. And I don't think it's helping non-tecnical users to (mis-)label it "analog". For several reasons:

- On the Arduino I/O's it still says PWM.
- Non-tecnical people mostly don't really know what "analog" means anyway.
- Even non-tecnical users may one day want/need to understand a bit more about how the "black box" (=Arduino) works. I suspect they (like me) may be confused by the (mis-)labeling.

So.. since "analog" is wrong and PWM is too tecnical perhaps "virtualAnalog" (or something like that) would have been the best choice. But it is off course irrelevant cause it's too late to change it.


Thanks for helping me better understand how a servo works (TO ALL). Now I'll move on with my endlessly expanding research todo list and read up on newly added concepts like: servo feedback circuit, H-bridge and PID-loop/controller...


Best wishes

Aniss

retrolefty

#21
Sep 19, 2009, 04:27 pm Last Edit: Sep 19, 2009, 04:28 pm by retrolefty Reason: 1
I know it's a dead horse and that there is no way the Arduino platform would ever change the wording from analogWrite() to pwmWrite().

However it's just not right and can't be helpful to newcomers to have two commands analogWrite() and analogRead() that have drastically different electrical characteristics. It isn't so difficult to learn for someone just starting to program, as much as if they are also new to electronics fundementals.

Now, where can I obtain a new horse.  ;)

Lefty

clifdweller

To be clear
- PPM (pulse position Modulation) is a method of controlling multiple servos.
- PWM( pulse width modulation) is the method by which a single servo is controlled.

-ppm is used to divide the clock of a timer into chunks that are used for each servo. Within each of those chunks of time you vary the time of an on pulse(pulse width) to tell that servo where to move.


-PWM is an incorrect term because you don't have to send a constant signal to a servo. I can send a 2.0ms pulse and then wait ten seconds before sending the next pulse and it won't hurt the servo. After a certain amount of time a servo just shuts off until i send it another signal. If i want it to stay on i have to send it pulses every "x" seconds which for rc servos happens to be 20 ms. If i do send signals every 20 ms then i am using PWM but if i send the signals at different times it isn't.

-ppm is absolutely incorrect terminology for controlling a single servo. It describes how to control when servo signals are sent when multiple servos are used.

-- The correct terminology then would be a PWM signal at 50HZ(20ms) with pulse widths varying from .5 - 2.0 ms controls a single servo and keeps it turned on. <-- this seems a little complex so i'll stick with PWM and analogwrite for now

retrolefty

One issue with your posting:

Quote
I can send a 2.0ms pulse and then wait ten seconds before sending the next pulse and it won't hurt the servo.


This is not how R/C type servos are designed to operate, they are not designed to be shutoff between normal 20ms updating of pulses. You will find that once you stop sending pulses to a servo it loses all 'holding' torque and if you had a heavy enough torque load on the servo horn the position could change without any correction until another pulse is sent.

Without power or a continuous 50hz signal update the only holding force is the servos gear train resistance relative to the 'live load' force.

Lefty

mem

#24
Sep 19, 2009, 11:55 pm Last Edit: Sep 19, 2009, 11:57 pm by mem Reason: 1
Quote
To be clear ? PWM( pulse width modulation) is the method by which a single servo is controlled.

"PWM of a signal or power source involves the modulation of its duty cycle" ( http://en.wikipedia.org/wiki/Pulse-width_modulation )
Are you aware that a servo can be operated correctly over its full range without altering the duty cycle of the control signal?
If servo control can be achieved without modulating the duty cycle then PWM would seem a poor choice for describing its encoding.

Perhaps this discussion should be continued in bar sport, I think  this thread is losing its relavance to hardware interfacing  ;)

Aniss

#25
Sep 20, 2009, 01:55 am Last Edit: Sep 20, 2009, 01:57 am by Aniss Reason: 1
He he..this PWM/PPM discussion just refuses to die. As much as I'm glad I posted the topic (I needed to understand it better) I'm kinda regretting that I posted it together with my OTHER general servo questions. These seem to be lost in the PWM/PPM ordeal.

For instance I'm still trying to figure out this:

Quote
what kind of signal is sent from the motor controller to the DC motor?


Is it an analog signal (=the voltage being regulated up and down), PWM or a 3rd option that the servo's motor controller uses to control the DC motor?

mem

#26
Sep 20, 2009, 02:11 am Last Edit: Sep 20, 2009, 02:12 am by mem Reason: 1
Most of the low cost (analog) servos I have looked at drive the motor with pulses that are (more or less) proportional to the error (the difference between the current physical position and the commanded position) with the polarity as needed to move the motor in the direction that corrects the error.  Motor pulses are usually only generated immediately following a command pulse.

retrolefty

#27
Sep 20, 2009, 02:50 am Last Edit: Sep 20, 2009, 02:51 am by retrolefty Reason: 1
In the prior posting I showed a link that discusses a popular servo controller chip that was used for decades internally for many hobby servos:    http://www.seattlerobotics.org/encoder/200009/Servos.html

While no longer being used, I'm sure most of the inexpensive servos are still using the same general design just with smaller chips.

In figure 1 of the embedded data shows the motor connection on the right hand side. It is being driven by a H-drive bridge. The artical discusses the operation of the servo controller in some detail.

Lefty

Go Up