Class D amp using LM319 comparator

Finally! I`m back from long hiatus!

As the subject title implies, yes. LM319 is not a popular choice as integrator/differentiator combo due to it`s output pull-up resistor which is not good to directly drive capacitive load. Although it was being claimed by chip makers as fast comparator, they mean it’s fast enough as digital pulse generator for driving TTL/DTL logic gates. This means it can generate decent PWM pulses intended for class d amp purposes but at different, or should I called it harsh method as shown in schematic diagram of Fig. 1 below.

Fig. 1 Single comparator U2 as triangular wave generator then U1 as amplifying PWM generator that can be driven by small signal audio source.
LM319 PWM circuit
Fig. 1 Shows LM319’s U2 is wired as square wave generator whose frequency determining network is governed by R3 and C2. Then the output was terminated with R9 and C4 that serve as a triangular wave generator. Don’t laugh! I’m not done yet!.

Most experienced class d amp circuit designers are blessed with an eagle eye and can quickly spot the questionable design approach I made above (only 2 seconds is enough mind you). Yes, these dudes are understandable because what the hell am I intend to use for that kind of circuit? It’s not so linear triangular waveform as a reference in the first place! Well hold on fellas, I will show you that with a little tweaking on their timing network, then maybe this design approach may tickle your fancy in considering it. So lets dig a little bit further and fasten your seat belts.

First of all, I provide a simulation in LTspice to show you the behavior of the circuit depicted in the following order. In Fig. A Capacitor C2 is being charged and discharged via resistor R3 produced by square wave source. In fig. A also (below circuit) I put a linear triangular wave generator so that you can see the two overlaid signals for precise comparison. It is forbidden for us to use this kind of bended triangular wave as a reference. The reason why it is so bent is that the capacitor is a hungry beast in the circuit – It sucked all the resources available from the source generator but the resistor cannot cope for that amount of energy (nonlinear current results). That’s why it bends a lot. If the resistor can only provide bidirectional constant current to charge and discharge the capacitor then it would be linear. But adding constant current to do that will require two faster and pricier comparators that will add cost and difficulties for beginners to tackle with. In my first circuit above of Fig. 1, only one comparator U2 is needed as square wave generator followed by U1 as an amplifying PWM that can be directly driven by any audio source. Input sensitivity will be +/- 240 mv then the output will swing from near 0 to almost VCC at 235Khz sufficient enough to drive FET drivers.

Fig. A simulation shown below with lower resistance for R3 giving higher charge/discharge current.
Fig A circuitWaveform of Fig. A showing severe bending of voltage due to nonlinear current demand of capacitor. Peak to peak current is shown bellow.

Overlayed triangular signal Fig A
Triangular current Fig A
Peak to peak current of 11ma gives bended rise and fall signal.

3 thoughts on “Class D amp using LM319 comparator”

  1. Hey, just read your post on how to build a class D amp using lm319 comparator. Im willing to build a class d amplifier and i´m gonna generate the pwm in the same way as you did cause it seems to be pretty wise. I got a couple questions for you: 1)After simulating your first circuit on LTSpice I couldn´t help noticing that the negative input of the second comparator has a DC value different from the DC value of the triangular signal that is at the positive input. I read several times the third page of you post in which you explain wih a simulation how the negative input should follow the average value of the triangular wave form. Therefore I can´t understand why there is a little offset difference in the simulation (this affects the comparison between the audio signal and the triangular) . And I don´t understand what you intend to achive by adding the refference to the original circuit : “I will add tuning mechanism at the output of U2 inserted between R3 and R7 because this is the culprit in making the duty factor to ~51%. R7 effectively add resistance to R3 during charging of C2 but discharges quicker via output transistor without R7 ugh!” Guess the question here is: what am I missing?/ why the offset of the signals at the input of the comparator don´t equate on my simulation?. 2) I was wondering if by any chance did you measure the THD for the amp?. I know it sounded good, but just wondering. As it regards the class D I´m designing i want to make a 100watt (RMS) over an 8 ohm load. I´m gonna use IRF2110 and mosfets in a full bridge topology (probably taking feedback from the load). Any suggestions?

  2. Hello,
    Thanks for your interest regarding this article. I will answer your question soon after I fixed my laptop that refuses to boot after windows 10 update. As of now, I am answering you via my smartphone. There are at least 7 visitors asking the same way (privately) as you did but I want to publish your question with my answer via comment section so that it will serve as my answer to those dudes as well. Regards.

  3. Hey, just realize what the mistake was. The two RC networks after the first comparator act as you explained in your post. The thing is that the RC network that clamps the negative input of the second comparator to the offset value of the triangular waveform (cross over point ) takes over 500ms to reach the rigth offset value. I should have looked at the .op rather the transient simulation . I realized when I saw that in an image you posted a transient simulation for 1000ms.

    I understand what your tunning mechanism is now. You add the trim pot along with the diodes to be able to change the period of the triangular, guess I was way too tired yesterday when I first read it.

    Very good job dude, your circuit is both cheap a reliable with good outcomes.
    I´ve been strugling to find easy class D amp circuit implementations.

Leave a Reply

Your email address will not be published.

*