Class D audio amp not working

Thread Starter

Arijeet

Joined Dec 27, 2019
78
Hi everyone,

This is my first time posting, so I hope I didn't post in the wrong section.
My friend and I have been working on a university project, where we simply choose what we want to build, and present a valid schematic from the internet to our assistants.
I found a circuit from the youtuber GreatScott, and ordered all the parts (I've put it in the attachment). We have changed the circuit, by adding 220nF capacitors at the inputs of the comparator, in order to eliminate the DC offset of the triangle wave and the amplified input wave. We have also put a potentiometer at the output of the LM386 as a voltage divider, in order to have a primitive volume control.

We connected all the components on breadboards, and put an 8ohm speaker at the output. The circuit worked fine when we used a function generator as the input, which was set to a 1kHz sine wave with around 500mV peak to peak. However, once we connected the input to one channel of an audio jack, which was connected to a PC (and a smartphone later on), as we slowly raised the volume, we could hear the sound, fairly distorted, for maybe half a second. Afterwards the 15V supply voltage from our lab bench power supply went into CC mode at 300mA output and the voltage dropped to around 5V. Increasing the current definetly doesn't help.

Once we lower the volume, everything goes back to normal with no output at the speaker, and as soon as we raise the volume, the same thing happens.

I have run out of ideas as to what could be the problem, so I would love to hear any advice.
I'm sorry for bothering, and I thank everyone in advance!
Hey, I am also building this circuit, but it in my circuit, Hex inverter is not inverting my PWM signal.

Moderator edit; New thread created from old thread.
 

Thread Starter

Arijeet

Joined Dec 27, 2019
78
Then obviously something is wrong with the circuit.
But my crystal bowl is out for cleaning, so you will need to post a an exact schematic of your circuit for help.
Sir, I have also posted my circuit on this platform. please see my exact schematic and real-time observations from oscilliscope.
 

Alec_t

Joined Sep 17, 2013
11,637
The comparator pull-up resistor is shown as 10k. Reduce it to 1k as I believe you have already been advised.
Unused inputs of the inverter IC should be grounded; again as advised.
If you post schematics they should show exactly the component values and the layout you currently have, with all connections; otherwise people trying to help you troubleshoot could be wasting their time. If you want help you must help the helpers.
What do you mean by the inverter 'not working'? Show us the output waveform/voltage when driven by the triangle waveform as input.
I have grounded every pin except 1,2,14.
If you grounded pins 4,6,8,10,12 you may well have killed the IC, or at least stopped it working temporarily. The inverter outputs must NOT be grounded.
 

Thread Starter

Arijeet

Joined Dec 27, 2019
78
The comparator pull-up resistor is shown as 10k. Reduce it to 1k as I believe you have already been advised.
Unused inputs of the inverter IC should be grounded; again as advised.
If you post schematics they should show exactly the component values and the layout you currently have, with all connections; otherwise people trying to help you troubleshoot could be wasting their time. If you want help you must help the helpers.
What do you mean by the inverter 'not working'? Show us the output waveform/voltage when driven by the triangle waveform as input.

If you grounded pins 4,6,8,10,12 you may well have killed the IC, or at least stopped it working temporarily. The inverter outputs must NOT be grounded.
yes I put a pull-up resistor 2k already before and for grounded pins,I have done experiment before grounded but nothing happened, zero volts come at the output, the I visit the datasheet of hex inverter,it is clearly written over there that unused pins will be grounded or pull up with VCC.
 

Thread Starter

Arijeet

Joined Dec 27, 2019
78
I am building a class D Amplifier, I have taken a reference of youtube channel of great Scott video link- (
) I have to build my circuit but, overall in the circuit, My hex inverter is not working. when I am providing a digital PWM signal from the LM393 comparator to the HEX inverter (MC74HC04AN), it should invert the PWM signal, but when I am performing,0 volts is coming in the second pin (output of hex inverter). when I powered the circuit, Mosfet driver Low input side input voltage is showing is zero. In the High input side,5 Volt is coming. but the low input side is not coming. I have changed my hex inverter but nothing has happened.

# I am not sure about DC coupling is affecting or not, but if you see in the picture which is posted on an oscilloscope,
1-Triangle wave has an offset of around 2.5 volts above ground reference.
Question 1- Did triangle wave should be zero dc offset, should I add a high pass filter after TLC555 timer output, which will keep my triangle wave with zero dc offset?
Operational Data:-

Basic Testing of Hex inverter
I am posting another two pictures which are based on basic testing of Hex inverter. in this experiment, a)- first, I provided a square wave of 2.5 volts with 200 khz frequency, duty cycle 50% to the input of Hex inverter, and output was zero volts. b)- after 1st method was not worked properly, I just thought hex inverter will work as digital input 0 to 5 volt. that's why I provided the same data as above written with 2.5 volts dc offset extra to see the results. when I performed I got these results. please see the below pictures(figure 5, figure 6, figure 7 ).
# Class D Amplifier overall practical Data
  1. TLC 555 timer generates triangle wave Approx and above 200khz with 2.14 volt.
  2. LM3393 comparator using for comparing two signals, Audio signal( Sin wave - 1 Hz to 20 khz with voltage-2 volt(max)) and Triangular wave(2.14).(input voltage common-mode range reference taking consideration not more than 3.5 volts)
  3. Hex inverter((MC74HC04AN) is used for inverting the PWM signal.
  4. Ir2113 MOSFET driver is used for high-speed switching.
  5. IrlZ44 n MOSFETs are using.
I am posting my practical data which is shown in real-time operations (oscilliscope).
  1. Schematic Diagram of class D amplifier (Figure 8)
  2. Triangle wave (TLC555 Timer). (I am posting two pictures for clarity)(Figure 1, figure 2)
  3. LM393 comparator output (i am posting two pictures for clarity). (figure 3, 4)
Afterward, hex inverter is unable to work. the reason I don't know. please give me a valuable comment.
 

Attachments

Last edited:

Thread Starter

Arijeet

Joined Dec 27, 2019
78
The comparator pull-up resistor is shown as 10k. Reduce it to 1k as I believe you have already been advised.
Unused inputs of the inverter IC should be grounded; again as advised.
If you post schematics they should show exactly the component values and the layout you currently have, with all connections; otherwise, people trying to help you troubleshoot could be wasting their time. If you want help you must help the helpers.
What do you mean by the inverter 'not working'? Show us the output waveform/voltage when driven by the triangle waveform as input.

If you grounded pins 4,6,8,10,12 you may well have killed the IC, or at least stopped it working temporarily. The inverter outputs must NOT be grounded.
I have uploaded everything in this post, now you can see everything with correct experimental data, please give valuable suggestions.
 

schmitt trigger

Joined Jul 12, 2010
320
You are lacking hysteresis on the comparator (positive feedback) and therefore have lots of spurious oscillations.

Show the simultaneous waveforms at the input and output of the inverter. Use the exact vertical sensitivity for both. And please, please, please align the vertical ground position of each channel to a graticule.
As Alec mentions, you might have already damaged it.
 

Audioguru again

Joined Oct 21, 2019
1,907
The video and your copy show that the amplifier is missing an output coupling capacitor to feed the 4 ohm speaker which has a DC resistance of about 3.8 ohms. Then the average DC speaker voltage is 7.5V and the DC continuous current in the speaker is 7.5V/3.8 ohms= 2A (!) and the DC power is 15W (!), even when the amplifier is not playing sounds.

The input of the inverter is a 5V peak-to-peak (NOT 2.5V) rectangular waveform and its output should be inverted at 5V peak-to-peak.
The datasheet for the 74HC04 should say to ground unused INPUTS, not outputs. If you connected the outputs to ground then you burnt it up.

Get rid of the breadboard. It cannot be used for audio and it cannot be used for 200kHz. The high capacitance between the rows of contacts and wires on the breadboard shows the risetime of the PWM from the output of the comparator is too slow.
 

Thread Starter

Arijeet

Joined Dec 27, 2019
78
You are lacking hysteresis on the comparator (positive feedback) and therefore have lots of spurious oscillations.

Show the simultaneous waveforms at the input and output of the inverter. Use the exact vertical sensitivity for both. And please, please, please align the vertical ground position of each channel to a graticule.
As Alec mentions, you might have already damaged it.
In before ,I tried and put a resistor value (1M ohm) to output and positive pin for hysteresis,but nothing changed in the output.if I removed the feedback resistor ,same results will come what I have shown in figures.and I will post the input and output response of hex inverter soon as possible.and As Alex mentioned before ,I need to connect ground to the input pin not output pin . Honestly ,what I have posted this figures ,and what I am conveying to everyone that when iam performing experiments ,I have not connected ground with anyone of pin except 7. I will keep in mind again when I will perform I will keep ground to input pins .
Your suggestions are welcomed , please feel free to ask . thanks
 

Thread Starter

Arijeet

Joined Dec 27, 2019
78
The video and your copy show that the amplifier is missing an output coupling capacitor to feed the 4 ohm speaker which has a DC resistance of about 3.8 ohms. Then the average DC speaker voltage is 7.5V and the DC continuous current in the speaker is 7.5V/3.8 ohms= 2A (!) and the DC power is 15W (!), even when the amplifier is not playing sounds.

The input of the inverter is a 5V peak-to-peak (NOT 2.5V) rectangular waveform and its output should be inverted at 5V peak-to-peak.
The datasheet for the 74HC04 should say to ground unused INPUTS, not outputs. If you connected the outputs to ground then you burnt it up.

Get rid of the breadboard. It cannot be used for audio and it cannot be used for 200kHz. The high capacitance between the rows of contacts and wires on the breadboard shows the risetime of the PWM from the output of the comparator is too slow.
Yes you are right with your point. And I am not performing class d amplifier circuit on breadboard ,I have already build a circuit on general purpose pcb board.In which you commented ,yes i was performing a small experiment for basics testing of hex inverter.but I am not getting any solution about that ,why hex inverter is not invertering my pwm wave ,if everything is okay. Still in video the guy had done the same thing but what i am doing the mistake.
 

Thread Starter

Arijeet

Joined Dec 27, 2019
78
Picture no
Which part of the circuit is giving the waveform in tha last scope pic (....704)?
Picture no- 8 represents the
Picture no-5 circuit ,in that picture I have done the basics test of hex inverter and check the inverter whether it is working or not.so that's why I checked ,and work in higher 200khz frequency . So ,I put HC7404 hex inverter on breadboard ,I put square wave from function generator ,to the pin no -1 and taking output from pin no- 2 and plot in the scope. So that's was last image.i performed this circuit in various frequencies (1hz to 200khz ) .it is easily working till 10khz after sometime inverting signal has started it's ringing effect.
 
Last edited:

Audioguru again

Joined Oct 21, 2019
1,907
Do not test a high frequency signal on a 74HC04 on a breadboard. The inductance and capacitance of the breadboard and its wiring causes high frequency ringing. If the unused inverters do not have their inputs grounded or if the 74HC04 does not have a supply bypass capacitor then it will not work properly and might be damaged.
Why is your input test signal only 2.5Vp-p instead of the 5Vp-p from the output of the comparator?
 

Alec_t

Joined Sep 17, 2013
11,637
I put square wave from function generator ,to the pin no -1 and taking output from pin no- 2 and plot in the scope. So that's was last image.
Well if pic ...704 shows the output from pin 2 of the inverter IC then your inverter is working (at least after a fashion), but there seems to be so much noise on the output that the scope trace isn't locking properly?
 

Thread Starter

Arijeet

Joined Dec 27, 2019
78
Do not test a high frequency signal on a 74HC04 on a breadboard. The inductance and capacitance of the breadboard and its wiring causes high frequency ringing. If the unused inverters do not have their inputs grounded or if the 74HC04 does not have a supply bypass capacitor then it will not work properly and might be damaged.
Why is your input test signal only 2.5Vp-p instead of the 5Vp-p from the output of the comparator?
1-) Yes ,I know the outcomes of using breadboard,if I worked in higher frequency,but I already mentioned when I am building class amplifier ,it is on general purpose pcb board.next time I will keep in my mind .
2-) good question.when I was checking my hex inverter ,I put square wave from function generator +/- 2.5 vpp,1hz ,50% duty cycle,but hex inverter was not working. Then I put a dc offset extra+ 2.5 volt above on square wave then hex inverter starts working.it means it will work 0to 5 volt.but when it comes to the original circuit,i am not giving any dc offset, I am feeding the own signal directly to the hex inverter input from comparator.
 

