I need help designing a class ab amplifier to power an 8 ohm 0.2W speaker to create an alarm sound. I'm outputting a sine wave at 150Hz and 5Vpp from a TI microprocessor.

Questions 1: A class AB amplifier amplifies the current not the voltage correct?

I have a couple NPN and PNP transistors, 2N3904 and 2N3906.

Question 2: If Q1 is correct. Will my uP be able to output enough current for these BJT's to amplify? Or do I need some sort of preamplifier or anything before I get to the AB amplifier?

Question 3: How do I figure this out through the BJT's datasheets? What do I look for on them to figure this stuff out for myself? Is it the current gain plot shown below? enter image description here

Seeking analog help!


1 Answer 1


Q1: A full class AB amp could amplify voltage and current. I suspect you mean a specific topology of a class AB amp. And from what you describe, I suspect you mean two transistors driven with diodes as voltage shifters which yes does not amplify voltage, only current. The example below is only Class B, but will suffice just fine for an alarm.

Push-Pull Class B amp
Push-Pull Class B Amp

Q2: If your expected circuit is anything like the picture above, then you shouldn't be using current from the uP to send directly into the BJT's. Your uP sends a voltage, this should be coupled by capacitors and then you should send the voltage signal to the amplifying stage which then uses current from the supply to drive the BJT amplification. Even if you choose not to capacitively-couple your input signal to your amp stage, you'd tie in the uP signal between the diodes. You'd notice that even then, any current coming from the uP is not current that travels through either BJT. Therefore, you don't have to worry about the gain between your uP output and the amp, you have to worry about the current flowing through R1 and R2 and how much gain you'll need there.

Q3: Becomes moot if what I answered in Q2 is correct. This is because your current input is determined by R1 and R2 then rather than the uP output.

You'll likely want to place an extra capacitor as well between your amp output and Rl (a much larger one than the input side to the amp) so that you isolate DC voltages from the AC signal you're trying to send to the speaker. This would allow your speaker to operate from -2.5V to 2.5V (for example) rather than from 0 to 5V which is what your uP will be powered/operated with.

For more detail on component values, then you'd want to look at BJT gains.

First you'll want to know what maximum voltage you'll want to drive your speaker with. Using Ohms law and the relation to power you can use V^2/R=P. Or V = sqrt(P*R). That would give you V=1.26V but that's only at DC. A sine wave with equivalent power to DC would be sqrt(2) times that or 1.79V. And since it's a sine wave it'd be +/-1.79V or 3.58Vpp. That's a pretty large range, but within the operating capability of a 5V power supply.

Using the other form of the power equation P=I^2*R, you can find the maximum current you'll want to drive the speaker with: 0.158 amps but once again that's at DC so your maximum current will be sqrt(2) times that for AC or 0.224 amps. Your Hfe plot shows that your current gain ranges from 70 to 170 so pick a number in there and see if it'll work. 100 is a good place to start. If you want the ability to output 0.224 amps, with a gain of 100, you'd need the input to the transistor to be 0.00224 or 2.24 miliAmps. I'd start there with your resistor biasing. Assume 0.7 V drops across each diode, Vcc is 5V and R1 and R2 are equal. That means 3.6/2 V or 1.8V drops across each resistor. 1.8V/0.00224A = 803 ohms. I'd start there and see if it works.

For the coupling capacitors I'd go as large as you have them within reason. 1uF to 100uF is probably a good place to start.

A word of caution, do not take the values I've given here and blindly place them into a production PCB. It is bound to fail miserably. Take the circuit and component values given here create the circuit on a breadboard and then toy with/modify it until you understand it prior to trying to put it into a PCB. All values here are estimates and first order guesses. Also, DO NOT use 12V or 19V to drive a dainty speaker like that unless you want to watch a lot of diodes, transistors, and speakers release all their magic smoke.

  • \$\begingroup\$ The input caps do block the uP from having to provide the DC bias of the circuit. But they still have to provide some current at 150hz as the caps will look like resistors of value 1/(2 x pi x 150 x C). If you pick C well it won't be much but it's not zero. \$\endgroup\$
    – hwengmgr
    Commented Apr 3, 2015 at 22:23
  • 1
    \$\begingroup\$ Capacitors don't buffer. They block DC. Normally there would be a voltage amplification stage preceding the output stage you've shown. \$\endgroup\$
    – user207421
    Commented Apr 3, 2015 at 23:37
  • 1
    \$\begingroup\$ This output stage is Class B, as one output device turns off almost exactly where the other turns on there is no region where it is operating in Class A. But that doesn't affect its suitability for the application at all. \$\endgroup\$
    – user16324
    Commented Apr 3, 2015 at 23:39
  • \$\begingroup\$ How do I know what size resistors and capacitors to use? I have to option to use Vcc as 12V or 19V, they will both be available on my PCB. \$\endgroup\$
    – EE_Eric
    Commented Apr 3, 2015 at 23:47
  • \$\begingroup\$ @BrianDrummond Can you expand on that or point me towards a source where I can learn more? Everything I'm reading classifies this circuit as a push-pull class AB amplifier. As far as I can tell, both transistors would be at least slightly on for about 70% of the full range. Wouldn't that make it class AB? At 0 input, there's still quiescent current flowing through both transistors, right? \$\endgroup\$
    – horta
    Commented Apr 4, 2015 at 2:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.