Author Topic: Improve this constant current circuit to become LOGARITHMIC?  (Read 656 times)

LooseJunkHater and 1 Guest are viewing this topic.

Online LooseJunkHaterTopic starter

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: de
Circuit in Falstad

Likely going to get this circuit made by a PCB manufactuer to be used for various things. It's just a basic constant-current control, from 0-2A. My only problem is that I can't figure out how to LOGARITHMICALLY control the potentiometer, to have fine-control at 0-100mA, and less control at 100mA-2A. I know that I could simply use a logarithmic pot, but is there any other way to have the circuit act in a logarithmic manner?

Design-rationale (before people ask):
- The first op-amp is to simply decrease the input resistant into the second op-amp.
- The 70k resistor to ground at the input of the second op-amp exists so that if the pot breaks, only ~5mA will be allowed to flow through the FET.
- I know that I'll need a compensation capacitor at the FET to reduce ringing
- I'm using a 0.1ohm resistor to reduce voltage drop at the 2A load
- The op-amp I'll be using to measure the ~0.5mv voltages at the 0.1ohm current sense resistor is the Microchip MCP6V97 (+/- 25μV at 25C).
« Last Edit: July 10, 2024, 12:50:26 am by LooseJunkHater »
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2275
  • Country: ca
Re: Improve this constant current circuit to become LOGARITHMIC?
« Reply #1 on: July 10, 2024, 01:49:52 am »
Change the 70k resistor to 1 or 2k and you'll get a response curve close to what you are looking for.
 

Offline JoeyG

  • Regular Contributor
  • *
  • Posts: 121
  • Country: au
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12971
Re: Improve this constant current circuit to become LOGARITHMIC?
« Reply #3 on: July 10, 2024, 07:51:40 am »
The left OPAMP in the Falstad sim is absolutely pointless.  +in tied low and -in tied high so its output is railed at its negative supply (ground).  You then pull that up a bit with the left 70K resistor and because a LM324 is not a RRIO OPAMP, that gives you *some* voltage across the pot, but in no way a stable voltage.

Get rid of it, and if you need better stability than your 5V supply, use a reference IC to feed the pot via a dropper resistor.

 

Offline srb1954

  • Super Contributor
  • ***
  • Posts: 1107
  • Country: nz
  • Retired Electronics Design Engineer
Re: Improve this constant current circuit to become LOGARITHMIC?
« Reply #4 on: July 10, 2024, 09:42:06 am »
You can get an approximately logarithmic response out of a linear taper pot by having a low value (compared to the pot resistance) resistor connected from the pot wiper to ground. This extra loading on the pot wiper alters the division ratio from that expected from the pot alone, except at the bottom end of the pot travel where it reverts to a more linear characteristic.

You can tune the shape and range of the division curve by adjusting the ratio between the pot total resistance and the extra load resistor. I suggest you set-up a spreadsheet calculation and try various values until you get the curve you like. Try starting with a load resistor of 1/10 the pot resistance.

A consequence of the extra load resistor is that the input resistance to the pot varies considerably as the pot is turned so you will need a much better voltage reference, which can tolerate additional load current draw, than your circuit.
 

Online LooseJunkHaterTopic starter

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: de
Re: Improve this constant current circuit to become LOGARITHMIC?
« Reply #5 on: July 10, 2024, 12:51:39 pm »
The left OPAMP in the Falstad sim is absolutely pointless.  +in tied low and -in tied high so its output is railed at its negative supply (ground).  You then pull that up a bit with the left 70K resistor and because a LM324 is not a RRIO OPAMP, that gives you *some* voltage across the pot, but in no way a stable voltage.

Get rid of it, and if you need better stability than your 5V supply, use a reference IC to feed the pot via a dropper resistor.

Does RRIO simply stand for rail-to-rail input out? I assume using a 1.25v voltage reference should be fine, something like a TL431?

Change the 70k resistor to 1 or 2k and you'll get a response curve close to what you are looking for.

Done; Falstad Circuit. Now the only problem seems to be that the minimum current is around 30mA instead of close to 0mA as before. I guess at this point I'll just need to mess around a bit with the IRL circuit to get it working perfectly?
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
Re: Improve this constant current circuit to become LOGARITHMIC?
« Reply #6 on: July 10, 2024, 01:52:27 pm »
You're missing some components in your MOSFET feedback loop.

Here's my load:
  https://www.eevblog.com/forum/projects/constant-current-dummy-load-ran-a-gutter/msg3180226/#msg3180226

« Last Edit: July 10, 2024, 01:56:18 pm by MarkF »
 

Online LooseJunkHaterTopic starter

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: de
Re: Improve this constant current circuit to become LOGARITHMIC?
« Reply #7 on: July 10, 2024, 02:16:49 pm »
You're missing some components in your MOSFET feedback loop.


Why are you putting 12v at 0R2? What's the purpose of the unity gain buffer OP-amp? Why is the potentiometer also at the input of the unity gain buffer and not after it?
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
Re: Improve this constant current circuit to become LOGARITHMIC?
« Reply #8 on: July 10, 2024, 03:05:24 pm »
The 12V through 1K resistor is a bodge partial solution.
If the DUT is powered off, the op-amp can't develop any voltage across the sense resistor.  This causes the op-amp to drive the MOSFET gate very high (i.e. fully turning 'on' the MOSFET).  If you than turn 'on' the DUT, it will see a momentary dead short.  As a partial fix, I always feed a small current through the sense resistor which will allow you to turn down the pot to minimum.  Hence, turning 'off' the MOSFET.  Any position of the pot other then minimum and again the MOSFET gate will be driven to max.  The real solution is to add a bunch of circuitry to sense the DUT voltage and disable the MOSFET.  My solution has minimal effect on the current.  Since, I already had the PCB made, I can live this limitation.

You can look at Jay_Diddy_B's Dynamic Electronic Load Project.  He doesn't have my problem.  But, it requires a -/+V power supply.

The unity gain op-amp is to buffer the set voltage of the pot from the 10:1 resistor divider into the op-amp driving the MOSFET.  A 0-5V output from the pot or the external control results in a 0-0.5V across the sense resistor.  This gives me a 0-2.5A current load.  The 10-turn pot gives me a controllable current down below 5mA.
« Last Edit: July 10, 2024, 03:07:05 pm by MarkF »
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2275
  • Country: ca
Re: Improve this constant current circuit to become LOGARITHMIC?
« Reply #9 on: July 10, 2024, 03:54:56 pm »
Quote
Change the 70k resistor to 1 or 2k and you'll get a response curve close to what you are looking for.

Done; Falstad Circuit. Now the only problem seems to be that the minimum current is around 30mA instead of close to 0mA as before. I guess at this point I'll just need to mess around a bit with the IRL circuit to get it working perfectly?
You could  try 100k pot with ~10k to ground, instead of 10k and ~1k.

I also agree about the opamp selection. Like the dual LM358,  the quad LM324 will do input to negative rail (ground) but needs plenty of room to the positive rail. It can output close-ish to negative rail IF the load impedance is very high (very little current). You can help it get closer to -ve rail with a pull down resistor, keeping in mind the current wasted in it when the output is higher voltage. As always, only you can test if it can do what you need.
 

Online LooseJunkHaterTopic starter

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: de
Re: Improve this constant current circuit to become LOGARITHMIC?
« Reply #10 on: Yesterday at 05:52:41 pm »
What about this circuit? It's more logarithmic near the center of the POT but less around the 0ohms and 10k ohms points. I also decided to adjust it to 0mA-1A instead of 0mA-2A for more control. I think I may still need to use the Microchip MCP6V97 OP-AMP because I don't think an LM324/LM358 will be able to accurately control the FET at 0-25mA ranges due to the current-resistor measurement voltages being between 0.5mv-5mv.

Anyone see any problems with it? I'm using all standard resistors and the 1nf cap can be modified to reduce oscillations if needed in the actual circuit, as well as the 220ohm resistor at the current sense resistor can be changed to adjust the lowest-current flowing through the FET.

The 2.5v voltage reference I'll likely generate via a TL431, which should be able to easily handle the ~15mA.
« Last Edit: Yesterday at 05:59:07 pm by LooseJunkHater »
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
Re: Improve this constant current circuit to become LOGARITHMIC?
« Reply #11 on: Yesterday at 08:51:23 pm »
It seems overly complex to me.
If you don't intend on having an external control source, you don't need the
first op-amp buffer and the middle voltage divider resistors (4.7K and 680).

Just drive the second op-amp directly with the output from the pot.
Remember, the voltage applied to the (+) input of the op-amp will appear
across the sense resistor.  This will determine the load's current.

You might want to put a small capacitor from the pot wiper to GND.  It will
filter small instabilities and noise in the control.

The only reason I had the buffering op-amp was because I have two control sources
and I needed to isolate the resistor division of the pot from the 10:1 division.

Also, it would be better if the 1K resistor on the MOSFET gate was lower.
A 100 ohm resistor would be better and give a better response from the MOSFET.

The 220 ohm resistor is not adjusted for lowest load current.  You make it just
big enough so the MOSFET gate voltage goes to zero when no SUT is connected and the
control is set to minimum.  A little of the adjust will be determined by how much
play you have at the low side of the pot.  You want the pot to come off its end stop
a little before the op-amp reacts.  You'll see want I mean when you start testing.
(I would leave it out until everything else is working.)
« Last Edit: Yesterday at 08:59:07 pm by MarkF »
 

Online LooseJunkHaterTopic starter

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: de
Re: Improve this constant current circuit to become LOGARITHMIC?
« Reply #12 on: Yesterday at 10:14:14 pm »
The 220 ohm resistor is not adjusted for lowest load current.  You make it just
big enough so the MOSFET gate voltage goes to zero when no SUT is connected and the
control is set to minimum.  A little of the adjust will be determined by how much
play you have at the low side of the pot.  You want the pot to come off its end stop
a little before the op-amp reacts.  You'll see want I mean when you start testing.
(I would leave it out until everything else is working.)

What about now?

I've included the 2.5v TL431 voltage reference in the circuit, removed the unity-gain buffer, added a small cap to the wiper of the POT, and I decreased the resistor to the FET-gate to 220-ohm. I'll need to adjust the 220-ohm resistor beside the current-sense resistor IRL I guess?

From your earlier comment:
The real solution is to add a bunch of circuitry to sense the DUT voltage and disable the MOSFET.  My solution has minimal effect on the current.  Since, I already had the PCB made, I can live this limitation.

Do you have a source-post on the circuitry to sense the DUT voltage and disable the FET?

I was also thinking of making a digital version of this circuit, replacing the POT with a digital PWM + varying duty cycle to control the output current. I ONLY want to work on this AFTER I finalize the analog circuit.
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
Re: Improve this constant current circuit to become LOGARITHMIC?
« Reply #13 on: Yesterday at 10:50:31 pm »
I can offer this from my stash of thing I've saved over the years:

Caution:  There is NO over-voltage protection on the feedback voltage from the DUT.
« Last Edit: Yesterday at 10:53:10 pm by MarkF »
 

Online LooseJunkHaterTopic starter

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: de
Well that circuit schematic is incredibly useful and saves me a lot of time to support digital control of my circuit, thanks! That's an incredibly simple way to read the voltage, read the current, and set the current. Do you have the source code for this circuit as well?

Further I guess going back to my circuit in Falstad, do you have any additional feedback for it or do you think it's "good enough" at this time?
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
I don't have the software for that electronic load.  It's not mine.
Really, it's just setting the DAC output for the current and reading two ADC inputs for the Arduino.  Plus what's required to control it (i.e. display, rotary encoder, a PC connection, etc.)  You might try to search for his web page.  It would be years old though.

One last thing you seem to have dismissed.  In the load I built, I had the ability to control the load externally with the simple addition of a switch and BNC connector.  Being able to control the load from an arbitrary waveform generator is just as nice to have as computer controlled.  Your choice.
 

Online MarkF

  • Super Contributor
  • ***
  • Posts: 2593
  • Country: us
It looks like there is still a GitHub page for the Jasper Sikken Electronic Load:
   https://github.com/bertrik/ElectronicLoad?tab=readme-ov-file

And a description:
   https://www.tindie.com/products/jaspersikken/arduino-electronic-load-r3/
« Last Edit: Today at 01:10:07 am by MarkF »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf