I am creating a constant-current source and am having troubles stabilizing the control loop around U3, this is the circuit: circuit

This next picture represents the plot of loop-gain of U3: loop-gain plot

I've tried adding capacitor across R3, capacitor from U3 output to its non-inverting input and a series resistor between U4 and U3. I've tried experimenting with some values, but dont seem to get it right.

The phase margin is -57° and gain margin +43dB. Both values indicate instability as does transient analysis.

So, how do I know what to do to stabilize the control loop? I need to insert a pole somewhere below 2.5MHz to decrease ROC to 20dB? But then again there is a problem with gain margin.

I've also uploaded the LTspice files for anyone to try the simulation, they can be found here.

  • 1
    \$\begingroup\$ The first rule of opamps is don't put gain in the feedback loop. You can put a low pass as a quick fix. However, this is bad practice because it can stop working when you change opamps. I recently had to deal with a situation like this. Such a problem is difficult to spot, if the engineers are unfamiliar with opamp stability. You should rethink your design. What I would do is put the switch between U3 and the MOSFET gate using two separate control loops. You can put the gain amplifiers between the reference voltage and the positive terminal of the control loop opamps as required. \$\endgroup\$
    – user110971
    Commented Apr 7, 2017 at 12:46
  • \$\begingroup\$ @user110971 Could you please draw a schematic of the design you explained. I am not sure I understand it correctly. \$\endgroup\$
    – Golaž
    Commented Apr 7, 2017 at 16:01

1 Answer 1


You have a gain of 123 in the feedback loop and if an opamp were designed that could live with this amount of feedback gain then it would be a poor opamp indeed. The main suppliers design their opamps to have a small but significant margin of stability when operating in unity gain and you've blown that out of the water by adding over 40 dB of gain to the feedback loop.

Personally I don't see why any feedback gain is needed to make this a current source. The gain from U3 should be perfectly sufficient.

  • \$\begingroup\$ It is actually over 40 dB because it is voltage. \$\endgroup\$
    – user110971
    Commented Apr 7, 2017 at 14:11
  • \$\begingroup\$ Oops I meant 40 dB.... correcting! \$\endgroup\$
    – Andy aka
    Commented Apr 7, 2017 at 14:30
  • \$\begingroup\$ Output of U4 switch is going to LPF and ADC, and V6 will actually be DAC. So I "need" this gain to get use of full input/output range of ADC/DAC. Reference voltage is 4.096V. \$\endgroup\$
    – Golaž
    Commented Apr 7, 2017 at 15:57
  • \$\begingroup\$ Then leave that gain outside the feedback path. Pretty easy to implement. \$\endgroup\$
    – Andy aka
    Commented Apr 7, 2017 at 17:30
  • \$\begingroup\$ Sure I can do this for the ADC part. But for the DAC I would need to attenuate its output voltage (V6 in this case) down to 250uV for the minimum desired current. Instead of U1 124x gain, I would need 124x attenuation at U3 non-inverting input. Would this work? \$\endgroup\$
    – Golaž
    Commented Apr 7, 2017 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.