What exactly is Pulse Width Modulation? how does PWM control work, and what does a PWM circuit look like?
To control the speed of a d.c. motor we need a variable voltage d.c. power source. However if you take a 12v motor and switch on the power to it, the motor will start to speed up: motors do not respond immediately so it will take a small time to reach full speed. If we switch the power off sometime before the motor reaches full speed, then the motor will start to slow down. If we switch the power on and off quickly enough, the motor will run at some speed part way between zero and full speed. This is exactly what a p.w.m. controller does: it switches the motor on in a series of pulses. To control the motor speed it varies (modulates) the width of the pulses – hence Pulse Width Modulation.
Consider the circuit above: this shows the drive MOSFET and the motor. When the drive MOSFET conducts, current flows from battery positive, through the motor and MOSFET (arrow A) and back to battery negative. When the MOSFET switches off the motor current keeps flowing because of the motor’s inductance. There is a second MOSFET connected across the motor: MOSFETs act like diodes for reverse current, and this is reverse current through the MOSFET, so it conducts. You can use a MOSFET like this (short its gate to its source) or you can use a power diode. However a not so commonly understood fact about MOSFETs is that, when they are turned on, they conduct current in either direction. A conducting MOSFET is resistive to current in either direction and a conducting power MOSFET actually drops less voltage than a forward biased diode so the MOSFET needs less heatsinking and wastes less battery power.
You should see from the above that, if the drive MOSFET is on for a 50% duty cycle, motor voltage is 50% of battery voltage and, because battery current only flows when the MOSFET is on, battery current is only flowing for 50% of the time so the average battery current is only 50% of the motor current!
There is a problem however: when the MOSFET switches off, it not only interrupts the motor current but it also interrupts the current flowing from the battery. The wires from the battery have inductance (so does the battery) so when this current is interrupted this inductance causes a voltage spike: in the circuit the main capacitor absorbs (most of) this spike. When the drive MOSFET turns on again, battery current is asked to flow quickly – which it cannot. The main capacitor supplies current during the period battery current is re-establishing. In a controller capable of giving 120 amps this capacitor is working very hard and, if high current is drawn for too long (depending on the battery lead length) the main capacitor can explode! During the early development work we once used standard wire ended capacitors and melted the wires of the capacitor! Capacitors have copper plated steel leads and in motor control applications these leads can get extremely hot!
It will be apparent from the above that the work this capacitor does is extremely dependant on the loop inductance of the battery wires. Long wires will have a high inductance. Twisting the battery wires reduces their inductance.
Resistance in the battery leads will have a effect similar to inductance, so these wires should be thick.
Also, some people want to put an ammeter in the battery leads. The temptation should be resisted: simple car type ammeters in particular are highly inductive.
Simple controllers (such as are used for motorised golf bags) usually omit the expensive main capacitor and rely on the capacitance of the battery. You can get away with this – our early Eagle and Egret are such controllers. However a brief explanation of the effects are in order. To illustrate this, a graph of the battery voltage as it can be seen with an oscilloscope connected directly across the battery supply at the controller terminals. The scope earth is on the negative rail.
The top is a ‘scope’s eye view of battery positive, bottom is of the motor negative terminal (which is being switched by the controller). The waveforms have been cleaned up a lot to illustrate: in practise there is a lot of ‘dirty’ ringing on the waveform. The supply shown is 12v.
We join the waveform at a point where there is no battery current: the motor output is high and current is re-circulating in the flywheel. At A, the controller drive MOSFET switches on, diverting the motor current to flow from the battery. But the battery leads have inductance! The battery current cannot start immediately, so the battery leads drop a full 12v and the controller voltage extinguishes until the lead inductance can charge up, which it does by point B. The time A-B depends on current and battery loop inductance, and can be a significant proportion of cycle time!
Then, at point C, the bottom MOSFET turns sharply off, interrupting the current. Motor current is no problem, it keeps on flowing and the flywheel device is there to make sure it does! But you cannot suddenly stop the battery current – so it objects in the form of a large voltage spike. This spike rises until something gives: in this case it reaches the MOSFET avalanche breakdown voltage and the MOSFET clamps it. You can easily see the flat-topped clamping voltage with an oscilloscope. MOSFETs are rated for repeat avalanche energy and you have to be sure that the 1/2Li² stored in the battery loop inductance is well below the safe repeatable avalanche energy.
This is a problem: working out battery loop inductance is nigh on impossible – even for an engineer. For a punter to do it is – well, difficult. So a manufacturer simply supplies controllers to a known set of customers who use them in standard ways and sorts out problems as and when they arise on a empirical basis. It’s always a question of a non-technical customer trying to get something for nothing: the main capacitor is needed. For some applications you can indeed get away without! But it is definitely ‘getting away with it’!
In controllers with a main capacitor, most (but not all) of the supply irregularities are smoothed by the capacitor. Nevertheless you will see a positive overshoot and ringing as the battery current is interrupted.
PWM and motor Heating
A popular ‘old wife’s tale’ is that PWM causes the motor to heat more than pure d.c. Like most old wives’ tales, this springs from a partial truth nurtured by misunderstanding. The ‘myth’ comes about because, if the frequency is too low, the current is discontinuous (or at least variable over the pwm waveform) because the motor’s inductance cannot maintain the current properly during the off period of the waveform. So the motor current will be pulsed – not continuous. The average current will determine the torque but heating will be an integral of the current squared (heating is proportional to I²R)- the ‘form factor’ of the current will be greater than unity. The lower the frequency, the higher the ripple current and the greater the heating.
So consider an oversimplified case where the current is either on or off. If the current flows for, say, 1/3 of the time and you require a torque from the motor equivalent to that given by 1 amp continuous, them you clearly need an average current of 1 amp. To do this with a 33% duty cycle you must have 3 amps (the current flows for for 1/3 of the time).
Now a current of 3 amps will give 9 times (I squared) the heating effect of 1 amp continuous.
But if 3 amps is flowing for only 1/3 the total time – so the heating in the motor is 9 times for 1/3 the time – or a factor of 3 greater than the steady 1 amp! This waveform is said to have a ‘form-factor’ of 3.
However – if the pulse repetition frequency is high enough, the motor’s inductance will cause a flywheel effect and the current will become stable. For instance the Lynch motor has an inductance of only 39 microhenrys (being one of the lowest inductance motors I know of) and a resistance of 0.016 Ohms. The ‘Time constant’ for an L-R circuit is L/R which (for the Lynch motor) gives 2.4 mSec. For an SEM DPM40P4 (1kW) the inductance is 200 microhenries and the resistance 40 milliohms – giving a time constant of 5mSec.
As a rule of thumb and to avoid too much maths, the pulse repetition period must be significantly shorter than the motor’s time constant.
Other factors that affects PRF are:
If is it is in the audio band the motor can emit a whine (caused by a phenomenon known as ‘magnetostriction’, so keep above the audio band.
A MOSFET circuit dissipates most while switching from one state to the other so the frequency should not be too high – MOSFETs can be used upto 100kHz with care, but this is getting a bit high.
RF emissions: these increase with increasing frequency, so keep the frequency as low as possible!
It is clearly difficult to chose a ‘best’ compromise between these but an optimum frequency would seem to be around 20kHz.
There is a more detailed version of this page together with a lot more technical detail over on our sister site 4qdtec.com