Will this simple op-amp circuit work? - Page 1
Forum section: electronics / beginners

author: Thane of Cawdor
author_rank: Regular Contributor
timestamp: January 14, 2016, 02:35:09 pm
content: Hi everyone,I'm trying to set up a string of high power LED's rated at 12V, 25W overall. In order to precisely control the current through the LED's, I thought the simplest option would be an op-amp constant current sink.The RC circuit is used to reduce oscillation caused largely by the gate capacitance of the MOSFET. I've attempted to add some gain to the circuit so that I can use a lower value resistor at the MOSFET drain however I'm not too sure whether this circuit will accomplish thatAre there any modifications which I can make to do this (the circuit is attached below)?Thanks

author: mikerj
author_rank: Super Contributor
timestamp: January 14, 2016, 04:27:19 pm
content: At 25W/12v you will get roughly 2 amps through your 0.1Ohm sense resistor, giving you 0.2volts. You are then dividing this down with R3/R4 giving you just 18mV on the inverting input at full load.Fortunately this is within the input common mode range of the LM358, but you have wired the pot R5 to provide the full 12v range to the non-inverting input. Even if you had a perfect 'ideal' potentiometer, your control range (i.e. min to max current) would be (0.018/12)*270 = 0.4 degrees of movement - unusable. In practice all potentiometers have some end resistance, so it's entirely possible you may not be able to reduce the output below 18mV, in which case the load would always be set to maximum current.To fix this:1) Don't divide the sense resistor signal down.2) Add a fixed resistor into the top arm of the potentiometer to reduce the output voltage range to a usable range.

author: MarkF
author_rank: Super Contributor
timestamp: January 14, 2016, 04:34:34 pm
content: Refer to this simple power supply circuit by Peter Oaks as an example:

author: Thane of Cawdor
author_rank: Regular Contributor
timestamp: January 14, 2016, 04:53:38 pm
content: Thanks for the responses,QuoteCould I just remove the resistive divider and possibly use a differential amplifier (with gain) to measure the voltage across the resistor and then feed this into the negative input?QuoteOn a completely different tangent, I know, but what is the purpose of that 1N4148 diode in the current adjust loop? Would that be reverse-biased when IC2B is operating?

author: MarkF
author_rank: Super Contributor
timestamp: January 14, 2016, 05:05:56 pm
content: Quote from: Thane of Cawdor on January 14, 2016, 04:53:38 pmThe 'voltage' op-amp sets the output level while the 'current' op-amp can only turn the MOSFET off. Without the diode, the 'current' op-amp could raise the output level.Watch Peters description of the entire circuit:

author: Audioguru
author_rank: Super Contributor
timestamp: January 14, 2016, 07:15:27 pm
content: The current is regulated by reducing the output voltage until Ohm's Law is satisfied: Current= Voltage/resistance.

author: mikerj
author_rank: Super Contributor
timestamp: January 14, 2016, 09:45:56 pm
content: Quote from: Thane of Cawdor on January 14, 2016, 04:53:38 pmJust remove R4. The values of R3 and C1 may need some fiddling to get a good compromise between stability and transient response.

author: Seekonk
author_rank: Super Contributor
timestamp: January 14, 2016, 10:47:31 pm
content: I hate this analog solution. If you must, why don't you make the sense resistor higher so at least some of the wasted heat can be dissipated in that.

author: Dave
author_rank: Super Contributor
timestamp: January 14, 2016, 11:17:26 pm
content: Quote from: MarkF on January 14, 2016, 04:34:34 pmThat circuit is a pefrect example of whatnotto do.He used a nice, expensive REF02, a 4-wire current sense resistor and completely messed up the circuit, throwing the qualities of both elements to waste.The connection between the bottom two terminals of the sense resistor and the capacitors is going to carry a significant amount of current and therefore produce an additional voltage drop, which isn't going to have a nice stable resistance like you would get from a quality resistor, therefore the accuracy of the circuit is out the window.On top of that, neither opamp is frequency compensated, those thingswilloscillate.

author: Thane of Cawdor
author_rank: Regular Contributor
timestamp: January 15, 2016, 04:19:48 am
content: Thanks again,QuoteI wanted to keep the resistor value as low as possible so that I could use a lower power resistor, additionally, the supply voltage is very close to the LED string rated voltage and so wouldn't a larger value resistor cause a voltage drop which would affect the LED supply voltage too greatly (e.g. 2A through 1R resistor giving a 2V drop)?QuoteI have removed that resistor and added a 10k in series with the potentiometer (10-turn) voltage divider section, would the feedback voltage still be too low to effectively change current from(~min-max) since the maximum voltage at the -ve op-amp pin would be around 0.2V?

author: mikerj
author_rank: Super Contributor
timestamp: January 15, 2016, 02:22:41 pm
content: Quote from: Seekonk on January 14, 2016, 10:47:31 pmBecause then he won't be able to deliver full power to the load.Quote from: Thane of Cawdor on January 15, 2016, 04:19:48 am10k isn't really enough, you've reduced the potentiometer range from 0-12v to 0-6v, but you can still only use 0.2v of that range. Better would be to derive your setpoint voltage from a reference instead of the supply. At the moment, if the supply voltage dips as the LEDs start to draw current, then your set point dips as well. That reduces the current, and the 12v rail may then rise....you can see how this could potentially cause an oscillation. Using a voltage reference for your set-point voltage means the load current will become independent of the supply voltage.A cheap (but nasty) way to improve things a bit would be to connect a diode (e.g. 1N4148) across the potentiometer (with the 10k series resistor). This means the reference is approximately 0.6v, but it will change a little with temperature and supply voltage changes will still have a small effect, though far less than before.A proper voltage reference would give more stable performance e.g.a TL431 costs a few pennies and will give a stable 2.5v reference. You'd want an extra resistor to divide the 2.5v down your required range though and a TL431 requires at least 1mA to regulate properly. e.g. like this:

author: Thane of Cawdor
author_rank: Regular Contributor
timestamp: January 15, 2016, 03:28:39 pm
content: Thanks again for the responses,I've edited the original schematic on the initial post1. I just built up the circuit and works generally fine, however; the current that is set by the voltage on the non-inverting pin does not match that through a load resistor (by a scale factor of 10 due to 0.1 ohms as opposed to 1-ohm voltage drop for 1A).Although, the two are directly proportional in that as the voltage on the non-inverting pin decreases so does the current through the load (somewhat linearly) which is really the only thing I require for this application. Would this be an effect of the op-amp itself?Quote2. Also, I couldn't get the system to oscillate with or without R3 and C1. What would be the simplest method of doing this to test the stability/transient response of the RC network to ensure that the system remains stable over time?Quote3. Finally, I've attached a circuit which is the same as the initial one except for an added diff. amp with a gain of 10 (making use of both op-amps in the 358 package at least). Is this a possible solution to increasing the potentiometer degrees of motion or is it full of opportunities for loop instability/oscillation not to mention, over-complication?

author: mikerj
author_rank: Super Contributor
timestamp: January 15, 2016, 06:13:57 pm
content: Quote from: Thane of Cawdor on January 15, 2016, 03:28:39 pmIf I understand what you are saying then it's purely the effect of your sense resistor value. A 0.1ohm resistor gives a transfer function of 10 amps/volt. Since you are controlling this with a potentiometer, this makes no difference provided you scale the potentiometer voltage accordingly.Quote from: Thane of Cawdor on January 15, 2016, 03:28:39 pmIf it's stable now it's likely to remain that way unless you change something. Inductance in the load path is a good way to make current sources unstable, i.e. long wires that aren't twisted. Test over temperature and expected supply voltage range.Quote from: Thane of Cawdor on January 15, 2016, 03:28:39 pmAdding another amp into the feedback path is a good way to reduce stability, so C1/R3 will almost certainly be required to get that to work nicely.

