# Understanding this LPF in opamp feedback loop

I'm using a basic opamp driven mosfet to implement a precision low current sink for an LED:

This seems to work just fine within the range that I want it (10mA or so). I've seen other circuits that put an lpf in the feedback loop (R3 was 1K in the one I saw):

I'm trying to understand how that works. With the values of 100n and 10k, the -3dB point is 160Hz. What I don't understand is why the capacitor is connected to the opamp output instead of to ground. Wouldn't that divert noise above 160Hz back into the output? Of course, there'd be a phase shift as well but I cannot see why you wouldn't connect the capacitor to ground.

I'm guessing this is a really basic opamp circuit in a slightly different form but I'm not understanding what that form takes. I may have it backwards as high frequencies at the output of the opamp will "short" back to the inverting input and reduce the opamps output.

• The filter isn't needed in my opinion and I've implemented this circuit with BJTs in commercial products for exciting strain gauges and never used one. Noise has never been a problem either. I'm looking forward to any answers. May 9, 2015 at 10:43
• Thanks Andy. Given that the board this is on has gone to production already I was slightly concerned. I got feedback from an engineer that "current had varied". But getting more details it had varied by a few percent when he touched it so I think I'm OK ;-) May 9, 2015 at 12:11

The purpose of this circuit is to make sure the circuit has sufficient phase margin (does not oscillate). It's a particular problem with MOSFETs and not BJTs. 100nF is a very large capacitor- 1nF would work as well here (10nF is a good value), but maybe they wanted a bit of a LP filter or just wanted to be sure.

The problem is that the MOSFET (with such a low sense resistor) represents almost a purely capacitive load on the (exceptionally wimpy in this case) op-amp output. That produces a phase shift with the (relatively large) open-loop output impedance of the op-amp. In the case of the MCP6002 the maximum capacitance you can safely put on the output is less than 100pF with G=1. The Cgs is relatively low on that MOSFET (31pF typically, 46 max) but Miller capacitance comes into it too. Fortunately, with an LED load it's almost looking like a cascode arrangement, so you may be out of the woods.

You'd have to do a bit more calculation or simulation to be 100% sure- maybe try feeding a square wave to the non-inverting input and look to see how much overshoot you get in the current waveform. Varying when someone touches it sounds like it might be oscillating!

It's poor form IMO to do this in general- the second circuit above is the right way to do it. Even if you conclude it's working well enough, be careful that in production the MOSFET does not get replaced with something with substantially more capacitance. For example, the inexpensive AO3418 has a Cgs of 235pF (typical).

• That's great Spehro. This is the theory you have to ask an engineer for (I wonder is it in Art of Electronics). In my case, the output is static - it's fed from the other half of the opamp which is fed from a DAC but I'll still go and try and simulate to see what I get. In hindsight I should have put in Do-Not-Populate components as I did think about this before pushing the PCB (time pressures as usual) but I can easily bodge them in as the pins are beside each other. 1k and 10n as I've loads of those! Thank you. May 9, 2015 at 13:54
• AoE 3rd Edition shows a similar circuit with 3.3K/1nF and a 1 ohm sense resistor (Fig. 4.13), and they briefly mention why, but Win et. al don't go into how to calculate the values. Maybe they do in the op-amp chapter. It's sometimes better to add a series resistor to the gate as well (a few hundred ohms to 1K at most for a really low power op-amp), then the capacitance drive capability is virtually unlimited, but you must have the 1K/10nF fed back from the op-amp output (not the gate) or it will make things worse. May 9, 2015 at 15:36
• The third edition is out! Cool! I sometimes put a resistor before the gate but didn't bother on such a low power fet. May 9, 2015 at 15:55
• The resistor before the gate (alone) hurts the situation. The 3rd edition is great- I previewed one of the chapters a couple years ago- finally out. May 9, 2015 at 16:16
• Yup makes total sense +1 May 9, 2015 at 16:29