Author Topic: PWM a DC Motor Problems  (Read 10082 times)

0 Members and 1 Guest are viewing this topic.

Offline mribbleTopic starter

  • Regular Contributor
  • *
  • Posts: 202
PWM a DC Motor Problems
« on: April 06, 2015, 02:02:51 pm »
I'm driving a 12V Motor (typically runs at 0.8 A and stalls around 2A) an L298N h-bridge.  I have a pretty big heat sink on the L298N and when I run everything at constant on the motor gets a little warm.  However, if I PWM at at around 200 hz the motor and heat sink get pretty hot (finger can't touch more than for a few seconds).

So my questions are:
1) Why do things get hotter when running the system as a PWM?  And is there something I could do to reduce the heat?  I would think higher frequency switching would cause more heat, but it would be good to confirm this.
2) I've read about approximating a sine wave by using different length PWM.  If you think think this would help I could modify the software to do this, but is there some way to figure out the timing I should use?  Is it as simple as attaching a scope to the motor terminals and driving it at high enough frequencies to see what voltage gets generated?

Thanks for any suggestions!
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: PWM a DC Motor Problems
« Reply #1 on: April 06, 2015, 02:40:18 pm »
A few points.

The frequency must be "adapted" to the motor's winding inductance. If the frequency is too low, current in the windings will go up "a lot" and come back to zero or thereabouts on every PWM cycle, and remember that losses are proportional to the current's square (the motor will be running in what's called "discontinuous mode"). This heats up both motor and driver. If you have how to measure the motor's current, you should check that the current ripple is a small percentage of the average, something like 10% or less.

When you do PWM, there are additional losses due to the switching events (ON, OFF). The losses are proportional to frequency and switching time (how much time it takes to go from OFF to ON and vice-versa), besides motor current and supply voltage.

For a small motor, 200Hz looks like very little; I would start at 3 or 4KHz. You also need to have some capacitance near the supply pins of the L298.
« Last Edit: April 06, 2015, 02:45:42 pm by nuno »
 

Offline bktemp

  • Super Contributor
  • ***
  • Posts: 1616
  • Country: de
Re: PWM a DC Motor Problems
« Reply #2 on: April 06, 2015, 02:52:03 pm »
The typical L/R time constant for small DC motors is about 1ms. This sets the lower limit to around 500-1000Hz. The upper limits are the losses in the iron core and switching devices.
The optimal PWM frequency is 2-5kHz, but it is also most audible. Therefore it is often a tradeoff between switching losses and noise free operation.
 

Offline mribbleTopic starter

  • Regular Contributor
  • *
  • Posts: 202
Re: PWM a DC Motor Problems
« Reply #3 on: April 06, 2015, 03:30:37 pm »
Thanks guys!  It sounds like I just should try different PWM frequencies.  I will admit I choose a low frequency because it sounded better and I'm willing to take some extra inefficiencies for less noises.  I will do some experimenting to see if I can find a better trade-off.

Is there a website that explains the efficiency of PWM at different frequencies in practical terms?  I've started googling for this, but so much of it is too theoretical for my current level on this subject.  Also if you could point me to a good way to measure efficency that would be good.  DMMs don't seem accurate at these frequencies or is there a way to use one?  Would something like this work (http://www.amazon.com/GT-Power-Analyzer-Consumption-Performance/dp/B00C1BZSYO/ref=sr_1_5?ie=UTF8&qid=1428334190&sr=8-5&keywords=power+meter)?

 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13076
Re: PWM a DC Motor Problems
« Reply #4 on: April 06, 2015, 03:49:57 pm »
PWM the enable pin not the input pins.  If both input pins are in the same state with ena ble high that is dynamic braking.  If you are actually PWMing both inputs in antiphase thats even worse.   Both require the L298 to dissipate all the power that was dumped into the motor's rotational K.E. in the active part of the PWM during the rest of the cycle.

If you PWM the enable pin, and just use the input pins to set direction and braking mode, when its low, the motor can coast and you will get much smoother rotation and far less dissipation in the L298.
 

Offline bktemp

  • Super Contributor
  • ***
  • Posts: 1616
  • Country: de
Re: PWM a DC Motor Problems
« Reply #5 on: April 06, 2015, 04:01:58 pm »
PWM the enable pin not the input pins.  If both input pins are in the same state with ena ble high that is dynamic braking.  If you are actually PWMing both inputs in antiphase thats even worse.   Both require the L298 to dissipate all the power that was dumped into the motor's rotational K.E. in the active part of the PWM during the rest of the cycle.

If you PWM the enable pin, and just use the input pins to set direction and braking mode, when its low, the motor can coast and you will get much smoother rotation and far less dissipation in the L298.
For the L298 this may be true, but for a more modern motor driver with mosfets instead of bipolar transistors, applying PWM to the input pins not the enable pin is the right way. Shorting the motor winding for a short time enables the so called synchronous rectification. When you change the duty cycle the avarage voltage the motor sees follows the duty cycle and therefore depending on the current motor speed it either accelerates, brakes (regenerative braking) or keeps its current speed. Using antiphase PWM is no problem, it only increases the ripple current, but as long as it is small enough no problem. This enables true 4 quadrant control.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13076
Re: PWM a DC Motor Problems
« Reply #6 on: April 06, 2015, 04:29:51 pm »
Yes, the L298 is a bit of a Dodo and being bipolar has high losses. 

I agree that if you are using a MOSFET H-bridge at a high enough frequency that the self-inductance of the windings provides effective smoothing of the current, PWMing one end of the winding properly will set the average voltage and control the speed far more effectively without excessive losses.
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: PWM a DC Motor Problems
« Reply #7 on: April 06, 2015, 04:55:26 pm »
mribble, doesn't make much sense to talk of "efficiency of PWM at different frequencies" alone. It's a combination of PWM frequency, motor and driver that leads to a certain efficiency. The minimum PWM frequency needed is set by motor characteristics; what you don't want is to have the current go up and down (ripple) too much when the motor is stalled (or at the maximum load it will ever see in its application). If you have a scope you should measure the current in the motor and try various PWM frequencies and duty cycles (with stalled motor), you'll see the current ripple and understand better. You can also take a look at some DC-DC buck converters theory (like in the wikipedia), keeping in mind that the inductor would be the (stalled) motor.

Something that is not usually clear is why a big current ripple is bad for efficiency. There are other factors (as mechanical), but one that is not so obvious is that a constant average current of X over a certain period is not the same as an non-constant average current of the same X on the same period, in respect to power dissipation.
A simple example: In one case you have 2A for 0.5s and 0A for 0.5s, in another case you have 1A for the full second, both over a 1 Ohm resistor. Question: what's the average current and how much power is dissipated in each of the 2 cases?
 

Offline mribbleTopic starter

  • Regular Contributor
  • *
  • Posts: 202
Re: PWM a DC Motor Problems
« Reply #8 on: April 06, 2015, 07:48:45 pm »
Ian, I am PWM the enable pins like you recommended for the L298.  Perhaps next time I'll look at one of these more modern motor drivers.

Nuno, I do have a scope, but I've never measured current with it.  I've just ordered a beefy shunt resistor and will check my current at the motor under load.

Thanks for all the help!  I will report back after I've done some experiments.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13076
Re: PWM a DC Motor Problems
« Reply #9 on: April 06, 2015, 09:42:03 pm »
I assume you are following the circuit in fig 6 of the datasheet (although the sense resistor may be 0 ohms if you aren't measuring motor current)

What are you using for D1-D4?

What's the actual size of your "pretty big" heatsink?
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11713
  • Country: my
  • reassessing directives...
Re: PWM a DC Motor Problems
« Reply #10 on: April 06, 2015, 10:41:30 pm »
read at the bottom of the page "Some oscilloscope views of signals" for continuos mode motor 2nd pic compared to 1st pic discountinous... https://www.picotech.com/library/application-note/some-power-pwm-drivers-for-electric-dc-motors i'm experimenting with 2KHz PWM software generated by pic16f690, custom driver and h-bridge. the motors still got hot after few minutes, not good... voltage and current probing shows (as below), not good not continuous, i need faster mcu to generate PWM, 20-40KHz is much preferable.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline mribbleTopic starter

  • Regular Contributor
  • *
  • Posts: 202
Re: PWM a DC Motor Problems
« Reply #11 on: April 07, 2015, 01:49:05 am »
Ian, Yes fig6.  One change is I use a 100 uF cap instead of 100 nF on the source.  I also didn't need to drive two different motors so I linked together all 4 of the outputs instead of using just two.  See the image below for my schematic.  These are the diodes I'm using: http://www.mouser.com/ProductDetail/NXP-Semiconductors/PMEG4020ER115/?qs=sGAEpiMZZMuIUjt4yeP9cyH9QML0fiM5iZUs2A5NcSc%3d  And here is my heatsink: http://www.mouser.com/ProductDetail/Ohmite/RA-T2X-38E/?qs=sGAEpiMZZMttgyDkZ5WiumlCfl50RTwzz%2fuzhVigMN8%3d





 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13076
Re: PWM a DC Motor Problems
« Reply #12 on: April 07, 2015, 02:07:09 am »
Try adding a 0.1uF ceramic at the Vs pin in case the 100uF cap has too much ESR

If you've got a scope, check the PWM signal has nice square edges and is reaching good logic levels, and take a look at the output waveforms and compare with the datasheet.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11713
  • Country: my
  • reassessing directives...
Re: PWM a DC Motor Problems
« Reply #13 on: April 07, 2015, 03:48:00 am »
i'm experimenting with 2KHz PWM software generated by pic16f690
Why not just use the CCP module? You can easily get 40KHz with 8b resolution.
because i need 4 indepent PWM. at first glance the datasheet i thought the pic can do 4 PWM P1A-P1D it turned out only one, the rest are some kind of compliment for full h-bridge :palm: yea talking about wrong mcu selection here, but thats only in my stock. next move is using external 20MHz crystal (waiting order to arrive), if still not satisfy, move to avr 8 or 16MHz in my stock... just for the fun wasting time...
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13076
Re: PWM a DC Motor Problems
« Reply #14 on: April 07, 2015, 04:14:26 am »
Looking at the datasheet Figure 1 : Typical Saturation Voltage vs. Output Current, you 've got a total voltage drop inside the IC at the 2A stall current of 2.6V (assuming equal current sharing between the paralleled outputs) giving a dissipation of 5.2W and a heatsink temperature rise of about 20 deg C. Presumably you are complaining the chip is getting hotter than that.

The first thing I'd do is stick some 0.1 ohm resistors between the sense pins and ground and have a look at the current waveform.  As Nuno pointed out earlier, it sounds like I^2*R losses are killing you.

The next thing I'd try is pushing the PWM frequency up using the hardware PWM.  Its not what you need to control four independent motors, but as everyone seems to think your PWM frequency was at least an order of magnitude too low, it would be worth seeing if increasing it is going to solve your problem before you do a total redesign.

Finally, do you have more than one of these motors?  If it had a shorted turn on the armature it would explain a lot, so testing a different motor would be worthwhile.

I'm assuming its a PM motor not one with field coils. A series wound motor would certainly not be happy with low speed PWM.
« Last Edit: April 07, 2015, 04:16:59 am by Ian.M »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf