# Problem with voltage-controlled current source circuit using op-amp with MOSFET at high frequencies

This is a circuit from Mr. Sourav Gupta:

The problem is that I want to use this circuit to drive a current using voltage control which is a digital pulse signal in 1T, see picture below:

I want to use a signal like this to be Vin on that circuit with a frequency range of 1-10 kHz, but when I test on a breadboard the problem starts at around 1-10 kHz.

I researched this and I think this problem is caused by the LM358, because at low frequencies like 1-10 Hz the output pin 1 of LM358 has a low swing voltage and pin2 (the non-inverting pin of the LM358) feedbacks correctly, but at high frequencies the output pin has a swing output and pin2 (the non-inverting pin of the LM358) does not feedback correctly, see picture below.

This is the input signal at 10 kHz (pin 3 on LM358):

This is the output (pin 1 on LM358):

This is the non-inverting input (pin 3 on LM358):

I understand that if negative feedback is connected like this pin 2 should be the same as pin 3, but it is not.

I want to know how to fix this circuit, or maybe you can suggest me another Voltage Controlled Current Source Circuit.

• The LM358 has a gain-bandwidth product of less than a MHz. It's an abysmal op amp for almost any job. On top of that, you seem to have some problems with your feedback loop; what's your PCB layout look like? Apr 6, 2023 at 3:53
• I am test this on breadboard sir. Apr 6, 2023 at 3:58
• First off, please don't call me sir. Second, that's probably your problem. Breadboards have loads of parasitic capacitance everywhere, you're going to get coupling all over the place. Try doing it on a proper PCB, or even just stripboard. Apr 6, 2023 at 4:00
• Ok. Mr.Hearth i will try on stripboard Apr 6, 2023 at 4:28
• The 10k resistor in series with the gate of Q1 will severely limit the frequency response of the output. Try about 20 ohms. Apr 6, 2023 at 4:30

This is caused by capacitance between the drain and gate of the MOSFET. With rapid rise and fall of output potential $$\V_{OUT}\$$, this capacitance causes a significant Miller current to flow via R1, which can be hundreds of microamps:

simulate this circuit – Schematic created using CircuitLab

R1 is large enough in your circuit that hundreds of microamps through R1 causes many volts across it, which has the effect of switching the MOSFET back on when the op-amp is trying to switch it off, or switching it off when the op-amp is trying to switch it on!

Of course, the op-amp responds to try to correct this "error", which is why you don't see a clean square wave at its output. This is the voltage $$\V_Y-V_X\$$ across R1, due almost entirely to Miller current:

The solution in your case is probably quite simple; make R1 much, much smaller. Here I make it 330Ω, and plot R1's voltage again:

simulate this circuit

Voltage across R1, due to Miller current is kept well under 100mV, much less likely to interfere with the MOSFET's current state, and doesn't cause the op-amp to respond wildly.

R1 serves two purposes. Firstly, it limits gate charge current, which for this circuit isn't that critical, because the limited output slew rate of the op-amp has a similar effect. Even with no resistor there gate charging current would only be a couple of milliamps, which the op-amp can easily handle.

Secondly, and most importantly, without R1, Miller current is effectively limited only by the impedance of the output of the op-amp, and the op-amp is endangered. So R1's most important role is to protect the op-amp from high gate currents due to fast transitions at the drain of the MOSFET, which get coupled capacitively to the gate.

If R1 is too low, the op-amp is not sufficiently protected, and if it's too high, Miller current will develop too great a voltage across it, preventing the MOSFET from switching off or on quickly and cleanly.

• I replaced the LM358 with a CA3140 and the output is a very sharp square wave. Apr 6, 2023 at 5:32
• @PStechPaul then I imagine that the CA3140 has a much higher slew rate, able to correct for the error across R1 much more quickly. I think you'll probably see the problem return at higher frequencies, since there must come a point at which gate-drain coupling causes a voltage across R1 to change faster than the op-amp can compensate. Apr 6, 2023 at 5:46
• @PStechPaul If what I said is correct, then I would also expect ringing to become a problem, requiring some frequency compensation. The low slew rate of the LM358 is probably the only thing preventing this circuit from ringing like a bell. Apr 6, 2023 at 5:47
• The OP only requires 1-10 kHz. CA3140 has 4.5 MHz gain*bandwidth, and has 9V/us slew rate. It will probably be adequate up to 100 kHz. Apr 6, 2023 at 5:51
• @PStechPaul No argument against R1=20Ω and OA1=CA3140, because I think you're right. I would still advocate for higher R1, and frequency compensation, since that load may not be a simple resistance. I'll wait for the questioner to complain about ringing or oscillation before I go there though! Apr 6, 2023 at 6:13