# Gas station without pumps

## 2017 June 23

### Uncompensated transimpedance amplifier

Filed under: Circuits course — gasstationwithoutpumps @ 16:07
Tags:

In my book Applied Electronics for Bioengineers, I have students build transimpedance amplifiers for phototransistors (and some students use them for electret microphones as well).  In the book, I never deal with compensating the transimpedance amplifiers to avoid oscillation, as I try to stay away from students having to reason about phase of signals and oscillation has never been a problem in the student designs.

But I thought that I ought to understand the method myself, especially if I need to help students trying to do higher bandwidth, higher gain transimpedance amplifiers.  First I read up on the subject—one of the better introductions is the Maxim application note 5129 Stabilize your transimpedance amplifier.  The key concepts are the following:

• When the frequency is high enough (where the open-loop gain is limited by the gain-bandwidth product) the phase change of the amplifier is about –90° (or 90° for the negative input).
• If we set up a transimpedance amplifier with feedback resistor R, then the feedback consists of a low-pass RC filter: a voltage divider with R on tap and the input capacitance of the amplifier and any capacitance in parallel with the current source on the bottom.
• The phase change of a low-pass RC filter (gain $\frac{1}{1+j\omega RC}$) approaches –90° above the corner frequency.
• Having a phase change of 0° and gain ≥ 1 around a feedback loop results in instability and possible oscillation.

That means that we can have instability at frequencies between $\frac{1}{2\pi RC}$ and the gain-bandwidth product (though we probably only have problems for frequencies at least a factor of 3 above the low-pass corner frequency, since the phase change of the filter is only asymptotically –90°).  If the parasitic capacitances are low and we only request small transimpedance gain, then RC is small, and the corner frequency of the low-pass filter is above the gain-bandwidth product, so there are no problems.  Will the students ever encounter problems?

Today I tried to make an unstable transimpedance amplifier using the MCP6004 op amps that we use in class.  The op amps have a gain-bandwidth product of 1MHz, so I needed an RC time constant much larger than 160ns.  I chose 2MΩ and 47nF for an RC time constant of 94 ms and a corner frequency of 1.69Hz.

The very large bypass capacitors are to make sure that there are no sneak paths through the power supply and positive input—to make sure that I’m looking at the phenomenon I’m really interested in.

I connected the amplifier up to the Analog Discovery 2, and I definitely got instability:

There does seem to be a somewhat unstable oscillation happening.

The reasoning about the amplifier instability suggests that the oscillation should be at about the frequency where the gain around the loop is 1, that is where $\frac{f_{GBW}}{f}\frac{1}{2\pi f RC}=1$ or $f= \sqrt{\frac{f_{GBW}}{2\pi RC}}$. For the circuit I made, that would be around $\sqrt{1MHz \; 1.69Hz}= 1.3kHz$.

I did some FFTs of the waveform (averaging over hundreds of traces to reduce noise, since the signal is fluctuating).

The peak is around 1380Hz, very close to the predicted oscillation frequency. Also visible are harmonics of 60Hz, which are the correct output of the transimpedance amplifier (picking up stray currents by capacitive coupling).

To compensate a transimpedance amplifier, we need to add a small capacitor in parallel with the feedback resistor, making the gain of the feedback filter $\frac{1+j\omega R_{F}C_{F}}{1+j\omega R_{F}(C_{F}+C_{i})}$, where $R_{F}$ and $C_{F}$ are the feedback components and $C_{i}$ is the input capacitance. For “optimal” compensation, we want to set the upper corner frequency $1/(2\pi R_{F}C_{F})$ at the geometric mean of the lower corner frequency $1/(2\pi R_{F}(C_{F} + C_{i}))$ and the gain-bandwidth product $f_{GBW}$. Using a larger capacitor (overcompensating) increases the phase margin (thus allowing for some variation from specs) at the cost of reducing the bandwidth of the final amplifier.

We can set the equation up as $1/(2\pi R_{F}C_{F})^2 = f_{GBW}/(2\pi R_{F}(C_{F} + C_{i}))$, which we can simplify by assuming that $C_{i} \gg C_{F}$ to get $C_{F} = \sqrt{ \frac{C_{i}}{2 \pi R_{F}f_{GBW}}}$, which for my design comes to 61pF.

A 68pF compensation capacitor cuts out the oscillation peak, but there is still a fair amount of noise around the corner frequency of the amplifier (1.2kHz). Overcompensating with a 680pF capacitor reduces the noise substantially, but the bandwidth is reduced to 120Hz.

I also tried a somewhat more realistic example, with only a 2.2nF input capacitance, which calls for about a 13pF compensation capacitor. A 20pF capacitor does fine:

The oscillation is well suppressed by the compensation capacitor.

Now I have to decide how much (if any) of this to include in my book. Perhaps it can be an optional “advanced” section in the transimpedance amplifier chapter?