op amp feedback in class AB not working properly  - Page 1
Forum section: electronics / beginners

author: Rasmus
author_rank: Contributor
timestamp: September 30, 2023, 04:22:00 pm
content: I've been trying to build an amplifier over the last couple of weekends and this week I was made aware of connecting the feedback from my op amp stage to the output of my class AB power stage for added stability. I simulated it and everything seemed to work nicely. However I can't seem to get it biased properly in real life on a breadboard. The op amp is outputting way to high a voltage (4.8V) when it should be outputting 1.6 - 1.7V and also the inverting and non inverting outputs are not equal at all I hope someone has an idea to what might be going since i have been pulling my har out for some time now.I have attached the simulation and also a schematic with the actual measured voltage levels written on it thanks in advance to anyone willing to take a look.

author: Vovk_Z
author_rank: Super Contributor
timestamp: September 30, 2023, 04:50:39 pm
content: Output should be a half of a Vcc (because of a resistor divider at opamp input). If power supply is about 9.6 VDC then 4.8V at output is ok.

author: magic
author_rank: Super Contributor
timestamp: September 30, 2023, 05:03:12 pm
content: Your feedback is positive due to inversion by Q1. This can't work.

author: Zero999
author_rank: Super Contributor
timestamp: September 30, 2023, 05:05:38 pm
content: Quote from: magic on September 30, 2023, 05:03:12 pmThat's true and even if the inputs to the op-amp were exchanged, there's no frequency compensation, so there'll be positive feedback at a higher frequency, causing oscillation.

author: Rasmus
author_rank: Contributor
timestamp: September 30, 2023, 05:14:40 pm
content: Quote from: magic on September 30, 2023, 05:03:12 pmI see makes sense I might just do two equal resistors then so there's no phase shift.

author: Rasmus
author_rank: Contributor
timestamp: September 30, 2023, 05:18:06 pm
content: Quote from: Zero999 on September 30, 2023, 05:05:38 pmJust out of curousity why would frequency compensation be needed for higher frequencies and how would I go about about compensating?

author: Benta
author_rank: Super Contributor
timestamp: September 30, 2023, 05:46:04 pm
content: And due to missing emitter resistors susceptible to thermal instability/runaway. Not ot mention the nightmare of setting an initial quiescent current.

author: Zero999
author_rank: Super Contributor
timestamp: September 30, 2023, 06:20:17 pm
content: Quote from: Rasmus on September 30, 2023, 05:18:06 pmThe gain of any op-amp falls with increasing frequency. This is because there are parasitic capacitances in the transistors, which take time to charge and discharge by the internal constant current sources.There's a small delay between any change in voltage on the inputs and the output. This is related to the parasitic capacitances and current sources, as above.The delay causes a phase shift between the input and output signal. If the phase shift is 180o, the inverting and non-inverting inputs exchange functions. Imagine a 1MHz signal. It has a period of 1µs, meaning each cycle takes 1µs. If we put the signal through a circuit, which has a delay, equal to half the period, i.e. 500ns, then the output of the circuit will be negative, when the input is positive i.e. 180oout of phase. If the circuit is an op-amp, with a negative gain at low frequencies, i.e. a nominal 180ophase shift, it will have a 360ophase shift. In other words, negative feedback will become positive, at 1MHz.Look at it another way: the op-amp always adjusts its output voltage so its inputs are both nearly the same voltage, which takes time to happen. Suppose the op-amp is configured for a gain of 1 and its input voltage is suddenly changed from 0V to 1V. For a short length of time, there's a considerable difference in voltage between the inputs. If the gain is very high and there's a long delay, the output will overshoot, which will cause the inverting input to be much higher than the non-inverting. It will then compensate by reducing the output voltage. This overcompensation will result in oscillation.Most op-amps such as the TL071 are frequency compensated at unity gain. This means the gain is below 1 (actually it's <1/√2), when the phase shift exceeds 180o, which ensures it doesn't ring or oscillate. Adding an extra stage which introduces additional gain, or a delay, will cause oscillation, as the gain will be >1, when the phase shift is 180o. To solve the problem, the gain must be reduced at high frequencies, which is normally done by adding a suitably sized capacitor. Quite often some experimentation is required.

author: nigelwright7557
author_rank: Frequent Contributor
timestamp: September 30, 2023, 06:59:46 pm
content: Quote from: magic on September 30, 2023, 05:03:12 pmGood catch.Put transistor above bias diodes so transistors doesnt invert.

author: John B
author_rank: Frequent Contributor
timestamp: September 30, 2023, 09:13:12 pm
content: Q1 isn't really needed, both it and R6 can be removed and the base current can be sunk purely by the op amp. D1-3 could also be replaced with a transistor and resistor divider with trimpot on the base to give a variable voltage drop, which will give you finer control than a string of diodes. I see you've got a 1N5819 to add a bit more bias current, but using individual diodes only gives you at best ~250mV resolution.Falstad linkAlso note the large cap bypassing the bases/ transistor

