Continue to Site

# Class D PWM amplifier. Why certain resistors are better?

Status
Not open for further replies.

#### mik3ca

##### Member
Here I am now trying to tackle another issue. Have a look:

This is my circuit that ultimately will amplify the analog audio output of an ISD1700 series chip.
With the values shown I tried it as a separate amplifier in which the "earphone" input is my laptop audio (cable connected from laptop earphone jack to circuit). The output is an 8 ohm 1/2 watt speaker.

If I use high values for RV (like 470K) then I can get the circuit working but if I use low values (like 10K or 22K) then there is no audio output.

I posted this question on another forum and someone mentioned about the pulsing frequency should be between 300 and 500kHz because I'm using an LM393 and someone suggested I should use 100K resistors for RG and RV but I don't understand why those values were picked. I'd like to know from a mathematical standpoint as I will be powering this circuit from batteries and the voltage can change any time.

It's a loading issue. Rg and Rv are meant to bias the voltage from the input.

The 22uF cap AC couples the input signal. (It blocks the DC voltage from the earphone so only the AC signal gets through centered around zero). But then it hits Rg and Rv which have a DC voltage so this new DC voltage gets added to the AC. Now the AC sits on top of this new DC voltage instead of the old one before the capacitor. So that whole deal there basically gets rid of the DC component of the input and replaces it with a new one. It basically changes the DC level that the AC signal is riding on.

The lower Rg and Rv get, the more heavily the earphone input is loaded. THis means that it takes more current to produce the same voltage (it's almost like a partial short-circuit to either +Vcc or GND if you want to think about it that way). The lower Rg and Rv get the harder the earphone has to work to produce the same voltage on the other side of the capacitor and at some point it just can't do it anymore.

Ideally you want Rg and Rv to be infinite so that the input signal is not drained away towards Vcc or GND, but of course if you have that then there's no DC bias anymore. The lower Rg and Rv are, the more the voltage at that point becomes locked to the DC voltage they are producing and the harder the earphone has to drive to move the voltage away from that DC voltage (which you need because you want DC+AC).

100K was just chosen because it's a really big value to limit current flowing from Vcc to GND which saves power, and also doesn't load down the input as much. It was not chosen to be any larger because at some point not enough current will flow anymore to realistically maintain that DC bias (i.e. the infinite resistance I mentioned earlier). As the resistance approaches infinite the DC bias becomes less stable since less current is flowing to maintain that DC bias voltage and other high resistance paths start becoming attractive for the current to flow through relative to the resistor.

Also, in this case you don't want it too high because it will mess with the op-amp bias currents since they need a way to circulate.

Last edited:
there doesn't seem to be any obvious reason. Rg and Rv should be equal, which biases the input at 1/2 Vcc. it's possible that low values load down the audio source, although a 5k input impedance should be high enough that just about anything should work as a source without getting loaded down. you should also verify that the DC voltage on pin 6 of the comparator is also at 1/2 Vcc, and that the triangle wave is symmetric with respect to 1/2 Vcc. it's possible (and i've run into something similar before) that with 10k resistors there, you are leaking current out through the electrolytic (which for this circuit where you have 1/2 Vcc on one side of the cap, the cap is backwards, and will leak current). with the 100k resistors, the - side of the electrolytic is at +2.5V, but the amount of current that can get through is limited by the 100k resistors.

...and other high resistance paths start becoming attractive for the current to flow through relative to the resistor.

So I'm guessing I'll be ending up with a complex voltage divider since the opamp may have a huge resistor tied from input to source in the order of megaohms and this would be in parallel with RG or RV and the voltage at input must be at certain value to turn on, but I'm trying to discover my actual high limit.

So I'm guessing I'll be ending up with a complex voltage divider since the opamp may have a huge resistor tied from input to source in the order of megaohms and this would be in parallel with RG or RV and the voltage at input must be at certain value to turn on, but I'm trying to discover my actual high limit.
Yeah, or even the PCB dielectric itself.

I wouldn't go above 1MOhm. The bias currents for the op-amp are about 300nA at room temperature. That's 0.3V for 1Mohm. 0.15V if you treat the two resistors as a parallel resistor in an AC model by "turning off" the DC sources.

The 22uF appears to be the wrong way round?.

Nigel, I believe that your sharp eyes have located the root cause. I would go for a smaller value also, like 4.7 uf

Speaking of caps, what is the purpose of the 1 uF cap from the output to ground?

Nigel, I believe that your sharp eyes have located the root cause. I would go for a smaller value also, like 4.7 uf

Speaking of caps, what is the purpose of the 1 uF cap from the output to ground?

Presumably part of the filtering on the output?.

However, it's really a pretty crappy looking design, why not just use a class-D IC amplifier? - presumably the quality of this one is going to be very low?.
I also agree that 22uF seems rather excessive, but I imagine the circuit was 'designed' by someone with little experience or understanding?.

Well I'm not ultra picky with quality just as long as I get output and that its intelligible. Im gonna replace my TLC555 thats in the circuit with an NE555 because that cmos part might be the reason for the need of such high resistors for the design.

Well I'm not ultra picky with quality just as long as I get output and that its intelligible. Im gonna replace my TLC555 thats in the circuit with an NE555 because that cmos part might be the reason for the need of such high resistors for the design.

This reasoning is incorrect. The CMOS part allows you to use higher value resistors. It does not require it.

might be the reason for the need of such high resistors for the design.

There's no need regardless, and it doesn't even use 'high' value resistors anyway.

Have you replaced the 22uF with a lower value, fitted the correct way round?.

I suddenly realized what is wrong with the circuit: you are using the Q output as an input to the comparator!!
The Q output is a squarewave. To generate a PWM signal you require a sawtooth wave.

Ok so I did connect the capacitor right and did more experiments I tried 10uF then 1uF and it seems lower values work but what if i wanted to allow more base to go through? I'm gonna use filter calculators because I think im passing mains frequency through (60hz)

I went as low as 47nF for capacitor and even though the sound is the cleanest, theres not much base but with my resistors... with RG set to 10K and RV set to 470K+, I get sound

Did you read post #12?

Ok so I did connect the capacitor right and did more experiments I tried 10uF then 1uF and it seems lower values work but what if i wanted to allow more bass to go through?
You need to learn the formula for calculating a coupling capacitor. It is 1 divided by (2 x pi x frequency x resistance). So your 47uF capacitor feeding 8 ohms cuts 426Hz -3dB (half the power) and cuts lower frequencies -6dB per octave. Since we can hear down to 20Hz but most woofers cannot go that low then the capacitance should be at least 470uF.
Oh, your speaker is a cheap tiny little 0.5W so it will not produce bass sounds anyway.

You need to learn about biasing an opamp or your comparator to see that the values for RV and RG should be the same, then its can swing its output equally up and down.

Per schmitt trigger in post #13, you need to move the - input of the LM393 to pin 2 of the LM555 in order to obtain significant modulation of the pulse width.

While at it, replacing the 2.2k resistor that charges the 220 pf capacitor with a constant current source would reduce harmonic distortion if that is an issue.

You need to learn the formula for calculating a coupling capacitor. It is 1 divided by (2 x pi x frequency x resistance). So your 47uF capacitor feeding 8 ohms cuts 426Hz
See I thought such formula existed in my circuit except I use 1/(2 x pi x RC) for a capacitor and resistor network and I always thought it had to do with RG or RV but now you're telling me speaker inpedance. So you're suggesting I should use the inductance equation. See... this is stuff internet doesn't really publish. someone needs to fire the people at google.

EDIT:
I used 1/(2 x pi x RC) with 8 for R and 0.000047 for C and got about 423. of course I rounnded PI off to 6.28

Last edited:
See I thought such formula existed in my circuit except I use 1/(2 x pi x RC) for a capacitor and resistor network and I always thought it had to do with RG or RV but now you're telling me speaker inpedance. So you're suggesting I should use the inductance equation. See... this is stuff internet doesn't really publish. someone needs to fire the people at google.

EDIT:
I used 1/(2 x pi x RC) with 8 for R and 0.000047 for C and got about 423. of course I rounnded PI off to 6.28
I round off 1/(2pi) to be "0.16". Then 0.16/(47uF x 8 ohms)= 425.5Hz.
The input RC and the output RC both affect low frequencies.
The small inductance of a speaker affects its very high frequencies and has no effect on its low frequencies.
You calculated a -3dB cutoff frequency of 423Hz so there will be no low frequencies. Audio goes down to 20Hz.

#### Attachments

• coupling capacitors.png
15.4 KB · Views: 77
he's not going to hear much below 1khz anyway, OP said he was using a 1/2W 8 ohm speaker, which is most likely 4 inches or less in diameter.

Status
Not open for further replies.