Author Topic: LM317 Dummy load circuit  (Read 1741 times)

0 Members and 1 Guest are viewing this topic.

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1035
  • Country: jo
  • I am the cult of personality
    • Thundertronics
LM317 Dummy load circuit
« on: April 14, 2018, 12:21:59 pm »
Dear friends,

I have attached my circuit for this project but it does not work perfectly, thus I seek your feedback.

I used LM317 module (from Banggood or Aliexpress), it comes with filter caps and so on. I removed feedback resistor in order to drive the adjust pin directly.

My circuit can do from 0-650mA and then it jumps to more than 2A directly! sometimes I can regulate it to 1-1.7A but most of the times it jumps directly from 650-700mA to 2-2.5A.

I measured the op-amp output voltage and it jumps too, same as LM317 output voltage which is obvious.

I needed a negative rail in order for LM317 to make it to 0v output which is a must, so I have put diodes in series to achieve it. They get too hot and I managed to burn a few of them.

Do you have any solution?

I know I can use a simple NPN for the job instead of LM317 but I don't have a powerful NPN (all tiny size) nor a MOSFET and I also want to make it using the LM317.

Looking forward to your kind help!

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 6844
Re: LM317 Dummy load circuit
« Reply #1 on: April 14, 2018, 01:26:55 pm »
That circuit sucks, and so does your photo!

You can treat a LM317 as a thermally protected power transistor and use it in the classic OPAMP + transisistor current sink circuit, where the current negative  feedback is taken from the top end of a low value emitter resistor.

However its far from ideal for low voltages, as even with a negative bias supply for he OPAMP, its dropout voltage can be up to 2.5V.
 
The following users thanked this post: nugglix

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1035
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #2 on: April 14, 2018, 11:17:51 pm »
That circuit sucks, and so does your photo!

You can treat a LM317 as a thermally protected power transistor and use it in the classic OPAMP + transisistor current sink circuit, where the current negative  feedback is taken from the top end of a low value emitter resistor.

However its far from ideal for low voltages, as even with a negative bias supply for he OPAMP, its dropout voltage can be up to 2.5V.

I took the photo at 6:00 AM.

So is there any solution to the current circuit? any modification which still uses lm317?

Is my negative voltage generation method any good? what is your method if you want negative rails from a single DC supply?

My shunt resistor is about 0.5R or even less... so I need millivolts to make amps which is, as you said, not ideal for lm317. So what if I made the shunt resistor 1 ohms? this way we can use 1v for 1a which is kinda better.

I currently have small transistors like 2n2222 or so... Dave mentioned that he used a logic level mosfet for the job and it is important to be like that, Why? is it because of low gate voltage form op-amp?

Offline Cliff Matthews

  • Supporter
  • ****
  • Posts: 1467
  • Country: ca
    • General Repair and Support
Re: LM317 Dummy load circuit
« Reply #3 on: April 15, 2018, 01:35:06 am »
..what is your method if you want negative rails from a single DC supply? This works (maybe add a third diode for your cct.)
 

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1035
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #4 on: April 15, 2018, 02:24:15 am »
..what is your method if you want negative rails from a single DC supply? This works (maybe add a third diode for your cct.)
Thanks cliff, but I used this method in my circuit.

Anyway, I'd like to know if this circuit has any hope of success or I should just revert back to traditional opamp+mosfet. In that case, there are lots of options.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 6844
Re: LM317 Dummy load circuit
« Reply #5 on: April 15, 2018, 02:35:29 am »
I'd use some dollar store 9V batteries to power the OPAMP or a separate floating PSU and a rail splitter, as your diodes make the already excessive headroom required by the LM317 positively ridiculous.   

Lets suppose you want to push it up to the LM317's design load current of 1.5A - worst case, you need 2.5V headroom for the regulator, you have another 0.15V drop across the 0.1R resistor + >2.8V across your diode stack, and you are up to a 5.5V minimum input voltage.

If you use a floating supply for the OPAMP, the minimum input voltage will be under 3V and the minimum current will be down around 20mA, maybe lower.

If possible use a floating 12V supply so you can easily fan-cool the LM317's heatsink - it will need it.  For the rail splitter, if you don't have anything better,  use another OPAMP as a unit gain buffer, with its output to Gnd and 2x (10K || 0.1uF)  as a potential divider across the 12V supply and its output to Gnd.  As OPAMPs dont tolerate capacitive loads, it is *CRITICALLY* important that you don't put any extra decoupling between the terminals of the floating 12V supply and Gnd.  You can (and should) however put as much as you like directly across the resulting +6V and -6V OPAMP supply rails, especially if the floating supply is also running a fan.

LTspice sim attached.
 
« Last Edit: April 15, 2018, 02:38:29 am by Ian.M »
 

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1035
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #6 on: April 15, 2018, 03:20:00 am »
I'd use some dollar store 9V batteries to power the OPAMP or a separate floating PSU and a rail splitter, as your diodes make the already excessive headroom required by the LM317 positively ridiculous.   

Lets suppose you want to push it up to the LM317's design load current of 1.5A - worst case, you need 2.5V headroom for the regulator, you have another 0.15V drop across the 0.1R resistor + >2.8V across your diode stack, and you are up to a 5.5V minimum input voltage.

If you use a floating supply for the OPAMP, the minimum input voltage will be under 3V and the minimum current will be down around 20mA, maybe lower.

If possible use a floating 12V supply so you can easily fan-cool the LM317's heatsink - it will need it.  For the rail splitter, if you don't have anything better,  use another OPAMP as a unit gain buffer, with its output to Gnd and 2x (10K || 0.1uF)  as a potential divider across the 12V supply and its output to Gnd.  As OPAMPs dont tolerate capacitive loads, it is *CRITICALLY* important that you don't put any extra decoupling between the terminals of the floating 12V supply and Gnd.  You can (and should) however put as much as you like directly across the resulting +6V and -6V OPAMP supply rails, especially if the floating supply is also running a fan.

LTspice sim attached.

Thanks.

Ltspice says missing models for lm324 and the zener diode (what is it for?). I don't know how to download them as I searched previously but didn't get what I need.

I thought of using 2 of 9v batteries to do the job but thought it would be too big, now it seems a better choice. Having the floating supply gonna be more expensive and I don't have one of those murata isolated dc-dc supplies to do the job.

making 9v+9v = 18v total supply to power a 12v fan is not bad, especially that it will drop to 8v easily so a total of 16v won't hurt the fan.

I will test the circuit tomorrow after getting 9v batteries to see if it makes sense or not... because if it still has issues, then I will get back to opamp+mosfet design.

It is worth mentioning that the lm317 that I have is a module with its own heatsink (small), and I have a 5v dc fan. Is it gonna be enough?

Offline Audioguru

  • Super Contributor
  • ***
  • Posts: 1268
  • Country: ca
Re: LM317 Dummy load circuit
« Reply #7 on: April 15, 2018, 03:40:23 am »
I'd use some dollar store 9V batteries to power the OPAMP
Hee, hee. Someone from "ovah theah" said, Pound Shop instead of Dollar Store. :)
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 6844
Re: LM317 Dummy load circuit
« Reply #8 on: April 15, 2018, 03:51:46 am »
Here's the BZX84 series diodes from my standard.dio file
Code: [Select]
.model BZX84C3V3L D(Is=1.5n Rs=2 Cjo=350p nbv=3 bv=3.3 Ibv=1m Vpk=3.3 mfg=OnSemi type=Zener)
.model BZX84C4V7L D(Is=1.5n Rs=.8 Cjo=260p nbv=3 bv=4.7 Ibv=1m Vpk=4.7 mfg=OnSemi type=Zener)
.model BZX84C5V1L D(Is=1.5n Rs=.6 Cjo=225p nbv=3 bv=5.1 Ibv=1m Vpk=5.1 mfg=OnSemi type=Zener)
.model BZX84C6V2L D(Is=1.5n Rs=.5 Cjo=185p nbv=3 bv=6.2 Ibv=1m Vpk=6.2 mfg=OnSemi type=Zener)
.model BZX84C8V2L D(Is=.8n Rs=.5 Cjo=135p nbv=3 bv=8.2 Ibv=1m Vpk=8.2 mfg=OnSemi type=Zener)
.model BZX84C10L D(Is=.6n Rs=.5 Cjo=150p nbv=5 bv=10 Ibv=1m Vpk=10 mfg=OnSemi type=Zener)
.model BZX84C12L D(Is=.6n Rs=.5 Cjo=150p nbv=5 bv=12 Ibv=1m Vpk=12 mfg=OnSemi type=Zener)
.model BZX84C15L D(Is=.6n Rs=.5 Cjo=110p nbv=6 bv=15 Ibv=1m Vpk=15 mfg=OnSemi type=Zener)
Grab the .model BZX84C3V3L  line and paste it onto the schematic.
For the LM324 - I only used it as a generic jellybean OPAMP, so you could substitute anything else of similar performance.  If you do substitute it you *must* either remove the .loadbias, and put up with the resulting slow simulation times or temporarily comment out the .loadbias and .step, rerun the .savebias and edit it as described.  See .savebias in LTspice help file.

http://ltwiki.org/files/LTspiceIV/examples/LTspiceWorldTour2011/LM324.MOD
http://ltwiki.org/index.php5?title=File:LM324-national.asy

Worst case, with 12.5V in the LM317 will be dissipating about 25W.  Do you think your 5V fan and the existing small heatsink will be good enough?

I wasn't proposing running the 12V fan from 2x 9V batteries - they'll die too quickly.   Instead, if you need a fan, use a 12V wallwart which MUST NOT have a ground pin with the rail splitter below - the diodes are to protect the OPAMPs if the wallwart gets disconnected.  Drop R2 on the original schematic to 2K7 to keep the Zener current near 1mA.

N.B. *DO* *NOT* attempt to run any high current loads like your 5V fan between +6V or -6V and Gnd.

« Last Edit: April 15, 2018, 04:04:53 am by Ian.M »
 

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1035
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #9 on: April 15, 2018, 04:16:10 am »
I can get a 5v usb charger followed with a boost converter to get 12v supply, will it work? you mentioned it must not have a ground connection with splitter.

Right now I have an adjustable laptop charger (12-24v) which can act as the floating supply, thus I will need another one to test (which will be the psu load itself - 12.5v here).

What is left is to figure out the heatsink with fan thing, best thing I can do now is to get a 12v fan and make it run always. I don't know it will be enough with existing heatsink... especially that it will be sucking the air from the heatsink not pumping air on it. Dunno if that differs on performance.

I would appreciate it if you shared your ltspice library.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 6844
Re: LM317 Dummy load circuit
« Reply #10 on: April 15, 2018, 04:39:09 am »
If you re going to use a 5V USB charger + boost converter, you don't need the rail splitter.  Connnect the 5V PSU between Gnd and the OPAMP's negative power pin for a -5V supply to it, and connect the boost converter input across the 5V PSU, and set it up for x2 boost to get your +5V supply for the OPAMP. 

My LTspice libraries are nothing special - the custom models are nearly all from LTwiki or the LTspice Yahoo group.  The very few I have customised myself (or cant remember where they came from) can all be found here zipped up with whichever sim I tweaked them for.
 

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1035
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #11 on: April 15, 2018, 05:02:38 am »
If you re going to use a 5V USB charger + boost converter, you don't need the rail splitter.  Connnect the 5V PSU between Gnd and the OPAMP's negative power pin for a -5V supply to it, and connect the boost converter input across the 5V PSU, and set it up for x2 boost to get your +5V supply for the OPAMP. 

My LTspice libraries are nothing special - the custom models are nearly all from LTwiki or the LTspice Yahoo group.  The very few I have customised myself (or cant remember where they came from) can all be found here zipped up with whichever sim I tweaked them for.



So I will have 0 and -5v from the usb charger if I ground it's positive output, instead of 5 and 0v if I ground the negative output. Thus results in 5v and -5v from boost rather than 10v and 0v. So the 12v fan could be powered from the boost (10v diff) instead of 12v difference voltage? could be, but it will get less current... perhaps I should make the boost go up to 12v difference which will make it 7v-> -5v total output while the usb charger still the same. opamps won't argue with this.

Now I understood that the "floating" part is not what it matters here, but the mere splitting of the rail. unlike my linear low dropout design where I needed the floating part to be there.

Here the load power supply will be connected to the input of the LM317 and the -5v rail, right?


Online Ian.M

  • Super Contributor
  • ***
  • Posts: 6844
Re: LM317 Dummy load circuit
« Reply #12 on: April 15, 2018, 05:11:07 am »
No, the source under test goes between LM317 In and Gnd (which is the USB charger +V) so the LM317 load current does NOT pass through the auxiliary floating PSU.
 

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1035
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #13 on: April 15, 2018, 08:50:06 am »
OK, I will test tomorrow and will update you on results.

Anyway, I will be doing the bigger version of it which is gonna be opamp+mosfet like everyone else, 30v 5A or so. I have ordered these mosfets:

IRL640A: https://www.aliexpress.com/item/Free-shipping-10pcs-lot-IRL640A-TO-220-200V-18A-new-original/32675986021.html?spm=a2g0s.9042311.0.0.u8tP2F
IRLIZ44N: https://www.aliexpress.com/item/10PCS-IRLIZ44N-IRLIZ44-TO220F/1000004693800.html?spm=a2g0s.9042311.0.0.u8tP2F

which are logic level ones, but total power dissipation is less than required... right? So I must parallel them to achieve 30v5A rating.

I also got these heatsinks:
https://www.aliexpress.com/item/2-x-Black-Aluminum-Radiator-Heat-Sink-Heat-Sink-40-x-40-mm-x-11-mm/32811370283.html?spm=a2g0s.9042311.0.0.u8tP2F

Can I drive both mosfets with one op-amp output without external parts? cuz I got 5 power resistors (1R) which can be used but I don't want to waste them if not required. I will get 12v fan to suck the air out to keep them cool.

So I need to know if I can parallel them easily or not. And in case I need a better mosfet, what is it? it has to be logic level one but with high power rating and, most importantly, available on aliexpress.

best regards

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 6844
Re: LM317 Dummy load circuit
« Reply #14 on: April 15, 2018, 10:15:40 am »
MOSFETs typically have too much Vgs threshold (and gain) variation to be easy to parallel in linear mode without a lot of derating.   It would be preferable to give each its own OPAMP for gate drive and current sense resistor for feedback.   

However its easy enough to test your MOSFETs for matching at the max current you want to run them at: Start by writing an ID number on every one. Mount one on a heatsink (clip and silpad is good - you'll be changing it a lot!) and connect it to a PSU with a suitable drain resistor: 1R 10W would be a good choice.  Use a pot to bias the gate and ramp it up to the current you want to run at.   Measure the Vgs.   Repeat with the next one,  till you have them all.   Sort the results into Vgs order, then try the MOSFET with the highest Vgs for the desired current at the Vgs of the lowest and see what current you get - that's how much imbalance they'll have.   

Run one for a while starting from cold, initially at 80% of your desired current and monitor the current, Vgs and heatsink temperature to get some idea of their thermal behaviour.

If you are very lucky and they are all from the center region of the same die, they may all have very similar Vgs at the desired current and you'll be able to get away with directly paralleling them, though even then its better to keep the drain resistors separate if they are large enough to provide a voltage drop greater than the Vgs variation.
« Last Edit: April 15, 2018, 12:10:53 pm by Ian.M »
 

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1035
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #15 on: April 15, 2018, 10:52:03 am »
MOSFETs typically have too much Vgs threshold variation to be easy to parallel in linear mode without a lot of derating.   It would be preferable to give each its own OPAMP for gate drive and current sense resistor for feedback.   

However its easy enough to test your MOSFETs for matching at the max current you want to run them at: Start by writing an ID number on every one. Mount one on a heatsink (clip and silpad is good - you'll be changing it a lot!) and connect it to a PSU with a suitable drain resistor: 1R 10W would be a good choice.  Use a pot to bias the gate and ramp it up to the current you want to run at.   Measure the Vgs.   Repeat with the next one,  till you have them all.   Sort the results into Vgs order, then try the MOSFET with the highest Vgs for the desired current at the Vgs of the lowest and see what current you get - that's how much imbalance they'll have.   

Run one for a while starting from cold, initially at 80% of your desired current and monitor the current, Vgs and heatsink temperature to get some idea of their thermal behaviour.

If you are very lucky and they are all from the center region of the same die, they may all have very similar Vgs at the desired current and you'll be able to get away with directly paralleling them, though even then its better to keep the drain resistors separate if they are large enough to provide a voltage drop greater than the Vgs variation.

So what if they have some imbalance and yet I paralleled them? isn't the final current what is important? If someone has 5% more than the other, it will still be generally ok and won't blow it up.

I want 30v5a which is 150 watts, so getting 3 mosfets for 50w each is kinda suitable for the choices that I mentioned (55~60W). Worst case scenario according to your post is that I will have to put 3 sense resistors but I may be able to get away with just one opamp. For me, I prefer 3 opamps and 1 sense resistor but I don't know if it is possible or not. Absolute worst case is 3 opamps and 3 resistors which is still doable! So no worries! only problem is heatsink size.

I got 2 pieces of this one: https://www.aliexpress.com/item/2-x-Black-Aluminum-Radiator-Heat-Sink-Heat-Sink-40-x-40-mm-x-11-mm/32811370283.html?spm=a2g0s.9042311.0.0.hBwCTC

Can 2 of them be able to hold that much power (with 12v fan)? or should I get a bigger one?

this is the case that i bought: https://www.aliexpress.com/item/Black-Extruded-Aluminum-Enclosures-PCB-Instrument-Electronic-Project-Box-Case-100x76x35mm/32813597400.html?spm=a2g0s.9042311.0.0.WL1OPg

Aluminum is nice cuz I can mount the heatsinks inside to it via this thermal paste:

https://www.aliexpress.com/item/GD900-Thermal-Conductive-Grease-Paste-Silicone-Plaster-Heat-Sink-Compound-5-Pieces-High-Performance-Gray-Net/1283572161.html?spm=a2g0s.9042311.0.0.WL1OPg

so it will act as yet another heatsink!

How about 2 heatsinks for 2 mosfets while the other one is mounted directly at the case?

___

To tell you the truth I am weak at getting required parts in general... I need your advise about getting powerful logic level mosfets if you know one possible to use at this power. The items that I got for this project (and in general too):

IRL640A
IRLIZ44N
BD437
BD438
LM324
LM358


Offline Cliff Matthews

  • Supporter
  • ****
  • Posts: 1467
  • Country: ca
    • General Repair and Support
Re: LM317 Dummy load circuit
« Reply #16 on: April 15, 2018, 12:00:08 pm »
If you parallel them, use ballast power resistors.. Why? The one with lowest Rds conducts more and heats-up faster causing less current to the the others (thermal runaway..). Eg: Here's a DIY 100-watt load anyone can make in an hour (even me  :)  )
 

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1035
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #17 on: April 16, 2018, 10:04:25 am »
I have tested your ltspice simulation by putting lm324 mode and asy at the same folder, it always go to 1 second of simulation and stops there. current still raises above 2A because voltage raises above 200mv on opamp positive input.

Anyway, I have tested the same circuit but with lt1013 (i don't actually have it, but i choose it for simulation only) and put resistor divider instead of potentiometer (i forgot how to deal with it in ltspice) and most importantly I put 160mv source as the input to the divider instead of the zener diode simply because I want to use an arduino pro mini to drive an lcd so I thought of using its pwm output to create 160mv output (+ rc filter) to act as the upper limit of 1.6A which worked well in simulation.

however, I used transient mode of simulation rather than dc op... I don't know why you use it. If I switch to transient in your circuit, then weird simulation results happens.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 6844
Re: LM317 Dummy load circuit
« Reply #18 on: April 16, 2018, 01:19:53 pm »
You do a .dc and/or .op analysis to confirm there is a suitable operating point within the voltage range you need, then a .tran analysis to see if its got stability problems - which in this case it has.   As .tran has the startup option, we don't need to use .loadbias to get a rapid operating point solution to avoid excessive sim runtime when stepping.

The simulation is stalling because its breaking into HF oscillation at low load voltages#.  This isn't really surprising because a LM317 has a lot more gain than an ordinary BJT or power MOSFET and the OPAMP is running 'flat-out'.   The fix is to roll off the HF gain of the OPAMP and LM317 with some very small capacitors.   I made an educated guess that 100pF would do the job, but that's probably not optimal.   As we don't know how realistic the OPAMP and LM317 models are at HF, there is little point in doing a full loop stability analysis* using .ac in LTspice - you'll just have to suck it and see in the real circuit.

I've redrawn the pot as two parametric resistors with a function to vary them with respect to time as a pair so its as close as possible to my previous sim,  because the potentiometer subcircuit in that doesn't support varying the wiper with respect to time.  The control function wR4() ramps up to 100% over 4 seconds then blips down to 30% and back up to 70% to check the step response.   LTspice sim attached - drop in in the same directory as the previous one as it needs most of the same models

N.B. if you rapidly step the load for real, clamp the input of the LM317 with a 27V Zener so cable inductance doesn't spike it above its max voltage rating.

Feel free to replace the pot with a PWL source + whatever RC network you are planning to use on the Arduino output to filter and scale it.

# The oscillation problem didn't occur at 12.5V, which is why it slipped past my initial .tran sanity check of the previous sim.   *ALWAYS* treat mysterious sim slowdowns or stalls as an indication of potential trouble.  Stop the sim or pause the marching waveforms and zoom in on the time its stalled at, then look for oscillations or chaotic behaviour *SOMEWHERE* in your circuit

* LTspice: Stability of Op Amp Circuits http://www.linear.com/solutions/4449 also on Youtube: youtu.be/YYWlPFBebfc?t=0 if the Analog Devices takeover has borked it!
« Last Edit: April 16, 2018, 08:28:33 pm by Ian.M »
 

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1035
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #19 on: April 16, 2018, 03:33:49 pm »
You do a .dc and/or .op analysis to confirm there is a suitable operating point within the voltage range you need, then a .tran analysis to see if its got stability problems - which in this case it has.   As .tran has the startup option, we don't need to use .loadbias to get a rapid operating point solution to avoid excessive sim runtime when stepping.

The simulation is stalling because its breaking into HF oscillation at low load voltages#.  This isn't really surprising because a LM317 has a lot more gain than an ordinary BJT or power MOSFET and the OPAMP is running 'flat-out'.   The fix is to roll off the HF gain of the OPAMP and LM317 with some very small capacitors.   I made an educated guess that 100pF would do the job, but that's probably not optimal.   As we don't know how realistic the OPAMP and LM317 models are at HF, there is little point in doing a full loop stability analysis* using .ac in LTspice - you'll just have to suck it and see in the real circuit.

I've redrawn the pot as two parametric resistors with a function to vary them with respect to time as a pair so its as close as possible to my previous sim,  because the potentiometer subcircuit in that doesn't support varying the wiper with respect to time.  The control function wR4() ramps up to 100% over 4 seconds then blips down to 30% and back up to 70% to check the step response.   LTspice sim attached - drop in in the same directory as the previous one as it needs most of the same models

N.B. if you rapidly step the load for real, clamp the input of the LM317 with a 27V Zener so cable inductance doesn't spike it above its max voltage rating.

Feel free to replace the pot with a PWL source + whatever RC network you are planning to use on the Arduino output to filter and scale it.

# The oscillation problem didn't occur at 12.5V, which is why it slipped past my initial .tran sanity check of the previous sim.   *ALWAYS* treat mysterious sim slowdowns or stalls as an indication of potential trouble.  Stop the sim or pause the marching waveforms and zoom in on the time its stalled at, then look for oscillations or chaotic behaviour *SOMEWHERE* in your circuit

* LTspice: Stability of Op Amp Circuits http://www.linear.com/solutions/4449 also on Youtube: http://www.youtu.be/YYWlPFBebfc if the Analog Devices takeover has borked it!


I am at work now so I cannot view the simulation file! I can't wait to get back and see it. I just wanna make sure it works this time. I've been into this compensation of op-amp feedback loop when I designed (with the help of others) my linear low dropout (1v) lab supply and I still not too good with it. I thought it won't be needed here but looks like it is!

Basically, all we have to deal with is the opamp loop right? nothing else is there to bother stability if I remember. However, why this is not the case with classic opamp + Nmosfet circuit? I try to answer this by quoting your words on lm317 gain... is it the cause?

you mentioned opamp running "flat-out", my guess is that it is without compensation rc-network? I always guess the value by trial and error but something like 10k + 100nF seems to work.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 6844
Re: LM317 Dummy load circuit
« Reply #20 on: April 16, 2018, 06:12:10 pm »
No, by 'flat-out' I meant that it didn't have any local negative feedback.   If you add anything else with too much gain inside the negative feedback loop of an OPAMP without local negative feedback, you almost always run into trouble as there's still too much gain at the lowest frequency where the phase shift round the loop is sufficient to make the originally negative at DC feedback positive.  The gate capacitance of the classic MOSFET circuit, in combination with the OPAMP's output impedance has a massive damping effect on the loop at higher frequencies.
10K +100nF would usually be massive over-kill.  The resulting corner frequency is only 160Hz so the transient response is gonna *SUCK*.  My first response, in the absence of a proper analysis, would usually be to reach for my box of ceramic caps <1000pF, and  try one per device I need to roll-off at HF, starting with something in the 50pF to 300pF range.

As you are at work, here's the circuit as a GIF.
 

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1035
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #21 on: April 17, 2018, 04:20:03 am »
I have tested the circuit after removing the pot stuff all together, and put a voltage instead. It seemed to work well at 3v input or more... less than that will not work. I couldn't get two 9v batteries today, I will get them tomorrow and it will be the practical test.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 6844
Re: LM317 Dummy load circuit
« Reply #22 on: April 17, 2018, 06:46:09 am »
You may want to start with the response 'slugged' for the real circuit to avoid high power HF oscillation.   Try increasing C1 to 4.7nF, and R5 to 4K7.   An LTspice .ac sim shows a very flat response up to 10Khz then within +/-3dB up to 30Khz with minimal objectionable peaking.

Sim attached.  Hint: plot Vfb - you are looking for as close as 0dB as possible with respect to the current control signal input Vset, then plenty of phase margin as it starts to roll off at its corner frequency.
 

Offline VEGETA

  • Super Contributor
  • ***
  • Posts: 1035
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #23 on: April 17, 2018, 08:58:00 am »
I put LT1013A instead of LM324 since it does not work... The result has many waves. I managed to print Vfb alone and Vfb-Vset as seen in attachment.

I notice some curves started to appear near 30KHz as you mentioned... Problem is I don't know how to analyze this AC stuff. I know a bit about poles and zeros, also about stability of op-amp according to phase margin or so. Like, looking at these graphs, what can we conclude? plus, why there are lots of lines? is it because of step function.

What is left to do in this circuit? let's put some points that we can work with.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 6844
Re: LM317 Dummy load circuit
« Reply #24 on: April 17, 2018, 12:16:05 pm »
Yes, with that OPAMP and a couple of other LT 'precision' ones I tried, it doesn't seem to want to stabilise no matter what we do in the OPAMP feedback loop.  I suspect an issue with the LM317 model as it isn't always passing the minimum current it requires for regulation.   Perhaps a rethink is in order: Discard my idea of using the LM317 inside the loop, and simply let the LM317 run as a regulator, similar to your original concept.

However the LM317 model seems to implement feedback current limiting at a little over 15V across it when passing 1A, so if that's realistic you may not get the load you want with one LM317.  If you use two, Adj and In in parallel with separate 0.2R current set resistors it will probably work better.

Use the OPAMP to convert 0 to 5V from your PWM to -1.25V) to -1.15V) on the ADJ pin to vary the voltage across the 0.1R current set resistor.

You either need a precision reference for the bias voltage that offsets the OPAMP output, or two Zeners cascaded for better stabilisation as I have drawn, or it will let the current rise excessively as the + battery discharges.

I've put some attention into rolling off the HF response of the OPAMP and decoupling Adj to hopefully make it more stable in real life.

Sim attached.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf