Author Topic: High side current sensing  (Read 2643 times)

0 Members and 1 Guest are viewing this topic.

Offline TomS_Topic starter

  • Frequent Contributor
  • **
  • Posts: 851
  • Country: gb
High side current sensing
« on: December 19, 2021, 05:34:02 pm »
Hi all.

Im working on a re-design of a little relay controller that I made for a solar setup on my garage that I use to keep my motorbike battery topped up when not using it (which is more often than not these days). Basically it just sequences a couple of relays to connect and disconnect a charger from the battery and supply in the correct order.

Im re-working it to also include some voltage monitoring which will be reported back using LoRaWAN, and will feed in to some kind of algorithm to only start charging when battery voltage falls below a level and also when solar voltage is suitably high (my current controller just turns the charger on between x-y hours of the day, so Im hoping to make things a little more clever).

As a stretch goal I also want to include current monitoring to see how much is being drawn from the solar panel. No other reason except for a bit of a challenge and some more interesting stats.

Ive been looking into the subject a little, and I think I am settling on high side current sensing, as it seems that this is less suscepitble to noise than low side sensing.

My specs are:

* 10A maximum current
* 3.3V operation for the opamp, rail to rail
* Assuming 100mV per A from sense resistor as an example

Based on these figures I believe that my opamp needs to provide 3x amplification and to get this I could use R12=R14=33K with R13=R15=11K, which would get me 3V at 10A (providing a little leeway).

Does this sound correct?

Ive spec'd the MCP602 opamp because it seems to fit the bill, but open to suggestions for something better/more appropriate.

Thanks!
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13120
Re: High side current sensing
« Reply #1 on: December 19, 2021, 05:49:39 pm »
MCP602 common mode input range is Vss-0.3V to Vdd-1.2V.
Your Vdd is 3.3V, so the upper common mode range limit is 2.1V.
R12:R13 form a 4:1 potential divider so the maximum permissible input voltage on X3-4 is 8.4V

Unless your solar setup's battery is only a 2S LiPO, that isn't enough!

Hint: either use a dedicated high side current sense amp IC rated for your max DC bus voltage, or an 'over the top' OPAMP.
« Last Edit: December 19, 2021, 06:04:38 pm by Ian.M »
 
The following users thanked this post: TomS_

Offline bugnate

  • Regular Contributor
  • *
  • Posts: 58
  • Country: us
Re: High side current sensing
« Reply #2 on: December 19, 2021, 06:00:09 pm »
I too would suggest looking into a dedicated IC e.g., INA138, although for this particular chip datasheet says 500mV full scale from sense resistor, so you'd have to dial back that spec a bit. Or you could find something else.
« Last Edit: December 19, 2021, 06:06:49 pm by bugnate »
 
The following users thanked this post: TomS_

Offline TomS_Topic starter

  • Frequent Contributor
  • **
  • Posts: 851
  • Country: gb
Re: High side current sensing
« Reply #3 on: December 19, 2021, 06:35:39 pm »
Swing and a miss. Back to the drawing board.  ^-^

This is why I tend to stay away from analog electronics I guess. Its too difficult when nothing is "ideal".  :-DD

Quote from: Ian.M
Unless your solar setup's battery is only a 2S LiPO, that isn't enough!
Batteries are lead acid - nothing fancy. The controller runs off an old car battery because its what I had laying around. It is charged up by its own charger, but never turns off.

Quote from: bugnate
INA138, although for this particular chip datasheet says 500mV full scale from sense resistor
I kind of think that maybe a shunt would be more appropriate. They seem to give less mV per A, so should fall within the specs of this chip better. Or I could use a divider to cut the input in half maybe?

 

Offline rfclown

  • Frequent Contributor
  • **
  • Posts: 416
  • Country: us
Re: High side current sensing
« Reply #4 on: December 19, 2021, 06:49:46 pm »
 LinearTech app note attached. I've used the arrangements with an NPN like on page 8.
 

Offline Leo Bodnar

  • Frequent Contributor
  • **
  • Posts: 814
  • Country: gb
