Author Topic: LM358 in Consant Current Circuit Problem  (Read 10809 times)

0 Members and 1 Guest are viewing this topic.

Offline TheInfernoManTopic starter

  • Contributor
  • Posts: 27
  • Country: de
LM358 in Consant Current Circuit Problem
« on: December 31, 2016, 03:40:58 pm »
Hello,

I am new to this forum and I have a question, regarding to my Schematic.
My wish is to build a Constant Current Dummy Load like the one from Dave, but I have a lot of problems.

I started on the breadboard and I think everything worked okay. Then I designed a PCB and built it up.
There starts the problem. The Current is all, but not constant. At one time, there is no current, then the full 5A, instead my wish of 1A at this time.

So I started debugging my circuit and I think I destroyed one LM358 (I dont know how, but I had 40V on my Circuit, but only powering with 12V Input  :o ).
Now I simplified the schematic as good as I can and attached it to this post. (I used a new LM358 in the debugging circuit)
The original Schematic is also attached (is there a mistake ?)

If I connect the non-inverting Input to Ground and use the LM358 in a Comperator configuration my idea is that no current should flow.
But in Reality there is 1.3A flowing at A1.

Why is this so ? I have no idea.

--
I am really new to electronics and I am German, I'm Sorry for a few mistakes in my language...
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14210
  • Country: de
Re: LM358 in Consant Current Circuit Problem
« Reply #1 on: December 31, 2016, 03:51:42 pm »
The LM358 can easily oscillate with too much capacitive load at its output. Something like 100 pF, maybe 1 nF with some luck is Ok, but more is calling for trouble. The 2 FETs are more like in the 10 nF range.

So one would need to have resistors between the OPs output and the gates (one for each FET). This is generally a good idea if there are two MOSFETs in parallel as other wise high frequency oscillations are possible.

In addition there should be a fast feeedback directly around the OP: so a capacitor from OPs output to the inverting input, and a resistor in front of the inverting input.

C1 in the original circuit is at a wrong place (wrong input) and rather large - more like 1 nF would be the right size.

For a first test I would use just one FET, with 40 V it is possible the FETs died from to much voltage.
 
The following users thanked this post: TheInfernoMan

Offline TheInfernoManTopic starter

  • Contributor
  • Posts: 27
  • Country: de
Re: LM358 in Consant Current Circuit Problem
« Reply #2 on: December 31, 2016, 04:01:58 pm »
So I changed my circuit a little bit, but in this short time I could not desolder my FET's from each other.
The new Circuit is now attached and the problem is likely the same, but now at A1 is only 0.02A instead of 1.3A
But if I slowly rise the Voltage at the non-inverting input the Current Rises instantly to 3A

Should I desolder the FET's from each other and try ?
 

Offline TheInfernoManTopic starter

  • Contributor
  • Posts: 27
  • Country: de
Re: LM358 in Consant Current Circuit Problem
« Reply #3 on: December 31, 2016, 04:12:03 pm »
If I apply 0.1V to the Non-Inverting Input the flowing Current is like 0.5A, but if I continue rising up the Voltage to 0.15V the Current, which is flowing decreases with more Voltage at the non-inverting Input. And my buck-converter which supplies the non-inverting input makes a quiet buzzer sound. Now and then the Current oscillates (I see it on my Ammeter) from 0A to 0.9A often up and down.
 

Offline Audioguru

  • Super Contributor
  • ***
  • Posts: 1507
  • Country: ca
Re: LM358 in Consant Current Circuit Problem
« Reply #4 on: December 31, 2016, 06:08:48 pm »
You missed an important fix to prevent the new oscillation: "In addition there should be a fast feedback directly around the OP: so a capacitor from OPs output to the inverting input".
 

Offline TheInfernoManTopic starter

  • Contributor
  • Posts: 27
  • Country: de
Re: LM358 in Consant Current Circuit Problem
« Reply #5 on: December 31, 2016, 06:31:42 pm »
Now I added a 0.022uF Capacitor betweent Output and the inverting Input, but it's not better, with Ground connected to the non-inverting Input there flows 1.5A  ???
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: LM358 in Consant Current Circuit Problem
« Reply #6 on: December 31, 2016, 07:03:57 pm »
Bypass the 12K in the noninverting amplifier with, say, 10nF.

I have simulated the circuit and it oscillates like crazy, because of the noninverting stage.
« Last Edit: December 31, 2016, 07:09:52 pm by orolo »
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: LM358 in Consant Current Circuit Problem
« Reply #7 on: December 31, 2016, 07:12:49 pm »
Still the circuit needs much improvements. At least, add two separate about 220ohm gate resistor. Also each of the mosfets shall have its own current shunt. Otherwise the current won't be halved and mosfets have to be closely paired/matched - which is a pain in the ass.

Also, the circuit is lacking a loop rolloff (compensation). Place a small cap across the opamp (output to inverting input) and feed the inverting input through a resistor.  Lets begin with somethinh like 1k 1n.
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: LM358 in Consant Current Circuit Problem
« Reply #8 on: December 31, 2016, 07:14:45 pm »
Bypass the 12K in the noninverting amplifier with, say, 10nF.

I have simulated the circuit and it oscillates like crazy, because of the noninverting stage.

No.  The 12K resistor shall be split for two separate gate resistors (to prevent HF mosfet oscillations) and shall NOT AT ALL be EVER shunted by any cap.

see my previous post.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14210
  • Country: de
Re: LM358 in Consant Current Circuit Problem
« Reply #9 on: December 31, 2016, 07:16:15 pm »
R3 = 12 K is way to large. This makes R3 and the gate capacity a significant low pass, possibly even lower than the 22 nF and 3 K.  A more normal value would be 100-330 Ohms, so just enough that the OPs output is not upset with the capacitive load.

Another point is that there should be an RC snubber (e.g 10 Ohms an 10 µF in series) at the output - just in case the source is inductive.

Make sure the second halt of the LM358 is not causing trouble.

 If the two MOSFETs are really tight coupled it might be OK, but the second MOSFET might not help very much, as current sharing will not be good. So you may have to separate them anyway. With more MOSFETs, each one should at least have it's own gate and source resistor. The signals from the source can than be combined with resistors (like the 3 K resistor in the circuit).

With 5 mV of offset rating, there could be a current up to about 25 mA, even with the control voltage at zero. So 3 A of output suggests the circuit is still oscillating somehow, or something is broken.
 
The following users thanked this post: TheInfernoMan

Offline Benta

  • Super Contributor
  • ***
  • Posts: 5877
  • Country: de
Re: LM358 in Consant Current Circuit Problem
« Reply #10 on: December 31, 2016, 07:17:16 pm »
Before trying to compensate the circuit with caps all over the place, I have a question:

Where is the supply bypass cap(s) at the opamp?

I mean, this kind of current source sink is normally a nobrainer, especially with an amp that's so well-behaved as the LM358.

« Last Edit: December 31, 2016, 07:21:21 pm by Benta »
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: LM358 in Consant Current Circuit Problem
« Reply #11 on: December 31, 2016, 07:18:16 pm »
But if I slowly rise the Voltage at the non-inverting input the Current Rises instantly to 3A

The load current is proportional to the voltage on the noninverting input. Iload = U / R1 = U / 0.2 
That means 1V input yields 5 amps!

Benta: Sure, that is also a good question to start with!
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: LM358 in Consant Current Circuit Problem
« Reply #12 on: December 31, 2016, 07:20:52 pm »
Bypass the 12K in the noninverting amplifier with, say, 10nF.

I have simulated the circuit and it oscillates like crazy, because of the noninverting stage.

No.  The 12K resistor shall be split for two separate gate resistors (to prevent HF mosfet oscillations) and shall NOT AT ALL be EVER shunted by any cap.

see my previous post.

Edit: a pic of the simulation I uploaded before.


No, no. Look at his complete schematic. He is feeding the mosfet-driving part of the 358 with the other half acting as a non-inverting amplifier, with 3k/12k. There is the problem (or at least, a big problem).
« Last Edit: December 31, 2016, 07:23:58 pm by orolo »
 
The following users thanked this post: TheInfernoMan

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: LM358 in Consant Current Circuit Problem
« Reply #13 on: December 31, 2016, 07:23:01 pm »
Oh, sorry, I was  thinking only about the first schematic, that is at least partially OK.

The second one (Schaltplan.png) is very wrong of course.
 
The following users thanked this post: orolo

Offline TheInfernoManTopic starter

  • Contributor
  • Posts: 27
  • Country: de
Re: LM358 in Consant Current Circuit Problem
« Reply #14 on: January 01, 2017, 07:59:30 am »
First I have to say, that I am really sorry for my mistakes in my schematic. But I did not know it better.

I think I have to redesign my schematic. How can I make that better, if I not know all these things about oscillations etc. ? I have only seen some "basics" videos.

Did somebody got a tip, how it is easier for me to Look for mistakes Like Them ?

Can someone make a short schematic, of the Basic Part of the CC Load, what I should make so. I would be really thankful.

I am really thankful for your help.
 

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: LM358 in Consant Current Circuit Problem
« Reply #15 on: January 01, 2017, 11:19:58 am »
You can solve both problems. Instead of amplifying x5 the load voltage, divide by 5 the potentiometer reference voltage: you can do that with a follower and a divider. That way, you keep the dangerous amplifier out of your feedback loop.

About the constant current, keep it simple and try an RC filter like the following. I don't mind building the circuit myself and testing it, if it gives more trouble.



 
The following users thanked this post: TheInfernoMan

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: LM358 in Consant Current Circuit Problem
« Reply #16 on: January 01, 2017, 11:48:46 am »
Yes, that is the correct way to do it. However, you're missing a gate resistor - loading the opamp capacitively migh produce instability, or even HF oscillations of the mosfet. So adding a few hundred ohms series resistor to the gate is the simplest solution.

TheInfernoMan: You shall stop watching simple videos, as obviously, you don't learn anything from them, as things aren't that simple in reality.

I think Dave (EEVBlog) did make a video about designing a constant current load some time ago. Try to look it up. But I'd also recommend googling for application notes from the big semiconductor companies, as there are lot of very detailed appnotes with all the engineering in them, to make a basic up to very well behaved constant current loads.

For example I remember appnote from Jim Williams designing a 100A load, this one: http://cds.linear.com/docs/en/application-note/an104f.pdf
 
The following users thanked this post: orolo, TheInfernoMan

Offline TheInfernoManTopic starter

  • Contributor
  • Posts: 27
  • Country: de
Re: LM358 in Consant Current Circuit Problem
« Reply #17 on: January 01, 2017, 12:00:36 pm »
So first I want to say thanks to Orolo and Yansi.
I built up the simple circuit from you and it works fine.
You can't imagine how happy I am to see a circuit on my desk working  ;D

I would read the document you linked Yansi now, and I think I can learn a lot  :D
I will now redesign my schematic and build a new PCB.

Thanks,
@Orolo Can I send you my finished schematic, that you can have a look on it, I would not spend again hours to solder and then throw it away  :'(

Attached: Now the schematic that works; can I built my new schematic up from that schematic ?
« Last Edit: January 01, 2017, 12:27:11 pm by TheInfernoMan »
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: LM358 in Consant Current Circuit Problem
« Reply #18 on: January 01, 2017, 12:18:27 pm »
Soldering and throwing away often gives you more valuable experience, than just look at things  ;)

Even if you build something that does not work as intended is an experience.
 
The following users thanked this post: TheInfernoMan

Offline orolo

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: es
Re: LM358 in Consant Current Circuit Problem
« Reply #19 on: January 01, 2017, 01:31:52 pm »
@Orolo Can I send you my finished schematic, that you can have a look on it, I would not spend again hours to solder and then throw it away  :'(
I'll build your circuit (with a different mosfet, I have to look what I got in the hoard  :) ) -- I'm curious about the gate resistor. Simulating your circuit, it works fine as per your schematic. It gently gets into regulation with no overshoot, no matter how big the gate resistor. However, with other mosfet models, increasing the gate resistor caused overshoot, so I think I'll put a pot there and see what happens.

I'm very glad the circuit worked, but the merit is not mine at all. I took the simple circuit from The Art of Electronics, values included. In the book they don't use a gate resistor, probably because they employ a jfet instead of a mosfet.
 
The following users thanked this post: TheInfernoMan

Offline TheInfernoManTopic starter

  • Contributor
  • Posts: 27
  • Country: de
Re: LM358 in Consant Current Circuit Problem
« Reply #20 on: January 01, 2017, 01:47:58 pm »
So now I redesigned my schematic and followed the simple one.
Would this circuit work now ?  ???

If, then I would begin solder it to a piece of perfboard.
Attached is the new schematic.
What was ment with a supply bypass capacitor? (C3 is also attached to the Opamp, is this the bypass ?)

Thanks in advance  :)
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: LM358 in Consant Current Circuit Problem
« Reply #21 on: January 01, 2017, 01:51:02 pm »
No it won't work at all, as you are confusing the inverting and non-inverting inputs of the opamps. Have a thorough look at the orolo's schematic.

Also, the buffer amp is absolutely of no use there.



 

Offline TheInfernoManTopic starter

  • Contributor
  • Posts: 27
  • Country: de
Re: LM358 in Consant Current Circuit Problem
« Reply #22 on: January 01, 2017, 01:55:51 pm »
Oh sorry, you are right, obviously. Now I changed the Input.
What do you mean with the buffer amp? (Do you mean U1.2? It is also in the simple schematic...)
 

Offline Yansi

  • Super Contributor
  • ***
  • Posts: 3893
  • Country: 00
  • STM32, STM8, AVR, 8051
Re: LM358 in Consant Current Circuit Problem
« Reply #23 on: January 01, 2017, 02:02:29 pm »
Yes, U1.2. That's a buffer, voltage follower or whatever you call it. It does not help with anything in the circuit, only makes it worse:

The noninverting input of U1.1 is already high impedance, why buffering it again?

The real opamps have offset voltage. That means a voltage, that is like "added" to the real input voltage. It is usualy a few mV and drifts with temperature. The useless buffer only adds error to the signal it is buffering, as it's output voltage equals the input one, plus the offset and its temperature drift.

As you already work with small voltages in the circuits (let's say hundred mV or a volt), the few mV offset voltages both from the buffer and the current regulating opamp U1.1 adds significant errors in the circuits precision. Thats because the offset voltages are becoming significant compared to the operating voltages in the circuit.

The useless buffer is lowering the precision of the circuit.  That will show up as the current setpoint of your CC load being more temperature dependent and not tracking the setpoint voltage (from the potentiometer) exactly.

You can also verify simply with some precision voltmeter: Measure the voltage on the pin 5 to ground, and then the voltage on the shunt. In theory, these should be absolutely the same. But there will be a difference of few mV (say up to 10mV). And this voltage error will be also dependent on the temperature of the opamp.

If your shunt is being 0.2 ohms, the 10mV error equals 50mA error in the load current. Also considering that LM358 has a typical offset drift of 7uV/K up to 20uV/K, that means if you raise the temperature of the opamp  for 10°C, you add up to 200uV error each amplifier, resulting in 0.4mV error. Your load current will change up to  0.4mV/0.2ohm = 2mA per 10°C temperature change.

Might not be of any problem here, but may be a big trouble in other applications, so better being aware of this.

(not mentioning we have not counted for many other aspects, like input offset currents)
« Last Edit: January 01, 2017, 02:15:38 pm by Yansi »
 
The following users thanked this post: TheInfernoMan

Offline Richard Head

  • Frequent Contributor
  • **
  • Posts: 685
  • Country: 00
Re: LM358 in Consant Current Circuit Problem
« Reply #24 on: January 01, 2017, 02:03:07 pm »
An NPN bipolar transistor is a better choice in this application.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf