Author Topic: Mosfet driver for op-Amp based constant current source.  (Read 3471 times)

0 Members and 1 Guest are viewing this topic.

Offline 4krubyTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Mosfet driver for op-Amp based constant current source.
« on: January 20, 2022, 02:35:50 pm »
Hello,

I am trying out a circuit for a constant current load for discharging Lithium batteries using mosfet and op-amp.
I am using LM358 for op-amp and IRFZ44N for the mosfet from a 5v (500mA max) power supply.
First I tried a circuit like this (file : circuit_1):
1385954-0
Here, I got the output of the op-amp as around 3.7v which is not enough to switch the mosfet completely. Moreover, as you can see, I was using the same power source for powering mosfet as well as to connect the mosfet drain. I observed that very little current was flowing and mosfet became very hot.
I have a few questions here:
Can I use a single transistor to drive the mosfet? Most of the circuits I encountered had the mosfet gate connected to the collector of the BJT where the logic will be reversed (mosfet OFF when op-amp is ON).
Is it possible to connect the mosfet to the low-side (emitter) of the BJT and switch it ON?

Thanks.
« Last Edit: January 20, 2022, 02:38:23 pm by 4kruby »
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Mosfet driver for op-Amp based constant current source.
« Reply #1 on: January 20, 2022, 04:06:59 pm »
Here, I got the output of the op-amp as around 3.7v which is not enough to switch the mosfet completely.
It seems you are using +5V to power the op-amp. The LM358  only has  a voltage swing of 0 to the positive supply - 1.5V. How about using a higher supply voltage for the op-amp? Or a different op-amp (with rail-to-rail output) or a different MOSFET with a lower Vgs.

Quote
Is it possible to connect the mosfet to the low-side (emitter) of the BJT and switch it ON?

A schematic of what you're intending would be helpful.

Do you mean the op-amp output is driving an NPN base with the emitter driving the MOSFET gate?
 
The following users thanked this post: 4kruby

Offline magic

  • Super Contributor
  • ***
  • Posts: 6761
  • Country: pl
Re: Mosfet driver for op-Amp based constant current source.
« Reply #2 on: January 20, 2022, 09:14:34 pm »
This circuit is not very accurate because LM358 draws additional 0.5~1mA from the battery which is not measured by the resistor.

If this is not a problem, you can replace the MOSFET with any random TO220 NPN transistor. Base current will not be an error because it comes from LM358 which takes it from the battery. So all current measured by the 1Ω resistor comes from the battery and the only error is the small current flowing through LM358 ground pin, which is not counted, as before.
 

Offline 4krubyTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: Mosfet driver for op-Amp based constant current source.
« Reply #3 on: January 20, 2022, 09:15:33 pm »
It seems you are using +5V to power the op-amp. The LM358  only has  a voltage swing of 0 to the positive supply - 1.5V. How about using a higher supply voltage for the op-amp? Or a different op-amp (with rail-to-rail output) or a different MOSFET with a lower Vgs.
I was naïve enough to think that a transistor would do the trick with the 5v supply forgetting the fact that the transistor will drop a good 0.6volts atleast which will then be under the 4.5v gate threshold.
Do you mean the op-amp output is driving an NPN base with the emitter driving the MOSFET gate?
Yes Exactly.

I came to my senses a bit now. A 5v is not sufficient even if a transistor is introduced (unless there is a boost circuit of some sort).
So, the supply voltage has to be increased. In that case, since the Opamp should be able to handle a wide range of voltage, I can altogether use the same circuit with a higher voltage as you suggested and throw away the great idea of including a transistor (unless we need a fast switching of course for the gate current which I need to determine).
 

Offline 4krubyTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: Mosfet driver for op-Amp based constant current source.
« Reply #4 on: January 20, 2022, 09:18:46 pm »
This circuit is not very accurate because LM358 draws additional 0.5~1mA from the battery which is not measured by the resistor.

Well, obviously I did not think about this too. (The assumption of an ideal opamp - which I should try to erase from my brain).
Is there a way I can mitigate this? I mean make the circuit more accurate?

 

Offline magic

  • Super Contributor
  • ***
  • Posts: 6761
  • Country: pl
Re: Mosfet driver for op-Amp based constant current source.
« Reply #5 on: January 20, 2022, 09:21:22 pm »
I have a bunch of old TS27L2 opamps with 20µA current consumption, so I would simply pull one of those. TLC27L2 is a TI equivalent. If you can find them, or some other ultra low power CMOS opamps, that might be the laziest solution. Many CMOS opamps have rail to rail outputs too (but not xx27L2).

Wait, sorry. I don't think this chip would be good for operation down to 3V - its output needs even more positive voltage headroom than LM358.

Of course you can always use external supply for the opamp, if you don't mind that. Or try to pass LM358 ground current through the 1Ω resistor, but this requires a slightly more complex circuit where the opamp works in inverting configuration.

There is also the question what happens when the battery is fully discharged and the opamp continues drawing current from it. Not good for unprotected cells.
« Last Edit: January 20, 2022, 09:31:19 pm by magic »
 
The following users thanked this post: 4kruby

Offline Benta

  • Super Contributor
  • ***
  • Posts: 5869
  • Country: de
Re: Mosfet driver for op-Amp based constant current source.
« Reply #6 on: January 20, 2022, 09:27:59 pm »
I observed that very little current was flowing and mosfet became very hot.

You'll see that it can get MUCH hotter. All the energy from the battery will have to be dissipated by your MOSFET (and a little bit but the sense resistor). You'll need to buy some aluminium chunks somewhere to cool it.

 

Offline 4krubyTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: Mosfet driver for op-Amp based constant current source.
« Reply #7 on: January 20, 2022, 09:40:39 pm »

Of course you can always use external supply for the opamp, if you don't mind that. Or try to pass LM358 ground current through the 1Ω resistor, but this requires a slightly more complex circuit where the opamp works in inverting configuration.

There is also the question what happens when the battery is fully discharged and the opamp continues drawing current from it. Not good for unprotected cells.

What do you mean by "always use external supply for the opamp" ? I am sorry for the circuit as it does not show the opamp power terminals. The opamp will be powered by a separate supply other than the battery.

Yes. the discharging should not continue. I would either protect the battery with a battery protector IC or might include a microcontroller to monitor the whole thing.

I consulted the datasheet of LM358 and found that it can source or sink 20mA of current (average). But I am not sure whether this is enough for a frequency of say 150khz (the gate charge of the mosfet I am using to be 63nC). (150Khz is a fancy switching frequency of the opamp output which I saw in one of the videos where a similar setup was tested).

Quote from: Benta
You'll see that it can get MUCH hotter. All the energy from the battery will have to be dissipated by your MOSFET (and a little bit but the sense resistor). You'll need to buy some aluminium chunks somewhere to cool it.
Yes thanks, I am planning to install a heatsink.
« Last Edit: January 20, 2022, 09:44:06 pm by 4kruby »
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 6761
  • Country: pl
Re: Mosfet driver for op-Amp based constant current source.
« Reply #8 on: January 20, 2022, 09:49:42 pm »
What do you mean by "always use external supply for the opamp" ? I am sorry for the circuit as it does not show the opamp power terminals. The opamp will be powered by a separate supply other than the battery.
Well, this is exactly what I mean. If the opamp has a separate supply than its internal current doesn't discharge the battery and there is no error.

Give the opamp a slightly higher supply, like 12V perhaps, and all your problems are solved. Or stay with 5V and look for a logic level MOSFET. Or darlington - its base current error will be low (easily <0.1%) due to very high β, except for low currents like a few mA (depends on type) where β decreases.
 

Offline 4krubyTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: Mosfet driver for op-Amp based constant current source.
« Reply #9 on: January 20, 2022, 09:59:38 pm »
What do you mean by "always use external supply for the opamp" ? I am sorry for the circuit as it does not show the opamp power terminals. The opamp will be powered by a separate supply other than the battery.
Well, this is exactly what I mean. If the opamp has a separate supply than its internal current doesn't discharge the battery and there is no error.
I thought you might be talking about the current consumed by the inverting input terminal of the opamp (which must be very negligible I suppose).

Give the opamp a slightly higher supply, like 12V perhaps, and all your problems are solved. Or stay with 5V and look for a logic level MOSFET. Or darlington - its base current error will be low (easily <0.1%) due to very high β, except for low currents like a few mA (depends on type) where β decreases.
Higher supply it is then. Logic level mosfets are hard to find in place where I live. I am trying to find a solution with the parts I already have.

