Op-amp switching threshold problem

Thread Starter

mondo90

Joined May 16, 2025
125
@Ian0 but this is a very "risky" design. Every speaker is different with different RLC characteristic. Even in the circuit that
crutschow put together you can see high frequency audio signal is attenuated. Do you think my simple low pass LC filter is a better solution here?

If you assume that the highest audio frequency is only 100Hz (for initial testing) then your filter cutoff could be possibly as low as 200 to 300Hz, but the lowest switching frequency Fsw would be maybe 500Hz. It looks like maybe your Fsw is 600Hz perhaps? That's good, but then the filter cutoff frequency has to be much lower than 11kHz.
Yyy, sorry where did you get the 11khz frequency from? My last version utilized a low pass filter with the 3db frequency at 200hz this is because the switching frequency is 1kHz. This final switching frequency will be ~500kHz so the LP filter seems to be good enough as I can start rolling off at 20kHz.
 

0ri0n

Joined Jan 7, 2025
173
Below a version with a comparator and a 500kHz 4Vpp triangle. The audio signal is applied directly to the comparator. Beware that the comparator has no power supply rejection, any kind of noise on the +/-2.5V supply rails affects the average of the PWM voltage, is amplified and propagates to the load/loadspeaker. A 4th order 24 kHz Butterworth lowpass filter is used to recover the amplified audio.

PWM_Amp_Schematic_1.png

PWM_Amp_Transient_1.png


The output waveform is far from being perfect still. I was trying to fix it with negative feedback formed by R5 and R7 but it didn't help a single bit. What can I do for that?
You are trying to apply negative feedback to the comparator stage instead of a preceding audio/error amplifier. The added error amplifier improves power supply rejection of the comparator by keeping the average output voltage at 0V, no matter what the +/-2.5V supply voltage rails look like.

PWM_Amp_Schematic_2.png

PWM_Amp_Transient_2.png
 
Last edited:

MrAl

Joined Jun 17, 2014
13,708
@Ian0 but this is a very "risky" design. Every speaker is different with different RLC characteristic. Even in the circuit that
crutschow put together you can see high frequency audio signal is attenuated. Do you think my simple low pass LC filter is a better solution here?



Yyy, sorry where did you get the 11khz frequency from? My last version utilized a low pass filter with the 3db frequency at 200hz this is because the switching frequency is 1kHz. This final switching frequency will be ~500kHz so the LP filter seems to be good enough as I can start rolling off at 20kHz.
Hello again,

Sorry, I posted the angular frequency which was around 11kHz.
The frequency from that came out to 1783Hz. That is still too high.
That is using the last values I saw for your circuit:
R4=10
R6=1000
L1=100uH
C2=10uF

If you changed those values again let me know I will recalculate this.
 

Ian0

Joined Aug 7, 2020
13,132
@Ian0 but this is a very "risky" design. Every speaker is different with different RLC characteristic. Even in the circuit that
crutschow put together you can see high frequency audio signal is attenuated. Do you think my simple low pass LC filter is a better solution here?
The high frequency audio in @crutschow 's design is NOT attenuated. You were measuring it in the wrong place. You were measuring across part of the speaker's equivalent circuit, not across the output of the amplifier.
It's not a risky situation if you have control over the speaker characteristics, such as in a powered speaker.
 

crutschow

Joined Mar 14, 2008
38,526
this is because you are tracing a current on R4
Yes, that's the speaker current, which is what generates the sound.
1kHz your output sill looks OK with 3A P2P, however increase it to 20kHz and you get:
Yes, you could add some inductance in series to smooth out the 100kHz ripple, but that less of a problem for the higher PWM frequencies typically used for Class-D amps,
But, that speaker model is for a subwoofer with a 28Hz resonant frequency. The model for a tweeter that can reproduce 20kHz is likely significantly different.

If you look at audio Class-D ICs, all some of them have at the output are some ferrite beads for EMI reduction, not to smooth the waveform (example).
 

Thread Starter

mondo90

Joined May 16, 2025
125
The high frequency audio in @crutschow 's design is NOT attenuated. You were measuring it in the wrong place. You were measuring across part of the speaker's equivalent circuit, not across the output of the amplifier.
It's not a risky situation if you have control over the speaker characteristics, such as in a powered speaker.
In my first attempt yes, I looked in the wrong place, but later I realized in @crutschow circuit R4 is the output speaker and here is its current for 20kHz waveform:
1760292655991.png
Looks attenuated for me, right?

If you look at audio Class-D ICs, all some of them have at the output are some ferrite beads for EMI reduction, not to smooth the waveform (example).
I see:
1760292821332.png

So is the conclusion that my idea to add a low pass filter at the PWM output won't work because the speaker internal RLC will change filter characteristic?

You are trying to apply negative feedback to the comparator stage instead of a preceding audio/error amplifier. The added error amplifier improves power supply rejection of the comparator by keeping the average output voltage at 0V, no matter what the +/-2.5V supply voltage rails look like.
I applied feedback from output to input, are you saying I should add some preamplifier before that?
 

Ian0

Joined Aug 7, 2020
13,132
In my first attempt yes, I looked in the wrong place, but later I realized in @crutschow circuit R4 is the output speaker and here is its current for 20kHz waveform:
View attachment 357056
No, R4, L1,C2,L2 R5 and C3 all are part of the speaker. R4 and L1 are the resistance and inductance of the voice coil, C1 is the compliance of the suspension, L2 is the inertia of the cone, and R5 is the frictional loss.

By the way, you can complete the feedback loop from the speaker output right back to the input, but you have to get the phase response right. A simple feedback network would tend to make it oscillate at the resonant frequency of the output filter which would destroy it in short order.
 

0ri0n

Joined Jan 7, 2025
173
I applied feedback from output to input, are you saying I should add some preamplifier before that?
If you want to have negative feedback then yes. The PWM output voltage of the comparator can be used to apply negative feedback to the audio preamp stage. As the comparator is placed inside the feedback loop, it has to be, for stability reasons, fast and have negligible delay.
 

MrAl

Joined Jun 17, 2014
13,708
In my first attempt yes, I looked in the wrong place, but later I realized in @crutschow circuit R4 is the output speaker and here is its current for 20kHz waveform:
View attachment 357056
Looks attenuated for me, right?


I see:
View attachment 357057

So is the conclusion that my idea to add a low pass filter at the PWM output won't work because the speaker internal RLC will change filter characteristic?



I applied feedback from output to input, are you saying I should add some preamplifier before that?
A typical output filter would be tuned to maybe 30kHz just for example. It might be higher too though.

However, I recommend that you do not measure the current through R4 nor the voltage across the terminals of the 'speaker' in order to get a feel for what kind of waveform will be reproduced by the speaker. It would probably be better to measure voltage across the two capacitors especially the larger value one (they are in parallel though anyway). That would probably represent the actual cone movement.

In a real speaker, you can have some pretty weird waveforms across the terminals and that could be accompanied by some weird current waveform going into the speaker too. That does not mean that the cone movement will follow those waveforms with a perfect reproduction. There are other things that have to be considered which could be thought of as the compliance. This means that the compliance is somewhat like a low pass filter that filters the voltage and current getting to the speaker terminals. To understand the actual sound THD you'd have to consider that.

To think about this just a tiny bit more, I do not think the surrounding air is modeled, that is probably already represented by the compliance.
 

Thread Starter

mondo90

Joined May 16, 2025
125
By the way, you can complete the feedback loop from the speaker output right back to the input, but you have to get the phase response right. A simple feedback network would tend to make it oscillate at the resonant frequency of the output filter which would destroy it in short order.
Ian0, what do you mean by getting a phare right? Do you mean applying frequency compensation somewhere in the loop?
 

Thread Starter

mondo90

Joined May 16, 2025
125
Hi @Ian0 ,@crutschow, I am getting back to this subject after some study on filters. For now I have a question about VCVS block that I borrowed from your schematic example:
1769280465173.png

How do you realize it in practice? Should it be a pair of MOSFETs(a power stage) that will push/pull the current into the output? If so then it won't be much different than class AB right?

Thanks!
 

crutschow

Joined Mar 14, 2008
38,526
How do you realize it in practice? Should it be a pair of MOSFETs(a power stage) that will push/pull the current into the output? If so then it won't be much different than class AB right?
Yes.
But it doesn't need to be class AB since the output is operating as a switch, so linear crossover distortion is not a factor.
Edit: It would actually be a Class D amp.
 
Last edited:

MrAl

Joined Jun 17, 2014
13,708
Hi @Ian0 ,@crutschow, I am getting back to this subject after some study on filters. For now I have a question about VCVS block that I borrowed from your schematic example:
View attachment 362612

How do you realize it in practice? Should it be a pair of MOSFETs(a power stage) that will push/pull the current into the output? If so then it won't be much different than class AB right?

Thanks!
Hi there,

This might be interesting for your project.

If you lower the capacitor C2 to 70uf you get near to the critically damped response. With 140uf you still get some overshoot which might be a problem. This change may not be mandatory, but you might get better results. The critically damped response comes from this expression:
4*C*R^2-L=0

It's also ok if 4*C*R^2-L comes out a little negative. If it comes out positive then it has some overshoot.

The two different responses are shown in the attached drawing. The blue is with the 140uf and the red is with the 70uf.
Note that with the 140uf the response reaches the required value faster, but it overshoots. With the 70uf it takes a little longer but it never overshoots.

Of course change would require testing.
 

Attachments

Thread Starter

mondo90

Joined May 16, 2025
125
If you lower the capacitor C2 to 70uf you get near to the critically damped response. With 140uf you still get some overshoot which might be a problem. This change may not be mandatory, but you might get better results. The critically damped response comes from this expression:
4*C*R^2-L=0
Thanks for keeping an eye on the values I selected. However in my LTSpicie simulation I actually do a very unrealistic simulation for 1khz carrier frequency. This is because I could not find a fast enough op-amp/comparator to handle 500khz. This in turn affects the LC filter I use, it is setup to roll of at 100hz - just for the purpose of testing it out.
On the other hand I don't know why are you using this expression in particular? I just denormalized a low pass butterworts topology for 100 cutoff.

Yes.
But it doesn't need to be class AB since the output is operating as a switch, so linear crossover distortion is not a factor.
Edit: It would actually be a Class D amp.
Thanks, makes sense.

Speaking about op-amps selection, I was thinking about using MAXIM9002 IC, this seem to be a good choice for both carrier generation as well as modulator. One thing I wasn't find in the datasheet is if they have diode protected input, and if so, how should I alter my feedback/resistors selection?


Thanks!
 
Last edited:

MrAl

Joined Jun 17, 2014
13,708
Thanks for keeping an eye on the values I selected. However in my LTSpicie simulation I actually do a very unrealistic simulation for 1khz carrier frequency. This is because I could not find a fast enough op-amp/comparator to handle 500khz. This in turn affects the LC filter I use, it is setup to roll of at 100hz - just for the purpose of testing it out.
On the other hand I don't know why are you using this expression in particular? I just denormalized a low pass butterworts topology for 100 cutoff.

Thanks!
Hi,

That expression comes about when determining the type of response. In algebraic jargon, it's called the 'discriminant'. It determines if a quantity under a radical is either positive, negative, or zero.
There are three possibilities:
1. underdamped
2. critically damped
3. overdamped
If it is #2 or #3 the output is smooth, but with #1 it can be oscillatory which is bad sometimes. It can be a little oscillatory or very oscillatory. We almost always avoid the very oscillatory response, while a little oscillatory is often helpful.
Critically damped is like the in-between value, where we get smooth response, but it's the fastest without being oscillatory at all.

Overdamped and critically damped have a response that consists of only exponentials like A*e^(-a*t) or with cosh(...) or sinh(...) terms which are all smooth. The underdamped response has sinusoidal components like sin(...) and cos(...) which means as least part of the response varies up and down before settling, if it ever does settle that is.

The expression for the discriminant varies depending on the circuit. For your circuit it is as given previously.

This kind of classification is a little more refined than the usual naming convention would tell us.
 

Thread Starter

mondo90

Joined May 16, 2025
125
Yes.
But it doesn't need to be class AB since the output is operating as a switch, so linear crossover distortion is not a factor.
Edit: It would actually be a Class D amp.
Oh ok, well then that brings us down to about:
Z=-4500*j
This output stage is not that easy to realize as it sounds. It requires a gate driver, which is not trivial. Would you be able to recommend some books or other materials that cover this type of transistors circuit design in depth? I have tried to lookup power electronics book, but didn't find complete circuits there - they rather replace this with blocks "gate driver", or such.
 

MrAl

Joined Jun 17, 2014
13,708
This output stage is not that easy to realize as it sounds. It requires a gate driver, which is not trivial. Would you be able to recommend some books or other materials that cover this type of transistors circuit design in depth? I have tried to lookup power electronics book, but didn't find complete circuits there - they rather replace this with blocks "gate driver", or such.
Hi,

I am not sure what circuit you are referring too now as this thread started some time ago, like several months now and we talked about different things. I also cannot find the post that you seem to have quoted that I had posted sometime in the past perhaps you can point that out.

When it comes to gate drivers though, they might be shown as a 'block' because there is not that much to them when you use a dedicated gate driver integrated circuit chip. If you show the exact circuit you are working with now we can go over this in more detail.
 
Top