author: Yuu
author_rank: Regular Contributor
timestamp: September 30, 2023, 10:27:28 pm
content: Quote from: Zero999 on September 30, 2023, 06:20:17 pmSo just out of curiosity, if you wanted to compensate OP's circuit, after he fixes his positive feedback of course, would you put cap in parallel with R4 between output and inverting input?OR would you put a cap between op-amp output and inverting input?It has to be the latter right? Because that way at suitably high frequencies, you bypass the gain of Q1 entirely and you just make a unity-gain voltage follower.

author: Smokey
author_rank: Super Contributor
timestamp: September 30, 2023, 10:36:42 pm
content: https://www.amazon.com/Designing-Audio-Power-Amplifiers-Cordell-dp-1138555444/dp/1138555444/ref=dp_ob_title_bk

author: Benta
author_rank: Super Contributor
timestamp: October 01, 2023, 12:08:55 am
content: Quote from: Smokey on September 30, 2023, 10:36:42 pmLooks nice. Did you read it or have it on your shelf?

author: David Hess
author_rank: Super Contributor
timestamp: October 01, 2023, 12:29:38 am
content: The power output stage is inverting, so feedback from the output needs to go to the non-inverting input.Frequency compensation remains from the output of the operational amplifier to the inverting input, which serves to bypass high frequencies around the slow power output stage.

author: Rasmus
author_rank: Contributor
timestamp: October 01, 2023, 05:15:21 am
content: Quote from: John B on September 30, 2023, 09:13:12 pmI'm planning to drive a 4 ohm speaker so I'm not sure the op amp will be able to sink that much current on it's own I have around 20 mA running in the bias network at the moment and that would start hurting the op amps performance as far as I can see in the datasheet.

author: magic
author_rank: Super Contributor
timestamp: October 01, 2023, 07:21:20 am
content: You would need Q1 or something similar if the chip can't run on rails high enough to support the required voltage swing.If it's only a matter of current you can simply add more emitter followers, perhaps in "diamond buffer" configuration to avoid losing output swing.Speaking of which, you will want to replace R5 with a current source or at least add bootstrap there. Otherwise you will find that R5 doesn't provide enough base current to the output NPN close to the positive rail, or it provides way too much current when close to the negative rail.NE5532 costs negligibly more and has better output drive ability than TL072. Also no phase reversal nonsense.If you really require JFET input, consider OPA2134.TL072 should be banned.

author: Rasmus
author_rank: Contributor
timestamp: October 01, 2023, 12:25:07 pm
content: Quote from: magic on October 01, 2023, 07:21:20 amDid you mean something like this?It clips at around +7.5V in the simulation but maybe thats just the maximum i would be able to get out

author: magic
author_rank: Super Contributor
timestamp: October 01, 2023, 12:50:14 pm
content: Probably overkill. Audio amps rarely use more than 3 emitter followers in a chain, so Q13 could drive Q12 base directly.If you replace R5 with a current source the output will almost reach rail voltage minus voltage drop of the darlington (Q10, Q9).

author: Rasmus
author_rank: Contributor
timestamp: October 01, 2023, 01:03:00 pm
content: Quote from: magic on October 01, 2023, 12:50:14 pmI thought Q13 and Q14 was a current source do I need it to be constant? I tried that at first with 1/2 VCC + 2*Vbe on the base og Q13 and the signal on the annode of D4 but only the positive half was present on the output.

author: Yuu
author_rank: Regular Contributor
timestamp: October 01, 2023, 01:14:47 pm
content: Quote from: Rasmus on October 01, 2023, 05:15:21 amHe says you can remove Q1 because it provides voltage gain in that configuration but what you want for current gain is an emitter-follower configuration like you already have with those four transistors on your output.

author: magic
author_rank: Super Contributor
timestamp: October 01, 2023, 01:44:16 pm
content: Take the original schematic.Replace Q1 with a PNP emitter follower.Replace R5 with a current source.This should work.

author: Rasmus
author_rank: Contributor
timestamp: October 01, 2023, 03:01:57 pm
content: Not quite sure how to build a suitable current source as a replacement for R5 I did try some things in LT spice but nothing really seemed to work at all. I did however add a pnp(Q2) to the circuit John B provided in order to not sink current into the op amp seems to work fine and will go up to +/- 9V I will try to build it for real whenever I get the time.

author: soldar
author_rank: Super Contributor
timestamp: October 01, 2023, 03:46:19 pm
content: Quote from: Rasmus on October 01, 2023, 03:01:57 pmHave a look at the first circuit in this thread:https://www.eevblog.com/forum/projects/classic-40w-audio-amp-with-discrete-components/Also:

author: Smokey
author_rank: Super Contributor
timestamp: October 02, 2023, 03:56:30 am
content: Quote from: Benta on October 01, 2023, 12:08:55 amBoth?