Author Topic: "Classic" high side current sense amp circuit  (Read 12230 times)

0 Members and 1 Guest are viewing this topic.

Offline cellularmitosisTopic starter

  • Supporter
  • ****
  • Posts: 1111
  • Country: us
"Classic" high side current sense amp circuit
« on: May 11, 2015, 03:59:08 am »
I learned today that you don't have to use a dedicated part to do high side current sensing: you can do this with plain old op amps.  This was news to me, so I thought I'd write a post to introduce the other newbies to this idea.

Disclaimer: This information isn't useful for making "real" products: dedicated parts which do this can be had for under $1.  This approach is of interest for educational purposes, and would be appropriate in an educational kit power supply current limiting circuit.

I was browsing digikey and came across the CS30.  In the datasheet, they show this functional representation of how the part works:



Later, I came across a great app note from Linear about high side current sensing, and they showed the same circuit:



I decided to throw this into LTSpice and play around with it, and sure enough it works!



However, as-is, that circuit has a few limitations.  You'd have to use a rail-to-rail op amp there, because the sense voltage would be right up at VCC, and also the VCC of your circuit would be limited to what the op amp can handle.  Also, you'll need a buffer on the output.

If we add in a few extra voltage dividers and op amps, we have a usable circuit:



This can be implemented with a quad op amp, 9 resistors, and a 2N3904.

I've attached the LTSpice files so you can have a play with it.

Use R3, R5, and R9, R10 to scale down the sensed voltage to ensure it is within the common mode range of your op amps.  Here, I've just divided it by 2, but if your op amp supply rail is e.g. 5V, you'll want to tweak those resistors to divide it further.

From what I can tell, the ratio of R2 to R8 sets the overall gain of the sensed voltage (which now has to be combined with the voltage divider's gain to calculate the overall gain).  R4 should match R2.
LTZs: KX FX MX CX PX Frank A9 QX
 

Offline cellularmitosisTopic starter

  • Supporter
  • ****
  • Posts: 1111
  • Country: us
Re: "Classic" high side current sense amp circuit
« Reply #1 on: May 11, 2015, 04:04:11 am »
I'm curious about what would be the advantages / disadvantages of using this approach vs making your own instrumentation amp to subtract the current sense offset voltage.  That's a similar number of op amps and resistors.



http://www.circuitstoday.com/instrumentation-amplifier
LTZs: KX FX MX CX PX Frank A9 QX
 

Offline cellularmitosisTopic starter

  • Supporter
  • ****
  • Posts: 1111
  • Country: us
Re: "Classic" high side current sense amp circuit
« Reply #2 on: May 11, 2015, 04:21:39 am »
Hmm, this circuit appears to be misbehaving when the load is a short.
LTZs: KX FX MX CX PX Frank A9 QX
 

Offline cellularmitosisTopic starter

  • Supporter
  • ****
  • Posts: 1111
  • Country: us
Re: "Classic" high side current sense amp circuit
« Reply #3 on: May 11, 2015, 04:29:35 am »
Ah, U1 is trying to make both inputs equal.  As soon as the inverting input drops below 1 diode drop, it can no longer do this.  This is because if there is any current flowing out of the op amp, the lowest the voltage can ever be at the top of Q1's collector is one diode drop.  Below that, the circuit goes haywire.
LTZs: KX FX MX CX PX Frank A9 QX
 

Offline TerminalJack505

  • Super Contributor
  • ***
  • Posts: 1310
  • Country: 00
Re: "Classic" high side current sense amp circuit
« Reply #4 on: May 11, 2015, 05:00:03 am »
Thanks for sharing the information.

Rob77 showed a similar circuit in this post.

It seems to work pretty well.  I'm using it in one of the circuits that I'm playing around with in the simulator.
 

Offline cellularmitosisTopic starter

  • Supporter
  • ****
  • Posts: 1111
  • Country: us
Re: "Classic" high side current sense amp circuit
« Reply #5 on: May 11, 2015, 05:35:02 am »
TerminalJack505, Thanks for the link!  Interesting circuit.  That's the first time I've ever seen the negative power rail of an op amp "hang" off of another rail via a zener.  Interesting idea :)
LTZs: KX FX MX CX PX Frank A9 QX
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21732
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: "Classic" high side current sense amp circuit
« Reply #6 on: May 11, 2015, 05:59:22 am »
Primary drawbacks are CMRR (ever try sensing a flying shunt on a switching inductor?) and unidirectional operation.  Bias current, and errors thereof, are another drawback (transistor bias current, and base current error).

The AD8210 solves bidirectional operation in a reasonable manner.  The internal equivalent schematic is basically the mirror double of the above circuit.  It's not entirely apparent what its "fully differential" op-amp is doing (what's Vcm set or controlled to?), but in any case, one could very easily be made in a similar way with a little study.  The CMRR is quite a bit better than most, probably due to that symmetry.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline ludzinc

  • Supporter
  • ****
  • Posts: 506
  • Country: au
    • My Misadventures In Engineering
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5320
  • Country: gb
Re: "Classic" high side current sense amp circuit
« Reply #8 on: May 11, 2015, 06:54:23 am »
Practically speaking, using a pair of resistor voltage dividers to try to take the current sense voltage below the rails doesn't work becuase of the resistor tolerances.

The typically small voltage drop across the sense resistor will be swamped by any divider resistor tolerance differences, so getting an accurate absolute value isn't possible in the real world.
 

Offline cellularmitosisTopic starter

  • Supporter
  • ****
  • Posts: 1111
  • Country: us
Re: "Classic" high side current sense amp circuit
« Reply #9 on: May 11, 2015, 02:24:18 pm »
Howardlong, I'm not sure I understand.  Wouldn't the voltage divider resistors cause an error which scales with the signal?  If the resistors are out by 1%, it doesn't matter how small the signal is, because the error will scale with the signal.

But the input offset voltage of the op amps would create the kind of problem you are referring to, where as you make the signal smaller and smaller, eventually it gets swamped by Vos.
LTZs: KX FX MX CX PX Frank A9 QX
 


Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3244
  • Country: gb
Re: "Classic" high side current sense amp circuit
« Reply #11 on: May 11, 2015, 05:16:48 pm »
Howardlong, I'm not sure I understand.  Wouldn't the voltage divider resistors cause an error which scales with the signal?  If the resistors are out by 1%, it doesn't matter how small the signal is, because the error will scale with the signal.

Having mismatched resistors ruins the CMRR, so if the voltage supply was unregulated the output would vary as the voltage changed.
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5320
  • Country: gb
Re: "Classic" high side current sense amp circuit
« Reply #12 on: May 11, 2015, 07:13:06 pm »
Howardlong, I'm not sure I understand.  Wouldn't the voltage divider resistors cause an error which scales with the signal?  If the resistors are out by 1%, it doesn't matter how small the signal is, because the error will scale with the signal.

But the input offset voltage of the op amps would create the kind of problem you are referring to, where as you make the signal smaller and smaller, eventually it gets swamped by Vos.

No, it's that the relatively small voltage drop across the sense resistor is likely to be of similar magnitude to the errors incurred by 1% resistors in the voltage divider.

See the attached spreadsheet I made up for you.

In the first case, we have perfectly matched resistors:



All good. The difference in the + inputs to U2 and U3 are what we'd expect.

Now say R3 is 1% high in resistance:



As you can see, you now have a significant negative offset, not only that, but can the next stage even deal with a negative offset?

Here is the worst case in that direction:



... and the worst case in the other direction:



So the main problem is that the resistor tolerances inevitably introduce offsets. You can reduce the impact to some degree by increasing the R1 sense resistor, but then you'll be wasting more power in your sense resistor. Either that or go for 0.1% or better resistors, with a shock to the BOM cost. Or trimpots, which adds to your production line costs.

That is why I don't recommend using voltage dividers on current shunt resistors.

Edit: How do I know this? Been there, done that, have appropriate scars. It is boldly recommended in a Microchip datasheet of all places (MCP19111) to allow the device to provide outputs over 3.6V, due to a pin voltage limit (http://ww1.microchip.com/downloads/en/DeviceDoc/20002331B.pdf). I raised a ticket on how this could ever work but got nowhere. I did indeed wire it up, and it behaved as I expected, i.e. there was a significant offset on the current sense. I don't think they ever tried it.
« Last Edit: May 11, 2015, 07:30:58 pm by Howardlong »
 
The following users thanked this post: cellularmitosis

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6726
  • Country: nl
Re: "Classic" high side current sense amp circuit
« Reply #13 on: May 11, 2015, 08:18:47 pm »
Edit: How do I know this? Been there, done that, have appropriate scars. It is boldly recommended in a Microchip datasheet of all places (MCP19111) to allow the device to provide outputs over 3.6V, due to a pin voltage limit (http://ww1.microchip.com/downloads/en/DeviceDoc/20002331B.pdf). I raised a ticket on how this could ever work but got nowhere. I did indeed wire it up, and it behaved as I expected, i.e. there was a significant offset on the current sense. I don't think they ever tried it.

Don't they only mean you need a divider for the Vsen feedback? I don't see any mention of common mode limits for the current sense amplifier.
 

Offline cellularmitosisTopic starter

  • Supporter
  • ****
  • Posts: 1111
  • Country: us
Re: "Classic" high side current sense amp circuit
« Reply #14 on: May 11, 2015, 09:59:03 pm »
Howard, thanks a lot for taking the time to illustrate your point.  That really helped me understand the problem.

After work I'll reproduce your spreadsheet as a Google doc to reinforce the lesson and so future readers of this thread can play with it.
LTZs: KX FX MX CX PX Frank A9 QX
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5320
  • Country: gb
Re: "Classic" high side current sense amp circuit
« Reply #15 on: May 11, 2015, 11:50:57 pm »
Edit: How do I know this? Been there, done that, have appropriate scars. It is boldly recommended in a Microchip datasheet of all places (MCP19111) to allow the device to provide outputs over 3.6V, due to a pin voltage limit (http://ww1.microchip.com/downloads/en/DeviceDoc/20002331B.pdf). I raised a ticket on how this could ever work but got nowhere. I did indeed wire it up, and it behaved as I expected, i.e. there was a significant offset on the current sense. I don't think they ever tried it.

Don't they only mean you need a divider for the Vsen feedback? I don't see any mention of common mode limits for the current sense amplifier.

Section 4.1, max voltage on any pin except those named is VDD+0.3V, and VDD is internally regulated to 5V. I needed 7.4V.

 

steverino

  • Guest
Re: "Classic" high side current sense amp circuit
« Reply #16 on: January 05, 2018, 12:53:58 am »
Sorry to resurrect an old post, but it was recently referenced in the post https://www.eevblog.com/forum/projects/sensing-voltage-current-glitches-on-5v-rail-schematic-enhancements/. 

I just wanted to comment that this post demonstrates why images should be stored locally on the eevblog forum.  All of Howardlong's (hi nezbrun!) images have vanished (remotely stored in photobucket, which has changed it's hosting terms).  Now, imagine if OP cellularmitosis' images were likewise unavailable -- it would make this valuable post useless.

Perhaps David should write a script to replace all remote images with a local copy.  I know this involves more storage space, i.e. $$, but in 10 years the eevblog archives will be severly limited.

This is probably the wrong place to post this, but it's such a good example of the drawbacks of remote image storage.

-Steve
 
The following users thanked this post: cellularmitosis, nugglix

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3244
  • Country: gb
Re: "Classic" high side current sense amp circuit
« Reply #17 on: January 05, 2018, 03:17:27 pm »
There are various browser plugins to resurrect dead photobucket links (I see all of Howard's pictures through Firefox), but I suspect PB will be trying to stop these working.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf