• Forums
• Posts
Latest Posts
Active Posts
Recently Visited
Search Results
• Page Extras
• Forum Themes

### Measuring Current through a Mosfet - Guidance needed

Author
Super Member
• Total Posts : 1444
• Reward points : 0
• Joined: 2005/11/02 13:58:11
• Location: Indianapolis, Indiana
• Status: offline
0

# Measuring Current through a Mosfet - Guidance needed

All,

As some of you know, I'm preparing to drive a couple of 12V 15A motors through an N-Channel Low-Side MOSFET.  I'm using an 18F4620 with a bunch of free I/O and analog inputs.  One of the things I'm considering is trying to measure the current through the motor by measuring the voltage on the Drain of the MOSFET.  RDS is about 17mOhms.

Two questions:

1.  Anybody with experience on how well this works?  I'm anticipating only using this at 100% duty cycle.  I assume I'll need to also measure the Gate Voltage at any given time in order to guess at RDS.  Sound good?

2.  Obviously, I can't hook the Drain directly to the A/D, as the voltage on the drain will be 12V at 0% duty cycyle.  How to deal with this?  An op amp?  What about flyback voltage?  If an op-amp is the right answer, can you recommend a part #?  I'd like a part which doesn't require a negative supply.

Thanks,
Jon

http://www.serialwombat.com
When someone asks you "Can't you just...", watch out.

### 14 Replies Related Threads

DarioG
• Total Posts : 53195
• Reward points : 0
• Joined: 2006/02/25 08:58:22
• Location: porcodioland
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/12 10:23:00 (permalink)
0
Hmmm, well, are you going to measure current for *every* PWM cycle?
Which is its frequency?

As for 2), I'd say that a single resistor divider could be enough - scaling the 12V to 5V. Resistor could be low enough to fit PIC's requirements, since they're driven by the Mosfet's i.e. power-side. Spikes etc should not hurt since the resistor(s) would cut them.

I'm just guessing though...

miami bridge is falling down, falling down ♪ :)

Super Member
• Total Posts : 2504
• Reward points : 0
• Joined: 2006/03/27 22:51:42
• Location: Turkey
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/12 10:34:15 (permalink)
0
I dont think it is a good idea to measure the voltage across Rds because its value changes due to temperature and the gate voltage .
I usually I use the shunt resistor method, for example 0,1 ohm 50watt resistor placed between the source of teh mosfet and ground ( for low side  mosfet ) and using opamps to amplify the voltage across the shunt resistor  and then using A/D of PIC + calculations  , the opamps should be rail to rail powered  , because you might need some negative or positive offset voltages to celebrate the output of the opamps to 0v when no current through in your motor . Also due to the swiching frequency from PWM you need to design a good  low pass filter to hang the unwanted high frequencies in order not to disturb your A/D readings .

Hope it helps .

jpopelish
Super Member
• Total Posts : 314
• Reward points : 0
• Joined: 2003/11/07 12:39:20
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/12 11:03:58 (permalink)
0
Using the mosfet channel resistance as a current to voltage converter is very rough.  Good for protecting the MOSFET from overload is about all it is good for.

I would go with a 4 terminal (if available) current shunt resistor in the source lead.  A 0.01 ohm would produce 150 millivolts of signal at 15 amps, with heat production of only 2.25 watts.  This can easily be scalled up to about 4.5 volts with a non inverting opamp configuration with a gain of 30.   Something like the Microchip MCP6021 or MCP6022 (rail-to-rail, 5 volt supply 10MHz) opamp would probably work well.

You should still control the flyback voltage to protect the MOSFET.

--
Regards,

John Popelish
Super Member
• Total Posts : 1444
• Reward points : 0
• Joined: 2005/11/02 13:58:11
• Location: Indianapolis, Indiana
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/12 11:06:30 (permalink)
0

I dont think it is a good idea to measure the voltage across Rds because its value changes due to temperature and the gate voltage .
I usually I use the shunt resistor method, for example 0,1 ohm 50watt resistor placed between the source of teh mosfet and ground ( for low side  mosfet ) and using opamps to amplify the voltage across the shunt resistor  and then using A/D of PIC + calculations  , the opamps should be rail to rail powered  , because you might need some negative or positive offset voltages to celebrate the output of the opamps to 0v when no current through in your motor . Also due to the swiching frequency from PWM you need to design a good  low pass filter to hang the unwanted high frequencies in order not to disturb your A/D readings .

