mosfet as current regulator

Hello, i am working on SLA charger controlled by arduino. Becase circuit should be for batteries with variable capacity, arduino should be able to setup charging conditions.
Charging voltage is quite easy, voltage regulator LM338 its adjust pin controlled by opamp. Opamp controlled by arduino pwm pin with low pass filter.
Current control seems to be more complicated. I have been thinking to use logic level mosfet for example IRLZ44N which should be also controlled by arduinos pwm pin with low pass filter.
Problem is that mosfet getting very hot when gate not fully saturated, it is almost impossible to keep it coldeven with heat sink.
Charging current should be from 0.5 to 4A it means for 5 to 40Ah battery ( based on C/10 formula).
Is my approche for current regulation wrong, did I something wrong or what is more feasible approach?

I was also thinking to use LM338 in current control mode, but current is in this case limited by huge resistor which has to witstand huge power. I think there is no way to control regulator in current control mode by arduino, because digipots are max for few mAmps.

Thank you in advance for any feedback or advice. Best regards Miro

Unless you pwm an average current, there is no way to get your MOSFET current regulator to not get hot. Go ahead and calulate the resistance the MOSFET has to be under any given condition to provide teh proper current and use I squared R to get the power dissipation of the MOSFET.

In fact I am not an electro enginner, so.... I dunno understand very well.
In mosfet datasheet is Rds(on) it is 0.022oHm. So if Is my understanding well, when mosfet not fully saturated, Rds increase thats why it is getting more hot?
So what should I calculate, what square? Please explain. I was thinking to use two mosfets in parallel, but than would be current through each mosfet half of total current, so mosfet would be even less saturated and probably more hot.

Thank you for your advice. Miro

Let us say that your battery when charging at 1.5 A is at 1.3 V. The voltage on the other side of the MOSFET is 5 V. The MOSFET must drop (5 - 1.3) 3.7 V and pass the full 1.5 A. This means that the MOSFET must be a resistance of R=V/I = 3.7/1.5 about 2.5 ohms. The power will be 3.7 * 1.5 or about 5.6 W, which can also be calculated as Isquared R, or 1.51.52.5.

You are going to need a big heatsink.

SLA means sealed lead acid battery. Constant voltage charging sets the maximum voltage at 2.45V. Constant current charging will mean a battery voltage less than that, but not below 2V.

Still, 4A at 3V is 12W. Why not use a computer power supply and use the 3.3V output as the charging output? Cuts way down on the power dissipated in the MOSFETs.

If you put two MOSFETs in series and adjust the gate voltage so the total current is still 4A, you have half the current through each, therefore half the power (both still dropping the same voltage).

Why not put a logic level MOSFET across R2 in the LM338 voltage regulator circuit? Use a small series resistor to measure current. Then the Arduino smoothed PWM output can drive the gate of the MOSFET to regulate current. With the transistor ON, voltage at the output is 1.25V. To drive more current, turn the PWM down.

You need a minimum of 3V differential across the LM338. So to charge a single SLA cell, takes about 5.5V minimum. Call it 6V at 4A, the LM338 needs a heat sink large enough to dissipate 24W.

KeithRB:
Let us say that your battery when charging at 1.5 A is at 1.3 V. The voltage on the other side of the MOSFET is 5 V. The MOSFET must drop (5 - 1.3) 3.7 V and pass the full 1.5 A.

Purpose of mosfet should not be voltage drop, just current limiting, so why it should drop so much?

polymorph:
Still, 4A at 3V is 12W. Why not use a computer power supply and use the 3.3V output as the charging output? Cuts way down on the power dissipated in the MOSFETs.

I fotgot to mention that I wanna charge 12V SLA battery.

polymorph:
If you put two MOSFETs in series and adjust the gate voltage so the total current is still 4A, you have half the current through each, therefore half the power (both still dropping the same voltage).

Problem is that mosfet gets more hot with lower current ( when not fully saturated ).

polymorph:
Why not put a logic level MOSFET across R2 in the LM338 voltage regulator circuit? Use a small series resistor to measure current. Then the Arduino smoothed PWM output can drive the gate of the MOSFET to regulate current. With the transistor ON, voltage at the output is 1.25V. To drive more current, turn the PWM down.

I dont know much about mosfet resistance, but my understanding is that mosfet serve as variable resistor, with high impedance when it is closed and low when saturated. So in fact that mosfet would serve as "potentiometer"??

Than would be able to control charging process with one PWM output pin to control regulator adjust pin.
It would be same as control it with opamp ??
Series resistor or hall current sensor to sens current that battery sink, and if it would be too high, I would just decrease LM338 adjust pin voltage, so output voltage would be also less and battery would sink less current....
Is my understanding right?

Thank you for your patience, and sorry for my english:(

In order to limit current it has to drop more voltage. You canna change the laws of physics!

polymorph:
Why not put a logic level MOSFET across R2 in the LM338 voltage regulator circuit? Use a small series resistor to measure current. Then the Arduino smoothed PWM output can drive the gate of the MOSFET to regulate current. With the transistor ON, voltage at the output is 1.25V. To drive more current, turn the PWM down.

Thank you for your brilliant idea, I just test it and it really works. I am real electro noob, but I like it.
So I connected battery to stepup regulator I have at home through hall effect current sensor, and battery sing little current when supply voltage was just few volts higher than battery voltage. And when supply voltage increase also current increse.
Charging process would be just to slowly increasing charging charging voltage in accordance to required current until desired voltage will be achieved....am I right?

However to be able charge 50Ah battery I would need 5A ( to follow magic formula capacity of batt / 10 ) and it would need huge heatsink. But I think battery 50Ah or even bigger can be charged with current about 3A without any problems, what do you think guys?

zmatek:
Hello, i am working on SLA charger controlled by arduino. Becase circuit should be for batteries with variable capacity, arduino should be able to setup charging conditions.
Charging voltage is quite easy, voltage regulator LM338 its adjust pin controlled by opamp. Opamp controlled by arduino pwm pin with low pass filter.
Current control seems to be more complicated. I have been thinking to use logic level mosfet for example IRLZ44N which should be also controlled by arduinos pwm pin with low pass filter.

You can do current control by monitoring the current and using a PID loop or similar
to adjust the voltage to maintain constant current - possibly simpler than having
two separate charging circuits?

If you want to control voltage and current-limit in hardware then the single pass transistor
needs to be controlled via diodes from two opamp outputs, one controls the voltage
(assuming the current isn't over limit), the over controls the voltage when the current
reaches the limit.

Voltage sensing is done via opamp in differential amplifier configuration, a single
programming voltage controlling it.(*)

Current control done via standard opamp current source with the pass-transistor in
the loop to buffer. (Again a single programming voltage input needed).

Combining the two needs a diode from each output so that then can both limit the
drive to the pass transistor when needed (pull up resistor or current source to energize
the pass transistor).

The pass transistor can be a MOSFET, but actually a BJT or Darlington is better
because of the lower voltage drop of emitter-follower compared to source-follower
in a typical power device.

(*) Differential amp needed because the battery under charge isn't at ground, its
lifted up by the current-sense resistor needed by the opamp current source circuit

KeithRB:
In order to limit current it has to drop more voltage. You canna change the laws of physics!

sure I cannot, it is obvious :slight_smile:
Simply use mosfet as current regulator is waste of heat and energy $)
For my charger purpose is enough to regulate voltage and sens current, so current limiting will be done by Arduino.
I like this solution, I will need less componets and I will save one PWM pin.

Guys could you recommend good OpAmp rail to rail with multiplication of 5 ?

MarkT:
You can do current control by monitoring the current and using a PID loop or similar
to adjust the voltage to maintain constant current - possibly simpler than having
two separate charging circuits?

If you want to control voltage and current-limit in hardware then the single pass transistor
needs to be controlled via diodes from two opamp outputs, one controls the voltage
(assuming the current isn't over limit), the over controls the voltage when the current
reaches the limit.

Voltage sensing is done via opamp in differential amplifier configuration, a single
programming voltage controlling it.(*)

Current control done via standard opamp current source with the pass-transistor in
the loop to buffer. (Again a single programming voltage input needed).

Combining the two needs a diode from each output so that then can both limit the
drive to the pass transistor when needed (pull up resistor or current source to energize
the pass transistor).

The pass transistor can be a MOSFET, but actually a BJT or Darlington is better
because of the lower voltage drop of emitter-follower compared to source-follower
in a typical power device.

(*) Differential amp needed because the battery under charge isn't at ground, its
lifted up by the current-sense resistor needed by the opamp current source circuit

Thank a lot for detailed tutorial, but it is again rocket science for me.
Could you post link to some similar circuit, maybe I could understand it more.
My Idea is use OpAmp to multiply smoothed arduino PWM to get 16,5V of it as maximum.
Output of OpAmp will be used as reference voltage for adjustment pin of LM338.

As feedback will be simple voltage divider ( two resistors ) for voltage monitoring and hall effect sensor for current monitoring. Because I use 3.3V arduino, to be able get from OpAmp output voltage between 0-16,5V I will need OpAmp rail to rail with multiplication of 5, am I right?

Doh! I meant to say two MOSFETs in -parallel-, half the current in each.

Purpose of mosfet should not be voltage drop, just current limiting, so why it should drop so much?

Because that is how you are controlling current. If you have an 18V power supply charging a 12V SLA battery, and the voltage limit to the battery is 13.8V, the excess 4.2V must be dropped across something.

No offense meant, but perhaps you should start with a simpler project.

BTW, there is a schematic using an LM338 as a 12V lead acid battery charger in that datasheet I gave you.

polymorph:
BTW, there is a schematic using an LM338 as a 12V lead acid battery charger in that datasheet I gave you.

yes yes, you are right... chrager circuit in datasheet is charger without arduino control.
So I will use LM338 as regulator and its voltage adjust pin will be controlled by arduino PWM with low pass filter and OpAmp.
Because of current sensing with arduino analog pin and voltage sensing with resistor voltage divider I will be able clearly monitor charging voltage and current and also adjust it by voltage going from OpAmp to LM338 adjust pint.

Is my idea bad?
If not, I am looking for OpAmp circuit...I found this one using LM324:

It is not inverting OpAmp. Is is possible to get output voltage from OpAmp between 0-14V when it will be supplied by 24V and value of resistor R4 and R5 will be adjusted?
Thank you in advance for confirmation, if you will say yes I will build that circuit ( include LM338 ) and share my results :slight_smile: