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

0 Members and 1 Guest are viewing this topic.

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #25 on: April 17, 2018, 05:40:55 am »
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.

I 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.

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #26 on: April 17, 2018, 06:57:28 am »
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.html

So 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?

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: LM317 Dummy load circuit
« Reply #27 on: April 17, 2018, 10:09:04 am »
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 the LT3083 as 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.
« Last Edit: April 17, 2018, 10:12:43 am by Ian.M »
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #28 on: April 17, 2018, 10:47:18 am »
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.

I 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.

Quote
However its probably easier just to wait for your MOSFETs to arrive and use the 'classic' low minimum input load circuit.

That 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.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: LM317 Dummy load circuit
« Reply #29 on: April 17, 2018, 12:01:33 pm »
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.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #30 on: April 17, 2018, 12:46:32 pm »
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.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: LM317 Dummy load circuit
« Reply #31 on: April 17, 2018, 07:35:46 pm »
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.
« Last Edit: April 17, 2018, 07:55:33 pm by Ian.M »
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #32 on: April 17, 2018, 10:44:20 pm »
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.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: LM317 Dummy load circuit
« Reply #33 on: April 18, 2018, 12:19:45 am »
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.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #34 on: April 18, 2018, 05:46:40 am »
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.

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: LM317 Dummy load circuit
« Reply #35 on: April 18, 2018, 07:51:58 am »
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.
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #36 on: April 18, 2018, 09:04:38 am »
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.

Pots 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?

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: LM317 Dummy load circuit
« Reply #37 on: April 18, 2018, 12:58:55 pm »
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.
« Last Edit: April 18, 2018, 01:13:23 pm by Ian.M »
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #38 on: April 20, 2018, 11:33:52 pm »
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 ?

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: LM317 Dummy load circuit
« Reply #39 on: April 21, 2018, 12:04:25 am »
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.5V
Also,  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?
 

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #40 on: April 21, 2018, 12:14:47 am »
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.5V
Also,  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?

My 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.

Offline VEGETATopic starter

  • Super Contributor
  • ***
  • Posts: 1946
  • Country: jo
  • I am the cult of personality
    • Thundertronics
Re: LM317 Dummy load circuit
« Reply #41 on: May 12, 2018, 08:52:37 am »
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


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf