# A Class D Power Amplifier - and Why it Won't Work

A project log for DC Current Transformer

Investigating fluxgate current sensors (DC capable) with detours into analog electronics and switched mode power supplies.

jbb 07/07/2014 at 04:221 Comment

First up, apologies for the long drought.  I've been super busy at work putting together a MW (yes, MegaWatt) class prototype power converter at work, and it has been eating my life.  Now I'm on holiday and finally have a moment to do an update.

So, this entry will be about using a Class D - i.e. switchmode - power amplifier as a controlled current source.  Let's have a look at the basic features:

So, V1 is a +15V supply.  Q1 and Q2 are small power MOSFETs (driven with synthetic PWM by V2 and V3).  L1 and Cf filter the square wave signals at Vx into a pretty smooth voltage at Vy, which feeds our load resistor (RL) via the feedback windings (Lf, actually 1 winding through 3 stacked cores).

The SPICE parameter E is used to adjust the average voltage applied to L1 / Cf / Lf.  I have used a .step command here to try several values.  I also cheated a bit and forced the initial conditions (IC) of the inductors to avoid long settling times.  We get a bit of oscillation between L1 and Cf - this is not a surprise, because we have carefully chosen low resistance MOSFETs, inductors and (presumably) capacitors.  Welcome to the wonderful world of power electronics :-)

So we see here that we can achieve controlled currents of 0.2A to 1.0A.  However, we actually wanted a +- 1A supply, so this circuit won't work.

Let's have a look at a bipolar version:

So, we now use +- 15V supplies, which means that the MOSFETs now have to block 30V - I've swapped to 55V types.  I also added an initial condition (IC) to Cf to cut down on that oscillation, and changed the duty cycle calculation a little.

The duty cycle has 2 changes.  Firstly, 0% duty now corresponds to an average of -15V at Vx.  100% duty still corresponds to 15V at Vx.  Thus the 0% to 100% gain is now 30V / 100% (where it was previously 15), and there is an offset; 0V occurrs at 50% duty cycle.

The waveforms look promising:

However, there is a subtle and really important problem with the circuit.  Let's have a look at the currents into supplies V1 and V4 (i.e. the main suplies).  These are equivalent to the drain currents of Q1 and Q2 (bottom).

So, the average current through Q1 is 545mA, and the average current through Q2 is -435 mA.  What does this mean?

Well, positive current through Q1 corresponds to real power (8.20W) being drawn out of V1.  This is what we expect.  Negative current through Q2 corresponds to real power (6.52W) being pushed into V2.  This is fine in SPICE, where the voltage source is perfect.  However, a normal power supply cannot absorb power.  This means that energy will build up in the filter capacitors, increasing their voltage until something A) stops working or B) blows up.

I personally prefer option A, so I like to put proteciton in place.  Got some spare ADC channels?  Add software overvoltage protection.  Got no ADC channels?  Add comparators.  Your hacking time is valuable, people!  Don't spending it fixing avoidable mistakes when you could be making new and exciting mistakes.

Note: negative current through a MOSFET is absolutely possible.  Firstly, all enhancement mode (the normal type) MOSFETS, be they N ot P channel, have a built in body diode.  Secondly, if you apply gate voltage, the channels do turn on and conduct. This is called synchronous rectification and is often used by power supply designers to improve efficiency.

I(Q1) = -471 mA average (7.07W pushed into V1)
I(Q2) = 536 mA average (8.04W supplied by V4).

So, we have a mirror image of the same problem.  V1 blows up instead of V4.  This is an inherent problem with the circuit.  I have done the paper anaylsis too (but didn't want to bore you all with the maths - let me know if you're interested) and this is exactly the case.  For a non-zero output current we have inconvenient energy transfer between the positive and negative power supplies.

But wait!  Class D audio amps work!  What gives?

So, the answer to this one lies in the application.  An audio amp is carefully designed to deliver zero DC current at the output (as this could damage the speakers).  Therefore the average power transfer between the positive and negative power supplies is approximately zero.  There is of course some transient power transfer, but we can buffer that with some big storage capacitors.

The next installment will cover a couple of potential solutions to this problem.

See you all later.

## Discussions

jbb wrote 07/13/2014 at 21:54 point
Oh bugger. I've just seen that all the images have disappeared! Sorry about that - I'll fix it in the next couple of days.

Are you sure? yes | no