I had one more question though. If we keep the discharge current of the battery to be very less say, below 500mA, will a medium power transistor such as 2n2222 would suffice instead of the mosfet ?
The 2n2222 is rated for atleast 600mA continous current and it does not need a heat sink right? - just curious.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Mosfet driver for op-Amp based constant current source.
« Reply #10 on: January 20, 2022, 11:00:30 pm »
I had one more question though. If we keep the discharge current of the battery to be very less say, below 500mA, will a medium power transistor such as 2n2222 would suffice instead of the mosfet ?
The 2n2222 is rated for atleast 600mA continous current and it does not need a heat sink right? - just curious.

You are still limited by the max power dissipation of the device which for the 2n2222 is 500mW.
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 6761
  • Country: pl
Re: Mosfet driver for op-Amp based constant current source.
« Reply #11 on: January 20, 2022, 11:06:58 pm »
A few 2N2222 could be connected in parallel with separate emitter resistors, if you can't find anything in TO220.
 

Offline 4krubyTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: Mosfet driver for op-Amp based constant current source.
« Reply #12 on: January 21, 2022, 04:30:08 am »
You are still limited by the max power dissipation of the device which for the 2n2222 is 500mW.
I'm sorry if this sounds absurd. But what does that mean? I can't find the junction resistance for the bjt like the mosfet.
how does this limit the current draw / operation of the circuit?

A few 2N2222 could be connected in parallel with separate emitter resistors, if you can't find anything in TO220.
I have one in TO-126 package - a D882 : http://www.ps-pfs.com/pdf/DYNATRON/D882.pdf - I think this is also a good candidate. Right?
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2389
  • Country: gb
  • Recovering Electrical Engineer
Re: Mosfet driver for op-Amp based constant current source.
« Reply #13 on: January 21, 2022, 08:41:08 am »
This kind of current source is prone to AC instabilty. Addd components as shown in this bipolar example. https://www.edn.com/error-compensation-improves-bipolar-current-sinks/

You just dont have enough headroom. If you have set the input to 4V the mosfet will have 4V subtracted from its Vgs. G is already at 4V. So the mosfet gate need Vgs +4 V to tun on.
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 6761
  • Country: pl
Re: Mosfet driver for op-Amp based constant current source.
« Reply #14 on: January 21, 2022, 10:10:20 am »
Power dissipation is collector-emitter voltage (= battery voltage) times load current (you said: 500mA). So up to 2.1W with a fully charged Li-ion battery. TO126 is OK for 2W with a heatsink.

Base current of NPN will cause error because it is measured by the 1Ω resistor but it doesn't come from the battery. Actual discharge current is ~1% lower than 1Ω resistor current (assuming β=100).
 

Offline 4krubyTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: Mosfet driver for op-Amp based constant current source.
« Reply #15 on: January 21, 2022, 11:50:03 am »
Base current of NPN will cause error because it is measured by the 1Ω resistor but it doesn't come from the battery. Actual discharge current is ~1% lower than 1Ω resistor current (assuming β=100).
I agree since the bjt's are current operated device and base current also will flow through the emitter path. Then if I need accuracy, raising up the supply voltage and using a mosfet is the better choice. The one thing I was considering is the switching frequency of the mosfet. Whether the opamp will be able to cope up with switching the mosfet ON (supplying enough current) at the switching frequency.

You just dont have enough headroom. If you have set the input to 4V the mosfet will have 4V subtracted from its Vgs. G is already at 4V. So the mosfet gate need Vgs +4 V to tun on.
I don't quite understand this statement. Do you mean that if the Gate threshold voltage is 4.5v, I need 8.5v to turn on the Mosfet? Can you please explain it?
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Mosfet driver for op-Amp based constant current source.
« Reply #16 on: January 21, 2022, 03:43:09 pm »
You just dont have enough headroom. If you have set the input to 4V the mosfet will have 4V subtracted from its Vgs. G is already at 4V. So the mosfet gate need Vgs +4 V to tun on.
I don't quite understand this statement. Do you mean that if the Gate threshold voltage is 4.5v, I need 8.5v to turn on the Mosfet? Can you please explain it?

This is based on your use of a 1 ohm shunt resistor. The MOSFET source is at I*R volts where R is the shunt resistance and the gate needs to be raised above that.
 