Thread Starter

Arijeet

Joined Dec 27, 2019
78
Well if pic ...704 shows the output from pin 2 of the inverter IC then your inverter is working (at least after a fashion), but there seems to be so much noise on the output that the scope trace isn't locking properly?
I understand your point.but my only concern is to invert the signal.in a video he had done very easily.do you think any coupling issues will come .yes ina a video,no coupling compensation is used.
 

Audioguru again

Joined Oct 21, 2019
1,907
In your post #13 you said you tested a "HC7404" on a breadboard. Was it an old 7404 or was it a 74HC04? Was it tested with all the extra inductance and capacitance of a breadboard? Were the unused inputs grounded?

First you said your inverter input test signal was 2.5Vp-p but now you say it was +/- 2.5Vp-p which is completely different.
The input must NEVER be negative, maybe you damaged the 74HC04 with the negative input. The signal from the comparator never goes negative, it goes from 0V to +5V which is 5V p-p.

The author of the video and maybe you do not understand that this simple class-D amplifier circuit is not a real circuit that is usually bridged. A bridged amplifier circuit has two amplifiers, one amplifier for each speaker wire. the output of the second amplifier is the inverted output from the first amplifier. Then the speaker gets double the p-p voltage for almost 4 times the power and the speaker gets no DC in it so a series output coupling capacitor is not needed.
 

Thread Starter

Arijeet

Joined Dec 27, 2019
78
In your post #13 you said you tested a "HC7404" on a breadboard. Was it an old 7404 or was it a 74HC04? Was it tested with all the extra inductance and capacitance of a breadboard? Were the unused inputs grounded?

First you said your inverter input test signal was 2.5Vp-p but now you say it was +/- 2.5Vp-p which is completely different.
The input must NEVER be negative, maybe you damaged the 74HC04 with the negative input. The signal from the comparator never goes negative, it goes from 0V to +5V which is 5V p-p.

The author of the video and maybe you do not understand that this simple class-D amplifier circuit is not a real circuit that is usually bridged. A bridged amplifier circuit has two amplifiers, one amplifier for each speaker wire. the output of the second amplifier is the inverted output from the first amplifier. Then the speaker gets double the p-p voltage for almost 4 times the power and the speaker gets no DC in it so a series output coupling capacitor is not needed.
I am using Mc74hc04 hex inverter (new) ,yes I tested my hex inverter 2.5vdc p-p with extra 2 .5 dc offset voltage provided ,in this way the hex inverter was working on breadboard.but if I do not provide ,dc offset the hex inverter will not work.i have a just said you that I had performed these things step by step.i totally agree with your point that hex inverter will not in negative. And I am not trying and providing+/- 2.5 vpp to the hex inverter.
 

Thread Starter

Arijeet

Joined Dec 27, 2019
78
I am using Mc74hc04 hex inverter (new) ,yes I tested my hex inverter 2.5vdc p-p with extra 2 .5 dc offset voltage provided ,in this way the hex inverter was working on breadboard.but if I do not provide ,dc offset the hex inverter will not work.i have a just said you that I had performed these things step by step.i totally agree with your point that hex inverter will not in negative. And I am not trying and providing+/- 2.5 vpp to the hex inverter.
In the beginning you are talking about bridge amplifier ,Did you mean to say that I need to build full H bridge amplifier circuit using two comparators Lm 393 ,1st will be Non inverted output and second will be inverted output and then I need to use two MOSFETs drivers ir2113 for drive full h bridge using 4 MOSFETs? Is this you are asking?
 
Top