# Is this an appropriate circuit to drive my 8 ohm speaker using PWM?

Would feedback cause the output to compensate for deadzone problem?

s3n4te: Would feedback cause the output to compensate for deadzone problem?

No. Recall your transistor basics. The emitter/base junction will only conduct when the applied voltage is greater then around .6vdc, so there is a time while the signal is moving from 0 to .6v that the transistor can't conduct. This is the source of the so called cross-over problem as one transistor stops conducting and the other starts conducting.

Any basic description/drawing of class AB amplifiers will explain the DC bias set-up where neither transistor is allowed to completely turn off no matter what the signal value is. In essence the amplifier runs in class A (at a low continuous current flow) until the signal is high enough to 'take control' of the conduction transistor and so enters class B operation.

Lefty

Why have you drawn 12v batteries all over the place? You just need a +12 rail and a -12v rail.

I understand why there is distortion if there is no opamp there, but not when there is an opamp with the output is connected back to inverting input of the opamp. The output would always equal to the input * gain no matter if the transistors off when input is -0.7 -- +0.7V? Is this correct?

Edit: I did a Fourier analysis at the output with 10khz sine wave, and the THD is only 1.3%.

s3n4te: I understand why there is distortion if there is no opamp there, but not when there is an opamp with the output is connected back to inverting input of the opamp. The output would always equal to the input * gain no matter if the transistors off when input is -0.7 -- +0.7V? Is this correct?

Yes the opamp feedback circuit will try and correct the situation, but then the output of the amp isn't the real reflection of the input signal (+ gain) for short period of time around zero input signal. It causes a 'notching effect' at zero crossing that is easily seen on a scope and can be heard if one knows what to listen for. Again just read up on basic audio amplifier circuits using discrete components and you will learn all there is to know about the subject.

Modern IC audio amplifier chips do the same thing inside to eliminate the problem. Again this is a classic problem for any amplifier using bipolar voltage push-pull output stage, which allows DC coupling to the speaker. A single ended amp stage does not have this problem, but are very inefficient running in continuous class A operation (50% current flow with zero audio signal) and have to be capacitance coupled to the speaker.

Lefty

If I add active low pass filter would that cause my output wave to be triangular?

s3n4te: If I add active low pass filter would that cause my output wave to be triangular?

Not for frequencies below the cutoff design frequency of the filter. Not sure how you are processing audio information via PWM output. Is this using some kind of PCM signal? Or are you just ramping up and down the PWM duty cycle using a audio sine wave table?

It's hard to design an effective filter unless one knows the signal format being used.

Lefty

KE7GKP:

the output of the amp isn’t the real reflection of the input signal (+ gain) for short period of time around zero input signal. It causes a ‘notching effect’ at zero crossing that is easily seen on a scope and can be heard if one knows what to listen for. Again

Absolutely true. However, if s3n4te is only listening to square waves out of an Arduino, he probably won’t even notice it.

I told him that.

Not clear why one would string all those discrete components together to make a low-power amplifier when you can get an LM386 for less than the price of a pack of chewing gum?

Maybe he is trying to learn how to design audio circuits, it’s still an honorable task. The ‘golden ear’ audiophiles still frown on using opamps or ICs in general in their megabucks systems, go figure.

PS: In his circuit he is taking the feedback signal not from the opamp output, but rather right from the speaker output tap, which is common for such audio amps.

You can improve the crossover distortion by trying to keep the transistors biased. Try adding a few resistors as shown to see if it improves things. You will need to experiment with the exact values, that’s half the fun of building amplifiers.

Okay after taking your recommendations, I have adjusted the circuit to resemble this:

The diodes are to provide the dc bias to prevent crossover distortion, the pot for volume control, and 22pF cap for active low pass filter. What do you guys think?

I am using the following scheme:

What do you guys think?

Yea, dump the 1k and 4k resistors, just wire the pot's wiper to the 10k resistor.

Time to melt some solder?

Vanyamba: I am using the following scheme: http://sites.google.com/site/vanyambauseslinux/_/rsrc/1298081054520/electronics/arduino-generator-signalov/fast-pwm-sound2.png

That's a rather Lo-Fi approch, but with square wave input who cares, it will make noise. ;)

retrolefty: That's a rather Lo-Fi approch, but with square wave input who cares, it will make noise. ;)

Transistor is good noise filter.

KE7GKP: Not really. In fact it is more often the opposite.

In order to switch a bipolar transistor, some amount of current required, isn't it?

KE7GKP: Yes. And every active component (and many passive components) are all sources of noise and/or distortion.

Sounds a bit paranoidal. :) "This is my HiFiduino, baby." (c)

Okay I built the circuit, and the wonderful smell of magic smoke started to come out both bjts after decreasing resistance in the pot to 0 (I had to replace both). By the way, I kept the 4k and 1k voltage divider in the circuit. How do I calculate the power dissaption of the bjts in this type of circuit?

Okay, here is a more appropriate circuit.

The MOSFET I used is IRF3707Z, any higher current logic level MOSFTETwill work, such as the sparkfun sells.
The speaker is from mpa.com
http://www.mpja.com/prodinfo.asp?number=14618+SP
90dB. I use it in a fencing club to make a warble when a touch is scored, can be heard very well.

The current thru your BJT is (Vsource - Vce)/(sum of resistance in the rest of the path)

So (5V-0.5v)/(8ohm+pot)

I think I figured it out, since with 0 ohms at the pot, the voltage output of the opamp would be 1V, which means 12 - 1 = 11V must be dropped across the bjt. 1V/8ohms = 0.125 A ----> power disipation of bjt = 11V*0.125A = 1.375W > 0.6 W max of the transistor. Is this correct?

Which circuit do you have wired up? There have been several posted.