I read somewhere that there is no such thing as "internally compensated opamp". Opamps get less stable at unity gain (correct me if I'm wrong). I've used opamps without compensation before and it works fine (at low frequencies and low adc resulution).
I'm asking in for a specific case - buffering voltages of high resistor value dividers (200k:20k) with built in 10 bit ADC of PIC16F15324. The pin input capacitance is 5pF, Sampling capacitor of ADC is 10pF. The interconnect resistance + sampling switch resistance = 8kOhm, so the sampling cap 10pF can be pretty much ignored. There will be some PCB capacitance which shouldn't be that much - no ground plane, 10-20mm (<1inch) trace from output to pin, 0.6mm trace.
But also I want to know in general when should I compensate OpAmp and when I'm overdoing it. I don't want to be able to do the calculations - I already tried that, and as many of you pointed out - in most cases you can just workaround the math by simulation, building the circuit and testing, using best practices ... etc. I'm too old for math:)
So I attached 3 levels of compensation (not 100% sure what I'm doing - schematics could be wrong). fig 2 amplifies by 2, so the divider has to be changed. fig. 3 fixes that, but multiply that by two inputs and component count is getting ridiculous. But even if this doesn't make sense for 10 bits, I was curious about those 22 bit ADCs MCP3550. What if I want to play with microvolts.
I also found this one - with the cap and resistor connected directly on the opamp output.
TLDR:
So when and how I should compensate?
Hello,
It looks like your time domain response for Fig 3 is:
Vout=1-e^(-(0.0055*t)/Cout)*cos((5e-4*sqrt(400000000000*Cout-121)*t)/Cout)
so you could investigate the theoretical response using that to get an idea what is going on.
You can note that Cout is part of the exponential and part of the angular frequency, so as you change Cout the response either dies down faster or slower, and the frequency increases or decreases. Now if Cout is a certain value, the frequency will be 'faster' than the exponential can damp the response, so you will get ringing. That means overshoot and plenty of oscillation until it dies down, or just a little overshoot until it dies down. So it's like a race between the exponential part and the oscillatory cosine part ... if the oscillatory part takes a long time to reach a peak, the exponential damps the response down and there will be little or no overshoot.
If Cout is very small, the cos() part changes to cosh() and that means no oscillation at all. However, you dont really need that you can get by with a larger value of Cout. For example, if you stay under 100pf you should see a decent response. If you go up to 1000pf you will see overshoot.
The usual idea now is to figure out what you need in terms of settling time because that is very typical using an ADC.
You dont want to be too slow, but if you go too fast you get ringing and much overshoot. The overshoot however leads to faster response, so it ends up being a trade off. If your response time is not really too important then you are probably ok with the circuit as is. It may even be fast enough for many applications.
This is a theoretical result using an ideal op amp. The real life response of the op amp could change this to some extent, but that function above is good for getting a grip on what is happening with this circuit.