Atom Feed
Comments Atom Feed

Similar Articles

2012-03-27 16:26
Adventures in Class D (part 2b) - ringing in switching circuits
2011-06-04 21:39
Adventures in Class D (part 2)

Recent Articles

2019-07-28 16:35
git http with Nginx via Flask wsgi application (git4nginx)
2018-05-15 16:48
Raspberry Pi Camera, IR Lights and more
2017-04-23 14:21
Raspberry Pi SD Card Test
2017-04-07 10:54
DNS Firewall (blackhole malicious, like Pi-hole) with bind9
2017-03-28 13:07
Kubernetes to learn Part 4

Glen Pitt-Pladdy :: Blog

Adventures in Class D (part 1)

I've been experimenting with Class D on and off for nearly 20 years now. When I started MOSFETs where rather less refined devices than they are now, with large gate capacitances (and worse yet drain-gate capacitances) and often not good Rdson.... without even bigger capacitances that is. Things have improved, and now driver chips with level translation and everything built in are common, but that would be no fun!

What I've been messing with recently is a fully discrete drive and output stage using some fairly old (but good) MOSFETs I had kicking about. I've also made my life hard in other ways: I've opted for a "bridged" (H-Bridge output) which means two sets of floating supplies, two sets of drivers, no ground reference for an easy control stage, and much more.

There is method in my madness though....

Why Bridged?

I wasn't a fan of bridge output amps for many years, but then it finally hit me - there are no significant ground currents as the output current is going supply-to-supply (assuming split supplies... and who whold build a serious amp without them). That means you keep your reference (grounds) much cleaner than a single ended amp, and that helps avoid corrupting low level signals.

With Class D it is even more beneficial:

The two halves of the bridge switch in opposite directions which means that interference from the carrier gets cancelled too - kind of the "twisted pair" effect. This in turn means that output filter design can be more relaxed.

Additionally, I am opting for a balanced control stage which provides even more immunity to noise and interference.

Then there's the fact that the supply voltages can be kept smaller (by about half) which means that the amplitude of the carrier is half  (or a quarter in power terms) which again means less carrier to suppress or broadcast as interference.

It's all rather good in terms of signal integrity, just a bit of a pain (and additional expense) when it comes to design.

Class D myths and truths

There is an awful lot of stuff said and written about Class D, and some of it by people with an in-depth understanding, and some of it not. In fact, a lot of what I've read recently seems very light on facts and rather heavy on colourful "marketing" language. That never fills me with confidence - if stuff is truly good then it shouldn't need to be hyped.

So here we go at looking at some of the key features (or fallacies) of Class D....

All about Efficiency

The theory goes that because it's switch mode (ie. hard-on or off) the losses in the output devices are minimal. Sounds good in theory, and with good design close to theory is achievable, but it needs a little care in reality.

I was going to save myself some hassle and enquired about some Class D modules that where being sold on eBay based on and off-the-shelf controller/driver chip. To my amazement, the designer couldn't provide any figures on power dissipation to spec the heatsink and after some research I found posts from him on audio forums on the web asking for help on designing these modules. Oh dear!

As it turns out, the power output figures where rather inflated and in reality it could probably only deliver about 200W sustained, but there was more. For a 200W amp, it required a 1K/W heatsink and a 400VA transformer. Well, a Class AB amp would typically have a similar heatsink (based on dissipation on music rather than continuous signals), and would generally not need such a huge transformer. So much for "Class D Efficiency"!

This is unfortunately the reality of Class D. A bad design can easily put it in the same league as Class AB, and the disadvantage is that a low output levels (which is where it will be operating most of the time with music) an amp that has high losses when idle due to slow switching, lack of deadtime, and other factors is probably going to run a lot hotter than a Class AB of the same rating.

Great Class D sound

Again, it depends. I was told to buy a certain Class D amp buy a friend on the basis that everyone was raving about. I did..... and was very disappointed. The low end rolled off at about 100Hz. That was easily solved - the input filter was to blame so I put bigger caps in. The supply then started to wobble and the whole thing went unstable and locked up the moment the volume went up to normal listening levels. At that point I kind of lost interest and still have no idea what people where raving about. Maybe it was the fact that it had no bass that made it sound "fast" or suppressed boomyness (typical modern speakers have about 4dB or more lift from around 100Hz - not a faithful reproduction of the sound as many would have you believe), or maybe any number of other ways that different deficiencies in different components may have helped cancel each other out.

