Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

PWM for motor control

  1. Oct 30, 2008 #1


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    I recently encountered (not for the first time) a situation in which a PWM output from a microcontroller is sent to a MOSFET bridge that drives a motor (a very high current, inductive load). I started to wonder exactly WHY it is that the duty cycle of the PWM controls the motor speed. I know that the average of the waveform is proportional to the duty cycle, but it seemed strange that the load would behave as though it were being exposed to the average voltage when in fact it was effectively being exposed to a rapidly time-varying one. Then I read something that hinted that the inductive load was somehow providing a smoothing effect. I figured that if I could just solve the system and figure out the current through the motor as a function of time, I'd be set. After all...

    ...presumably the current through the motor is proportional to its speed (if somebody knows otherwise, please let me know!)...

    ...so I modelled the system as a series RL circuit with a square wave voltage source v(t) (is this reasonable?)

    I set up the typical DE:

    [tex] v(t) = i(t)R + L\frac{di(t)}{dt} [/tex] ​

    After solving using an integrating factor, you get:

    [tex] i(t) = \frac{e^{-\frac{R}{L}t}}{L}\int_0^t e^{\frac{R}{L}\tau} v(\tau)\, d\tau [/tex]​

    I guess we can define the square wave piecewise, letting it have period T and duty cycle D where D is a number between 0 and 1 telling you for what fraction of the period it's high:

    [tex] v(t) = V_{max}, \ \ \ \ 0 \leq t \leq DT [/tex]
    [tex] v(t) = 0, \ \ \ \ DT \leq t \leq T [/tex]
    [tex] v(t+T) = v(t) [/tex] ​

    So what's i(t)? if t = T, the integral only goes over one square pulse:

    [tex] i(T) = \frac{e^{-\frac{R}{L}T}}{L}\int_0^{DT} V_{max} e^{\frac{R}{L}\tau} \, d\tau[/tex] ​

    Now it took me a while, but I finally figured that at some *arbitrary* time t, the integral will have gone over n square pulses where:

    [tex] n = \left \lceil \frac{t}{T} \right\rceil [/tex] ​

    That's all well and good, but I don't know how to calculate that to get some sensible result for i(t). The integral works out to:

    [tex] i(t) = n\frac{e^{-\frac{R}{L}t}}{R}V_{max} e^{\frac{R}{L}DT} [/tex] ​

    So...what do I do now? Ideally I'd like to get the result that i(t) is constant and equal to

    [tex] D\frac{V_{max}}{R}[/tex] ​

    That would be *awesome*, because it would mean that the current is a fraction of the max that could be drawn, the fraction being determined by the duty cycle, and everything would make sense. But I don't know how to get there.

    1. Does anybody know how to solve this math problem?

    2. Am I thinking about this in the right way? Because I can't think of any other way that "PWM duty cycle controls motor speed" remotely makes any sort of sense.
    Last edited: Oct 30, 2008
  2. jcsd
  3. Oct 31, 2008 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Something just struck me when I was considering a simpler example (a PWM light dimmer)


    Does this work as a good qualitative explanation for the *motor* as well? Still, it doesn't quite cut it. In the lightbulb, it doesn't matter that the current drops to zero during the off portion of the cycle, because we can't perceive it. Or maybe it doesn't drop to zero, due to back emf...in which case we're back to where we started...trying to solve for i(t) to figure out exactly what happens! Can somebody help me do the math?
  4. Oct 31, 2008 #3


    User Avatar
    Science Advisor
    Gold Member

    I'm no expert but I think you will need to model using a fourier integral. Since a pulse v(t) is the sum of all frequencies each having their own phase.
  5. Oct 31, 2008 #4


    User Avatar
    Science Advisor

    I won't address the mathematical points of this discussion, but as for the qualitative hand-wavy arguments, well...

    In the case of a motor driver driving a motor, the motor (and wheel, and robot / car, etc.) all have a certain (rotational) inertia. If the motor driver frequency were low enough, you would see the motor stop and go in jerky motions. But go above this critical frequency, and only smooth motion results.

    In the case of an (incandescent) light, if you assume that the number of photons emitted might be high or zero (in reality, you receive a portion of the sine waveform), but you receive some total number of photons at your eyes every 1/30 of a second or so--roughly the upper limit of your eyes' 'sampling frequency'. As a result, you see the average of the intensity. For all of us, 50/60 Hz AC driven incandescent lights look continuous, despite a zero crossing 120 times a second--this might be due to the incandescent lights' inductance--but someone else would have to confirm that. Fluorescent lights are able to respond fast enough that they do flicker at 100/120 Hz. For most of us, this is imperceptible, but I know people who are driven crazy by fluorescents because they're able to see this constant flickering--or some beat frequency, at least.

    If you're familiar with communications and the Nyquist theorem, these are both sort of physical manifestations of that.
  6. Nov 5, 2008 #5


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Yeah, that's a really good point, and I can't believe I didn't think of it. For this reason, the steadiness of i(t) doesn't matter quite as much, and so I've abandoned the mathematical analysis (I have other things to do).

    Yes I am, and we have since discussed this further in the other thread as well. Thank you very much for your remarks!
  7. Nov 10, 2008 #6
    Energy=power X time In a pulse width modulation circuit, you are not varying the power put into a load, that stays the same, but you are varying the time it is applied to it, thus varying the total energy delivered.
  8. Nov 10, 2008 #7


    User Avatar
    Science Advisor
    Gold Member

    You can't really change one without changing the other in this case. Average the power and it certainly changes with duty cycle.
  9. Nov 10, 2008 #8
    average, yes, which is factors time into the equation.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: PWM for motor control
  1. PWM fan control? (Replies: 6)