• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required as is 20 years of participation in forums (not all true). Come here to have fun, be ready to be teased and not take online life too seriously. We now measure and review equipment for free! Click here for details.

Class D Amplifiers 101

DonH56

Major Contributor
Technical Expert
Patreon Donor
Joined
Mar 15, 2016
Messages
2,807
Likes
3,109
Location
Monument, CO
#1
This is a quick overview of how class D amplifiers operate. Note the “D” does not mean “digital”; it is simply the next letter in order as standards bodies enumerated amplifier types (A, B, C, D, E, F, G, H, I, etc.) It takes an analog, not digital, input and produces a pulse width modulated (PWM) output. I apologize in advance for the length.

The figure below is a simplified schematic diagram of a class D amplifier. It is a rather busy diagram, so we’ll step through each piece from input to output. First the input signal, Vin, is applied to the input buffer (shown as an operational amplifier, opamp). The negative input of the opamp receives the feedback signal (Vfb) from the output (Vout). The output of the buffer is the difference between these two signals, providing a modified signal to the rest of the amplifier. The feedback signal allows the amplifier to correct any errors at the output, improving linearity (e.g. lowering distortion) and stabilizing the circuit so part variations, power supply and temperature changes, and other effects do not reduce performance. In the real world perfection is hard to find, so the output will not be perfect even with feedback, but it can get pretty close as Amir’s measurements have shown.

1555709533824.png


After the buffer is a comparator, a circuit that outputs a “high” if the (+) input is above the (-) input and a “low” otherwise. The (-) input is the comparator’s threshold voltage. This converts the input from a purely analog signal to one that is quantized (sampled) in amplitude though not in time. Almost but not quite a true digital signal, which is quantized in time and amplitude. A comparator with a clocked latch after it is a basic building block for an analog-to-digital convert (ADC). This is not an ADC. The other input to the comparator is a triangle wave; more about that shortly.

The comparator’s output (Vcmp) is applied to a controller. This is usually a logic circuit and voltage amplifier that drives the output switches. The controller can be complicated, but its basic job is to turn on either the high or the low switch, and never both at the same time! That would short the power rails through the switches, increasing power, heat, and chances of blowing up the amplifier.

The switches connect the unfiltered output (Vamp) to either the positive (V+) or negative (V-) power supply rail. Power is expended mainly as the signal is switched from high to low and back and the filter plus load (speaker) is charged; when the switches are static, little power is needed, as the signal is supplied from the output filter. That is the key to the high efficiency of a class D amplifier. There is no standing bias current in the output devices as in a class A or class AB amplifier. A push-pull class A amp has full current flowing all the time and is at best 50% efficient. A class AB amplifier reduces the current by only supplying current as needed to drive the load with minimal standing (constant) current just to cover the “gap” when the signal transitions from top and bottom devices. A class AB can achieve about 67% efficiency. By eliminating standing current, a class D amplifier can achieve 90% or higher efficiency, meaning much lower average power and much less power wasted as heat.

The switching rate is usually well above the audio band, perhaps 100 kHz to 1 MHz. That means no in-band power supply noise, but also adds very high frequency noise at the output. There is also a small “dead zone”, a time during which neither switch is on, thus higher switching frequency makes the dead zone as short as possible so it does not affect the output signal. The output low-pass filter is to get rid of all the high-frequency energy and deliver a smooth analog waveform to the speaker.

The triangle generator is what creates the high-frequency PWM signal to drive the switches. To see how it modulates the signal, consider replacing it with a DC source (a battery). If Vdc is 0 V, then the output is a square wave at the signal frequency. As you raise or lower the DC voltage, the period remains the same, but the pulse width changes since only part of the signal is above or below the threshold.

1555709569103.png


The period of the comparator’s output is the same as the input signal’s (same fundamental frequency) but the pulse width changes. Since you only have two levels (high and low), it is like a one-bit DAC without oversampling, and you would not be able to filter output. Not only is the switching rate too low, but it effectively varies with the signal, so you are just turning your input into a pulse train at the same frequency. Hardly useful for this application. By applying a high-frequency triangle wave, the pulses can be made much narrower, and the comparator’s output frequency is modulated to a much higher frequency. This allows the pulses to be filtered to create a smooth (analog) output signal.

Here is a picture showing some of the waveforms inside the amplifier. The input at the top is a ~10 kHz sine wave. The triangle generator is producing a 100 kHz signal as shown in the middle. The bottom plot shows the comparator’s output. It creates a pulse train similar to that shown with a DC reference, but now the pulse train produces much higher-frequency pulses. Notice the high pulses are still generally longer as the input signal is higher, and shorter as the input signal drops below 0 V, but the pulses occur and a much higher rate. Now a simple filter can remove the high-frequency switching noise to create a smooth analog output.

1555709601679.png


Moving on, the plots below show the input and triangle wave in the upper plot, and the output before and after the output filter in the lower plot. For the particular circuit simulated, the gain is set to produce ~100 Vpp for a 2 Vpp input using +/-100 V power supply rails. The Vamp signal looks exactly like the Vcmp signal as expected but scaled to the output level (+/-100 V instead of +/-1 V). At this scale you cannot see any dead zone in the output; like any decent design, it is as small as practical and invisible by eye. The ripples in the output signal Vout are because this amplifier is designed to operate at 500 kHz. I slowed it down to make it easier to see the switching waveforms, but that means the feedback and filter circuits are not adequately reducing switching noise at the output since they were designed for higher a switching frequency.

1555709618667.png


Here is the picture for the same 10 kHz input signal but switching at 500 kHz as designed. It is harder to see the triangle waves and distinguish the pulse shaping (width modulation) at the higher rate. The output signal is much smoother as seen in the next plot of just the output signal.

1555709634547.png

1555709644694.png


Finally here is an FFT (frequency plot) of the output signal. There are some low-frequency artifacts of the simulation and FFT resolution, plus some mixing products from the signal and switching frequencies, but the overall dynamic range is about 65 dB. This is an idealized design but also is not particularly optimized for performance – I just did enough to get it stable. The output filter rolls off over about 20 kHz, but you can clearly see the 500 kHz switching frequency tone about 50 dB below the output signal, then harmonics falling off above that. I could take more points and optimize the design for better performance but hopefully this shows enough to see generally how a class D amplifier works.

1555709655170.png


A word about the feedback circuit: making this stable means keeping the delay through the amp low enough and switching frequency high enough that the amp circuitry and output low-pass filter does not add too much phase shift. That was one of the biggest problems with early designs; the switching frequency was fairly low, so the feedback circuit (and output filter) had to roll off just above the audio band, and that caused a lot of phase shift in the audio band itself. There was little loop gain to reduce the distortion of higher-frequency audio signals and to ensure amplifier stability with complex loads (like many speakers). Too much phase shift and the feedback would be in phase with the input, adding instead of subtracting (positive feedback), and you have built an oscillator. A very powerful, speaker-eating oscillator. Switching frequencies have gotten much higher so this circuit can work well and is, I suspect, still the main compensation network for most of today's amplifiers.

Adding feedforward compensation is more prevalent today, at least in the very few schematics I have seen (remember this is not my day job). In this scheme some of the input signal is "fed forward" to the output to help bypass the switching stages and output filter. The feedforward circuit may include a low-power class A or AB amplifier that handles not only error correction but also provides most of the output for low-level signals. You must align the phase of the feed-forward circuit to the main signal path, of course, to add the right amount of feedforward compensation at the right time. Again, I do not know, but suspect many modern class D audio amplifiers are using this sort of approach. Some call it a hybrid design due to the class A/AB output driver.

1555709671783.png


Other schemes put multiple switches in parallel, but staggered in time, so the effective switching rate is much higher, use more complex generators to create PWM/PFM and other output signals, and so forth. Too complicated for one post.



HTH - Don
 
Last edited:

Hugo9000

Active Member
Joined
Jul 21, 2018
Messages
140
Likes
263
#4
Thank you very much for this and your other very informative posts, @DonH56 !
 

RayDunzl

Major Contributor
Central Scrutinizer
Joined
Mar 9, 2016
Messages
6,871
Likes
3,046
Location
Riverview, FL
#5
Hmm...*

*looks at all the complications that could be avoided with a powerful feed forward circuit...
 
Joined
Apr 10, 2019
Messages
26
Likes
27
#6
...
Other schemes put multiple switches in parallel, but staggered in time, so the effective switching rate is much higher, use more complex generators to create PWM/PFM and other output signals, and so forth. Too complicated for one post.
HTH - Don
Thank you so very much Don - very useful post, enjoyed that a lot. If it's not to much trouble, could you explain the difference between these four Class D output topologies? I believe US 2005/0162228 is Putzeys' Patent, forming the basis for the UcD/Ncore amplifiers, which eventually became a non-hysteresis 5th order self-oscillating control loop, taking feedback only at the speaker output

foo.png
 

restorer-john

Major Contributor
Joined
Mar 1, 2018
Messages
2,057
Likes
3,058
Location
Gold Coast, Queensland, Australia
#7
Here is one of the very first commercial Class D amplifiers. The Sony TA-N88. Circa 1978.

1555721933020.png



As you can see, the block diagram and basic circuit description (attached also as PDF) is as per Don's excellent description.

1555721812435.png


The schematic and block diagrams (including the SMPS) are also attached for those who would like to study the 41 year old design which is still valid and highly regarded to this day.
 

Attachments

Last edited:

restorer-john

Major Contributor
Joined
Mar 1, 2018
Messages
2,057
Likes
3,058
Location
Gold Coast, Queensland, Australia
#9
I believe US 2005/0162228 is Putzeys' Patent, forming the basis for the UcD/Ncore amplifiers
Sony did it first. Putzey's was a 5yo at the time...
 
Last edited:

RayDunzl

Major Contributor
Central Scrutinizer
Joined
Mar 9, 2016
Messages
6,871
Likes
3,046
Location
Riverview, FL
#12
Last edited:
Joined
Feb 9, 2018
Messages
40
Likes
79
#13
Thanks a bunch for the info on the Sony TA-N88 - does that mean Putzey patented essentially the same design?
No, Putzey's is self oscillating, also most common nowadays, Sony's is PWM with Comparator. A new Danish company is apperently taking it to the next level, see https://www.audioxpress.com/news/pu...-reduce-distortion-in-speakers-and-amplifiers, have some well known people behind, incl. Bruno Putzeys and former TI people. Funny thing, its located in my birthtown, Roskilde in Denmark.
 
Joined
Apr 10, 2019
Messages
26
Likes
27
#14
No, Putzey's is self oscillating, also most common nowadays, Sony's is PWM with Comparator. A new Danish company is apperently taking it to the next level, see https://www.audioxpress.com/news/pu...-reduce-distortion-in-speakers-and-amplifiers, have some well known people behind, incl. Bruno Putzeys and former TI people. Funny thing, its located in my birthtown, Roskilde in Denmark.
+1 for Roskilde in Denmark : )

Yes, I'm aware of PuriFi, the topic is covered in detail by Putzeys himself on the DYI Audio forum:

Ncore design refinement
 

DonH56

Major Contributor
Technical Expert
Patreon Donor
Joined
Mar 15, 2016
Messages
2,807
Likes
3,109
Location
Monument, CO
#15
@decoRyder -- Could you provide a link to the original article? I'm having trouble making out some of that. In any event, there are many variations on a theme. Off-hand I am not seeing anything particularly distinguishing about them other than some shifting in implementation details. Using parallel channels and getting rid of the output inductor is a nice idea but in practice very difficult to achieve. Either you get the effective rate high enough that capacitive filtering alone is enough, depend upon the load for filtering (goodbye tweeters), or implement a scheme that causes alternating channels to cancel the noise spikes. The latter I have done and it works, sort of, but if everything is not just right you end up with very high-frequency spikes that look like impulses.

@restorer-john -- Trust you to dig up the Sony, nice job! I graduated HS in '78 and went to work in the EE lab and for a local audio store that carried them. It was ahead of its time in many ways, particularly use of VFETs and such a high (for the time) switching rate. It was a while before anything really matched it. I cannot recall the big class D amp that was also around about then, Infinity Servo amp maybe? Whatever the "other" one was, it was unreliable and sounded like, errr... "poor". I also built a couple of class D amps (and AB) using Siliconix VFETs with mixed results. My first self-oscillating attempt worked a little too well; it oscillated itself into thermal meltdown!

General thoughts/additions:

I stuck with the original "natural" PWM approach as it is what I have designed in the past and because it is a little easier to explain with a separate triangle oscillator. Self-oscillating designs I would assume are the norm today as they are cheaper, have fewer components, and do not require a clean triangle source (not all that hard to make but harder to make "cleanly" -- I used precision current sources driving a capacitor with switches to invert the slope). The idea of self-oscillating is to provide a feedback path that encourages oscillation at some high frequency and that is now your switching rate. There are a number of ways to do that; most use a simple LC circuit to feed back some of the output with enough lag to cause oscillation at the desired frequency.

Cons of class D amplifiers in general include sensitivity to the oscillator (any noise on the triangle generator just looks like signal -- no way to tell it apart) and high power supply sensitivity. Since you are switching from one rail to another (or ground to a single rail for some designs) any modulation of the power rails can be transmitted to the output signal. Most class D amps use a regulated supply for that reason, and most modern amps utilize switch-mode power supplies (SMPS') so the power supply is also high-efficiency.

Speaking of efficiency, there are number of places energy is lost in the design, reducing it below 100%. The low-level circuits (input buffer, triangle oscillator, control circuits, etc.) draw power and so there is some standing current (power) even when the amp is idle. The output switches are not ideal so some energy is lost in them whenever they change state. There is some loss in the output filter since the inductor has some resistance and the capacitor is not perfect either.

The switching frequency being well above the audio band means less in-band noise but also means you have essentially a big RF source in your stereo system. Shielding and isolation as well as good high-frequency filtering is very important to keep the amp from bleeding into other things. The high frequency also puts stress on things like power supply and output filter capacitors; they must be low-resistance (low-ESR) capacitors with good high-frequency response. That means special capacitors and additional small capacitors to get rid of all the high-frequency "hash". When you recap a SMPS or class D amplifier you need to pay careful attention to the types and characteristics of the capacitors. A big capacitor designed for a typical 120 Hz supply signal (from a rectified 60 Hz line) is likely to explode when hit with big 100+ kHz spikes. The inductor must be low-loss and wideband as well to handle the output switching current.

This is not really my area of expertise so I am sure others can contribute greater insights. The idea was to provide an intro that hopefully most ASR readers can follow. Amp designers know all this already and, if you want to build your own, there are innumerable articles and white papers available on the net and from the AES, IEEE, and other organizations. In fact when I started searching for the article decoRyder referenced I found a whole bunch of introductory papers on a number of manufacturer's websites that essentially went through the same information that I spent a few hours working up. Should have just linked a couple of those, but OTOH it was fun revisiting some of my past work and piddling with SPICE to get some sort of simple amp running to show the waveforms.

Thanks for the kind words all, glad y'all liked this one. It was a bit of work to pull together the pieces and shake the cobwebs out of my little pea brain! - Don
 
Last edited:

restorer-john

Major Contributor
Joined
Mar 1, 2018
Messages
2,057
Likes
3,058
Location
Gold Coast, Queensland, Australia
#16
I graduated HS in '79 and went to work in the EE lab and for a local audio store that carried them. It was ahead of its time in many ways, particularly use of VFETs and such a high (for the time) switching rate.
Just tell me you have a secret stash of Sony warranty supplied hand-matched VFETs in your parts bin out in the shed... :)
 

DonH56

Major Contributor
Technical Expert
Patreon Donor
Joined
Mar 15, 2016
Messages
2,807
Likes
3,109
Location
Monument, CO
#17
Just tell me you have a secret stash of Sony warranty supplied hand-matched VFETs in your parts bin out in the shed... :)
I wish! I'd been working on TVs and stereos as a tech for 5-6 years by then, but high-power amps' need for closely matched devices was a bit of a revelation. I thought that's what ballast resistors were for, then I smoked a few of them...
 

DonH56

Major Contributor
Technical Expert
Patreon Donor
Joined
Mar 15, 2016
Messages
2,807
Likes
3,109
Location
Monument, CO
#20
Does anyone know of the use of Gallium Nitride (GaN) transistors to improve switching speeds in class d I think?

https://www.psemi.com/newsroom/pres...fastest-switching-speeds-to-gan-class-d-audio
There are tons of articles citing GaN as the next big thing in power transistors. It is surpassing SiC and other heterostructures in a lot of places (DC through RF) due to its wide bandgap and low charge storage. I do think a discussion of device physics is a bit beyond the scope of this thread but it is an interesting subject.

Electronic Design and other trade magazines have articles like this: https://www.electronicdesign.com/power/gan-power-transistors-master-strokes-power-supply-canvas

Then there is this: https://www.amazon.com/GaN-Transistors-Efficient-Power-Conversion/dp/1118844769

I suspect GaN devices will be a boon to class D amplifier designers.

Edit: This article has a bit about GaN devices and issues (targets space but most of it is general info): https://www.microwavejournal.com/articles/31995-gan-sspa-technology-for-space-based-applications
 
Last edited:
Top Bottom