High side current sensing - Page 1
Forum section: electronics / projects

author: TomS_
author_rank: Frequent Contributor
timestamp: December 19, 2021, 05:34:02 pm
content: 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 exampleBased 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!

author: Ian.M
author_rank: Super Contributor
timestamp: December 19, 2021, 05:49:39 pm
content: 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.4VUnless 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.

author: bugnate
author_rank: Regular Contributor
timestamp: December 19, 2021, 06:00:09 pm
content: 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.

author: TomS_
author_rank: Frequent Contributor
timestamp: December 19, 2021, 06:35:39 pm
content: 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".Quote from: Ian.MBatteries 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: bugnateI 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?

author: rfclown
author_rank: Frequent Contributor
timestamp: December 19, 2021, 06:49:46 pm
content: LinearTech app note attached. I've used the arrangements with an NPN like on page 8.

author: Leo Bodnar
author_rank: Frequent Contributor
timestamp: December 19, 2021, 08:19:28 pm
content: Is MCP602 a requirement?How about something designed for this purpose likehttps://www.diodes.com/assets/Datasheets/ZXCT1021.pdfI have stopped using any Microchip analogue parts after a few bad experiences with their instrumentation opamps and voltage monitors.Leo

author: bugnate
author_rank: Regular Contributor
timestamp: December 19, 2021, 08:32:54 pm
content: Quote from: TomS_ on December 19, 2021, 06:35:39 pmIt 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.

author: TomS_
author_rank: Frequent Contributor
timestamp: December 19, 2021, 09:20:30 pm
content: Quote from: bugnate on December 19, 2021, 08:32:54 pmMy 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. :-)

author: TomS_
author_rank: Frequent Contributor
timestamp: December 19, 2021, 09:23:47 pm
content: Quote from: Leo Bodnar on December 19, 2021, 08:19:28 pmDefinitely 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.

author: TomS_
author_rank: Frequent Contributor
timestamp: December 19, 2021, 10:15:16 pm
content: 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! :-)

author: bugnate
author_rank: Regular Contributor
timestamp: December 20, 2021, 01:43:32 am
content: Quote from: TomS_ on December 19, 2021, 10:15:16 pmLooks perfectly reasonable to me. Have at it!

author: Ian.M
author_rank: Super Contributor
timestamp: December 20, 2021, 03:36:13 am
content: 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.

author: Psi
author_rank: Super Contributor
timestamp: December 20, 2021, 03:50:17 am
content: 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.pdfHigh 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.

author: TomS_
author_rank: Frequent Contributor
timestamp: December 20, 2021, 09:39:39 am
content: Quote from: bugnate on December 20, 2021, 01:43:32 amGreat! Thanks for your sanity check! :-)

author: TomS_
author_rank: Frequent Contributor
timestamp: December 20, 2021, 09:54:59 am
content: Quote from: Ian.M on December 20, 2021, 03:36:13 amAh 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!

author: Ian.M
author_rank: Super Contributor
timestamp: December 20, 2021, 10:01:13 am
content: 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.

author: TomS_
author_rank: Frequent Contributor
timestamp: December 20, 2021, 11:04:44 am
content: 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.

author: Terry Bites
author_rank: Super Contributor
timestamp: December 20, 2021, 04:52:04 pm
content: Take the old school wayhttps://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.

author: rstofer
author_rank: Super Contributor
timestamp: December 20, 2021, 06:06:38 pm
content: 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.

author: Leo Bodnar
author_rank: Frequent Contributor
timestamp: December 20, 2021, 07:37:06 pm
content: 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.LeoQuote from: Terry Bites on December 20, 2021, 04:52:04 pmP.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.

author: coromonadalix
author_rank: Super Contributor
timestamp: December 21, 2021, 03:46:52 am
content: ACS hall effect current sensors ??

author: xavier60
author_rank: Super Contributor
timestamp: December 21, 2021, 06:44:33 am
content: Quote from: Leo Bodnar on December 20, 2021, 07:37:06 pmThe 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/#msg3014970https://www.eevblog.com/forum/projects/improving-adjustable-dual-voltage-bench-power-supply/msg3021268/#msg3021268Ignore the diode, it's not needed when a suitable opamp is used.

author: EPAIII
author_rank: Super Contributor
timestamp: December 21, 2021, 07:34:28 am
content: That's what I was thinking. No DC coupling and no resistive losses.Win, win, win!Quote from: coromonadalix on December 21, 2021, 03:46:52 am