What is wrong with my class D amp design?

Thread Starter

LookAtThat

Joined Jun 7, 2023
14
Hi everyone! A few weeks ago I posted a thread asking for help with a triangle signal generator. It was for the class D amp I was designing. Now I mae the entire circuit, but the waveforms are quite messed up.
Here is my circuit:
Q7.JPG
The triangle signal generator and comparator I designed myself, the rest of the circuit I took it from here. This is the simulation of the waveforms:
Q8.JPGOn the first pane are a 1kHz sinusoidal input signal and the triangular signal, on the second is the PWM that the comparator is outputting and on the third is the amplified sinusoidal signal. But there are some huge spikes on the PWM and on the triangular signal, which ruin the output signal. Here is also a zoomed in picture of the waveforms:
Q9.JPGWhat did I do wrong in the circuit? Taken separately, the triangle signal is generated ok and the comparator works as intended. I believe there is something wrong with the IR2110 model, even though I downloaded it from Infineon's website. Either that or the wire configuration leading to it. Any thoughts? Thanks in advance!
 

MrChips

Joined Oct 2, 2009
29,848
I think your design is not correct.
Injecting the input signal at the output of U1 does not create the proper PWM signal.

Look up how a tracking ADC (or delta modulation) works.
 

crutschow

Joined Mar 14, 2008
33,355
Please label all the nodes you are graphing
How are we supposed to know where nodes n009, n012 are?

Another issue.
Since your PWM output goes between the supply voltage and 0V so it will have an average (DC) voltage of 1/2 the supply voltage and cause a large DC voltage through the speaker.
Put a large capacitor (e.g. 1000uF) in series with the speaker to block the DC.
 

Ian0

Joined Aug 7, 2020
8,946
I think your design is not correct.
Injecting the input signal at the output of U1 does not create the proper PWM signal.

Look up how a tracking ADC (or delta modulation) works.
“Input” is a very misleading description for that signal. ”input” appears to be the IR2110 non-inverted input, not the audio input.

it seems to be lacking a pull-up on the output of U1.
 

Audioguru again

Joined Oct 21, 2019
6,441
The M1 Mosfet is an N-channel follower that never turns on (its gate needs to be 10V more positive than its source).

If the circuit is perfect with an output of 12V peak-to-peak then the output power in an 8 ohms speaker is only 2.25W.
 

Ian0

Joined Aug 7, 2020
8,946
The M1 Mosfet is an N-channel follower that never turns on (its gate needs to be 10V more positive than its source).

If the circuit is perfect with an output of 12V peak-to-peak then the output power in an 8 ohms speaker is only 2.25W.
You didn‘t spot the bootstrap circuit (C1, C2)
 

Thread Starter

LookAtThat

Joined Jun 7, 2023
14
Thanks everyone! Ok, so I built the triangle generator and comparator separately. And I labelled all the important nodes:
Q10.JPG
I separated the two sections. I checked the datasheet for LM2903B (page 19 and 21) and I built the circuit as it recommended in the Application section. Added a 4.7k pull-up resistor (R13), a 0.1uF capacitor between Vcc and Ground (C7) and a 15pF capacitor between output and ground (C6). Then I noticed that the input must be between 0V and Vcc-2V, so I bumped the sine wave a little, it now goes between 0.1V and 1.1V. Then I connected an ideal triangle signal on the other input (with a period of 2.5us, frequency 200kHz). When I run the simulation, the PWM looks decent:
Q11.JPG
Now I'm comparing the ideal signal with the one I'm generating with the NE555. I made the calculations for 200kHz, but mine is 244kHz, which is ok. I also modified Rb1 to 1.5k in order to amplify the triangle signal a little. This is the comparison between the ideal signal and my signal:
Q12.JPG
Now I connected the generated triangle signal to the comparator and luckily the PWM looks decent now. I still have some spikes on the second curve of the sine.
Q13.JPGQ14.JPG
 

Thread Starter

LookAtThat

Joined Jun 7, 2023
14
So I tried simulating the entire circuit and I get a "Time step too small error", even by setting Abstol to 1e-006. So I split it in two. Right now I'm simulating the comparator, IR driver and MOSFET transistors. I'm using an ideal triangle signal at the comparator's input. The PWM still has some huge spikes, even though the width of the pulses seems to be alright. And the sine has some suspicious drops.
Q18.JPG
Q16.JPG
Q17.JPG
Could I add a capacitor to the output of the comparator to reduce the overshoot? Or is there a problem somewhere else?
 

Ian0

Joined Aug 7, 2020
8,946
I would recommend using a logic gate not a transistor to invert the signal - a transistor can take a microsecond to come out of saturation. Better still, use two exclusive-or gates, one with its spare pin connected to 0V to make it a buffer, and one with its spare pin connected to V+ to make it an inverter. Then the delays will all be equal.
If you need to use a transistor, add a Baker clamp (schottky diode from collector to base) to prevent it from saturating.
 

Thread Starter

LookAtThat

Joined Jun 7, 2023
14
Why do you have two boost caps (C1,C2)?
I saw this configuration in several designs with IR2110. I'll also try with a single polarized capacitor, as the datasheet suggests.

I added the Baker clamp, using a Schottky diode with average forward current 1A and breakdown voltage 30V, which should be enough. I also changed C2's value to 100n. I discovered a major fault with the IR: I forgot to connect VSS and COM to ground. I did that, on the same ground line with SD. Also I centered the sine and triangle ideal signals to 2.5V. The circuit now looks like this:
Q19.JPG
The inverted PWM signal is messed up. I'll try replacing Q1 with something else and see if it helps:
Q20.JPG
 

Thread Starter

LookAtThat

Joined Jun 7, 2023
14
I modified the ideal input signals back, triangle between 0 and 1.5V and sine between 0.1 and 1.1V. Now the PWM and the inverted PWM look decent. I guess the comparator doesn't like when the signals get past a specific voltage?
Q21.JPG
Q22.JPGI still have problems with the output signal, I'll try solving that next. About the comparator, do you think it would work if I power it differentially (between -5 and 5V) and then center the sine and triangle on 0V?
 

Ian0

Joined Aug 7, 2020
8,946
I still have problems with the output signal, I'll try solving that next. About the comparator, do you think it would work if I power it differentially (between -5 and 5V) and then center the sine and triangle on 0V?
If you do that, the logic zero voltage will be -5V, which might upset the next stage.
Have you tried a comparator with push-pull outputs (TLC3702)?
That might remove problems with pull-up resistors.
 

Thread Starter

LookAtThat

Joined Jun 7, 2023
14
If you do that, the logic zero voltage will be -5V, which might upset the next stage.
Have you tried a comparator with push-pull outputs (TLC3702)?
That might remove problems with pull-up resistors.
Thanks! I did that (unfortunately I couldn't find a .lib for TLC3702, so I used a TLV9032 instead). I also recalculated the LC output filter (output still didn't look ok with my values, so I took the standard values for 20kHz cutoff frequency, 8 ohm speaker from here, page 3). I also centered the sine and triangle waves on 2.5V. Now I put everything together and the output looks much better. I still have some clipping at the top of the amplified sine, though.
Q23.JPG
Q26.JPG
Q24.JPG
 

Ian0

Joined Aug 7, 2020
8,946
Thank you everyone for your help! I'd buy you all a beer if I could :)
I'm sure that there must be a way of doing that, now we have so much on-line shopping and take-away food delivery. But it's a bit early for a beer - I've only just had my breakfast.

A simple change to your circuit that might help - Swap the 1N5819 for a BAT42 or other small-signal shottky. It looks as though the 1N5819 has a lot of capacitance which might be slowing down the rise-time. (I still think an inverter would be better - such as 74LVC1G04 - and it needs fewer components)
TLV9032 is a better choice than TLC3702 and a much better choice than TLV3702.
 
Top