author: Thane of Cawdor
author_rank: Regular Contributor
timestamp: January 16, 2016, 07:12:00 am
content: Thanks,QuoteFirstly, is a differential amplifier even necessary in this application (since the non-inverting input will always be at ground potential) and can I just use a simple non-inverting op-amp with a gain of 10?Secondly, would I need to add another RC network to ensure the long-term stability of the other op-amp or only adjust the C1/R3 values since they are both in the feedback loop?

author: TerminalJack505
author_rank: Super Contributor
timestamp: January 16, 2016, 05:30:26 pm
content: The circuit like you have it now should work. I've attached some simulation results.Note that the error between the input and the output is due to the fact that the LM358 simulation model has a 2mV input offset voltage. This gets magnified to 20mV by the 10x gain. This likely won't be a problem for your application.The only change that I made to your circuit is that I made the compensation cap as small as possible while keeping the circuit stable with a decent phase margin. If I did everything right--and the simulator's models can be trusted--you can expect about 83 KHz bandwidth. Real life and the simulation may not agree entirely, of course.

author: Thane of Cawdor
author_rank: Regular Contributor
timestamp: January 16, 2016, 06:27:52 pm
content: Thanks for that!QuoteI understand the results from the first transient simulation but have a few questions for the AC model (second image):1. Why is L1 added? Is this to simulate inductance in the feedback path causing stability issues?2. What is the reason for placing the biased voltage source (Vin) in series with the coupling capacitor in that configuration as opposed to the same as the first transient simulation?3. Additionally, what is the practical effect of the bandwidth limitation and what is it limited by? Will this just effect the feedback loop rate of change (of LED current with respect to time) and is it just the combination of the non-ideal operational amplifier and the capacitor + parasitics?

author: TerminalJack505
author_rank: Super Contributor
timestamp: January 16, 2016, 07:14:56 pm
content: There's a ZIP file with some PDFs by Tim Green onthisweb page that explains what I was trying to do in the AC model. I'm no analog expert so I may not have done it right.The giant inductor is to basically break the loop (for any AC signals) but allow the circuit's DC operating point to be determined.The separate signal source in the AC model is to determine loop gain. Putting the signal source on the non-inverting input of the left-hand op amp wouldn't be the same. Those PDFs describe the method a lot better than I can.The bandwidth is basically going to determine how fast the circuit reacts to changes in the control voltage as well as any disturbance in the loop. So far as what determines the bandwidth, I'll leave that to the experts. Those documents will discuss it. It basically comes down to "poles" in the form of low-pass (RC, for example) filters. These may be an intentional part of the circuit (the dominate pole of the LM358) or not (parasitics.)

author: Thane of Cawdor
author_rank: Regular Contributor
timestamp: January 17, 2016, 05:11:01 am
content: Ah ok!In terms of testing the circuit for its stability in the real world scenario, could I feed a fast rising/falling square wave (high dV/dt) into the +ve input terminal of the op-amp or would some sort of step voltage be better at inducing ringing/oscillations?Thanks again

author: TerminalJack505
author_rank: Super Contributor
timestamp: January 17, 2016, 05:32:46 am
content: Yes, putting a fast-edged signal through the non-inverting terminal and watching the response will be a good way to determine stability. The high-frequency content of the fast edge can uncover many frequency response problems.

author: Thane of Cawdor
author_rank: Regular Contributor
timestamp: January 17, 2016, 06:46:48 am
content: Hi again,QuoteGreat! I'll set up a quick test to do thisIn terms of the maximum power dissipation of the MOSFET, would this just be determined by RDS(on)multiplied by the maximum LED current squared (I2R)?Thanks

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 17, 2016, 07:41:40 am
content: No, the MOSFET won't be operating on the Rds(on) curve. You have to measure Vds * Id.Tim

author: Thane of Cawdor
author_rank: Regular Contributor
timestamp: January 17, 2016, 07:54:51 am
content: QuoteOk, can I approximate this using the curves on the Idvs. VDSgraph from the IRF540 datasheet or would I need to measure the actual VDSin-circuit?Also, why wouldn't it be operating on the RDS(on)curve? Is it just due to the circuit topology?Thanks

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 17, 2016, 08:02:25 am
content: If it were on the Rds(on) curve, it wouldn't be controlling, gate voltage would be maxed out!...Which will happen if Vds is allowed to drop to that level, after all. The op-amp tries as hard as it can, saturating its output (Vgs will be around 10-11V, for an LM358 supplied with 12V), but is unable to cause more current to flow.Applying Kirchoff's Loop Rule, we have +12V at the top of the LEDs, V(LEDs) from there to the drain, Vds to the shunt resistor, and a little bit of voltage back to ground (I'm going to ignore the shunt voltage drop, because it's pretty small). If the LED is a three-in-series type array, then it should be expected to have 3-3.6V drop per die, or 9 to 10.8V drop total. The remaining 3 to 1.2V is dropped across the transistor, as controlled by the op-amp feedback.Tim

author: Thane of Cawdor
author_rank: Regular Contributor
timestamp: January 17, 2016, 09:02:54 am
content: Thanks!I don't have the LED's with me at the moment but they are specified to run at 12V (~5W COB strip LED similar to thishttp://www.aliexpress.com/item/dollarkey-4-8W-COB-LED-SMD-Strip-Light-Bulb-Lamp-Bead-Chip-2900-3200K-Warm-White/1885092145.html?spm=2114.40010308.4.12.lJt0Hv) and I wanted to run 5 in parallel, giving the approximate 25W figure.I'm assuming that in order to run the LED's at their specified 12V rating I would need a higher supply voltage due to the somewhat variable voltage drop across the MOSFET and the negligible 0.1-Ohm resistor. So if I had a 13V supply, I would have approximately 1V across VDSwhich would lead to a power dissipation of about 2W, is this correct?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 17, 2016, 05:10:18 pm
content: Hmm, "6-7V", those are only two dies in series. So you'll be dropping about 5V across the transistor. Better grab a heatsink!Note that you need a resistor in series with each one, to make a safe parallel array. Not much is necessary, maybe >= 0.47 ohm (with a maximum value of (5V)/(1A) = 5 ohms. Which is a good idea: might as well offload some of that wasted power from the transistor.) They'll still be mismatched at low currents... don't expect any miracles when it's dimmed down.Also, 5W each at 6-7V is a hair under 1A each, so you need 5A total (and the current sink needs to have an adjustable range up to 5A), and you need a 12V * 5A = 60W power supply.Tim

author: Thane of Cawdor
author_rank: Regular Contributor
timestamp: January 18, 2016, 06:12:46 am
content: Thanks for the response!QuoteIsn't the LED a 12V version as stated in the description or is that the actual voltage per LED in the COB die?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 18, 2016, 09:58:03 am
content: Well, who fuckin' knows, because there's no PDF for it, really...At the description it saysQuote1 chip (die) is obviously false for anything other than 3-4V, so we know one of these is wrong.The other description below this says...QuoteWhich is all kinds of more inconsistent. 6-7V at 500mA is 3-3.5W, not 4.8W.So, take your pick.There's no sign of onboard resistors, so they aren't going to take 12V-as-in-constant-voltage-power-supply.Probably you can run them at 700mA (which would give around 4.8W), and whatever voltage they actually operate at, burn them out quickly, and buy more replacements when needed.If you actually want good quality spectrum / CRI, reliable data and long lifetime, buy some legitimate brand name Cree or etc. parts. They'll be expensive, and you'll never have to replace them (assuming your thermal design is sufficient).Tim