# op amp+mosfet = current source.Why do we need a feedback resistor?

The feedback resistor is needed to compensate for the error of the input currents? How to choose the resistance R2.

Circuit source

Resistor R2.

Can I use this circuit, op-amp with differential input voltage range = +/- 0.6V? I'm not sure. I think not

• A very complete discussion of this sort of linear current supply is posted on another forum. – user2943160 Jun 8 '16 at 14:22

R2 (10k R4 in my diagram) is there to form together with C1 (1nF capacitor) a Miller Integrator to prevent unwanted oscillation. And yes, this circuit will sometimes oscillate, mainly due to poor PCB/breadboard design. And here you have a real world example (the breadboard one).

Without the Miller capacitance:

And after I add the Miller capacitance into the circuit:

http://www.ecircuitcenter.com/Circuits_Audio_Amp/Miller_Integrator/Miller_Integrator.htm

EDIT

Today I test this circuit again. And the result are: For RG = 0 Ohms; RF = 10k Ohms without Miller capacitance circuit oscillate (I_load from 1mA to 1A).

But surprise surprise If I short RF (10K) resistor the oscillations magically disappear (even if RG = 1K ohms).

So, it seems that the main cause of a oscillation in my circuit was a feedback resistor. I suspect that RF together with opamp input capacitance and some parasitic capacitance add a pole (lag) to the circuit and the circuit start to oscillate.
I even change the opamp to "much faster one" (TL071).And results was almost the same except the fact that he frequency of oscillations was much higher (713kHz).

• If you reduced R2 (gate resistor) to less than ten ohms, will it oscillate? Have you considered that using a gate resistor causes a problem that you then have to solve using an extra resistor and capacitor? Also, how does R2 form with C1 a miller capacitor - C1 is supply decoupling according to your pictures. – Andy aka Jun 8 '16 at 17:39
• @Andy aka Tomorrow at the evening I will try to find some time and I try to check it. I was referring to AndreyB circuit. – G36 Jun 8 '16 at 17:42
• @G36,Can I use this circuit, op-amp with differential input voltage range = +/- 0.6V? I'm not sure. I think not. – AndreyB Jun 9 '16 at 11:11
• @AndreyB no this circuit will not work with "differential input voltage range". – G36 Jun 9 '16 at 16:41
• @Andy aka For RG = 0; RF = 10k ohm the circuit will osculate. But no osculations if RG = 0ohms or 1K but RF = 0 ohms. I try RF 1K and 10K and in both of these cases the circuit misbehave. – G36 Jun 9 '16 at 16:48

You don't need a feedback resistor and neither do you need C1. I guess the "designer" has some strange perception that the circuit will oscillate without them but it won't.

• Oscillation will occur if Q1 provides gain - it won't because it is a source follower.
• Oscillation will occur if Q1 produces significant phase shift and this is more of a possibility but still unlikely if R1 (gate resistor) is kept low in value.

In fact, because of R3's presence, R1 is likely superfluous to requirements.

Here's an example circuit from Analog Devices: -

I don't see the two resistors and the capacitor in this schematic. If you were using a poor op-amp for this application (because of input offset voltages causing inaccuracies in the current) like the LM358 then you should consider using a bipolar transistor as shown in the data sheet on page 18: -

However, I believe it will work with a MOSFET providing you don't use a gate resistor (or a very small one). There are plenty of examples of the LM358 being used with MOSFETs without all the "extras": -

• I agree R1 is superfluous, but C1 is necessary when the opamp is not unity gain stable. That would be a strange choice here since it's used in unity gain configuration, but that can happen when you have on unused amp in a package. Once you decide C1 is required, you need R2 for it to work against since R3 is likely very low resistance. – Olin Lathrop Jun 8 '16 at 14:14
• @OlinLathrop good point – Andy aka Jun 8 '16 at 14:16
• @Olin Lathrop, explain more please. – AndreyB Jun 8 '16 at 14:23
• @AndreyB Olin is referring to op-amps that are not unity gain stable. Most op-amps are of course but (maybe) 1% are specifically designed to be voltage amplifiers at high frequencies and certain internal stability components are not present in order to give wider bandwidth possibilities. – Andy aka Jun 8 '16 at 16:41

This is a standard configuration for handling a capacitive load such as long cables (inside a standard current sink configuration).

The purpose of R1/R2/C1 is to decouple the op-amp output from the capacitive load presented by the MOSFET gate/source capacitance in series with R3.

It's unnecessary if R3 is significantly large compared to the op-amp open loop output impedance (between 8-70 ohms for common ordinary op-amps** with supply currents in the ~1mA range per amplifier) or the MOSFET has low input capacitance, or if the op-amp is designed to work with a large or unlimited capacitive load (if any of those three conditions are true).

R1 isolates the load, while C1/R2 provides a second feedback path (aka "in-loop compensation"). If you have R1, you should have C1/R2. R1 alone makes the situation worse.

** You have to be very careful with low power op-amps, which often recommend isolating capacitive loads in excess of only 100pF.

Edit: @G36 has provided a real-world measurement illustrating the effect (+1). It would probably not oscillate with R2 = 0$\Omega$ rather than 330 but that depends on the MOSFET used and on the load in the drain circuit. In any case, it will reduce the phase margin, leading to overshoot/undershoot of current.

Edit': Regarding choosing the values for a given situation, see this reference. R2 should be a value such that it's a lot higher than R3 and not so low it unduly causes offset or other bad effects. Say in the 1K-10K range normally, but it could be higher or lower for very low power or high frequencies respectively.

So pick a value for C1. The minimum value of R2 is:

$R_2 (min) = C_L \frac{R_O + R_1}{C_1}$ where RO is the open-loop output resistance of the op-amp and C_L is the load capacitance.

So if the load capacitance is 10nF including Miller effect, R1 is 100 ohms, RO is 100 ohms, and C1 is 100nF then R2 (min) = 20 ohms. So the circuit as shown (if my assumptions are reasonable) is grossly overcompensated and will respond much more sluggishly than necessary.

If we pick C1 = 100pF then R2 = 10K. Or you could use 1nF and 1K.

• This is not a simulation result but a real world measurement. I used my RIGOL scope to capture this. I only used LTspice to draw the simplified schematic the setup I used in the breadboard. – G36 Jun 8 '16 at 16:44
• Nice, As far as choosing a value for R2 (which was the question) I think you want the impedance of C1 to be much less than R2 at whatever frequency the circuit is going to oscillate at.... but I'm not sure. I almost always just use 10k ohm as is shown above. – George Herold Jun 8 '16 at 16:44
• @GeorgeHerold A reference added (which doesn't quite cover this configuration) and a calculation. If I don't want to calculate it I'll often use 1K/1nF/100 ohms with non-low power op-amps. – Spehro Pefhany Jun 8 '16 at 17:33

The capacitor in this circuit prevents a current spike when the circuit turns on. When the circuit is off, it is fully discharged, and when it turns on the output will be VC and the current will be either off or lower than the target. The negative terminal of the op amp will be driven up with the op amp output. The output will then rise until the target value is reached.

If not present, the negative terminal of the op amp will be at ground while the op amp output increases to a voltage higher than the target as it drives the gate capacitance through 100 ohms and may possibly saturate. When the FET turns on, overshoot may occur as the op amp recovers from saturation.

Well, it is an odd circuit. Not necessarily bad.

Keep in mind that the output of the op-amp is small signal ground and you'll see that R2 & C1 form a low pass filter. The R1 acting against the the transistor gate also acts as a bit of a filter too.

C1 also injects changes on the op-amp output back into the inverting input and thus speeds up it's response to step changes on the control input. This has the impact of slowing down the response of the op-amp output.

The optimization of the circuit will depend amongst other things, the input impedance of the op-amp.

Interestingly this all combines to allow for this circuit to be optimized for dynamical changes in the load and in the input reference some what independently.

• Your third paragraph is completely wrong. C1 slows down the opamp's response. – Olin Lathrop Jun 8 '16 at 16:06
• @OlinLathrop thanks, I can see why it reads that way, I'll clean up the language. – placeholder Jun 8 '16 at 16:07
• This still isn't right. C1 does not speed up the opamp's response to control input steps, it slows them down. C1 is a classic compensation capacitor. It's purpose is to keep the opamp stable. It essentially adds some output dV/dt to the negative input. When the opamp starts moving up quickly, this dV/dt raises the negative input a bit, which drives the opamp less hard in the direction it is going. – Olin Lathrop Jun 8 '16 at 19:47
• @OlinLathrop nowhere does it say that the op-amp is sped up, nor did it originally say that, but it was wooly language. Indeed in the edited version it explicitly says that the output is slowed. – placeholder Jun 8 '16 at 20:14
• The part I object to is "and thus speeds up it's response to step changes". That's wrong. It does no such thing. – Olin Lathrop Jun 8 '16 at 20:16