Offline 4krubyTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: Mosfet driver for op-Amp based constant current source.
« Reply #17 on: January 21, 2022, 04:49:14 pm »

This is based on your use of a 1 ohm shunt resistor. The MOSFET source is at I*R volts where R is the shunt resistance and the gate needs to be raised above that.
So if I understand you correctly, if the current is set to 0.5A, and if the gate threshold Vgs is 4.5 volts, then I have to apply 5v as the source will be at 0.5v right?
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Mosfet driver for op-Amp based constant current source.
« Reply #18 on: January 21, 2022, 04:52:14 pm »
Yes. Just use a smaller value shunt resistor - like 0.1R or even 0.05R. Then fix things up on the setting side with an appropriate voltage divider.
 
The following users thanked this post: 4kruby

Offline 4krubyTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: Mosfet driver for op-Amp based constant current source.
« Reply #19 on: January 21, 2022, 05:18:18 pm »
Yes. Just use a smaller value shunt resistor - like 0.1R or even 0.05R. Then fix things up on the setting side with an appropriate voltage divider.
Thanks. I understand it better now.
But I don't have lower value resistors (like 0.1R) - might order them at later point of time.
For now, I guess these modifications should work :
1. Increase the supply voltage of the opamp to 9v or 12v.
2. Determine the current (which should not be changed) - example 1A
3. Measure the opamp output and bias the mosfet gate such that it gets 5.5v (4.5 threshold + 1v source voltage).

Is the above approach good enough?

Thanks.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Mosfet driver for op-Amp based constant current source.
« Reply #20 on: January 21, 2022, 06:22:01 pm »
Sounds like a good plan. You can use multiple 1R resistors in parallel to create a lower value resistor.
 
The following users thanked this post: 4kruby

Offline Vovk_Z

  • Super Contributor
  • ***
  • Posts: 1412
  • Country: ua
Re: Mosfet driver for op-Amp based constant current source.
« Reply #21 on: January 21, 2022, 09:32:37 pm »
It is fine to have 0.5 Ohm shunt for 0.5 ADC rated current source. It'll give 0.5R*0.5A = 0.25 V voltage, just fine. (And 0.125 W dissipated across it - fine too).
So, it is two 1 Ohm resistors in parallel.
 

Offline flowib

  • Contributor
  • Posts: 35
  • Country: nl
Re: Mosfet driver for op-Amp based constant current source.
« Reply #22 on: January 23, 2022, 05:32:01 am »
10PC metal film 1R resistors in parallel will suffice as a shunt, and likely be more accurate as well.

Ideally you use something like a LT1010 or LH0002 to isolate the opamp from the mosfet capacitance.

The LH0002 internal circuitry is just four resistors and four transistors.

I like RFP12N10L for current sources but there are beter fets available, there is the IXTH80N075L2 which is nearly indestructible and designed for this application.

Delta Elektronika fanboy.
Does collecting boat anchors count as going to the gym?
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 6761
  • Country: pl
Re: Mosfet driver for op-Amp based constant current source.
« Reply #23 on: January 23, 2022, 08:33:27 am »
You don't need buffers unless for a high bandwidth load. Most simple project isolate the capacitance with a resistor if it becomes a problem and/or use an RC feedback network to stabilize the whole loop.

IXTH80N075L2 looks nice on paper but it's too large to be useful: its RthJC is less than 2x its RthCS - you lose 35% of rated dissipation simply by going from Tc=25°C to Ts=25°C ::)
Given its high price, it may be better to parallel a few smaller ones if you need that sort of power.
 

Offline 4krubyTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: Mosfet driver for op-Amp based constant current source.
« Reply #24 on: January 23, 2022, 02:16:47 pm »
Thanks for your replies guys,

My knowledge limits my understanding and I need to get some knowledge on the gate capacitance affecting the opamp

For starters,
I tried the circuit as given in the attachment, and got some results. But not accurate enough.
I set the potentiometer to 0.5V.
When I measured the current (I measured it from the 1ohm resistor to the ground), I got only 0.4A.
Why is there error of 0.1A? Is it due to accuracy of the 1 ohm resistor? or is it something else in the circuit?

Also, any improvement in the circuit is welcome.

Thanks.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Mosfet driver for op-Amp based constant current source.
« Reply #25 on: January 23, 2022, 07:14:41 pm »
Can you provide a link to the Falstad circuit?

Also, you should become familiar with LTSpice - it's a much better simulator.

https://www.analog.com/en/design-center/design-tools-and-calculators/ltspice-simulator.html
 

Offline 4krubyTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: Mosfet driver for op-Amp based constant current source.
« Reply #26 on: January 24, 2022, 05:19:58 am »
Hi,

Thanks. I am planning to learn LTspice.

The Falstad circuit is working fine. I just use the interface to draw the circuit to give a snapshot here. However, I tried the same circuit on a solderless prototype board. The circuit in simulator (Falstad) is working fine. However, in reality, it is not.

Moreover, I tried to avoid the bias resistors (to the gate of the mosfet) with the same result (I tried this since, the mosfet datasheet says that it's gate can handle +/- 20v and giving a gate voltage of 10v means that the operating region will change - in this case the Drain source can allow more current).

I am doubting on the Multimeter probes which I am using to measure the current since when I short the probes in ohmmeter mode, the reading sways between 0.3 to 0.6.
I think I have to use the current sensor like the ACS712 model and measure the voltage at its output. By that method, I think we can get a more accurate current right? Because, as per the datasheet of that current sensor IC, it outputs few millivolts for every ampere. But I doubt whether the multimeter can measure such a small voltage.

Thanks
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Mosfet driver for op-Amp based constant current source.
« Reply #27 on: January 24, 2022, 06:32:13 am »
...
Moreover, I tried to avoid the bias resistors (to the gate of the mosfet) with the same result
...

Honestly, I've never seen those bias resistors on this type of circuit.

Quote
I am doubting on the Multimeter probes which I am using to measure the current since when I short the probes in ohmmeter mode, the reading sways between 0.3 to 0.6.

It is very possible that your op-amp is oscillating. This circuit generally needs a capacitor between the op-amp output and the inverting input to quash those oscillations. Being able to look at the op-amp output on a scope would be very helpful.

This video has some good tips -- you can start at 3:35:

Electronic DC Load - Performance Improvements - theBreadboard
https://youtu.be/rh32ylmlz-A?t=3m35s

 
The following users thanked this post: 4kruby

Offline 4krubyTopic starter

  • Contributor
  • Posts: 40
  • Country: in
Re: Mosfet driver for op-Amp based constant current source.
« Reply #28 on: January 24, 2022, 07:04:16 am »
Honestly, I've never seen those bias resistors on this type of circuit.
I am confused. Didn't you mention this in
Yes. Just use a smaller value shunt resistor - like 0.1R or even 0.05R. Then fix things up on the setting side with an appropriate voltage divider.
Or is the voltage divider you mentioned here is for the input of the opamp?

It is very possible that your op-amp is oscillating. This circuit generally needs a capacitor between the op-amp output and the inverting input to quash those oscillations. Being able to look at the op-amp output on a scope would be very helpful.
Unfortunately, I don't have a scope. The two basic things I lack are a scope and a bench power supply. What value capacitor can I start with? most probably I should get the anser from the below video I suppose?

This video has some good tips -- you can start at 3:35:

Electronic DC Load - Performance Improvements - theBreadboard
https://youtu.be/rh32ylmlz-A?t=3m35s
Thanks. Let me check the video and see if I get any pointers.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3035
  • Country: us
Re: Mosfet driver for op-Amp based constant current source.
« Reply #29 on: January 24, 2022, 08:26:08 am »
Honestly, I've never seen those bias resistors on this type of circuit.
I am confused. Didn't you mention this in
Yes. Just use a smaller value shunt resistor - like 0.1R or even 0.05R. Then fix things up on the setting side with an appropriate voltage divider.
Or is the voltage divider you mentioned here is for the input of the opamp?

I meant the input of the op-amp.

What I meant by "fixing things up" is that when you change the shunt resistance you'll have to adjust the voltage to the non-inverting input of the op-amp and that can be fixed up with a voltage divider.

Usually the voltage presented on the non-inverting input is derived from a stable voltage reference -- like a TL431.

This is the video that precedes the one I mentioned:

Electronic DC Load Design and Testing -- theBreadboard
https://youtu.be/vd5IBFFjnOc

It's a little long, but might be worth watching / skipping / browsing through.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf