pwm vs pfm

Technoman

Senior Member
Hi

Is anyone as experimented the pfm (pulse frequency modulation) to drive motors of a robot. According to an article of a swiss company (Didel), it has some advantages over the pwm.

Translated from french (original text http://www.didel.com/pic/PwmPfm- "The PFM is little known, because it is not supported (integrated) by the micro controllers and is not necessary for the good high-frequency motors. In robotics amateur on the other hand, PWM is not usable, because the motor would not start under 30 % (per example) of PWM and is soon going to set in at an important speed, 30 % of the maximum speed . With the PFM, we choose a duration of impulse been enough so that the brought energy exceeds the friction and makes move the motor. [...] Some irregular moves will be possibly visible, but the average speed will be proportional to the PFM value."
 

Dippy

Moderator
I have never tried PFM but I reckon quite a few of us PWMers have noticed the obvious differencies in behaviour as we vary the base frequency.

Maybe you could experiment with different PWM frequencies at the start/low-end of your motor control and adjust frequency and duty as you increase.
All this may vary with your drive and motor but it is certainly worth a play and looks quite easy to do.

Let us know your findings.
 

erco

Senior Member
PWM is like the weather: everyone complains about it but no one does anything about it. You lose that 30% because your pwm frequency is too high. Servos deliver gobs of zerospeed torque because their frequency is low.

So now what will you try? Pity that Picaxe pwm freq bottoms out at 61 hz, but you can bit bang it slower.

http://www.youtube.com/watch?v=fL0O0_5ef_k
 
Last edited:

geoff07

Senior Member
PWM changes the duty cycle and thus the average energy transferred. PFM presumably only changes the frequency and thus not the average energy. I suspect that the optimum is a bit of both i.e. PWM with frequency adjustment. Some data would be interesting.
 

g6ejd

Senior Member
as PFM frequency increases, that's more pulses per unit of time and so more energy is delivered in a unit of time.
 

geoff07

Senior Member
Perhaps. But there are also more gaps, and the pulses and gaps must get shorter as the frequency increases, so how does the average change?
 

BeanieBots

Moderator
I've done lots of work with both PWM and PFM.
Besides the obvious which has already been mentioned, what do you want to know.
It's about matching your frequency with your motor and what control method you are using to adjust the pulses.
A 'standard' technique to overcome stiction/friction is to add a 'feedforward' value to the PWM value.
 

g6ejd

Senior Member
We were trying to establish the principle differences between PWM and PFM, or whether the latter is a combination of the two, because as F increases, does that mean average energy is being increased in a fixed unit of time?
 

fernando_g

Senior Member
Have never done a PWM to PFM foldback circuit to drive motors, but for SMPS use there are several control chips that do something similar.

But I suspect that commercially this has been done....riding the LIRR a while back, I noticed that when the train strats, the inverter whine is actually quite low, then up to a certain speed it increases in pitch, and remains in that pitch even as the train speeds up to cruise.
 

AllyCat

Senior Member
Servos deliver gobs of zerospeed torque because their frequency is low.
Hi,

That's not stricly the reason. Model-makers "Servos" use a relatively high power motor and/or gearing with a feedback loop (often called a servo loop) to drive the motor to a requested position. The low frequency (width-modulated) pulse is just a convenient method to define that required position using a single wire (bearing in mind that there might be separate and/or noisy supply rails).

The (translated) quote at the head of this thread seems to be specifically concerned with low frequency pulses, each having sufficient energy to "kick" the motor sufficiently to overcome stiction (static friction). IMHO it's similar to using a hammer to drive in a nail (which might alternatively be done with a hydraulic ram). It's "Horses for Courses", a hammer is excellent for some purposes, but is useless if you can't swing it sufficienly far, or for driving in screws! ;)

Cheers, Alan.
 

g6ejd

Senior Member
PWM changes the duty cycle of a fixed frequency to adjust the output voltage while PFM keeps the duty cycle fixed, but changes the frequency to adjust the output voltage.

In the PFM case and for any given time frame say X-secs for a given PFM frequency there are N-pulses, then if the PFM is doubled, there are now 2 x N pulses in the same unit of time, so average power has doubled.

How does that sound...

Further more, in PFM mode, the switching frequency varies as the line and load conditions vary. In other words, varying the switching frequency of the power supply controls the output voltage. With PFM mode, the switching frequency is proportional to the output power. At low output powers, the switching frequency is reduced which lowers switching losses and increases the efficiency.

I still haven't convinced myself this is correct because unless duty-cycle changes how can average power increase :)
 

Billo

Senior Member
PFM uses a fixed 'on' pulse width. So as the frequency increases the average on-time increases.

For example, if the 'on' pulse width is fixed at 5ms and the frequency is 30Hz, the total 'on' time for 1 second will be 150ms. If you increase the frequency to 60Hz the total 'on' time for 1 second will be 300ms.

As the OP states, set the PFM 'on' pulse width to allow the installed motor to just move. Then adjust the lowest frequency to provide minimal continuous motion. Now, to increase speed, you just increase the frequency. This method provides real useable torque from a crawling speeds to full speed.
 

BeanieBots

Moderator
I like AllyCat's hammer analogy because it really does 'hit' the mechanics which can also be problem at low frequencies. Bearings and gears can wear out very quickly if the wrong frequency is chosen.

Below are examples of the different power control methods.
For clarity I have used only 4-bit (16 levels) rather than the more normal
8-bit with 256 values.
By looking at the bit patterns it should be more obvious what the pro's and con's are when applied to a real world application and in particular a micro which has limitations such as 8 or 16 bit resolution. The examples are only 4-bit and as such exaggerate these issues nicely. It is very easy to see why PFM often switches to PWM when used at higher percentage power levels.

I have included my own personal favourite PPM ( pulse possition modulation) method which I use mainly because it has the advantage of fixed pulse width plus a linear 'power' control. It is particularly well suited to mains control when used with a 20mS (or multiple of) pulse for obvious reasons.


Standard PWM
0000000000000000 0%
1000000000000000 6.25%
1100000000000000 12.5%
1110000000000000 18.75%
1111000000000000 25%
1111100000000000 31.25%
1111110000000000 37.5%
1111111000000000 43.75%
1111111100000000 50%
1111111110000000 56.25%
1111111111000000 62.5%
1111111111100000 68.75%
1111111111110000 75%
1111111111111000 81.25%
1111111111111100 87.5%
1111111111111110 93.75%
1111111111111111 100%

PFM
0 0%
1000000000000000 6.25%
100000000000000 6.67%
10000000000000 7.14%
1000000000000 7.69%
100000000000 8.33%
10000000000 9.1%
1000000000 10%
100000000 11.1%
10000000 12.5%
1000000 14.29%
100000 16.6%
10000 20%
1000 25%
100 33.3%
10 50%
1 100%

PPM (aka distributed pulse)
0000000000000000 0%
1000000000000000 6.25%
1000000010000000 12.5%
1000100010000000 18.75%
1000100010001000 25%
1010100010001000 31.25%
1010100010101000 37.5%
1010101010101000 43.75%
1010101010101010 50%
1110101010101010 56.25%
1110101011101010 62.5%
1110111011101010 68.75%
1110111011101110 75%
1111111011101110 81.25%
1111111011111110 87.5%
1111111111111110 93.75%
1111111111111111 100%
 

g6ejd

Senior Member
@beaniebots - thanks for this, that's really clear, now I know how it works. A picture is better than a 1000 words.
 

erco

Senior Member
That's not stricly the reason. Model-makers "Servos" use a relatively high power motor and/or gearing with a feedback loop (often called a servo loop) to drive the motor to a requested position.
Thank you for bringing servos into the conversation, Alan. Continuous rotation servos are open loop devices as they lack feedback since the pot removed or disconnected. They are the perfect example of my point. Anyone who has had a CR servo robot "creep" on them when the servo is not nulled has witnessed the incredible torque afforded by very low frequency PWM. You would be hard-pressed to get a high-frequency motor controller operating at those minisicule speeds; the motor would be stationary and the controller would simply be whining. :)

Here's another spirited thread on PWM frequency, featuring opposing views from two "professional" motor controller designers: http://www.electro-tech-online.com/robotics-mechatronics/19246-suitable-pwm-frequency-motor-control-4.html
 

Billo

Senior Member
PFM
0 0%
1000000000000000 6.25%
100000000000000 6.67%
10000000000000 7.14%
1000000000000 7.69%
100000000000 8.33%
10000000000 9.1%
1000000000 10%
100000000 11.1%
10000000 12.5%
1000000 14.29%
100000 16.6%
10000 20%
1000 25%
100 33.3%
10 50%
1 100%
This is certainly not a realistic representation of PFM. Also, PFM does not have to be a low frequency as some have mentioned.

The only thing I can suggest is try a properly set-up PFM experiment and see how it works. Some of the speculation I have seen through this thread is at best humorous. For [simple] motor control, it gets the job done and is better and easier to configure than PWM. Properly done, it does not jump from 50% to 100% in some single step. That would be akin to doubling the frequency on that last step. It should also be noted that in most real-world applications, motor control is not a linear exercise. To double the speed, you need to more than double the power in. Also, the non-linearity is application specific, so if you want the motor to respond linearly to input, you need some non-linear control function designed for the particular application.
 
Last edited:

g6ejd

Senior Member
Hi @Billo, perhaps you'd like to set us all straight on this with some examples of what the technique is doing please.
 

Billo

Senior Member
@g6ejd

Did you get a chance to read post 14?

The only thing I would add to that is you need to first choose the frequency range you want to work with.

That's basically it, and it's going to provide a different set-up for each situation.

I often set up a little experimental jig using a couple of 555s to set my pulse width and starting frequency to suit the issue at hand. Once I have them, I can transfer them to whatever the final control mechanism is going to be. It's not really a necessity to do that, but It's what I like to do.

Just to be straight, I do not up hold PFM as the be-all and end-all. Each method has it's qualities and it's place, but for simple open-loop motor control (like little robots, toys, and other non-critical applications with small DC motors) , PFM is easier to get satisfying results from. I'd also recommend lower starting frequencies (50Hz - 200Hz) and free-wheeling between pluses for these applications
 

g6ejd

Senior Member
@Billo, thanks for this, I'd missed post 14. I think for me @Beaniebots diagram is the best representation of the principle and not withstanding the large jump in frequency at the top-end in what is just an example, when I'm assuming the motor will be at close to full speed and when such a transition took place would be blended with rotational momentum and inertia to further acceleration, that on balance it would indeed work.
 

Billo

Senior Member
@g6ejd

You are welcome, and you are also welcome to see things as you wish. However Beaniebots' table, while mathematically accurate, is not a realistic representation. Let's say the pulse width is 10ms, then that last jump represents a change in frequency of 500Hz to 1000Hz. Does it seem realistic that any control would be built to do that? What's wrong with 523Hz? 732.5Hz? 662Hz? 996Hz? 819 Hz? Or any frequency in between? PFM is linear WRT frequency and that is not implied in Beaniebots' table.

I get the impression that you night think I am being belligerent, but I am not intending to be. I was just pointing the error implied by the way PFM was represented in Beaniebots' table.
 

boriz

Senior Member
For clarity I have used only 4-bit (16 levels) rather than the more normal
8-bit with 256 values.
By looking at the bit patterns it should be more obvious what the pro's and con's are when applied to a real world application and in particular a micro which has limitations such as 8 or 16 bit resolution. The examples are only 4-bit and as such exaggerate these issues nicely. It is very easy to see why PFM often switches to PWM when used at higher percentage power levels.
Makes perfect sense to me. What don't you get Billo?
 

Billo

Senior Member
@boriz

I am not confused and am not asking any questions about this. I am merely pointing out that there is no 'issue' with PFM. It is indeed perfectly linear.

Are you under a different understanding, or are you out for a troll?
 

boriz

Senior Member
Troll! (How dare you compare me to Dippy :) )

You were bashing BB's simplified examples. Even though they were clearly marked as such and were not intended to be 'realistic'. Steady on old man. We're all on the same team.
 

BeanieBots

Moderator
Troll! (How dare you compare me to Dippy :) )

You were bashing BB's simplified examples. Even though they were clearly marked as such and were not intended to be 'realistic'. Steady on old man. We're all on the same team.
When did Dippy get promoted to Troll? :confused: (He still hasn't washed my car).

Anyway, my example was as pointed out by Boriz, only 4-bit.
When used in a real (and therefore limited) micro environment there WILL be issues with whatever method you use.
You do however have the choice. You can go the route my example gives OR you can use a different pulse width.
Sticking with 4-bit to show how it works let's say we make the pulse 4 time-periods long.

11110000000000000000 20% (the minumum possible without expanding on 4-bit)
11110 80% (the closest to 100%)

Expanding further you could ALSO control the pulsewidth (eg reduce pulse to 111) but that would NOT be true PFM
Also, yes PFM IS linear with frequency, BUT you cannot control the frequency linearly with low bit control.
If you have 32-bit control or analogue (eg 555) then things can be made to match the theoretical much more closely.

Also, don't forget a very good example of PFM which are 'Solar Poppers'
These are little robots with tiny solar panels. They store up energy until there is enough to move and then squirt it all out in one hit and move a little bit. Then they sit and charge up again.
 

AllyCat

Senior Member
Hi,

+1 for BB's excellent examples (with hindsight, the pulse 4 cycles wide probably demonstrates the limitations better).

Continuous rotation servos are open loop devices as they lack feedback since the pot removed or disconnected. They are the perfect example of my point. Anyone who has had a CR servo robot "creep" on them when the servo is not nulled has witnessed the incredible torque afforded by very low frequency PWM.
Sorry, I can't agree. IMHO a "continuous rotation servo" is a complete misnomer because it has no feedback loop. Remaining with my previous analogy, it's like removing the head from a hammer and calling it a "headless hammer". It may indeed still have a purpose (as a stick of wood) but the basic functionality has been destroyed.

That the "continuous servos" need to be nulled at a specific pulse-width shows that the pulse is a signalling method and does not drive the motor directly. I don't know if "model-maker's servos" even use PWM to directly control the motor current, but if they do, I suspect it is at a frequency higher than 50Hz. Surely the "incredible torque" is due to the gearbox?

The name servo is an abbreviation for servomotor or servomechanism which fundamentally use feedback control. In another analogy, if you go into a shop and ask for "a microwave", you might well get a microwave oven, but don't be too surprised if you get something else.

To do a boriz: :) http://www.youtube.com/watch?v=TxQqWSnsHoA

Cheers, Alan.
 
Last edited:

erco

Senior Member
IMHO a "continuous rotation servo" is a complete misnomer...

I suspect it is at a frequency higher than 50Hz.

Surely the "incredible torque" is due to the gearbox?
Where to start? :)

First, let's limit our talk to analog servos. Digital servos is another subject for another day. Whether or not you like the name "continuous rotation servo", that's the name. Google it. They are very real, very useful, and very popular in the robotics world. Your multiple references to them as "model-makers servos" (a complete misnomer) sounds like you're unacquainted with them. They are an inexpensive package providing motor, gearbox, and H-bridge driver, all controlled very simply via one control wire and standard control signals. Many robots use CR servos very effectively as drive motors for wheels. They may be purchased stock as CR, or often are modified from regular servos: http://www.servocity.com/html/continuous_rotation_informatio.html

Perhaps you have never felt the growl of a servo (CR or standard) as it applies low frequency (50 hz or less, so check your suspicions) pulses to the drive motor to correct a small error. There is significant torque applied, certainly multiplied by the gearbox, but most importantly afforded by low frequency pulsing of the motor by the control circuit. You missed my previous point that the problem with most high-frequency pwm drivers is that they are incapable of driving a servo at near zero speeds, all they do is squeal while the motor remains stationary. For robotics and many other electromechanical applications, that is wholly unacceptable and the most straightforward solution is to lower the pwm frequency.
 

Billo

Senior Member
11110000000000000000 20% (the minumum possible without expanding on 4-bit)
11110 80% (the closest to 100%)
With all due respect, this is still not the right way to look at this. in PFM, you vary frequency, not pulse width. Even a simple 8-bit CPU can produce accurate frequencies over a very wide range without much trouble, so I do not see the point of bringing in some improbable 4-bit pulse width scenario to describe a modulation method that is not dependent on pulse width. You are essentially mixing hair pins and carrot seed.

Please be assured, I am not attacking here. I know I am a relative newcomer to this site and therefore, in good 'ole internet fashion, automatically a distrusted infidel. So forgive me for my crime of trying to point out something wrong.

All that said, I don't really give a tinker's damn whether you believe me or not. I feel no compunction to provide credentials, nor to wrest any of you from your beliefs. I will leave all of you to think whatever you like on this subject, no matter how wrong it is. This topic is far to gnostic for my tastes. I just hope this is not the entire tone of this site.
 

erco

Senior Member
Please be assured, I am not attacking here. I know I am a relative newcomer to this site and therefore, in good 'ole internet fashion, automatically a distrusted infidel.

I just hope this is not the entire tone of this site.
@Billo the infidel: I'm tracking with you. I certainly appreciate your succinct clarity in post #14. Makes perfect sense to me. This thread has some passion in it (my posts included) and it's easy to get carried away in spirited debate. I think everyone has different experiences and wants to contribute, even if just playing devil's advocate. We welcome your expertise and helpful input. From my experience this forum is pretty welcoming with knowledgeable folks, even if you meet a few challenges along the way. :)
 

Dippy

Moderator
Well put erco. Very spirited, educational and amusing.
I'd better troll around to BB's gaff and clean his car.

One question; is this very difficult to try?
A little drop of code and a little drop of toy motor and vrooom (hopefully).
I might even try it myself if I can get a day off work.
 

BeanieBots

Moderator
Absolutely Dippy, A coded (PICAXE) example would be very much appreciated.
I'm more than happy to provide PWM and PPM examples but I'll leave the PFM example to someone else.
 

geoff07

Senior Member
So as I now understand it, by PFM is actually meant what I would call PIM (pulse interval modulation) - as the pulse does not change, only the interval does. 'Frequency' implies cycles which implies corresponding changes to both mark and space (at least to those with a radio background). Hence, I suspect, some of the confusion, at least here. And then there is BB's PPM ..

But a rose by any other name ..
 

fernando_g

Senior Member
So as I now understand it, by PFM is actually meant what I would call PIM (pulse interval modulation) - as the pulse does not change, only the interval does. 'Frequency' implies cycles which implies corresponding changes to both mark and space (at least to those with a radio background). Hence, I suspect, some of the confusion, at least here. And then there is BB's PPM ..

But a rose by any other name ..
Indeed. I'm with you on this one, it is simply a matter of naming convention which has got us confused.

PWM is very well understood, no need to rehash it.

However PFM, PIM, PDM (pulse density modulation) appear to be different names for the same thing. The way I understand it -and could be wrong- is that PFM has a constant on_time (mark), and the off_time (space) varies.
Since F = 1/(ton + toff), then as the off_time varies, the frequency varies also.

Now with an oscilloscope triggering on the rising edge of the on_time, as the modulation varies, one would see pulses either bunching together or spreading apart, and thus the modulation would be called PDM.

Lastly, if one triggers the scope on the falling edge (which is the start of the off_time), one would see the space between pulses either narrowing or widening, and one would be inclined to call it PIM.
 

fernando_g

Senior Member
And re-reading post #14, the PFM modulation could also be achieved with the complement: instead of having a constant on_time and variable off_time, make the on_time variable and the off_time constant.
 

BeanieBots

Moderator
And re-reading post #14, the PFM modulation could also be achieved with the complement: instead of having a constant on_time and variable off_time, make the on_time variable and the off_time constant.
That would mean that 100% power would need to be an exception rather than the more usual exception being fully off.
The advantage of fixed on period has already been mentioned which is to inject a minimum amount of power often to overcome stiction.
You are correct however. Though I'm not sure why anyone would want to do it that way.
 
Top