Constant current circuit problem - Page 1
Forum section: electronics / projects

author: interoth
author_rank: Contributor
timestamp: June 29, 2016, 02:25:41 pm
content: 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 schematicThe 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!

author: Seekonk
author_rank: Super Contributor
timestamp: June 29, 2016, 02:40:56 pm
content: 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.

author: Dr. Frank
author_rank: Super Contributor
timestamp: June 29, 2016, 02:48:40 pm
content: 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

author: tszaboo
author_rank: Super Contributor
timestamp: June 29, 2016, 03:21:17 pm
content: 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.

author: ZeTeX
author_rank: Frequent Contributor
timestamp: June 29, 2016, 04:37:50 pm
content: 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.

author: interoth
author_rank: Contributor
timestamp: June 29, 2016, 07:16:15 pm
content: Quote from: Seekonk on June 29, 2016, 02:40:56 pmI 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!

author: Brutte
author_rank: Frequent Contributor
timestamp: June 30, 2016, 08:46:02 am
content: 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.

author: interoth
author_rank: Contributor
timestamp: June 30, 2016, 12:55:08 pm
content: Quote from: Brutte on June 30, 2016, 08:46:02 amI'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

author: StillTrying
author_rank: Super Contributor
timestamp: June 30, 2016, 02:06:48 pm
content: 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.

author: Seekonk
author_rank: Super Contributor
timestamp: June 30, 2016, 02:28:23 pm
content: The PWM voltage divider should be across the cap and I would place a second capacitor there.

author: interoth
author_rank: Contributor
timestamp: June 30, 2016, 02:32:24 pm
content: 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.

author: interoth
author_rank: Contributor
timestamp: June 30, 2016, 02:33:49 pm
content: Quote from: Seekonk on June 30, 2016, 02:28:23 pmCould 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.

author: StillTrying
author_rank: Super Contributor
timestamp: June 30, 2016, 04:26:15 pm
content: 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, 500mABy 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.

author: ECEdesign
author_rank: Regular Contributor
timestamp: June 30, 2016, 05:41:05 pm
content: Quote from: interoth on June 30, 2016, 02:32:24 pmWhat kind of algorithm are you going to use to test these batteries?

author: dannyf
author_rank: Super Contributor
timestamp: June 30, 2016, 05:54:05 pm
content: "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, ....

author: interoth
author_rank: Contributor
timestamp: June 30, 2016, 06:43:44 pm
content: I ended up changing the PWM voltage divider to give a range from 0-0.45V, which gives me the accuracy I wanted.QuoteI'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.

author: Brutte
author_rank: Frequent Contributor
timestamp: June 30, 2016, 08:23:09 pm
content: Quote from: dannyf on June 30, 2016, 05:54:05 pmThis 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.QuoteThe 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).

author: Seekonk
author_rank: Super Contributor
timestamp: June 30, 2016, 08:26:23 pm
content: 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.

author: StillTrying
author_rank: Super Contributor
timestamp: July 01, 2016, 02:13:01 am
content: Quote from: Seekonk on June 30, 2016, 08:26:23 pmI 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.

author: interoth
author_rank: Contributor
timestamp: July 08, 2016, 12:19:11 am
content: 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