Author Topic: Constant current circuit problem  (Read 6434 times)

0 Members and 1 Guest are viewing this topic.

Offline interothTopic starter

  • Contributor
  • Posts: 35
  • Country: gb
  • Programmer gone electronics novice
Constant current circuit problem
« on: June 29, 2016, 02:25:41 pm »
I'm building an arduino controlled constant current load for testing batteries and I've got a problem I'm not sure about. I am pretty much a beginner so sorry if this is something simple!

Here is my schematic


The circuit works well at higher voltages/currents (over 5v and 500mA) however when the voltage starts to get low a constant current is no longer maintained.
At lower currents the voltage this occurs at is pretty low, however I want to be able to run 1A @ 3V (to test LiPo).
I have a feeling it's something to do with the forward voltage of the mosfet limiting the current at lower voltages however with my limited knowledge I am pretty much stuck.

Here are some probes of the source for the mosfet (all I have to work with is an 'vintage' analogue oscilloscope)
While working correctly:


At lower voltage but bordering on working:


At even lower voltage where the current seems linear to the voltage:


Any help is appreciated!
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Constant current circuit problem
« Reply #1 on: June 29, 2016, 02:40:56 pm »
For starters I would use a voltage divider on the input to the opamp, l1ke 220/10-22K. Some resistance to the FET gate like 47 ohms.  Lower the 1 ohm sense resistor closer to .1 ohm, this subtracts from the potential gate drive voltage which is pretty low now.
« Last Edit: June 29, 2016, 03:01:02 pm by Seekonk »
 

Offline Dr. Frank

  • Super Contributor
  • ***
  • Posts: 2384
  • Country: de
Re: Constant current circuit problem
« Reply #2 on: June 29, 2016, 02:48:40 pm »
The voltage at LOAD+ has also to be higher than the reference voltage over the 1 Ohm resistor, plus some margin over the FET.

As the arduinoPWM signal can be between zero and 5V, LOAD+ should be always higher than about 6V, or so.

I did not check the Gate voltage requirements of this FET, but you also have to take care, that the necessary voltage can always be delivered by the LM324.
You limited the supply to 0 and 5V, so the output of the 324 may vary between 0.5 ..4.5V (check datasheet) only, and I really wonder, if this is sufficient for all U/I combinations.

So I would use a +/- 15V supply for the LM324, and also would use the unregulated V++, or +15V as the source for the constant current, not GND and the battery.

So, connect the battery-plus to +15V, or V++, and the battery-minus to LOAD+.
This will sink the necessary constant current through your battery under  all circumstances, but you have to take care about additional power consumption, and the maximum UDS of the FET.

Frank
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7388
  • Country: nl
  • Current job: ATEX product design
Re: Constant current circuit problem
« Reply #3 on: June 29, 2016, 03:21:17 pm »
Because a FET is a capacitor, and opamps dont like capacitors on the output. Put there 47 ohm on the gate. And maybe change the opamp to something decent. Read, what rail to rail means for an opamp.
 

Offline ZeTeX

  • Frequent Contributor
  • **
  • !
  • Posts: 610
  • Country: il
  • When in doubt, add more flux.
Re: Constant current circuit problem
« Reply #4 on: June 29, 2016, 04:37:50 pm »
Try building this:
https://www.solo-labs.com/diy-30w-adjustable-electrical-load/
it includes compensation so no oscillation if you are using their schematics.
use +12V and +5V, or else your mosfet might not reach it full gate threshold voltage and you will need logic level one.

 
The following users thanked this post: Mechatrommer

Offline interothTopic starter

  • Contributor
  • Posts: 35
  • Country: gb
  • Programmer gone electronics novice
Re: Constant current circuit problem
« Reply #5 on: June 29, 2016, 07:16:15 pm »
For starters I would use a voltage divider on the input to the opamp, l1ke 220/10-22K. Some resistance to the FET gate like 47 ohms.  Lower the 1 ohm sense resistor closer to .1 ohm, this subtracts from the potential gate drive voltage which is pretty low now.

I went and got some .1 ohm resistors, this seems to have done the job for now - I can get down to 2V @ 1A before it fails which is well within my requirements. Thanks!
 

Offline Brutte

  • Frequent Contributor
  • **
  • Posts: 614
Re: Constant current circuit problem
« Reply #6 on: June 30, 2016, 08:46:02 am »
Inverting input is always ~the same as noninverting input in linear region of any op-amp.
So you want [0:5V] input range to be equal to 0.1R *[0:1A] = [0:0.1V] range.
The current control dynamic range would be too coarse I'm afraid, 0.1V is a bit over 5 values out of 256 available from 8-bit PWM.

Another thing is that 0.1V and such currents cause significant errors on any wiring and PCB. So the PCB layout is an important thing here.

Now, LM324 and alike is not rail2rail input and won't accept voltage higher than Vcc-1.5V on its inputs. So 3.5V is the highest one can get from 5V. Minor ussue with your 0.1V design.

 

Offline interothTopic starter

  • Contributor
  • Posts: 35
  • Country: gb
  • Programmer gone electronics novice
Re: Constant current circuit problem
« Reply #7 on: June 30, 2016, 12:55:08 pm »
Inverting input is always ~the same as noninverting input in linear region of any op-amp.
So you want [0:5V] input range to be equal to 0.1R *[0:1A] = [0:0.1V] range.
The current control dynamic range would be too coarse I'm afraid, 0.1V is a bit over 5 values out of 256 available from 8-bit PWM.

Another thing is that 0.1V and such currents cause significant errors on any wiring and PCB. So the PCB layout is an important thing here.

Now, LM324 and alike is not rail2rail input and won't accept voltage higher than Vcc-1.5V on its inputs. So 3.5V is the highest one can get from 5V. Minor ussue with your 0.1V design.

I've added a voltage divider on the PWM input so instead of 0-5V I get around 0-1V from the 255 values. I've also used the other spare opamp on the chip to amplify the voltage drop over the 0.1 ohm resistor so the arduino can get a more accurate measurement of the current. While it will definitely need some serious calibration it seems to be stable enough for the kind of measurements I want to get. If I were to do it again I would definitely choose a different design.

Here is the new schematic
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Constant current circuit problem
« Reply #8 on: June 30, 2016, 02:06:48 pm »
What is the max current you want to set?
The 0-1V PWM input implies setting 0-10A.
But the gain of your 0.1R amp can only measure up to 1.6A before the LM358 sticks at 3.5V.

If 5 Amps is enough these values should not need much calibration.
« Last Edit: June 30, 2016, 02:11:40 pm by StillTrying »
.  That took much longer than I thought it would.
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Constant current circuit problem
« Reply #9 on: June 30, 2016, 02:28:23 pm »
The PWM voltage divider should be across the cap and I would place a second capacitor there.
 

Offline interothTopic starter

  • Contributor
  • Posts: 35
  • Country: gb
  • Programmer gone electronics novice
Re: Constant current circuit problem
« Reply #10 on: June 30, 2016, 02:32:24 pm »
The max current I really would want to draw is 2A, the heatsink I have I doubt would be able to handle much more than that. I have around 114 LiPo cells which is what warranted this design. I want to test each individually which I will probably want to do at 1A.
 

Offline interothTopic starter

  • Contributor
  • Posts: 35
  • Country: gb
  • Programmer gone electronics novice
Re: Constant current circuit problem
« Reply #11 on: June 30, 2016, 02:33:49 pm »
The PWM voltage divider should be across the cap and I would place a second capacitor there.

Could you elaborate on this? I've probed the output from the divider going into the opamp and it seems pretty stable and seems to work.
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Constant current circuit problem
« Reply #12 on: June 30, 2016, 04:26:15 pm »
If you're only using 0.2V of your 1V PWM, you'll only be able to set the currents in steps of about 40 mA, which will make it difficult to set exact values like 100mA, 200mA, 500mA

By spreading the 0.2V over more of the 256 PWM range you'll get more resolution and finer current setting steps.


"The PWM voltage divider should be across the cap"
I think I know what you mean there, - but in practice it makes no difference.

"and I would place a second capacitor there."
Yes, dividing the resistance and capacitance by 2 and making a 2 stage filter gives a much smoother and faster response from the PWM.
.  That took much longer than I thought it would.
 

Offline ECEdesign

  • Regular Contributor
  • *
  • Posts: 173
  • Country: us
Re: Constant current circuit problem
« Reply #13 on: June 30, 2016, 05:41:05 pm »
The max current I really would want to draw is 2A, the heatsink I have I doubt would be able to handle much more than that. I have around 114 LiPo cells which is what warranted this design. I want to test each individually which I will probably want to do at 1A.


What kind of algorithm are you going to use to test these batteries? 
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Constant current circuit problem
« Reply #14 on: June 30, 2016, 05:54:05 pm »
"however when the voltage starts to get low a constant current is no longer maintained."

There are quite a few voltage sources here but a few considerations.

1. As the input voltage to the opamp, but the filtered pwm, or the current sense voltage, get too close to the negative rail (or ground here) the opamp will not function as expected.

2. As the supply voltage to the opa.p gets sufficiently low, it can no longer drive the MOSFET to be sufficiently open.

Depending on your goal, you may want to consider a negative rail on the MOSFET, floating around (via a diode for example), use a bjt (npn) or use a PNP, a r2r opamp, ....
================================
https://dannyelectronics.wordpress.com/
 

Offline interothTopic starter

  • Contributor
  • Posts: 35
  • Country: gb
  • Programmer gone electronics novice
Re: Constant current circuit problem
« Reply #15 on: June 30, 2016, 06:43:44 pm »
I ended up changing the PWM voltage divider to give a range from 0-0.45V, which gives me the accuracy I wanted.

Quote
What kind of algorithm are you going to use to test these batteries?
I'm going to use the arduino to measure the time and current(which should be constant) for the voltage to drop from 4.2 to 3V for the cells to calculate the capacity.
 

Offline Brutte

  • Frequent Contributor
  • **
  • Posts: 614
Re: Constant current circuit problem
« Reply #16 on: June 30, 2016, 08:23:09 pm »
1. As the input voltage to the opamp, but the filtered pwm, or the current sense voltage, get too close to the negative rail (or ground here) the opamp will not function as expected.
This is a bipolar op-amp with pnp inputs and the common mode input voltage spans from -0.3V up to Vcc-1.5V (w.r.t. GND)
That is not a hack - it was designed that way, it can safely operate in GND region.

Quote
2. As the supply voltage to the opa.p gets sufficiently low, it can no longer drive the MOSFET to be sufficiently open.

The LM324 family has wide supply range (3V - 40V) and 5V is ok. The irlz44n mosfet is of N type. This op-amp has a bipolar output stage and includes 0.0V It is rather slow and weak in mV region but you can happily drive 10mA load at 0.5V and that is more than enough to turn off an N-mos "to be sufficiently open". I'd be rather concerned with "to be sufficiently closed" as the output won't go higher than 3.5V (and then 0.1R drop).
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Constant current circuit problem
« Reply #17 on: June 30, 2016, 08:26:23 pm »
Does it make a lot of difference, no.  Just if you are going to use an electrolytic, you should put some voltage on it.  Anyway, if you are going to do that the 2.7K has no purpose.  Just what is all that ripple I see on the scope trace.  Sure looks like it needs a second cap.
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Constant current circuit problem
« Reply #18 on: July 01, 2016, 02:13:01 am »
Does it make a lot of difference, no.  Just if you are going to use an electrolytic, you should put some voltage on it.
I agree a couple of volts on the electrolytic would keep it in good health.  :)
But at the same time I try to minimize the loading on the 5V PWM so that the narrowest PWM pulses still have a fast rise time, and still rise to the full 5V level. In practice there's probably not much difference- there's usually something else a mile off at the ends of the PWM range.
.  That took much longer than I thought it would.
 

Offline interothTopic starter

  • Contributor
  • Posts: 35
  • Country: gb
  • Programmer gone electronics novice
Re: Constant current circuit problem
« Reply #19 on: July 08, 2016, 12:19:11 am »
Just an update, I've gotten the circuit working to a reasonable accuracy and integrated the arduino with an LCD to show the current and voltage.

The current target is set over serial. Next I will add a mAh counter and another battery channel. Also some physical buttons with menu system would be nice.
Excuse the crude gifs


 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf