Determining Value for Non-Inverting OpAmp Compensation Resistor

Started by phaeton, July 05, 2023, 10:58:22 PM

Previous topic - Next topic

phaeton

Hi folks, long time, no see.  I'm hoping maybe someone can smack me with a clue stick.  I've clobbered together plenty of guitar/bass circuits over the years using inverting opamp stages, to great success.  However, I had never built/arranged a non-inverting opamp stage before. While the old article I first learned from had served me well, it seems to have some missing information when it comes to what I've learned is the "Compensation Resistor" value. I breadboarded a simple amplifier circuit to tinker with.  It looks like this:



And to note, I'm not using a split power supply, I'm using a cheater one with a voltage divider, like so:



So for the opamp circuit, I was targeting a gain of 10, and this one is 11.  The article I initially read doesn't say anything about deriving the third resistor value (Rcomp).  The page has a sample circuit at the bottom that uses 1M.  I tried that and only got some tiny blatting out of it (sounding like it was misbiased).  I was about to connect a linear pot and 'dial it in till it sounded right', but figured it'd be better to know how to calculate it instead.  For science!

I searched here and TDPRI forums for a handy 'rule of thumb' type thing, but I didn't find very many relevant discussions, and no answers to my plight.  I got onto Google, but I must not have the right terminology, as I got a lot of hits but only a handful of ones relevant to what I'm doing.

A couple sites say to bias the non-inverting input at VREF (with my power scheme) or GND with a split supply.  That is what the Red Fuzz does, but it didn't work in my case.

A couple others say to calculate R1 and R2 as if they were in parallel- and that's the value to use for Rcomp.  Sounds like the nice rule o' thumb thing I was looking for.  I did that, got 9090 Ohms.  I plugged in a 9.1K and it worked!  But if I go look at schematics of other designs (classic stomboxery), that same calculation doesn't match what was used in the schematic.  Seems like half the time I end up with a value that's about half of the Rcomp resistor actually used in the circuit, which seems potentially clueful (maybe there's something to the power scheme type).

A video on Youtube had a simple calculation that involved the input capacitor too, i.e. Rcomp = 1/(2*pi*f*c).  I haven't tried that, but shortly after that, the same video says "just bias the non-inverting input to VREF".

Plenty more sites go right into calculus which is a bit over my head, unfortunately.  Many of them also appear to discuss various opamp applications different from audio amplifiers.

Adding to that, I'm seeing lots of variance in diagrams- i.e., the resistor/capacitor string (R1, C3) connected to the inverting input terminates at GND in some, and VREF in others, both variations for both power schemes.  The more I google the more confused I'm getting.  Maybe someone here can set me straight.

So that's what I've tried.  Here's what I'm trying to understand:

1) How does one calculate the value for Rcomp in a non-inverting opamp stage like above?

2) Is it going to be different for JFET-input opamps vs. BJT-input opamps?

3) If a variable resistor is involved (i.e., a potentiometer) does one just use its max resistance in the calculation?  (that's what I did)

4) Does the network off the inverting input (R1 and C3 in the above diagram) go to ground, or VREF?  If it varies, when?

5) Is "Compensation Resistor" the wrong term, and could that be why I'm getting a lot of useless results?


Thanks, and sorry.  I appreciate any replies or help anyone can offer.



Stark Raving Mad Scientist

PRR

"Compensation" comes from OLD high-precision work. Days when op-amp sucked real input current. Systems where millivolts of DC mattered.

The TL07x opamps have "no" input current. Or not enough to matter in audio. 1Meg is customary there. 10Meg is often fine. 1,000Meg is done in popular-price condenser microphones.

Your plan's DC output is not anywhere near zero. More like 4.5V. What do you care if it is 4.510 or 4.490? Or even 4V or 5V?  You don't want to see it wandering real close to the supply rails but tenths of a Volt are "nothing".

> it didn't work.....

"Don't work" is meaningless in diagnosis. It says nothing. Vref IS the answer in this case. Did you draw a full schematic? (not "mostly like a FluffFaze" but  different"). Did you measure and write-down voltages for study?
  • SUPPORTER

Rob Strand

A compensation resistor is the wrong idea for audio, it really only applies to DC circuits.

The primary reason for choosing Rcomp is to set the input impedance of the amplifier.   For an audio preamp this requirement completely overrides everything else.  In fact Rcomp should be set from the start without consideration for anything else.

The input impedance of the preamp loads the guitar pickup.   Somewhere around 470k to 1MEG is common as that's what most amps have.   Look at some guitar pedals and you will see most are in this zone.    Some pedals deliberately load the pickup but that's another story.

Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

amptramp

If you look at the spec sheets for op amps, one item you will see is "input bias current" and there will be a related one for input offset current.  Op amps with bipolar junction transistor input stages generally have higher values of both of these than op amps with JFET or MOSFET input stages.

For the old LM301A with bipolar inputs, the input bias current is typical 70, maximum 250 nanoamps.  Using a 1 megohm input resistor, that means the input voltage with a 1 megohm input resistor is a maximum of 0.25 volts above the voltage at the other end of the input resistor.  The voltage must be more negative at the input because the inputs are NPN and the base current pulls the voltage down at the op amp end of the resistor.  This is not usually a problem for audio circuits.

For the standard JFET input TL072 series, the input bias current is typical 65, maximum 200 picoamps at 25°C and 2 nanoamps over the full temperature range.  With a 1 megohm input resistor, the input voltage is a maximum of 200 µV or 0.2 mV across the 1 megohm resistor at 25°C and 2 mV over the temperature range.  I have never seen an audio circuit where this amount of DC offset matters.

I have designed circuits for DC measurement where the DC offset and differential bias current made a difference and I used matched resistances to ground or Vref from the non-inverting input and the parallel resistance of the feedback resistor and the input resistance on the inverting input.  This tends to cancel out the effect of bias current and leave only the effect of the (much smaller) input offset current.  I rarely see any audio circuit where this is necessary.  AC coupling in audio circuits prevents the effect of DC offset in individual stages from affecting the next stage.

antonis

As said above, "compensation" resistor is only needed both for significant input current and DC amps..
(many designers automatically implement it..)

And yes, its should be the parallel combination of feedback and gain resistors without too much concern about variabale feedback resistor value due to parallel equivalent value domination by gain resistor.. :icon_wink:
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

PRR

Last time I considered equal-value input resistors was days of '709. That's still only 2uA worst-case, and 0.3uA at any temp I'd want to be in.
https://www.ee.nsysu.edu.tw/lab/F6027/LM709%20Operational%20Amplifiers.pdf

So howsabout '702?
https://z3d9b7u8.stackpathcdn.com/pdf-down/U/A/7/UA702-Fairchild.pdf
2uA nominal in room, 10uA max in the arctic.

10uA in a 1Meg bias resistor is 10V error. Matching won't help if you only have 10V supply.

Both datasheets show frequency compensation info. Not the same thing.
  • SUPPORTER

antonis

Quote from: PRR on July 06, 2023, 02:53:05 PM
So howsabout '702?
https://z3d9b7u8.stackpathcdn.com/pdf-down/U/A/7/UA702-Fairchild.pdf .

Probably, due to lack of enough coffee, below unity gain buffer puzzles me a bit..


As I see it, it can't work as unity gain for positive signal of amplitude lower than diode forward voltage drop..
(assuming a diode steep slope..)
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

merlinb

Quote from: antonis on July 07, 2023, 04:30:42 AM
Probably, due to lack of enough coffee, below unity gain buffer puzzles me a bit..
As I see it, it can't work as unity gain for positive signal of amplitude lower than diode forward voltage drop..
Correct, but that circuit is intended for transient response testing, presumably with unipolar pulses.

antonis

Thanx Merlin..!! :icon_wink:

(I'd read more carefully schematic's heading..) :icon_redface:
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

phaeton

A quick note as it's been two days and I haven't responded yet:

Hey everyone, thanks for the replies so far.  I haven't yet had time to properly read through, but I've been able to skim them here and there between work and school tasks.  Hopefully this weekend I will have a moment to actually read through them and give a proper reply.

To that end, my original question was actually written in bits over several days so that's why it's probably a bit disjointed.  To PRR's comment I was actually measuring voltages, but forgot to include them.  I'll be sure to do so soon.  Sorry about that!

Thanks again. 

Stark Raving Mad Scientist

phaeton

Allright.  Thanks again everyone.  It definitely looks like I was chasing a ghost with the "compensation resistor" term.  As antonis and AmpTramp noted it's for a different application than this.  I do appreciate the historical explanation by PRR and everyone though.  I do enjoy all the lore and legends of electronics.

So I probably should have labled it R3 and posted a simple "how to calculate R3 value for an audio amp" instead of the wall of text above.

Quote from: PRR on July 05, 2023, 11:15:44 PM
> it didn't work.....

"Don't work" is meaningless in diagnosis. It says nothing. Vref IS the answer in this case. Did you draw a full schematic? (not "mostly like a FluffFaze" but  different"). Did you measure and write-down voltages for study?

Yep, you're right and I know better.  I did record some voltages:



The voltages of the non-inverting input varied less than a half a volt all the way across.  And what you see in the schematic above (aside from power and ground connections to the TL071) is exactly what I built.  I was trying to isolate the opamp for study.

Quote from: Rob Strand on July 06, 2023, 01:06:38 AM
The input impedance of the preamp loads the guitar pickup.   Somewhere around 470k to 1MEG is common as that's what most amps have.   Look at some guitar pedals and you will see most are in this zone.    Some pedals deliberately load the pickup but that's another story.

Yeah, and I did see that pretty frequently- 470K, 1M and also 10K in a few places.  Those were among the first values I tried.


Thanks again everyone, and sorry for getting started off with incomplete information.  I know better than that also, but I apparently have forgotten :icon_redface:
Stark Raving Mad Scientist

PRR

> non-inverting input varied less than a half a volt all the way across.


I see your meter is 10.538Meg input.
  • SUPPORTER

phaeton

Quote from: PRR on July 08, 2023, 07:56:44 PM
> non-inverting input varied less than a half a volt all the way across.


I see your meter is 10.538Meg input.

Yes, the one I was using is an old Fluke 77 that was advertised as having 10M internal resistance.  That's pretty standard with basic DVOMs though, right?

However, I feel like you're trying to point something out to me. ;)
Stark Raving Mad Scientist

PRR

Allowing for meter loading, all these numbers are "4.5V".

Also: the two inputs "must" be equal within 0.005V as long as you measure both at the same time. Without two meters, infer the unloaded voltage from the output voltage.

No input current balancing is needed for this opamp for any normal audio circuit.

  • SUPPORTER

phaeton

Quote from: PRR on July 09, 2023, 02:21:57 PM
Allowing for meter loading, all these numbers are "4.5V".

Also: the two inputs "must" be equal within 0.005V as long as you measure both at the same time. Without two meters, infer the unloaded voltage from the output voltage.

No input current balancing is needed for this opamp for any normal audio circuit.



Ah, I see. Thanks.

Sorry for such a long response time, as I've been busy this week.  I may not be able to get any 'bench time' this weekend either, but I do appreciate everyone's help in this thread.
Stark Raving Mad Scientist