One thing that Class D does have going for it over Class B or Class AB is that there are no zero-crossing anomalies. The importance of this is often overlooked. Music, or at least the type that hasn't had all it's dynamics stripped from it has a very low duty cycle. That is, it's mostly low energy with periodic bursts of energy. Add to that the fact that a comfortable "loud" level in a typical  European living room may only be touching at a couple watts a side at the peaks, which means amps are almost always spending most their time around that zero-crossing point with all it's non-linearities. Add reactive loads of real-world speakers and the zero crossing problems can be exaggerated. This problem is fairly obvious if you take a look at the the graph of distortion vs power output of a Class B/AB amp. At the top end of the power range, the distortion climbs as the amp clips, but on many amps it does at the bottom of the power range too as the signal falls into the regions of zero-crossing non-linearities and they begin to dominate as the distortion source.

The filter problem

Class D amps produce very high levels of high (RF) frequencies with the hard switching of the output stage. To avoid frying the load with the carrier as well as keeping interference down and keeping in line with emissions regulations, an LC filter is normally on the output. In some lower power amps this can be left out and only relying on the inductance of the speaker to filter the carrier, but any amp with significant output will almost certainly need a filter.

Not such a big deal if it is driving a known load as the filter can be designed for a specific load characteristics, but in a component amp that could be used with any load, the reactances of the load can cause the can the filter to behave in a very different way than it was designed. Speakers are almost never an ideal resistive load and every design is different.

Simulations I did of this problem some time back showed that even with a 1MHz carrier, there could be a few dB variation in the audio band due to different loads. Again, this is not necessarily going to sound bad, and in fact it may help compensate for flaws in some speakers, but it may just as easily exacerbate flaws in combination with others. The problem is consistency - the characteristics of the amp is going to be different for different loads.

Applying feedback from after the filter is one option but a minefield when it comes to stability. A basic LC is second order, then add in other load reactances and the phase becomes extremely unpredictable. Personally, I'd rather have a stable amp with some high frequency gain error than an unstable amp.

Output Impedance

One thing that is undeniable about Class D is the low output impedance. Linear amps often rely heavily on feedback to reduce the output impedance, but a Class D is hard switched with low impedance MOSFETs so the output impedance is inherently very low, and then feedback just makes it lower still.

Not a big deal with mids and tops, but when it comes to bass, many speakers are very sensitive to output impedance and it can significantly affect their "Q" and hence their frequency response.

Really, the low impedance make the low end behave more like theory (even if the room does the opposite!), and that means higher predictability. That's a good thing - things behaving as they where designed.

What are they good for?

Although the freedom from zero-crossing distortion is good across the board, the majority benefits of a well designed Class D amp do strongly favour the bottom end of the audio spectrum where most of the power demand is, speakers are sensitive to output impedance and where response anomalies of the output filters will not have significant impact. This is why they are a favourite when it comes to subs and the bass/mid in active systems.

Operating at low frequencies also means that often the carrier frequency can also be dropped which can make for higher efficiency and an easier design.

Strangely enough, that's what I've got in mind - a sub (or pair of subs) to compliment my vintage Leak TL12's.

Developing MOSFET drivers

MOSFETs speed depends largely on how fast you can drive the gate, though there are other factors like parasitics which make life harder. The thing to keep in mind is that the gate-source capacitance is not the whole story, and in some cases can end up the minor part of the problem.

As the gate voltage reaches the point that the MOSFET starts to switch (on or off), the source-drain voltage starts to change opposite to the source-gate voltage and the the gate-drain (or Miller) capacitance injects current into the gate opposing the drive. When the voltage swings we are talking about can easily be 100V in a moderately high power amp, the charge on the gate-drain capacitance can start to become a major factor. What is also important is that it is opposing the source-gate voltage change so is holding the MOSFET in a part-on state where the power dissipation is highest.

The main factor in the efficiency of a Class D amp (assuming you have the right dead-time and a low Rdson MOSFET) is generally how little time the output devices spend in this part-on state where they are dissipating the most power.

This is particularly important on the turn-off as the inductive load of the filter means that at turn-on the back-EMF from the inductor will be helping by minimising the current during switching, but by turn-off the current will have built up and the speed which the MOSFET can be turned off is the major factor in efficiency.

Starting with the highest-risk part of the design first (once cracked the rest is relatively safe), I made my mission to design a fast driver which could drive some hefty gate capacitances without difficulty.

Many previous experiments with driver chips worked well up to a point, but at high carrier frequencies things started to go wrong - the driver chips themselves start to get hot. They may have a 2A or higher output capability, but where simply not up to operating with large loads at high frequencies. As they warmed up, the Rdson of the outputs in the driver chip would rise which made them even hotter, but also meant that the MOSFETs weren't switching as fast as they should, so the drivers also started to get hot and sometimes fail themselves.

It also didn't take long before the MOSFET switching was so slow that the output devices where overlapping and it all went BANG!

While the driver chips may have been good at lower frequencies (eg. 10's of KHz) where SMPSUs and motor drives may have been operating, they clearly weren't up to driving high gate capacitances in the MHz region. Newer generation driver chips may be better, but I'm going to have fun with doing some discrete design.

So the key things we need are:

  • Can handle driving nice big MOSFETs at a respectable carrier frequencies (ie. high enough peak output currents).
  • Can do the above without overheating - BJTs are a pretty good option here as they turn on harder as they heat up where MOSFETs often do the opposite (depends on the particular one though).
  • Switch fast - this means not allowing BJTs to saturate as they are very slow coming out of saturation. MOSFETs are better here, but as they are voltage controlled, that means swinging voltages and that means we have to worry more about capacitance again.

Symmetric Emitter followers are inherently saturation free provided the base voltage stays within the supply rails, so a fairly safe bet. Problem is that there is a diode drop each way (so about 1.2-1.4V total) between input and output, and I want to be able to drive these from a low voltage signal from an opto-isolator.

I am forced to have a common-emitter stage for voltage gain, but that means I need to overcome saturation. The solution is rather simple - put a diode from the collector to pull down the base (via another diode so the diode drops cancel) thus the transistor stop's it's self saturating:

Diodes prevent BJT saturation

This is then buffered with a Symmetric Emitter follower to boost the current. This combines the low output impedance of the follower with voltage gain and fast switching of a common emitter stage, with protection against saturation.

The only other thing is the choice of devices. The "Maximum Ic" of the transistors is largely irrlevant here as the output current is a very brief spike rather than sustained, although it does give an indication of what the transistor is capable of. The key thing is actually the current gain (hFE) which tells us how much output current we can get into the gate of the MOSFET for the available base current from the common emitter stage.

Now there is a catch. hFE is normally spec'd at low currents where it is high, and at high currents (like our current spike to charge up the gate) the same device may have negliagable hFE. After a bit of looking at hFE graphs and experimenting, I settled on the readily available BC337-40/BC327-40 pair which are also available in a surface mount package. These do quite well at higher currents:

hFE for BC337

Although other gain-bands of BC337/BC327 are virtually identical at high currents (they all come down to a hFE of about 30-40 at 1A), the higher gain still counts on the edges of the current spike, effectively being able to deliver a "fatter" current spike than lower gain versions which still helps switch quicker.

How well does this work? I'm fairly happy with it and it can switch a chunky 18A MOSFET at 2MHz, though the MOSFET is clearly not keeping up at turn-off as as I would like:

Drain and Gate voltages

There is the step in the rise of the gate voltage caused by the drain-gate capacitance, however with the slow turn-off of the MOSFET the same step isn't visible. Examining data sheets, it seems that much higher drain currents are used when specing the MOSFET switching speed so this is likely to have to be dealt with as a combination of switching frequency and dead-time. These speeds would not be viable with discrete transistors if they where saturating.

Another interesting thing here is that the the gate voltage is actually rising past the turn-on threshold a fair amount before the MOSFET starts to switch which makes the step higher than if it was switching more slowly, and also accounts for the slight "fall back" of the step in the gate voltage.

With a more sensible switching speed for sub amps of 500KHz, it looks even better:

500KHz Gate Waveform

Here again we can see the step delaying the turn-on compared to the Square Input signal to the driver. With a sub amp there is still scope to drop the frequency even lower to say 200KHz which will boost efficiency further and still be able to put a good filter in rolling off at a few KHz.

Just for the sake of quickly proving a high risk part of the design I do quick "ratsnest" prototypes of the risky bits. This may not please some, but at least I know I'm in particularly good company with this one!

Ratsnets MOSFET driver test prototype

So, I have my ultra-simple fast MOSFET driver circuit which seems to comfortably switch chunky MOSFETs without overheating or slowdowns due to saturation. Sticking a 6N137 photo-coupler on the input gives an easy way of totally isolating the output stages from the control stage, and has an extra benefit: simply putting the LEDs back to back in opposite directions means the right MOSFETs switch without any extra inverters (or propagation delays). Then, add a basic RC filter and we have dead-time as one LED turns off then eventually the voltage swings far enough and the other turns on and vice-versa.

Next I'll look at the controller/modulator.