I am building a four channel constant current LED driver with PWM control. I have used the following circuit (replicated four times off a quad op amp). The circuit functions OK but as I wind the set point down the square output of the circuit becomes more and more resonant until it resembles a sine wave.

The power supply rail is damped by two 470 uF capacitors between the supply rails and close to the LED positive connection.

Any suggestions as to how to remove the oscillation without damping the frequency response of the circuit, as the minimum pulse width (1 bit) of the PWM output is approximately 2 microseconds at approximately 1kHz repetition rate?

The current in the LEDs is set to 700mA and the aim is to run it from 12 V but as the PSU is increased beyond about 11 V the drive current oscillations become large and the output becomes quite unstable. For info, there is a voltage droop of about 100mV on the supply rails during the on cycle of the MOSFET.


simulate this circuit – Schematic created using CircuitLab

  • 5
    \$\begingroup\$ I don't see any PWM in this circuit \$\endgroup\$ Mar 9, 2017 at 20:34
  • \$\begingroup\$ Throw an inductor or capacitor somewhere in the feedback loop (I'm too lazy to simulate this with spice right now \$\endgroup\$
    – Voltage Spike
    Mar 9, 2017 at 20:36
  • \$\begingroup\$ Is the op-amp on the same supply as the load? If it is you may want to decouple it through a diode or two and give them their own bulk cap. \$\endgroup\$
    – Trevor_G
    Mar 9, 2017 at 20:37
  • 2
    \$\begingroup\$ Please post scope shot of waveforms. \$\endgroup\$
    – bobflux
    Mar 9, 2017 at 22:20
  • 1
    \$\begingroup\$ That is just a horrific way to drive LEDs. \$\endgroup\$ Mar 10, 2017 at 2:55

2 Answers 2


Most opamps will oscillate in this situation.

Your MOSFET gate is a capacitor. Opamps with a capacitive load lose phase margin. With enough capacitive load, phase margin becomes negative and circuit oscillates. This is normal.

To regain phase margin,

  • Add MOSFET gate resistor (starting value 100 ohms) to isolate opamp output from capacitive load
  • Replace R4 with capacitor of suitable value, like 10-100pF, to close feedback loop at HF.

Determine component values according to opamp unity gain bandwidth and output impedance using Spice simulation.

Does anyone have suggestions as to how to remove the oscillation without damping the frequency response of the circuit as the minimum pulse width (1 bit) of the PWM output is approximately 2 microseconds at approximately 1kHz repetition rate.

Your opamp is very slow. It is a CMOS opamp intended for low power DC amplification: low slew rate, low GBW, next to non-existent output drive current.

Compounding the damage is a large MOSFET, with high gate charge, therefore lots of capacitance.


  • Use smallest BJT or FET that will do the job (faster, lower capacitance).
  • Use suitable opamp (faster, more drive current, etc)

Also, you have to decide whether you want to:

  • use your opamp as an ON/OFF transistor driver (which IMO is... weird) which will need a reeeeeeally fast opamp with tons of drive...
  • or control average current, in which case you'd low pass filter the PWM before feeding it to the opamp, it will be much simpler, but the LED won't blink.
  • \$\begingroup\$ Sorry, but like i said in my comment, even finding working point manually with a potentiometer would be not easy. This is because all range of current is covered by a very small range of Vgs. Not to mention current sense resistor affects Vgs... \$\endgroup\$
    – user76844
    Mar 9, 2017 at 21:58
  • 1
    \$\begingroup\$ OK, I understand your post now. Please notice the opamp feedback is taken on current sense resistor R1, so the opamp really controls current. However, it is unstable because of capacitive load. \$\endgroup\$
    – bobflux
    Mar 9, 2017 at 22:20
  • \$\begingroup\$ This is wrong. Because just as useless would be a system that doesn't care about capacitance. You can use mosfet with a 100pf gate and best available opamp. The problem will remain in mosfet behavior. Unless of course it is specially optimezed, which is probably not the case. \$\endgroup\$
    – user76844
    Mar 9, 2017 at 22:30

Use BJT. It's more linear. With MOSFET chances to get stable current control are not very high.

  • 1
    \$\begingroup\$ Sorry for downvoting, but this has nothing to do with "linearity". It's all about capacitance and phase margin. \$\endgroup\$
    – bobflux
    Mar 9, 2017 at 21:22
  • 1
    \$\begingroup\$ And how capacitance is important? Just don't tell me about opamp stability, it is not the unstable part here. Try finding working point with just a potentiometer. \$\endgroup\$
    – user76844
    Mar 9, 2017 at 21:47

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.