# Class D Amplifier Tutorial!

In this video I’m going to explain what
a Class D amplifier is and show you how to build one that’s
powerful enough for a home stereo system. 30 watts is a surprising amount of power
and it’ll cost you about 20 bucks. So what is a Class D amplifier? It’s an
amplifier that works in a certain way. A Class D amplifier takes an input wave,
like a sine wave, and converts it into a high frequency
pulse width modulated square wave. Then you filter the square wave and you
end up with an amplified sine wave on the output. Let’s start with example waveforms and
block diagrams and we’ll talk about specific circuitry later. I’m using my function generator to
generate a 2Hz sine wave with 200 millivolts peak to peak. 2Hz is unusually slow but it lets
us see what’s going on. Next, let’s use some circuitry to convert
that low frequency sine wave into a high frequency square wave. And lets show that in green. Notice how
the frequency of the square wave is a constant 300 kHz its but our 2Hz
input signal is changing the pulse width of the wave. As you know from my previous videos a pulse width modulated square wave is an
excellent way to quickly change the amount of power going to a load. In this case we’re going to quickly
change the amount of power going to a speaker. The amount of power supplied to the
speaker ends up being proportional to the duty cycle of the high-frequency
square wave. But we’re not ready to connect a speaker yet. We’ve got a signal that’s 0 to 12 volts DC with tons of unwanted high-frequency
noise and our speakers won’t like that. Let’s add an LC low-pass filter to get rid of
a lot of the high-frequency crap. And let’s pause the input signal so we
can see what happens. The high-frequency square wave is in
green and the low-pass filtered output is in yellow. The square wave is 0 to 12
volts DC with a duty cycle about 50%. After filtering we end up with an
average DC voltage of around six volts. Notice how this isn’t
perfect DC. It’s a little bumpy. That’s because our
low pass filter isn’t perfect. Now let’s crank up the input frequency
to 2 Hz again so you can see how the output changes. Now let’s zoom out on the time scale and you can see that we’ve got a 2Hz
sine wave now and its 2 volts peak to peak… Ten times more than the input. We have
successfully amplified the voltage of the input signal, and the amplifier can also deliver a lot
more current than the function generator can. Overall we get more power. But we’re not
ready to connect a speaker just yet We still have the 6 volt DC offset. So
let’s add a high pass filter so only AC can pass through to our speaker. And instead of this boring 2 hertz test
signal let’s connect something more fun. … Music playing … Alright, you want to make your own
amplifier? Let’s build this thing! Let’s start with the TPA3122. A 12 volt power supply and a 1000uF
capacitor to help filter it. I’ll put a link to the parts in the video
description section. First, let’s add some more capacitors.
Remember how I said a Class D amplifier converts your input sine wave into a
high frequency square wave? A class D amplifier switches high
is not going to do a very good job delivering stable power at these high
frequencies, So we use these capacitors to help fix
that. They’re also used to help stabilize the reference voltages used inside the chip. Next, we’re going to need some bootstrap capacitors. These are needed to help drive the
transistors inside the amplifier chip. Some class D amplifiers require these
capacitors, some don’t. We can configure the gain of the
amplifier with the two gain pins here. If we connect both gain pins to the
positive power supply rail, we get a gain of 63. It’s like turning
our amp up to 11! Wait… wrong movie. Connect the shutdown pin to your positive rail and connect mute to ground, otherwise the
amplifier will just stay silent. Next, we add our LC low-pass filter to turn the 300 kHz square wave back
into something that looks more like a normal audio signal. You don’t have to use the exact same 33uH
inductor I used but try to get one with at least 3 amp rating.
Now for the capacitors, I’m using 50V ceramic caps with
X7R dielectrics. Remember, we’re trying to get rid of the
high frequency content of the square wave so there’s going to be a decent amount
of high-frequency current flowing through these capacitors. So electrolytic capacitors are not going to be
good enough. Now because speakers don’t like to be fed DC we add some 1000uF
electrolytic capacitors in series with the amplifier’s output so
that we only get AC going through the speaker. So we’re
low-pass filtering then we’re high pass filtering. Finally let’s
add some 1uF capacitors to high pass filter the input audio signal. These also help ensure that your mp3
player doesn’t get damaged in case you screw something up. So now we have a highly efficient class
D stereo amplifier. This thing is more than powerful enough
with a 12 volt supply but if you want to crank the supply
voltage up to 28 volts you can get two channels of 15 watts,
and that’s more than enough for anyone’s living room. And if you don’t
like doing stuff on a breadboard, check out the link in the video
description where you can buy a kit with a PCB so you can solder a very
similar version of this amplifier. and it should give you less distortion
than mine. Okay so after all of that we turned a sine
wave into a bigger sine wave. What’s the point? You can use an op-amp to
do that. What’s all the square wave stuff anyhow? Well, let’s take a look at the power
consumption. Look at what’s inside an LM1875 op amp. There’s a lot going on here but the part
that will draw the most amount of power is the output stage. This transistor
arrangement helps form what is called a class AB amplifier. This is the part of the
amplifier that allows it to deliver high amounts
of current to a speaker. Class AB amplifiers typically use NPN
and PNP transistors on the output and they operate in the forward active
region. And to simplify what that means, it’s kind of like they have a resistance
of several ohms. This generates a lot of heat, but allows
the amplifier to output a continuous low distortion waveform. So what does the output stage of our Class
D amplifier look like? Well it’s two MOSFETs. When the top one
is on and the bottom one is off the square with goes high. When the
bottom one is on and the top one is off the square wave goes low. The
resistance of each MOSFET here is 0.2 ohms. And only one MOSFET is
on at any given time. Less resistance, less heat. And yes this
is a huge simplification. Accurately calculating amplifier efficiency
is beyond the scope of this tutorial but the important thing that I want you
to know is that Class D amplifiers are very efficient. So if class D amplifiers are cheap and very
efficient, why aren’t they used everywhere? Well at the
end of the day we’re listening to a filtered square wave.
Even after the low-pass filter, it’s never going to be a perfect
reproduction of the input audio signal. You’re always going to have a small
amount of distortion. Chances are you’ll never even notice it on most speakers
and headphones and that’s why most modern consumer
electronics use class D amps. But if you have expensive speakers
or you’re a professional musician, chances are you want to avoid class D
and stick to less efficient, higher quality class A or class AB
designs. But for the rest of us bums class D
will do just fine and you can use the circuit as part of a
home stereo system a home made boom box animatronics and more. Speaking of bums… don’t give money to this guy, he doesn’t
even know where to get a good deal! If you like my videos you can support me
by checking out the links in the video description section. There are many ways to help. Check this
out… if you visit my Amazon link and bookmark it every time you use that bookmark I’ll
get a percentage of the money you spent on Amazon. The price to you is exactly the same. You
get to buy whatever you would’ve bought on Amazon anyway, and Amazon just gives me a commission. And
that can make the difference between me being able to make videos or spending my time on another job. If
you can’t afford to buy or donate, that’s cool too. I love reading all the
encouraging comments that you guys leave. They keep me motivated and I read every
single one of them. Thanks guys!

## 100 thoughts on “Class D Amplifier Tutorial!”

1. Rodrigo Godoy Valenzuela says:

Subscribed

2. Mattias Stein says:

I still don't understand what is so good about digital implifiers. And why convential "linear"amplifiers have big coils and digital amps don't. Is it because digital amps are incredibily efficient driving the movement of the speakerdriver?
All I can imagine so far is a microprocessor driving a"tone generator" which is also the power generator directly driving the speaker drivers movement.(As you can see I am a total electronic noob)

3. lishde says:

This is a good napping video and when you wake up you know more

4. Ma ON says:

cool thanks for the input. Sounds like another application for this would be one where the distortion would be fesirable, like, say a distortion pedal for a guitar…hmm…

5. SUBRATA PANDEY says:

Very good work.Keept it up.

6. İbrahim YILDIZ says:

great job, thank you!!!

7. PETR DOLEZAL says:

Wait, so an audio signal is dc, lets say from 0 volts to 1 volt, or ac lets say from -1 volt to 1 volt? I am confused

8. Chaim Bendahan says:

9. Nick Jones says:

love your videos so great and informational and in laymen terms question I would like to build an amp that does not cut off at over 20khz I'm not using it for music so no worries there just want to amplify the freq gen I got that goes up into the MHz .. and not sure where to start since all audio amps cut off at 20khz and not sure what part of amp does that or how to fix/change etc…

10. John Raines says:

Great video. I need to bump the current output of a function generator and this video cleared up everything that was muddy in my text books. Thanks!

11. Cat22 says:

Could you do a video on receivers & transmitters used for Ham Radio?

12. Paul Ogilvie says:

very informative, thank you

13. Koushik Tesla says:

Does it needs dual rail psu or single rail is sufficient or not afro bro???

14. Home Studio Musician says:

great videos my friend! And I'm about to start doing some Home Studio Musician Youtube live videos and I'd love to copy your "bookmark this link and use it as your Amazon home page" function – I live in Canada and use amazon.ca, so not sure if it's available here, but if it is can you please tell me how to find out about it? Do I need a sellers account at Amazon? Again, many thanks, great teacher 🙂 James

15. s3v says:

Ha! I hear you playing Transa-supernova on the scope!

4:00 back to the futuer story one screen of giant speaker

17. Dave Chism says:

Very nice explanation.

18. Mark Funderburk says:

There are many very good class D amplifiers, theses days you will see fewer and fewer "old iron" types in any sound reinforcement situation (ex. concert), mostly becuase they are not nearly as power dense and much less efficient. Being a musician does not mean you have any special knowledge of what constitutes good sound quality. The same can be said of the so called "audiophiles" who spend thousands on tube amps (and other junk) that distorts the crap out of what they are listing to.

There is nothing "budget", or "crappy" about a class D amp, they are becoming so popular becuase in many situations they are superior in any meaningful way.

I make this point becuase too often I see an otherwise very informative video that happens to feature something related to audio and the presenter makes the mistake of assuming that the above mentioned groups actually know what they are talking about, if you really care to know what is best look at what actual audio engineers ( a surprising amount of whom are EEs) are using to produce the sound at large concert or in a high quality recording studio.

19. Jeffray Crownwell says:

I would like to find a schematic to build a 2.1 amplifier that could deliver some real power like 2 X 50W R.M.S and 100W for a subwoofer that could work on a 24 volts battery with an insanely low distortion…kinda like 0.001%…. I know it would be easy to get one tiny board from China….but they are so cheap and you didn't even turned the volume that the distortion already peaks at 10% and I just don't want to build a boombox that sounds like trash…..So I sure hope you can help me!

3:59 funny bro

21. Kevin Miedema says:

straightforward and simple – the stuff us filthy casuals need to understand audio amps 😉

EDM 1:32

23. Afrotechmods says:

Interested in learning about wireless power? Subscribers can get up to 80% off my course Wireless Power to the People – Wireless Charging 101 on udemy using the coupon code "YOUTUBE" http://www.udemy.com/wireless-power-to-the-people-wireless-charging-101/?couponCode=YOUTUBE

24. Chic Blick says:

can you tell me what program you used to draw the schematic?
i use eagle and cant seem to find the integrated circuit's library.

25. Lee Yy says:

Please do another video of filterless class D amplifier. I did a filterless amplifier out of just microcontroller and motor H-bridge with no inductor at all (well the speaker itself is inductor).

26. Simon Arsenault says:

loll classé is class D

27. diregremo says:

Big bottom.. talk about mud flaps, my babies got em.

28. Alessio S says:

thanks, I can use your works for future school projects

29. jwrtiger says:

Like the information using the 2-Hz signal…. really helps explain the process.

30. Timmy Girard says:

I've been watching you for a long time. I actually bought my OWON scope based on your reviews years ago.
I'm using your amazon link now and just bought this for my son to use with ProTools
https://www.amazon.com/gp/product/B06XKNZT1P/ref=od_aui_detailpages00?ie=UTF8&psc=1

Keep up the great work 🙂

31. Liam Holliday says:

Loved your video! The part about musicians avoiding Class D is inaccurate though. Most high quality bass amps have at least a Class D power section, Dark Glass stuff and others alike. Small head, 900W of power, can only be achieved by Class D at that size and sounds amazing!

32. gus bisbal says:

Great video. Thank you.

33. Silver Wang says:

hahaha Class D Bums!!

34. John Smith says:

How are Class D Amplifiers related to 'Blocking Oscillators', if at all?

35. Jonah Swain says:

Could you make a class d amp from discrete components and basic ICs (op-amp, comparator, …)

36. B I G B R I E F says:

37. superconfort says:

Awesome video, very thankful

38. Ramza II says:

por qué ponés el nombre del video en español si está en inglés y no hay subtítulos?

39. crunchyeater says:

Love your stuff, man. I'm an Electrical Engineering student and this is giving me a lot of encouragement to survive my classes. Keep it up!

straight to the point!great vid 🙂

41. Aleš Turoň says:

is here someone willing to answer me a few questions?

42. El_Ectric says:

2:47 What's the song?

43. Joe Duke says:

If I were playing with this, I'd experiment with using pin 6 to augment the lowpass Butterworth filters to arrive at a tunable 3rd and 5th harmonic Gyrator. The Bypass controls the first op amp of both the left and right pre-amplifiers, so why not use it to do more than power supply and startup noise reduction? Also, I'd make the MUTE, part of an active clipping controller. Remember, wherever logic is used, these are just transistors that can be operated analog, just make sure nothing overheats.

44. DD2Kean9 TlSfresh says:

Thanks for making these videos, sorry I couldn't donate. keep up the good work

45. ky lo says:

Theoretically, class D amp can have 90% of power efficiency. How can I measure the power efficiency of the circuit?

46. EmeritusE says:

I dunno… I look at class D stuff and all I can think is spurious radio frequency emissions and RFI all over the place.

47. Bimochan Shrestha says:

That explainend me everything really thanks.And May be ,can you also help me out for an idea to make any HAT Board using CAN-Bus and any kind of sensors….

48. Aguinaldo Rubio says:

Uhhh…. My brain~

49. Dilnuwan Amaraweera says:

this is a superb explanation

50. Cruzito Cruz says:

really all of them?

51. Munish Kumar says:

Very nicely explained. Appreciate much 🙂

52. simay kazıcı says:

I read a paper on a scientific magazine about this for 2 days along but this video speeds up my understanding like a rocket !! many thanks !

53. Master Basser says:

… i know its a test but, 30w isnt a lot at all… nor a surprising amount of power… im at 4200w and still needing more for loudness.

54. Wow Fail says:

I am at a loss, how would you configure volume knobs, and what is the approximate current draw at 30W.

55. James C. Sisson says:

i don't get all the techy stuff. can you give me some references to check out for a better unerstanding? thank you.

56. Somnath Patra says:

Very nicely explained. Love it dude😘

57. JC Denton KH says:

need a scope!

58. Cole Stitelman says:

Hey, Nice Video. If I'm trying to make a 1 watt Mono amplifier (with the TPA2001D1pwr) Would I use all the same Inductors and capacitors? what do you think?

59. Tashfi nowroz says:

Damn!
Been watching you videos and I am kind of getting inspired to build a Sound box by myself for my regular uses 🙂
Thanks.

60. Pasha !JBL says:

The PAM 8403 can't do it on 3 hz sine wave

61. Pasha !JBL says:

3:59 wait were all moving

62. Saptarshi Sahoo says:

63. Joshua Kuebler says:

Yours are some of my favorite electronics videos on the YouTubes. Informative with a side of humor. Thanks for all you do brother.

64. Fassa Faisal says:

Ay caramba! 😂

65. william fitzpatrick says:

Nice toot

66. Sergio Daniel Alarcon says:

puedo controlar la velocidad de un motor monofasico con eso??

67. Andrew Rigney says:

octopart.com is my new favorite website!

68. Rodolfo Gil says:

Ay!! Caramba!!

69. Vincent Robinette says:

This would have been the perfect thing back when "boomboxes" were popular. They would have used a lot less battery power, and could have driven lower impedance speakers, making them even more powerful. Once built, what was the 0 signal idle current @ 12 volts? Many of those large portable stereos used 8 D-Cells. They would last longer, particularly at lower playback levels, with a switch mode output stage. I noticed on the efficiency graphs, the levels with the widest margin of efficiency between the analog and switch mode output stages. at very low levels, the switch mode appears to have a very low idle current. It does not need a bias current, to prevent 0 crossing distortion. from 1 watt on up, advantage switch mode.

Could I make this as a module for a modular synthesizer?

71. steveandamyalso says:

@5:43 Robert Pease just rolled over in his grave.

72. john hopkins says:

…now to bridge the gap from PCM/DSD to Class-D PWM+DSP crossover/filter/delay
(sooo… rip my CDs at 300kHz/24bit??)… toslink 48k/20… Bluetooth??? just screw the amps to the back of my 2/3-way speakers, plug in Old notebook PS… oua la!!

73. MosesChuka says:

please can you recommend a book on high frequency circuit

74. tim minke says:

how would you scale this up to 200w/ ch

75. kwankunghkg says:

Great Tutorial . i am also an electronics lover since 1980 . Thank you very much : D

76. hrz_nrd says:

Very nice one!! I wanted to do one like yours but amazon doesn’t ship to UK and also I want to build an max of 200W!!

77. CIA says:

There are so many components in the schematic that you don't list in the video description…

78. Điện tử và lập trình says:

Both you and Great Scott have a great voice.

79. Siavosh Kasravi says:

Well you said you read every comment so here we go. When creating tutorials like these it is hard to decide when to go a bit deep but not too deep. More important when to declare something is complicated and you should see at as black box for not. Which you did very well. I shared your page in my Facebook to gather more audience. I have a suggestion: Please provide a road map of the videos you like to make in your website and try to raise money for each like a kick starter. So there will be 30 videos in entry level which cover all basic thing and you have made some of them. But you need money to make the others. This goes on for other levels. So people see what they are missing 🙂

80. Tommy Li says:

very well explained, learn a lot! thanks

81. maryam shafighpour says:

IT WAS GREAT ! I CANt buy any thing from amazon i live in iran… and i cant donate…. but it was helpful for me. and
thank you

82. E Barbie says:

Wrong about high-end speakers. There are versions of audiophile (fool) grade class-d amps out there! You'll need a full bridge output stage with GAN FETS operating at 750kHz PWM with robust closed-loop control and high-quality 5th order LPF with low distortion inductors. Such class-d amp will const around 500\$ per monoblock unit, which also included a high-quality SMPS.

I'm using 2 ICEPOWER monoblocks to drive my Focal Aria 926 speakers. And the sound is much better than the class AB amp in my Denon X4400H AVR…

Tnajs for the honesty, and thanks for your videos

84. Leo Lloyd says:

Thanks! I'm taking an electronics course at university but it's totally useless when trying to actually make something. I'm trying to make a bass amp right now and actually understand the course material at the same time, so your video was really helpful!

85. durdica mac says:

R U human?

86. Tampa Blush says:

wtf is going on. why are there lines everywhere

87. Mahmudul Hasan says:

And if the two-wire of any output speaker gets connects, amplifier shuts down. because the output is AC, not DC? (I am not pro, just learning)

88. Bo Yang says:

Great video to introduce how the class D amplifier works! How to choose the speaker impedance? Can I use the 4 ohm impedance electronic guitar speaker?

89. vaibhav verma says:

awesome

90. Joffito says:

anyone knows where to add a potentiometer (1k?) to add volume control? answer is much appreciated 🙂

91. v12345vtm says:

Sonos is klasse d

92. giri kotte says:

I think, right now, Class-D has equalled or surpassed Class -AB

93. Morgan Chandler says:

Awesome explanation really helps me on my goal of building a ramping voltage power supply

94. Ravenclaw Avenger says:

I was aware of class A, class AB Class B and class C amplifiers but I'd never heard of class D

95. Harie Amjari says:

Cant you just use a 555 timer? This chip can do anything!

96. daneesh pandayil says:

super explanation, thanks for the video cheers..

97. Nameer Mallick says:

I miss this guy

98. Manhuque Afonso J. Saire says:

Hi. I know this video was posted 5 years ago, but…can anyone tell me the design software used here?

99. Romenic Coelho says:

Muito bom a explicação do funcionamento do amplificador classe D.

100. 王昱 says:

nice video dude~