# Why this current regulator won't regulates?

I'm trying to make a current regulator to power up some LEDs. For now I'm working only on PSpice models.

The circuit above works well if the sensing opamp is configured as voltage follower or even if the voltage of the shunt resistor is directly reported to the inverting input of the main opamp U2A w/out the U2B.

Now, if the U2B is used to amplifying the shunt voltage resistor, in order to make this lower of at least 10 times to absorb 10 times less power, the opamp should amplifying 10 times this voltage and report it on the inverting input of U2A.

Under PSpice, by varying the Vcc from 4.5 (the minimum to have opamps working under this input values) to 12V, with this U2B which apmplifies fo 10 times, the current is like this. Where noramlly should remains stable under 50mA. The average value that you can see depends also on the base resistor of the BJT.

What am I missing?

It looks like the problem is the values of R6 and R7. The voltage divider ratio is $\frac{R7}{R6 + R7}$, which works out to $\frac{1.8k}{18k + 1.8k} = 0.091.$ That gives you about 45.5mA, which is close to what you see. You actually want a ratio of 0.1. Add a 220-ohm resistor in series below R7 and you'll get much closer to your ideal value.

• Ok, (3.3V*0.091)/R2 gives that "wrong" value. My mistake was to take a "module" non inverting circuit and barely apply it to a voltage drop of resistance and considering it as a voltage source. I did (50mA*R2)*(1+R5/R7), w/out considering that this requires an input of 3.63V. Is this error that gives the instability and negative trend (wrt to Vcc) too? Dec 7, 2014 at 11:06
• I'm not sure what could be causing that. It doesn't look like a very large change (about a third of a percent). It might be some non-ideality in the op amps or transistor. You might try using a smaller voltage step in your sim -- say, 0.01 volts. Right now it's hard to tell the true shape of the instability. Dec 7, 2014 at 23:49
• The shape change if the ratio is made to read a sense resistor of 0.66 ohms, so 10 times higher. It's a cutted triangle, so less evident. I'd like to underline that with a voltage follower configuration everything is working (at 50mA, but now we know why about that value). I mean, in the feedback there is always an opamp, like Andy said as a possible problem. But not forget that this is a simulation, I think that exoteric behaviours/parameters are not modelled. Dec 8, 2014 at 1:50

The negative feedback for an op-amp is usually taken directly from the op-amp's output or from the emitter of a transistor such as Q2. If you try and put "other stuff" in this feedback loop you introduce delays and what you find (normally) is that you are building an oscillator.

Please check what the transient response looks like because I suspect that your circuit will be oscillating at some frequency in the high kHz region.

All the main players such as TI, ADI etc design op-amps to compete with each other and they are constantly pushing the upper frequency capabilities of their devices. This inevitably means that the phase margins of those op-amps are a little close to the point of oscillation in normal circuits - you have added a 2nd op-amp and expect this to be stable - think again.

It can be made stable but this can be a tortuous endeavor.

The graph showing current against Vcc I suspect has triangular artefact on it due to this high frequency oscillation.

• Interesting. I need to amplify a small voltage from a shunt resistor due to power capabilities. Are you sure about the delay? Because if the feedback is given with a voltage follower, it will work pretty fine. Moreover, there is also a discending trend. Any suggestions? The triangular it's a case, it has a different shape but still periodic with other combinations of resistors on the second opamp. Dec 7, 2014 at 17:33
• The transistor voltage follower probably has a 3dB point of 500MHz and way way above that of normal op-amps - it has very little added contribution to phase margin. How do you mean the triangular shape is periodic - have you looked at a proper transient analysis. I don' expect it'll be a triangle in T-analysis but it will be time-periodic if the simulator you uses does show oscillation at all. Dec 7, 2014 at 17:35
• I mean that it is periodic with period of 0.5V (not time! :) ) So, you say that this behaviour is due to an oscillation at a fixed Vcc? Conceptually, how it can oscillates? Should I check the phase margin and find surprises? If so, I will definely check, since I didn't (forgive me!) Dec 7, 2014 at 18:10
• What does Pspice indicate when you do a transient analysis (several hundred milli seconds)? Dec 7, 2014 at 18:12
• All right. I did a simulation of 100ms. Everything is static, no oscillation. According to Pspice, the periodicity of the variation if I is only function of the Vcc. Dec 10, 2014 at 21:10

Running a version of your circuit under TINA gives proper operation at 45.2 mA. The fact that your waveform shows about 45 nA, rather than mA, suggests that you've made a data entry error. You should check to see if you've changed the sense resistor to 6.6 micro ohms.

That said, increasing the gain in order to lower shunt resistance power dissipation does not seem a pressing need. At 45 mA, a 6.6 ohm shunt will only dissipate 13 mW. Why is this a problem? Are you truly using a shunt so fragile that 13 mW is a problem? And, since this is an LED driver, I can't believe that you need enormous stability in your output current and are worrying about temperature drift in your shunt.

Or have I missed something?

• I'm pretty sure the graph shows 45 milliamps. It's easier to read if you zoom in. Dec 7, 2014 at 23:51
• The power, righ now (I will drive then higher currents once I can master this one) it's a relative power: I want to made something efficient. If LED abosorb 1mW, 13mW are too much. You can consider it as a project/exercise constraint. If I want to drive LEDs at their limit, then, I'd like to be sure that current is stable and, I'll learn to make a good current regulator. Everybody win :) About the current, are mA, you can zoom the image. Sorry if it is so tiny by default. Dec 8, 2014 at 1:39

The same circuit, with an BUZ70 will work perfect. There is still a little reduction on current at high voltages (from 15 to 24V). I don't know if it is a reduction of the gain of the MOS at higher voltages between gate and drain (doesn't should be ah higher gain)?

FYI, most UV LEDs have this charateristic: they are Much more efficient when Overdriven and, since you are concerned about efficiency, it would help to understand how this is done:

Current pulses are applied with a controlled peak amplitude and some limited maximum pulse width. The duty cycle of the square wave is reduced to limit both the PN junction temperature and the apparent brightness. (Reducing the duty cycle also reduces the pulse width.)

I hope you get excited by the constant current driver, and begin exploring the larger world of LED switching drivers.

ps If you are driving only one LED, the 3.3V supply may be adequate, so Vcc may only be needed for the OpAmp.

• Oh, nice advice the one about overdriving. I've thought a nice solution few days ago, using old notes from university and just at a concept level, that is worth saying because is using a sort of peak current driving. The output voltage of the opamp ideally should drive (using an MCU maybe) a DC-to-PWM controller which it self drive the MOS with a low dutycycle, fast transitions, between off and on (saturation), reducing drastically the wasted power. But I don't know how to convert the feedback signal from PWM-to-DC w/out affecting the phase margin. Large capacitors parallel to feedback? Dec 17, 2014 at 13:00