Hope it helps .

Thanks, guys.  I was hoping to use the value at the Drain, as this would also allow me to detect open circuit when Vgs = 0.  But, like I said, I've got lots of pins, so maybe I'll do both!

The PWM shouldn't be a problem.  I'll likely only take samples when I'm at 100% duty cycle, which should be the most common state of operation (along with 0%).  I really don't need the current information, but this is a "for fun" type project, and I've got the pins, so why not?

http://www.serialwombat.com
When someone asks you "Can't you just...", watch out.
DSchabel
Super Member
• Total Posts : 1714
• Reward points : 0
• Joined: 2005/05/24 14:00:34
• Location: Western NY State
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/12 11:09:42 (permalink)
0

I dont think it is a good idea to measure the voltage across Rds because its value changes due to temperature and the gate voltage .

I certainly agree with this.

You can usually go 2 routes to measure the current:  a shunt resistor, as has already been suggested, or a hall-effect current measurement device (such as the Sentron CSA-1V Current Sensor or the Allegro Current Sensors).

Bob_Blick
New Member
• Total Posts : 11
• Reward points : 0
• Joined: 2008/04/14 09:34:37
• Location: San Francisco - USA
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/13 10:16:08 (permalink)
0
Using the mosfet's resistance to measure current is not a good idea because it will be wildly inaccurate. However, if you just want to detect if the mosfet is under stress it is quite valid. If you'd like to see an example of it(schematics and code) in a project I did, take a look at:

http://bobblick.com/techref/projects/sv2hb/sv2hb.html

The bridges used Darlington transistors in this example but I have also used it with mosfets, changing the resistor values to trigger at a lower voltage. Basically if the voltage across the mosfet is over the "high" threshold of a pic digital I/O pin(don't use pins with schmitt trigger thresholds, use the ones with TTL levels) it aborts the PWM for that cycle. So it protects the mosfets from overcurrent at every cycle and it's quite effective.

Note that if you are using analog inputs to measure the motor current you must also pay attention to the PWM frequency to make sure your acquisition has some basis in reality - during any PWM cycle the current is changing. So look at what point you are sampling the current. And/or filter the signal for some sort of average. I wanted instantaneous protection so that's why I did it with a digital pin. You could also use comparators.

Hope this helps.

Cheerful regards,

Bob
Super Member
• Total Posts : 1444
• Reward points : 0
• Joined: 2005/11/02 13:58:11
• Location: Indianapolis, Indiana
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/13 10:32:28 (permalink)
0
Thanks, Bob.  It sounds like you're doing exactly what I'm looking for with regard to the diagnostic aspect.

You'll be happy to know that your site is entertaining, or at least my corporate firewall thinks it is ( ACCESS DENIED- Reason: Entertainment ).

I'll check out the schematic at home.

http://www.serialwombat.com
When someone asks you "Can't you just...", watch out.
DSchabel
Super Member
• Total Posts : 1714
• Reward points : 0
• Joined: 2005/05/24 14:00:34
• Location: Western NY State
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/13 10:43:39 (permalink)
0

Thanks, Bob.  It sounds like you're doing exactly what I'm looking for with regard to the diagnostic aspect.

You'll be happy to know that your site is entertaining, or at least my corporate firewall thinks it is ( ACCESS DENIED- Reason: Entertainment ).

I'll check out the schematic at home.

Hmmm ... but you said you were trying to MEASURE the current in your first post.

OK, what Bob is referring to is normally called "Desat" detection.  It's meant to detect when a FET (or IGBT) is out of saturation as indicated by the voltage present between the drain and source (or emitter and collector).  Google de-sat or desat.  You'll find a plethora of ways to detect this.

Super Member
• Total Posts : 1444
• Reward points : 0
• Joined: 2005/11/02 13:58:11
• Location: Indianapolis, Indiana
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/13 10:55:05 (permalink)
0
Oh... Desat protection.  That's something I hadn't thought about.  Basically, I originally thought I could do the following:

1.  Detect open circuit.  The Voltage at D should be around 12V if Vgs is around 0.  If not, it's open.  This assumes a high value pull-down resistor
2.  Detect a short circuit.  When Vgs is around 12V, the voltage at D should be pretty low (under a volt).  If it's not, then D must be shorted to battery.
3.  Detect the current when Vgs is around 12V by measuring voltage at D and using ohms law with an estimation of what Rds should be.

"3" obviously doesn't work, because it isn't fiesable to estimate Rds with any accuracy.  It appears that "2" could be the result of either a short in the motor, or a Desat condition.  In either case, i want to shut down.

http://www.serialwombat.com
When someone asks you "Can't you just...", watch out.
DSchabel
Super Member
• Total Posts : 1714
• Reward points : 0
• Joined: 2005/05/24 14:00:34
• Location: Western NY State
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/13 11:38:03 (permalink)
0

Oh... Desat protection.  That's something I hadn't thought about.  Basically, I originally thought I could do the following:

1.  Detect open circuit.  The Voltage at D should be around 12V if Vgs is around 0.  If not, it's open.  This assumes a high value pull-down resistor
2.  Detect a short circuit.  When Vgs is around 12V, the voltage at D should be pretty low (under a volt).  If it's not, then D must be shorted to battery.
3.  Detect the current when Vgs is around 12V by measuring voltage at D and using ohms law with an estimation of what Rds should be.

"3" obviously doesn't work, because it isn't fiesable to estimate Rds with any accuracy.  It appears that "2" could be the result of either a short in the motor, or a Desat condition.  In either case, i want to shut down.

#2. IS one way to detect Desat.  In other words, the FET is out of saturation due to a short to V+.  By definition, this IS Desat.

dchisholm
Super Member
• Total Posts : 3805
• Reward points : 0
• Joined: 2003/12/14 15:30:12
• Location: St Louis Mo
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/13 22:31:22 (permalink)
0
ORIGINAL: DSchabel

I dont think it is a good idea to measure the voltage across Rds because its value changes due to temperature and the gate voltage .

I certainly agree with this.

You can usually go 2 routes to measure the current:  a shunt resistor, as has already been suggested, or a hall-effect current measurement device (such as the Sentron CSA-1V Current Sensor or the Allegro Current Sensors).
Tally another vote that Rds is too loosely controlled and too variable for use in any meaningful measurement.

I have noticed several manufacturers offer special-purpose IC's designed expressly for the problem of high-side current sensing. (Linear Technology "LT6105" might be a number I remember correctly, but TI and Analog Devices have similar products.)  As I recall, the idea is to use a differential amp with near-instrument amp performance to measure the drop across a small resistor, amplify the voltage, and translate it down to a ground-referenced value.  I think some of these even have built-in sense resistors of a few milliohms.

Dale
Dutar
New Member
• Total Posts : 28
• Reward points : 0
• Joined: 2007/04/02 00:58:42
• Location: Tokyo
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/16 04:52:29 (permalink)
0
There is a FET catogary called "Logic MOSFET" (Logic Level MOSFET), which can hookup directly to a microprocessor. Their gate use 5V TTL/CMOS. You can find them with various voltage and current ratings from prety much all the leading manufactures.
kalpak
Super Member
• Total Posts : 3265
• Reward points : 0
• Joined: 2004/03/12 23:01:40
• Location: India
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/16 23:46:40 (permalink)
0
How about using one of the "INTELLIGENT POWER SWITCH" from IR? They come with short circuit protection.
DSchabel
Super Member
• Total Posts : 1714
• Reward points : 0
• Joined: 2005/05/24 14:00:34
• Location: Western NY State
• Status: offline
RE: Measuring Current through a Mosfet - Guidance needed 2008/05/17 12:34:01 (permalink)
0
ORIGINAL: kalpak

How about using one of the "INTELLIGENT POWER SWITCH" from IR? They come with short circuit protection.

Yeah, or else just put a current limiter in the high side.  Anything from a PTC fuse to a transistor circuit to one of the very nifty new current limit chips such as the LT4356-1 or the LM5069.  I love these!

You could provide individual limits to each motor power, or just have one circuit to power both motors.