Re: High side current sensing
« Reply #5 on: December 19, 2021, 08:19:28 pm »
Is MCP602 a requirement?

How about something designed for this purpose like https://www.diodes.com/assets/Datasheets/ZXCT1021.pdf

I have stopped using any Microchip analogue parts after a few bad experiences with their instrumentation opamps and voltage monitors.

Leo

Offline bugnate

  • Regular Contributor
  • *
  • Posts: 58
  • Country: us
Re: High side current sensing
« Reply #6 on: December 19, 2021, 08:32:54 pm »
I kind of think that maybe a shunt would be more appropriate. They seem to give less mV per A, so should fall within the specs of this chip better. Or I could use a divider to cut the input in half maybe?
It seems to me that for a relatively simple app like this (and in the absence of performance specs) it will not be difficult to get a useful result any which way you do it. Don't forget to low-pass the output. You didn't mention a bandwidth but having done other solar charging projects I'd think you don't need more than about 10 Hz or maybe even 1 Hz. From there you are in the usual ADC implementation game. If the low-pass C is big enough and the sampling rate is low enough, you shouldn't need to buffer.
« Last Edit: December 19, 2021, 08:44:52 pm by bugnate »
 

Offline TomS_Topic starter

  • Frequent Contributor
  • **
  • Posts: 851
  • Country: gb
Re: High side current sensing
« Reply #7 on: December 19, 2021, 09:20:30 pm »
It seems to me that for a relatively simple app like this (and in the absence of performance specs) it will not be difficult to get a useful result any which way you do it.
My rough plan for solar voltage is to sample once per second and record an average over a minute, and capture min/max per minute as well. For the motorbike battery voltage I don't know if sampling once per second or even minute is worth it, so I may only do that once every 5 minutes perhaps.

I certainly don't need anything highly accurate. Im not looking for mA precision because I'm likely going to drop a couple of LSb from my ADC readings to fit the values into single bytes for TX over LoRaWAN. I think I'm going to be limited to about 4mA resolution at best, but I'd be happy with 50-100mA in all honesty.

Same with voltage. 50-100mV would be perfectly fine with me. This isn't precision instrument country. :-)
 

Offline TomS_Topic starter

  • Frequent Contributor
  • **
  • Posts: 851
  • Country: gb
Re: High side current sensing
« Reply #8 on: December 19, 2021, 09:23:47 pm »
Is MCP602 a requirement?
Definitely not a requirement, and it doesn't look like I can use it anyway.

I found the INA186 I think it was which looked quite good, but I'm going to need to spend more time looking into these things. Have to figure out the shunt/resistor situation and how much gain such a current sense amp would then require.
 

Offline TomS_Topic starter

  • Frequent Contributor
  • **
  • Posts: 851
  • Country: gb
Re: High side current sensing
« Reply #9 on: December 19, 2021, 10:15:16 pm »
If I can calculate anything at all, I think the following works:

INA186A2 which has a gain of 50 (these seem to be in stock at Mouser, just barely).

Sense resistor of 5mOhm, 1-2 watts rating (e.g. https://uk.rs-online.com/web/p/through-hole-resistors/6926737)

10A current results in 50mV across the resistor, gain of 50 gives 2.5V out of the INA186.

Or have I got it wrong again?

Thanks all! :-)
 

Offline bugnate

  • Regular Contributor
  • *
  • Posts: 58
  • Country: us
Re: High side current sensing
« Reply #10 on: December 20, 2021, 01:43:32 am »
If I can calculate anything at all, I think the following works:

INA186A2 which has a gain of 50 (these seem to be in stock at Mouser, just barely).

Sense resistor of 5mOhm, 1-2 watts rating (e.g. https://uk.rs-online.com/web/p/through-hole-resistors/6926737)

10A current results in 50mV across the resistor, gain of 50 gives 2.5V out of the INA186.

Or have I got it wrong again?

Thanks all! :-)
Looks perfectly reasonable to me. Have at it!
 
The following users thanked this post: Ian.M

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13120
Re: High side current sensing
« Reply #11 on: December 20, 2021, 03:36:13 am »
Yep, that looks sane for a nom. 12V or 24V system.  Its worth noting that the SOT23-6 package variant with a REF input pin can be setup to read current in both directions, or toggled between reading forward and reverse current, and current overload merely causes the output to limit, so you *COULD* use this one for monitoring the current balance into/outof the battery.  Sense the charging current with REF grounded, and if its zero, set REF to the voltage required to measure negative current, and measure the discharge current if any.

Also, I'd suggest a combo of the Figure 8-5 'Transient Protection Using a Single Transzorb and Input Clamps' and  Figure 8-2 'Filter at the Input Pins', for robustness and also to smooth the current reading so you don't have to sample it so fast to get a valid average.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10229
  • Country: nz
Re: High side current sensing
« Reply #12 on: December 20, 2021, 03:50:17 am »
Depending on your requirements, the VN5E010AH might work well as a single chip solution. I've used them before.  The downside is they are pretty hard to get at the moment.
https://www.st.com/resource/en/datasheet/vn5e010ah.pdf

High side load switch, it can do over 10A due to built in 10mR fet. It also does all the current sensing for you and produces an amplified Isense output voltage.
Comes with over temp protection, reverse polarity protection, transient spike protection etc..

VN5E010AH is out of stock at digikey atm, but there are other VN5xxx versions that are similar, in stock, and might be suitable.

Looks likes digikey have some stock of the VN5016AJ-E.
That one is 16mR instead of 10mR, so you will need to design some good PCB heatsinking or just thermal epoxy a small heatsink on top of the IC.


« Last Edit: December 20, 2021, 04:05:15 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline TomS_Topic starter

  • Frequent Contributor
  • **
  • Posts: 851
  • Country: gb
Re: High side current sensing
« Reply #13 on: December 20, 2021, 09:39:39 am »
Looks perfectly reasonable to me. Have at it!

Great! Thanks for your sanity check! :-)
 

Offline TomS_Topic starter

  • Frequent Contributor
  • **
  • Posts: 851
  • Country: gb
Re: High side current sensing
« Reply #14 on: December 20, 2021, 09:54:59 am »
Also, I'd suggest a combo of the Figure 8-5 'Transient Protection Using a Single Transzorb and Input Clamps' and  Figure 8-2 'Filter at the Input Pins', for robustness and also to smooth the current reading so you don't have to sample it so fast to get a valid average.

Ah yep, I added some footprints for series resistors and a capacitor across the inputs, since footprints are basically free - if I didn't implement that I could just add 0ohm jumpers to hook the sense amp straight up. I'll take a look at the transient protection as well (on the road for the next couple of days now).

I wasn't planning on monitoring the battery charging current, but that's got me thinking now... The battery charger itself is a max of 5A so I could just hook the ref pin up to a voltage divider to give me charge and discharge off the bat. Although the 6 pin package is a SO70 which is sooooo tiny...

Could I also potentially tap off either of the sense wires into a voltage divider to read the voltage as well as current sensing from a single "measuring point", or would that just mess things up on the current sensing side (by increasing the current draw across that wire) and I'd be better off running a second, separate wire for the voltage sensing?

Thanks for your help!
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13120
Re: High side current sensing
« Reply #15 on: December 20, 2021, 10:01:13 am »
As long as you tap off on the 'hot' side of the 1K input resistors, there's no problem using the same wire for voltage sensing, if the voltage drop between the battery terminal and the shunt due to load or charging current is low enough to be negligible.  Don't forget to fuse the high side sense wires as close as possible to the shunt terminals, e.g. with a 100mA fuse in an inline holder or a suitable polyfuse to prevent disaster if the controller end ever gets shorted to ground.
 

Offline TomS_Topic starter

  • Frequent Contributor
  • **
  • Posts: 851
  • Country: gb
Re: High side current sensing
« Reply #16 on: December 20, 2021, 11:04:44 am »
I was intending to use reasonably high value resistors to draw as little current as possible from the battery. Something like 47K over 10K for example for some level of uA, and since I don't need to be sampling at a crazy high speed.

I think perhaps a few experiments wouldn't go astray before committing to a design.
 

Online Terry Bites

  • Super Contributor
  • ***
  • Posts: 2515
  • Country: gb
  • Recovering Electrical Engineer
Re: High side current sensing
« Reply #17 on: December 20, 2021, 04:52:04 pm »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: us
Re: High side current sensing
« Reply #18 on: December 20, 2021, 06:06:38 pm »
A standard for instrumentation and control is a 50 mV shunt.  It is a resistor that drops 50 mV at rated current and that can range from 1A up to thousands of amps depending on the model.

Google for '50 mV shunts'

These will work well with a high side current sense amplifier.
 

Offline Leo Bodnar

  • Frequent Contributor
  • **
  • Posts: 814
  • Country: gb
Re: High side current sensing
« Reply #19 on: December 20, 2021, 07:37:06 pm »
I can see a few niggles with this circuit - base current being ignored and requirement for either opamp power exceeding the PSU voltage or rail-to-rail input opamp.  I think it is just a conceptual piece rather than solid project.
Leo
Take the old school way https://www.allaboutcircuits.com/technical-articles/how-to-monitor-current-with-an-op-amp-a-bjt-and-three-resistors/
Dont go bonkers with current sense amps and such.

P.S. Oh well, read the comments.  Few people complain they built it and it does not work.
The author says: No, I didn't build the circuit. The Analog Circuit Collection articles are not intended to explain or evaluate a specific implementation. They present a general topology and some generic simulations; the details of a real-world implementation will vary according to the conditions and requirements of each application.
Jim Williams made it very hard for EE mag writers to pull a fast one.
P.P.S. Luckily, Bob Pease can't see where we have ended up.
« Last Edit: December 20, 2021, 07:43:35 pm by Leo Bodnar »
 

Offline coromonadalix

  • Super Contributor
  • ***
  • Posts: 6651
  • Country: ca
Re: High side current sensing
« Reply #20 on: December 21, 2021, 03:46:52 am »
ACS hall effect current sensors ??
 

Offline xavier60

  • Super Contributor
  • ***
  • Posts: 2977
  • Country: au
Re: High side current sensing
« Reply #21 on: December 21, 2021, 06:44:33 am »
I can see a few niggles with this circuit - base current being ignored and requirement for either opamp power exceeding the PSU voltage or rail-to-rail input opamp.  I think it is just a conceptual piece rather than solid project.
Leo
Take the old school way https://www.allaboutcircuits.com/technical-articles/how-to-monitor-current-with-an-op-amp-a-bjt-and-three-resistors/
Dont go bonkers with current sense amps and such.

P.S. Oh well, read the comments.  Few people complain they built it and it does not work.
The author says: No, I didn't build the circuit. The Analog Circuit Collection articles are not intended to explain or evaluate a specific implementation. They present a general topology and some generic simulations; the details of a real-world implementation will vary according to the conditions and requirements of each application.
Jim Williams made it very hard for EE mag writers to pull a fast one.
P.P.S. Luckily, Bob Pease can't see where we have ended up.
The idea can be made to work well and it can be powered down by breaking the current path through R2.
https://www.eevblog.com/forum/projects/improving-adjustable-dual-voltage-bench-power-supply/msg3014970/#msg3014970
https://www.eevblog.com/forum/projects/improving-adjustable-dual-voltage-bench-power-supply/msg3021268/#msg3021268
Ignore the diode, it's not needed when a suitable opamp is used.
« Last Edit: December 21, 2021, 06:49:02 am by xavier60 »
HP 54645A dso, Fluke 87V dmm,  Agilent U8002A psu,  FY6600 function gen,  Brymen BM857S, HAKKO FM-204, New! HAKKO FX-971.
 

Offline EPAIII

  • Super Contributor
  • ***
  • Posts: 1156
  • Country: us
Re: High side current sensing
« Reply #22 on: December 21, 2021, 07:34:28 am »
That's what I was thinking. No DC coupling and no resistive losses.

Win, win, win!



ACS hall effect current sensors ??
Paul A.  -   SE Texas
And if you look REAL close at an analog signal,
You will find that it has discrete steps.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf