LM317 Dummy load circuit - Page 1
Forum section: electronics / beginners

author: VEGETA
author_rank: Super Contributor
timestamp: April 14, 2018, 02:21:59 am
content: 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!

author: Ian.M
author_rank: Super Contributor
timestamp: April 14, 2018, 03:26:55 am
content: 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.

author: VEGETA
author_rank: Super Contributor
timestamp: April 14, 2018, 01:17:51 pm
content: Quote from: Ian.M on April 14, 2018, 03:26:55 amI 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?

author: Cliff Matthews
author_rank: Unknown
timestamp: April 14, 2018, 03:35:06 pm
content: ..what is your method if you want negative rails from a single DC supply? This works (maybe add a third diode for your cct.)

author: VEGETA
author_rank: Super Contributor
timestamp: April 14, 2018, 04:24:15 pm
content: Quote from: Cliff Matthews on April 14, 2018, 03:35:06 pmThanks 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.

author: Ian.M
author_rank: Super Contributor
timestamp: April 14, 2018, 04:35:29 pm
content: 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.

author: VEGETA
author_rank: Super Contributor
timestamp: April 14, 2018, 05:20:00 pm
content: Quote from: Ian.M on April 14, 2018, 04:35:29 pmThanks.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?

author: Audioguru
author_rank: Super Contributor
timestamp: April 14, 2018, 05:40:23 pm
content: Quote from: Ian.M on April 14, 2018, 04:35:29 pmHee, hee. Someone from "ovah theah" said, Pound Shop instead of Dollar Store.

author: Ian.M
author_rank: Super Contributor
timestamp: April 14, 2018, 05:51:46 pm
content: Here's the BZX84 series diodes from my standard.dio fileCode:.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.MODhttp://ltwiki.org/index.php5?title=File:LM324-national.asyWorst 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.

author: VEGETA
author_rank: Super Contributor
timestamp: April 14, 2018, 06:16:10 pm
content: 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.

author: Ian.M
author_rank: Super Contributor
timestamp: April 14, 2018, 06:39:09 pm
content: 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.

author: VEGETA
author_rank: Super Contributor
timestamp: April 14, 2018, 07:02:38 pm
content: Quote from: Ian.M on April 14, 2018, 06:39:09 pmSo 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?

author: Ian.M
author_rank: Super Contributor
timestamp: April 14, 2018, 07:11:07 pm
content: 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.

author: VEGETA
author_rank: Super Contributor
timestamp: April 14, 2018, 10:50:06 pm
content: 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.u8tP2FIRLIZ44N:https://www.aliexpress.com/item/10PCS-IRLIZ44N-IRLIZ44-TO220F/1000004693800.html?spm=a2g0s.9042311.0.0.u8tP2Fwhich 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.u8tP2FCan 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

author: Ian.M
author_rank: Super Contributor
timestamp: April 15, 2018, 12:15:40 am
content: 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.

author: VEGETA
author_rank: Super Contributor
timestamp: April 15, 2018, 12:52:03 am
content: Quote from: Ian.M on April 15, 2018, 12:15:40 amSo 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.hBwCTCCan 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.WL1OPgAluminum 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.WL1OPgso 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):IRL640AIRLIZ44NBD437BD438LM324LM358

author: Cliff Matthews
author_rank: Unknown
timestamp: April 15, 2018, 02:00:08 am
content: 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)

author: VEGETA
author_rank: Super Contributor
timestamp: April 16, 2018, 12:04:25 am
content: 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.

author: Ian.M
author_rank: Super Contributor
timestamp: April 16, 2018, 03:19:53 am
content: 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 modelsN.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 Circuitshttp://www.linear.com/solutions/4449also on Youtube:youtu.be/YYWlPFBebfc?t=0if the Analog Devices takeover has borked it!

author: VEGETA
author_rank: Super Contributor
timestamp: April 16, 2018, 05:33:49 am
content: Quote from: Ian.M on April 16, 2018, 03:19:53 amI 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.

author: Ian.M
author_rank: Super Contributor
timestamp: April 16, 2018, 08:12:10 am
content: 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.

author: VEGETA
author_rank: Super Contributor
timestamp: April 16, 2018, 06:20:03 pm
content: 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.

author: Ian.M
author_rank: Super Contributor
timestamp: April 16, 2018, 08:46:09 pm
content: 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.

author: VEGETA
author_rank: Super Contributor
timestamp: April 16, 2018, 10:58:00 pm
content: 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.

author: Ian.M
author_rank: Super Contributor
timestamp: April 17, 2018, 02:16:05 am
content: 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.

author: VEGETA
author_rank: Super Contributor
timestamp: April 17, 2018, 05:40:55 am
content: Quote from: Ian.M on April 17, 2018, 02:16:05 amI will try the circuit when I return home.My idea was to use Arduino pro mini to generate 150mv voltage from PWM and RC filter to act as the input to a 10-turn potentiometer which in turns sets the output desired current from 0v to 150mv -> 0A to 1.5A. Why Arduino? because it is gonna be used anyway to drive the LCD so why not using it for other stuff?Without opening the .asc file now, I cannot see the circuit. However, I you mention getting the lm317 out of the loop and returning to be a regulator but we are feeding it with a voltage now. Perhaps you meant the driving op-amp should not take feedback from 0.1R resistor and just drive it with a voltage directly? well, that was my original idea but I needed the 150mv upper limit so that it doesn't exceed 1.5A.However, as I told you before, it doesn't work perfectly as it works up to 600-700mA then jumps straight to around 2A. This could be due to the diodes used earlier, so perhaps with two 9v batteries could be different?So now we need to adjust the opamp circuit to output negative values. For 0A we need -1.25v and for 1.5A we need -1.10v (not -1.15, so why you picked it?)... I still don't get the idea of 0.2R resistors, plus I don't have zener diodes in hand.

author: VEGETA
author_rank: Super Contributor
timestamp: April 17, 2018, 06:57:28 am
content: Just a quick suggestion...I want to use one of these to give 5v to Arduino from the +9v battery:https://www.banggood.com/5Pcs-Mini-DC-Adjustable-Power-Supply-Buck-Module-Step-Down-Module-p-952402.htmlSo I thought why not use one like it for giving the -1.10v maximum for the 10-turn pot? we could give it the circuit ground as it's positive input and -9v as it's negative input... then adjust it to give -1.10v! So it will be -1.10 to -9v but we can put potential divider (or a pot) to make it have better resolution like from -1.10v to -1.30v?These units are so damn cheap and I've got 10 of them...giving them 0 and -9v is correct because overall it will be positive voltage.What do you think?

author: Ian.M
author_rank: Super Contributor
timestamp: April 17, 2018, 10:09:04 am
content: I think that's doomed to failure. The control voltage needs to be very stable and a cheap switching regulator has too much ripple and often, poor stability. Its probably a good idea to use an actual voltage reference IC and drive a SPDT analog switch IC with the raw PWM from the Arduino, to chop between 0V and an accurate Vref then low-pass filter that to get the control voltage. I think you'll also need to close the loop in software - use the same Vref for tha Arduino ADC reference, and pick up the voltage across the 0.1R resistor, amplify it with another OPAMP and feed it to an Arduino analog channel so it can detect if the current differs from that commanded, and depending on the magnitude of the error, either trim it or shut down with an error.Driving it with a 10 turn pot in place of the Arduino should be OK. just put the POT across the 4.7V Zener. The resistors that control the limits will need re-trimming - do that without the LM317 connected to get a range from -1.3V to -1.1V then hook it up and trim to get the desired range of current. For the trimming resistors, you'll probably need to use the nearest lower preferred value with a preset in series for fine adjustment.However its your need for as low a minimum voltage as possible for your load + the choice of a LM317 that's causing issues - balancing the 1.25V internal reference against the external control voltage to leave only 0.15V max across the resistor is a recipe for poor stability. If one wants to use a regulator + low value resistor, go for theLT3083as its output voltage directly tracks its set pin voltage, so if you ignore the 50uA current out of the set pin, normally used to control the output by developing a voltage across the control resistor, you could simply drive it from 0 to 0.15V from the output of an OPAMP.However its probably easier just to wait for your MOSFETs to arrive and use the 'classic' low minimum input load circuit.

author: VEGETA
author_rank: Super Contributor
timestamp: April 17, 2018, 10:47:18 am
content: Quote from: Ian.M on April 17, 2018, 10:09:04 amI don't have such components, any component that I want to get I always get it from Aliexpress. Simply because shipping from US\Europe based supplier is crazy expensive. Digikey offers 75$ for shipping same as mouser.These are cheap DC-DC converters but I think they have stable voltage especially for very low current consumption. I just put some caps on output to filter ripple and noise as much as possible.I want to know if the idea itself is working or not. I have another LM317 on hand so It could be put instead of the DC-DC module for regulating the -1.10v... how about that? So it is a matter of trial to see which one works. I will still use the dc-dc module for +5v supply for arduino.the only problem is now size of the project but it is not really an issue. I planned to put all this inside an Altoids-like tin from banggood but looks like I am gonna put it inside a traditional plastic box.QuoteThat would need another month or so. We have some local market shops for electronics but people working there are not really experts in details. I don't expect them to know "logic level MOSFET" which is the requirement for the project.I have ordered those mosfets for making a bigger version of this one which takes 30v and 5A... This one is mere 30v 1.5A and it is portable for small uses like testing batteries and dc-dc modules and so on.

author: Ian.M
author_rank: Super Contributor
timestamp: April 17, 2018, 12:01:33 pm
content: Yes, another LM317 would be a good choice for the reference. Mount it on the same heatsink as the constant current LM317, and ground its Adj pin and it should provide a 1.25V that tracks the internal reference of the other one fairly closely.Without any analog switches, its going to be a PITA keeping the PWMed control voltage stable with respect to the reference. Are you sure you cant source a CD4066 or equivalent, or a 74HC4066 locally? They used to be quite common for audio input switching in CRT TVs , so there's a chance you may still find a few at a TV repair shop.If not, I'll think up a precision clamp circuit using discrete components to limit the PWM output to the reference voltage before you filter it.

author: VEGETA
author_rank: Super Contributor
timestamp: April 17, 2018, 12:46:32 pm
content: Why would I make it 1.25v? we need -1.10 from it. it is another module with it's own heatsink and pot. mounting them at the same heatsink will short their outputs together, grounding its adjust will make it 1.25v as the reference but why joining it with the other one? I guess doing it separately as I explained is better and enough. Hook it between 0v and -9v then adjust it to -1.10v which should be straightforward to do + a pot to limit it to -1.30v instead of -9v and we are done. next put this voltage as an input to the 10-turn pot.Anyway, if we use LM317 to provide -1.10v regulation, then we won't need PWM at all. I would just put a potentiometer to limit the thing to only -1.10v ~ -1.30v then this will be the input to the current set 10-turn pot which will be limited to -1.10 and -1.30 for sure. The PWM was for making a desired voltage as a reference (150mV then) but that approach is no longer needed as we are now driving lm317 as a regulator without feedback from 0.1R.Sourcing anything is possible for me from Aliexpress but I don't need to wait 1 month to get them. I work in a far place in the south and my home town is in upper north... I return once per month so getting stuff locally isn't really an easy way. Let alone there are no specialized shops there (only in Amman). There are few shops but not really specialized ones.Anyway, I will try stuff today and I hope the circuit stays stable.

author: Ian.M
author_rank: Super Contributor
timestamp: April 17, 2018, 07:35:46 pm
content: The reason to put them on the same heatsink, the two LM317 chips will track fairly well with temperature so the reference supply should track the current sink LM317's reference. Of course the current sink will run a lot hotter, but the temperature differential will be less than if they were on separate heatsinks. Put a Silpad or mica washer under the low power one to isolate it. You cant use a LM317 to get a negative regulated voltage unless you have a fully floating bias supply to it so you can ground its output. without shorting the supply. If you are happy with just a pot, that may be the way to go, but for the current sink, use 2x LM317 in parallel apart from separate Out and 0.2R current set resistors to split up the dissipation so you don't run into stability problems due to the internal SOA limit cutting in.If you want to make your load Arduino controlled and you cant wait for a reference IC from Aliexpress, I've sketched up and simulated a circuit for a cheap and not-so-nasty 4.096V reference you could use for the Arduino ADC and for generating the current set control voltage that you should be able to build with locally available parts, provided you are prepared to test and hand-select a few. With care and adjustment, it should be considerably better than 1% if you calibrate it with an accurate meter. The sim should pull in the OPAMP model it needs from LTwiki.org. The Zener models are included as well.

author: VEGETA
author_rank: Super Contributor
timestamp: April 17, 2018, 10:44:20 pm
content: I've been trying this damn circuit all day and night but nothing works at all. Best result is that it works partially then crap happens. I even ditched the op-amp and but a pot, but nothing worked. I even tried the mini dc-dc and set it to -1.1v but it didn't work... same thing with the other lm317 which didn't work either.Seems that there is something else in the circuit we are not doing correctly because the 3 methods above are for making the bias voltage for the main lm317. I didn't try the op-amp taking feedback from the 0.1 resistor though, as you said it will oscillate.I don't know but when I connect my pots on 0v and -9v, the voltage changes in a weird way. it changes slowly then gets a massive change at once! I couldn't get what I wanted even by a simple pot.My shunt resistor is 15 of 1.5 ohms resistors which makes it 0.15R, even this gets different readings by the 2 multimeters that I have.I hope you try it if you have the time because I started to really lose hope from this circuit, if not lost it already. I feel disappointed in wasting 2 weeks to make it work then it didn't. I wonder why in theory it must work but in reality it doesn't.

author: Ian.M
author_rank: Super Contributor
timestamp: April 18, 2018, 12:19:45 am
content: Lets see a sketch of the circuits you've tried(and please use BLACK ink and a fibre tip pen so its readable even if you have to photo it with your phone camera. Hint: If you cant photo it in direct sunlight, use as much artificial lighting as possible, as close as possible without getting in the shot)and photos of the actual circuits and all parts involved. Give exact part numbers of all chips, transistors etc. involved, and if you know, whether they came from China, or another country.I'm not surprised you get inconsistant results for your 0.15R shunt. Most multimeters don't really give good results below one Ohm. To measure resistance down there you need to pass a known current through the resitor and measure the volltage across it and do the math, or use a really good meter that does four terminal resistance measurement.I'm assuming you don't have a reasonable well calibrated bench PSU with adjustable current limit. If I'm wrong, use it and ignore the bit about the LM317 and 12R resistor below.Take a 12 ohm resistor (anything from 10R to 15R would do), and connect it and a working LM317 (that you know regulates OK) as a simple fixed current sink. Use a PSU you know can maintain a reasonably steady voltage while providing 0.1A.Leave it running a while to thermally stabilise. Measure its Isink (or the PWU's constant current if not using a LM317) with both meters in series. Now add your unknown low-Ohm resistor in series in place of one of the meters, and measure the current on the remaining meter, and the voltage directly across the low-Ohm resistor's leads with the other meter. Then swap the meters and repeat. Then measure the voltage across the low-Ohm resistor with both meters. Finally repeat all the measurements so far in reverse order to allow for any drift in Isink due to the LM317 heating up.Average the currents and the voltages (after throwing out any readings that are way out of line with the rest) and use Ohms law and you'll be about as close as you can get with uncalibrated low cost meters. If the readings don't make any sense, suspect a problem with one of the meters - you'll find out if any of their test leads are intermittent!Once you have confidence in your meters, you'll only need one voltage and one current reading to measure future low-Ohm resistors.Build an accurate x10 OPAMP buffer and a precise 100mA current source, and you can apply the current to a resistor, connect the x10 buffer across it and directly read its resistance in milliohms as milliVolts at the OPAMP output.

author: VEGETA
author_rank: Super Contributor
timestamp: April 18, 2018, 05:46:40 am
content: Here is the circuit in description, all parts from China. We'll worry about the resistor later on if the regulator actually worked.I didn't try making the op-amp take feedback from 0.15R like the classic configuration yet, maybe it works if we put RC networks in the loop?Here I can using a positive voltage like from Arduino or even a pot... but I sense that going for these low value voltages and resistors is a problem by itself. It is just how I found most circuits online are.

author: Ian.M
author_rank: Super Contributor
timestamp: April 18, 2018, 07:51:58 am
content: Thanks. that's so much easier to read than your last schematic.It *should* work, unless the LM317's internal SOA protection circuit is kicking in. What value is the potentiometer? Also, please show exactly how you get that -1.050V from the second LM317. I didn't think there was any *GOOD* way to get a voltage less than its Vref.Yes the low voltages are a problem - for a LM317 - as you are balancing an external voltage of dubious stability against an internal reference in a chip that's going to heat up and therefore drift as the load is used. 1% of error in either voltage results in an over 6% error in the load current. Also, as its on the other end of the pot, your -9V supply needs stabilising as well. If you use a battery, the current setpoint will continuously drift up as it discharges.

author: VEGETA
author_rank: Super Contributor
timestamp: April 18, 2018, 09:04:38 am
content: Quote from: Ian.M on April 18, 2018, 07:51:58 amPots are 10K. I got -1.050v or so by connecting 0v and -9v at Vin and Gnd (respectively) of the LM317 module, then played with on board potentiometer to get the value. Remember, here 0v is total circuit ground and also Vin for LM317, so it's output will be in the negative always.What do you suggest now?

author: Ian.M
author_rank: Super Contributor
timestamp: April 18, 2018, 12:58:55 pm
content: So the whole OPAMP circuit is relative to the -9V supply. That must be as drifty as heck. That's why I suggest a positive reference, putting the pot between its output and ground, and using the OPAMP as an *inverting* buffer. Make its input resistor(220K+220K) two times its feedback resistor (220K) and the OPAMP gain will be -0.5, so you can set the reference LM317 module to 2.5V which should be well within its operating range. The OPAMP input and feedback resistors must be much much bigger than the source impedance for the control voltage or you'll get significantly less gain than you expect. With the resistors I suggested and your pot supplying the control voltage, the gain error should be well under 1% - the resistor tolerances will be far more signficant.To improve the control range of your 10K pot, put 1K in parallel with the pot track (to reduce the Thévenin equivalent resistance of the divider chain), and 4K7 between the lower end of the parallel combo and Gnd. Tweak the reference module output voltage till the load current just starts to rise with your 10K pot wiper very near its top end, and the other end of the pot's range should give you around -1V on Adj for somewhere near 1.5A max.N.B. I only attached the sim for completeness - the GIF of the circuit is the important thing. The sim needs the potentiometer component from the first zipped sim I posted back in reply #5 (potentiometer.asy and potentiometer.sub). Its horribly slow because I'm stepping the potentiometer and haven't bothered with .savebias/.loadbias.

author: VEGETA
author_rank: Super Contributor
timestamp: April 20, 2018, 11:33:52 pm
content: I've been trying the circuit all day long but nothing works.Opamp output always shows around -7.5 ~ -8.5 while the inverting input shows around -3.5 and -4v. So when getting -8v to adjust ping, nothing will work and output is 0.the 440k and 220k should give 0.5 gain.. since it is in inverting pin = 0.5 * -1 = -0.5. So if I feed 2v it should be -1v. However, the output of opamp always stays at -8v no matter what I do with the pot.Quick note: Maybe the issue is in connecting the pot? I mean I connected the 3 pins as shown but I think I should connect 2 pins right?! the upper one connected to 2.5v and the middle one which is output voltage. However, I did try the pot alone (between 2.5v and 0v) but still same issue... so ?

author: Ian.M
author_rank: Super Contributor
timestamp: April 21, 2018, 12:04:25 am
content: That sounds like the OPAMP is bad, or maybe its +9v supply is missing or you've got its pinout wrong. In normal operation its In- would be within a couple of mV of its In+ (always true of a working OPAMP in a steady state condition if its in its linear region of operation: i.e. the output isn't stuck up against one of its supply rails). As In+ is grounded, that means In- should measure as 0V.Photos please.If connected as shown, with the LM317 module feeding it set to +2.5V, the pot should vary the voltage at its wiper, Vc, between +2V and +2.5VAlso, work your way round all the OPAMP pins checking the voltage with respect to Gnd, and post the voltage at each pin, with Vc set to 2.5V. We'll also need the OPAMP part number if it isn't easily readable in the photo.Got any spare OPAMPs?

author: VEGETA
author_rank: Super Contributor
timestamp: April 21, 2018, 12:14:47 am
content: Quote from: Ian.M on April 21, 2018, 12:04:25 amMy opamp lis LM358 but it is SMD version which is so tiny that I had to spend 2 hours soldering wires to it. I suspect that it is the cause of this issue since there are no other way according to what we achieved. I have ordered lm358 and lm324 DIP version but they need another month to arrive. Perhaps I should just postpone the project until then because spending 5 hours debugging a simple circuit like this with dodgy part is not a funny thing.If you are interested in voltages, I told you the In- pin is -8v always... maybe it is shorted to GND pin or something. I will check tomorrow if I could get a better result or re-solder it a better way. I have ordered SMD to DIP adapters too for such situations.

author: VEGETA
author_rank: Super Contributor
timestamp: May 12, 2018, 08:52:37 am
content: For now, I have started a new topic here:https://www.eevblog.com/forum/beginners/dc-dummy-load-circuit-calibration/It is about using an N-MOSFET with op-amp... it still has one small problem that I would like you to take a look at it.regards