Introduction: 350 Watt Self Oscillating Class D Amplifier

Introduction and why I made this instructable:

On the internet, there are multitudes of tutorials showing people how to build their own class D amplifiers. They are efficient, simple to understand, and all use the same general topology. There is a high-frequency triangle wave being generated by one part of the circuit, and it is compared with the audio signal to modulate the output switches (almost always MOSFETs) on and off. The majority of these "DIY Class D" designs have no feedback, and the ones that do only sound clean in the bass region. They make somewhat acceptable subwoofer amplifiers, but have significant distortion in the treble regions. The ones without feedback, owing to dead-time required for MOSFET switching, have a output waveform that looks sort of like a triangle wave, as opposed to a sine wave. Significant unwanted harmonics are present, leading to a noticeable decrease in sound quality that makes music sound sort of like its coming out of a trumpet. The somewhat trumpety, not-so-punchy sound of my previous class D amplifier is why I decided to research and build an amplifier using this obscure, underutilized topology.

However, the classic "triangle wave comparator" is not the only way to construct a class D amplifier. There is a better way. Instead of having an oscillator modulate the signal, why not make the entire amplifier the oscillator? The output MOSFETs are driven (through suitable drive circuitry) by the output of a comparator with the positive input receiving the incoming audio and the negative input receiving a (scaled-down) version of the amplifier's output voltage. Hysteresis is used in the comparator to regulate the frequency of operation and prevent unstable, high frequency resonant modes. Furthermore, a RC snubber network is used across the output to suppress ringing at the output filter's resonant frequency and decrease the phase shift to near 90 degrees at the amplifier's operating frequency of around 100 Khz. Omission of this simple but critical filter will cause the amplifier to self-destruct, as voltages of several hundred volts may be generated, destroying the filter capacitors instantly.

Principle of operation:

Assume the amplifier is first started and all voltages are at zero. Due to it's hysteresis, the comparator will decide to to pull the output either positive or negative. For this example, we will assume that the comparator pulls the output negative. Within a few tens of microseconds, the output voltage of the amplifier has decreased enough to flip the comparator and send the voltage going back up again, and this cycle repeats around 60 to 100 thousand times every second, keeping the desired voltage at the output. Due to the filter inductor's high impedance and the filter capacitor's low impedance at this frequency, there is not much noise on the output, and due to the high operating frequency, it is far above the audible range. If the input voltage increases, the output voltage will increase enough that the feedback voltage reaches the output voltage. In this way amplification is achieved.

Advantages over standard class D:

1. Extremely low output impedance: Because the output MOSFETs will not switch back until the desired output voltage after the filter is reached, the impedance of the output is virtually zero. Even with a 0.1 volt difference between the actual and desired output voltage, the circuit will dump amps into the output until the voltage flips the comparator back (or something blows).

2. Ability to cleanly drive reactive loads: Due to the extremely low output impedance, self-oscillating class D can drive multi-way speaker systems with large impedance dips and peaks with very little harmonic distortion. Ported subwoofer systems with low impedance at the port's resonant frequency are a prime example of a speaker that a feedback-less "triangle wave comparator" amplifier would struggle to drive well.

3. Wide frequency response: As the frequency increases, the amplifier will attempt to compensate by varying the duty cycle more to keep the feedback voltage matched with the input voltage. Due to the filter's attenuation of high frequencies, high frequencies will start to clip at a lower voltage level than lower ones, but due to music having vastly more electrical power in the bass than the treble (approximately a 1/f distribution, more if you use bass boost), this is not an issue whatsoever.

4. Stability: If properly designed and with a snubber network in place, the nearly 90° phase margin of the output filter at the operating frequency ensures that the amplifier will not become unstable, even if driving heavy loads under heavy clipping. You'll blow something, likely your speakers or subs, before the amp goes unstable.

5. Efficiency and small size: Due to the self-regulating nature of the amplifier, adding plenty of dead time to the MOSFET switching waveforms does not affect the sound quality. Full-load efficiencies of well upwards of 90% are possible with a good quality inductor and MOSFETs (I use IRFB4115s in my amplifier). As a result, a relatively small heat sink on the FETs is sufficient and a fan is only required if operating inside an insulated enclosure at high power.

Step 1: Parts, Supplies, and Prerequisites

  • Prerequisites:

Building any kind of high-power circuit, especially one designed to cleanly reproduce audio, requires a knowledge of basic electronics concepts. You will need to know how capacitors, inductors, resistors, MOSFETs, and op-amps work as well as how to properly design a power-handling circuit board. You also need to know how to solder through-hole components and how to use stripboard (or build a PCB). This tutorial is geared towards people who have built moderately complicated circuits before. Extensive analog knowledge is not needed, as most of the subcircuits in any class D amplifier deal with just two voltage levels - on or off.

You will also need to know how to use an oscilloscope (just the basic functions) and how to debug circuits that are not working as intended. It is very likely, with a circuit of this complexity, that you will end up having a sub-circuit that does not work the first time you build it. Find and fix the problem before moving on to the next step, debugging one sub-circuit is much easier than trying to find a fault somewhere in the entire board. Oscilloscope usage is necessary to find unintended oscillation and verify that signals look the way they should.

General Tips:

On any class D amplifier, you will have high voltages and currents switching at high frequencies, which has the potential to generate a good deal of noise. You will also have low-power audio circuits that are sensitive to noise and will pick up and amplify it. The input stage and power stage should be at opposite ends of the board.

Good grounding, especially in the power stage, is also essential. Make sure that ground wires run directly from the negative terminal to each gate driver and comparator. It's hard to have too many ground wires. If you are doing this on a printed circuit board, use a ground plane for grounding.

Parts you will need:

(Message me if I missed any, I'm pretty sure this is a complete list)

(Everything labeled HV needs to be rated for at least the boosted voltage to drive the speaker, preferably more)

(A lot of these can be salvaged from electronics and appliances thrown in a dumpster, especially capacitors)

  • 24 volt power supply capable of 375 watts (I used a lithium battery, if using a battery make sure you have a LVC (low voltage cutoff))
  • Boost power converter capable of providing 350 watts at 65 volts. (Search "Yeeco power converter 900 watts" on Amazon and you'll find the one I used.)
  • "Perf board" or proto-board to build everything on. I recommend having at least 15 square inches to work with for this project, 18 if you want to build the input board on the same board.
  • Heatsink to mount the MOSFETs to
  • 220uf Capacitor
  • 2x 470uf Capacitor, one must be rated for input voltage (not HV)
  • 2x 470nf Capacitor
  • 1x 1nf Capacitor
  • 12x 100nf Ceramic Capacitor (or you can use poly)
  • 2x 100nf Poly capacitor [HV]
  • 1x 1uf Poly capacitor [HV]
  • 1x 470uf LOW ESR Electrolytic capacitor [HV]
  • 2x 1n4003 diode (any diode that can withstand 2*HV or more is fine)
  • 1x 10 amp fuse (or short piece of 30AWG wire across a terminal block)
  • 2x 2.5mh inductor (or wind your own)
  • 4x IRFB4115 Power MOSFET [HV] [Must be GENUINE!]
  • Assorted resistors, you can get them off eBay or Amazon for a few bucks
  • 4x 2k Trimmer potentiometers
  • 2x KIA4558 Op amp (or similar audio op amps)
  • 3x LM311 comparators
  • 1x 7808 voltage regulator
  • 1x "Lm2596" buck converter board, you can find them on eBay or Amazon for a few bucks
  • 2x NCP5181 gate driver IC (you might blow some, get more) [Must be GENUINE!]
  • 3-pin header to connect to input board (or more pins for mechanical rigidity)
  • Wires or terminal blocks for speakers, power, etc
  • 18AWG power wire (for wiring the power stage)
  • 22 AWG hook-up wire (for wiring everything else)
  • 200 ohm low power audio transformer for input stage
  • Small 12v/200ma (or less) computer fan to cool the amplifier (optional)

Tools and supplies:

  • Oscilloscope of at least 2us/div resolution with a 1x and 10x probe (you can use a 50k and 5k resistor to make your own 10x probe)
  • Multimeter that can do voltage, current and resistance
  • Solder and soldering iron (I use Kester 63/37, GOOD QUALITY lead free also works if you are experienced)
  • Solder sucker, wick, etc. You WILL make mistakes on a circuit this large, especially when soldering the inductor, it's a pain.
  • Wire cutters and strippers
  • Something that can generate a square wave of a few HZ, like a breadboard and a 555 timer

Step 2: Learn How Self-Oscillating Class D Works (optional But Recommended)

Before you begin, it's a good idea to get to know how the circuit actually works. It will help greatly with any problems you might have further on, and will help you understand what each part of the full schematic does.

The first image is a graph produced by LTSpice showing the amplifier's response to an instantaneous input voltage change. As you can see from the graph, the green line tries to follow the blue line. As soon as the input changes, the green line goes up as fast as it can and settles with minimal overshoot. The red line is the voltage of the output stage before the filter. After the change, the amplifier quickly settles and begins oscillating around the set point once again.

The second image is the basic circuit diagram. The audio input is compared with the feedback signal, which generates a signal to drive the output stage to bring the output closer to the input. Hysteresis in the comparator causes the circuit to oscillate around the desired voltage at a frequency far too high for ears or speakers to respond to.

If you have LTSpice, you can download and play around with the .asc schematic file. Try changing r2 to change the frequency and watch the circuit go crazy as you remove the snubber that damps excessive oscillation around the LC filter's resonance point.

Even if you don't have LTSpice, studying the images will give you a good idea of how everything works. Now let's get to building.

Step 3: Build the Power Supply

Before you start soldering anything, take a look at the schematic and example layout. The schematic is a SVG (vector graphic) so once you download it you can zoom in as much as you'd like without losing resolution. Decide where you are going to place everything on the board, and then build the power supply. Hook up battery voltage and ground and make sure nothing gets hot. Use a multimeter to adjust the "lm2596" board to output 12 volts and check that the 7808 regulator is outputting 8 volts.

That's it for the power supply.

Step 4: Build the Output Stage and Gate Driver

Of the entire build process, this is the hardest step of them all. Build everything in the "Gate driver circuit" and the "Power stage" in the schematic, making sure that the FETs are attached to the heat sink.

In the schematic, you will see wires that appear to go nowhere and say "vDrv". These are called labels in the schmatic and all labels with the same text get connected together. Connect all of the "vDrv" labeled wires to the output of the 12v regulator board.

After completing this stage, power this circuit up with a current-limited supply (you can use a resistor in series with the power supply) and ensure that nothing gets hot. Try hooking each of the input signals to the gate driver to 8v from the power supply (one at a time) and check that the correct gates are being driven. Once you have verified that you know the gate drive is working.

Due to the gate drive using a bootstrap circuit, you cannot test the output directly by measuring the output voltage. Put the multimeter on diode check and check between each speaker terminal and each power terminal.

  1. Positive to Speaker 1
  2. Positive to Speaker 2
  3. Negative to Speaker 1
  4. Negative to Speaker 2

Each should show partial conductivity only one way, just like a diode.

If everything works, congratulations, you've just finished the hardest section of the board. You remembered proper grounding, right?

Step 5: Build MOSFET Gate Drive Signal Generator

Once you have finished the gate driver and power stage, you are ready to build the portion of the circuit that generates the signals that tell the gate drivers what FETs to turn on at what time.

Build everything in the "MOSFET driver signal generator with dead time" in the schematic, making sure that you don't forget any of the tiny capacitors. If you omit them, the circuit will still test fine, but will not work well when you try to drive a speaker due to the comparators parasitically oscillating.

Next, test the circuit by feeding a square wave of a few hertz into the "MOSFET driver signal generator with dead time" from your signal generator or 555 timer circuit. Connect battery voltage to "HV in" through a current limiting resistor.

Connect an oscilloscope to the speaker outputs. You should get battery voltage reversing polarity a few times a second. Nothing should get warm and the output should be a nice, sharp square wave. A little overshoot is fine, as long as it's not more than 1/3 battery voltage.

If the output is producing a clean square wave, it means that everything you have built so far is working. Only one sub-circuit left until completion.

Step 6: Comparator, Differential Amplifier, and the Moment of Truth

You are now ready to build the portion of the circuit that actually does the class D modulation.

Build everything in the "Comparator with hysteresis" and "Differential amplifier for feedback" in the schematic, as well as the two 5k resistors that keep the circuit stable when nothing is connected to the input.

Connect power to the circuit (but not HV in yet) and check that pins 2 and 3 of U6 should both be really close to half of Vreg (4 volts).

If both of those values are correct, attach a subwoofer across the output terminals. hook up the power and HV in to battery voltage through a current limiting resistor (you could use a 4 ohm or greater subwoofer as a resistor). You should hear a small pop and the subwoofer should not move one way or the other more than a millimeter or so. Check with an oscilloscope to ensure that the signals going in to and coming out of the NCP5181 gate drivers are clean and have around 40% duty cycle each. If this is not the case, adjust the two variable resistors until they are. The frequency of the gate drive waves will be lower than the desired 70-110 KHZ due to HV in not being connected to the voltage booster.

If the gate drives signals are not oscillating at all, try switching SPK1 and SPK2 going to the differential amplifier. If it still doesn't work, use an oscilloscope to track down the fault. It's almost certainly in the comparator or differential amplifier circuit.

Once the circuit is working, leave the speaker connected and add the voltage booster module to boost the voltage going to HV in to around 65-70 volts (remember the fuse). Power up the circuit, and make sure that nothing gets hot initially, especially the MOSFETs and inductor. Continue monitoring temperatures for about 5 minutes. It is normal for the inductor to get warm, as long as it is not too hot to touch continuously. The MOSFETS should be no more than slightly warm.

Check the frequency and duty cycle of the gate drive waves again. Adjust for a 40% duty cycle and ensure the frequency is between 70 and 110 Khz. If it is not, adjust R10 in the schematic to correct the frequency. If the frequency is correct, you are ready to start playing sound with the amplifier.

Step 7: Audio Input and Final Testing

Now that the amplifier itself is working satisfactorily, it's time to build the input stage. On another board (or the same one if you have space), build the circuit according to the schematic provided with this step (you have to download it), making sure it is shielded with a grounded piece of metal if close to any noise generating components. Attach power and ground to the circuit from the amplifier, but don't hook up the audio signal yet. Check that the audio signal is at around 4 volts and changes slightly when you turn the "DC offset adjust" potentiometer. Adjust the potentiometer for 4 volts and solder the audio input wire to the rest of the circuit.

Although the schematic shows using a headphone jack as the input, you could also add a bluetooth adapter with its output wired to where the audio jack is. The bluetooth adapter can be powered by a 7805 regulator. (I had a 7806 and used a diode to drop another 0.7 volts).

Power up the amplifier again, and plug in a cable to the AUX jack on the input board. There will probably be some faint static.

If the static is too loud there are a couple things you can try:

  • Did you shield the input stage well? The comparators generate noise too.
  • Add a 100nf capacitor across the output of the transformer.
  • Add a 100nf capacitor between audio out and ground and place a 2k resistor in line before the capacitor.
  • Make sure the aux cord is not near the power supply or amplifier output cables.

Slowly (over several minutes) turn up the volume, ensuring that nothing gets too hot or distorts. Adjust the gain so that the amplifier does not clip unless the volume is on maximum.

Depending on the quality of the inductor core and the size of the heat sink, it may be a good idea to add a small fan, powered from the 12v rail, to cool the amplifier. This is an especially good idea if you will be putting it in a box.

Step 8: Demonstration Video