Bidirectional op amp current measurement for shunts with both ends outside rails - Page 1
Forum section: electronics / beginners

author: Infraviolet
author_rank: Super Contributor
timestamp: January 02, 2024, 11:29:21 pm
content: I want to use a single-supply op amp to measure the current flowing through a small shunt resistor, this current can be flowing in either direction. And the absolute voltage at the ends of the shunt can be, at times, well outside not only the op amp's rails, but the maximum voltage the op amp can survive exposure to.I've previously used this arrangement for low side single direction current meaurement:But it is single direction only, and whilst the shunt resistor wouldn't need the low end grounded, it would need the low end to be at some voltage low enough that V_low_end+I*R_shunt would still be low enough to be within the op amp's positive rail.I notice Horowitz and Hill mentions that there are ways to measure current with a similar arrangement for high-side usage, but they only show the details in the X Chapter book, which I don't have. So there must be ways of doing this for a high side shunt, and still keeping the op amp's input terminals both low enough that the op amp can be powered between a lower-voltage-rail* and overall-circuit-ground, and having the op amp's output measurement vary within the range of Gnd to the lower-voltage-rail.*lower than the voltage, relative to ground, where shunt is, a lower-voltage-rail might be 5V or 3.3V with a shunt somewhere where the voltage of the wire varies over time, it could be at 12V, or 6V, 2V or right down very close to ground. Trying to generate a voltage 5V below the shunt, so as to power the op amp from this, wouldn't seem feasible as the shunt can reach a voltage as low as ground so a resistor and zener couldn't generate the voltage as it would sometimes go below the overall system's ground. And the op amp's current-proportional output voltage would then ride up and down as the voltage at the shunt's location varied, which would be a nightmare to subtract away before making further use of the analogue level. This is much like "in-line" current sensing on an H-bridge.I'd really like to do this with op amps and standard components, rather than a specialised current measurement IC, so I've got a generic solution notreliant on the availability of some special part.My requirements for accuracy aren't too demanding, an accuracy perhaps as good as the nearest 50mA, but somewhat wider errors would be ok, for currents of 5A, to zero amps, to 5A the other way. I could accept an output which was symmetrical (0V out at 0A, maimum output at 5A either way) or asymmetric (2.5V out at 0V, 0V out at 5A one way, 5V out at 5A the other way). The main complication looks to be having voltages on the shunt well outside the op amp's rails.Thanks

author: RFDx
author_rank: Regular Contributor
timestamp: January 03, 2024, 12:44:01 am
content: AD629, AD8479, INA117, INA148, INA149. This are very high common voltage, difference amplifiers (Gain=1) were everything needed is already integrated, incl. the precision resistors. For single supply and bidirectional current measurement you need an additional (low impedance) reference voltage.

author: Infraviolet
author_rank: Super Contributor
timestamp: January 03, 2024, 01:21:45 am
content: Thanks for the note about bidirectional usage, yes it seems that just providing a stable reference at halfway between the lower-voltage-rail and ground, and putting it in place of the ground at the end of R22 is all it takes do go birectional.But is there a way to do this with the op amps I already have, which are NOT rated for very high common voltages? MCP6024, MCP6294, MCP6004. They're all rated or a maximum Vdd-Vss of 5.5V, and analogue inputs aren't allowed to go >1V beyond the rails. If the answer is an absolute NO to this, then I'll look at getting different op amps, but it would be nice to find a method which didn't rely on the op amp being able to cope with common mode input voltages well beyond its rails.Thanks

author: ArdWar
author_rank: Frequent Contributor
timestamp: January 03, 2024, 02:22:00 am
content: Quote from: Infraviolet on January 03, 2024, 01:21:45 amYou can emulate those opamps with your own resistor networks since they're in essence "just" your typical opamp circuit behind two voltage divider. However I'm not sure how usable the discrete version will be in real life since RBwill be very critical to offsets and drifts.

author: Infraviolet
author_rank: Super Contributor
timestamp: January 03, 2024, 02:26:19 am
content: Wouldn't the RA to RB ratio also mean you massively reduce your gain? The solution to offsets is usually a slightly bigger shunt resistance, if the application can allow it, thereby making the voltage across the shunt big enough for the offsets to be insignificant (comparedto the level of accuracy you want)?

author: RFDx
author_rank: Regular Contributor
timestamp: January 03, 2024, 03:00:12 am
content: Quote from: Infraviolet on January 03, 2024, 01:21:45 amYes, the complete schematic can be found in the datasheets of the IC's I mentioned. It's similar to a generic, differential amplifier but with five instead of four resistors. The high common mode voltage at the input is divided down to fit the CM range the opamp can handle while at the same time retaining a differential gain of 1. The input offset voltage/bias currents of the opamp should be as low as possible if you are looking for accuracy. A workaround would be to measure the output offset voltage with shorted shunt/inputs and subtract it from the actual measurements (the output DC offset voltage for the MCP6021 in the attached schematic is 12.8mV).

author: ArdWar
author_rank: Frequent Contributor
timestamp: January 03, 2024, 03:07:24 am
content: Quote from: Infraviolet on January 03, 2024, 02:26:19 amYes, technically, since that's the whole point of those INA117 type of devices. However your overall gain is still determined by RF/RA ratio. You can change/tune RB values to largest value that still allow input voltage swings to be within opamp limits.

author: David Hess
author_rank: Super Contributor
timestamp: January 03, 2024, 03:20:43 am
content: There are instrumentation amplifiers which support common mode input voltages outside of their supply range, but they have degraded precision.The standard high side current monitor can be doubled up to produce two ground referred outputs, with one indicating positive currents and the other indicating negative currents. Then a low side instrumentation amplifier could combine the signals.

author: shapirus
author_rank: Super Contributor
timestamp: January 03, 2024, 03:09:26 pm
content: So there are two problems to solve.1. Bidirectional current.This is not a problem for the classic dual-supply subtracting op amp circuit. The "real" GND, to which the bottom end of the shunt is connected, will be the reference point. Then you will need to create a negative rail for the op amp so that it can properly sense inputs below GND. This negative rail doesn't need to source/sink much power. There are many quite easy ways to create it (ICL7660, miniature isolated DC/DC switching converters etc.)On the output of the op amp you will get a respective bidirectional signal referenced to GND. If that's not appropriate, you can add an opamp-based full-wave precision rectifier after it.I did a quick simulation, and it seems to work quite fine. Of course, as frequency increases, phase shift becomes noticeable, as well as the rectifier's distortion near zero. What frequency are you expecting btw?Dual supply isn't even required I think, as you can add DC bias to the shunt's output voltage to shift the op amp input signals into the positive region, but it may be more comfortable to work with (depends on how you are going to handle the output signal).2. Protecting the op amp from the potentially excessive shunt voltage.If the op amp doesn't have built-in input clamping diodes, you can add your own to prevent the inputs of going above or below either rail + diode junction drop. To stay on the safe side, you can even create additional rails within a volt or two of the power rails, and clamp to those (but make sure they can sink or source the extra current flowing via the clamping diodes).You can also clamp using zeners. There are op amp based precision clamping circuits (but that's an overkill in this case I guess).

author: shapirus
author_rank: Super Contributor
timestamp: January 03, 2024, 03:21:50 pm
content: Quote from: Infraviolet on January 03, 2024, 01:21:45 amWhy not? There shouldn't be any fundamental difference with these. You just need to bring the input voltage to within their operating range. Use shunt with a lower resistance, for example.I did something that bears resemblance to what you are trying to do. In that case it was dividing voltage coming from the AC mains (bidirectional), DC biasing it, buffering, and feeding it into an ADC for further processing with a microcomputer. Basically a mains voltage data logger device. It still works 24/7 to this day. You may want to see the schematics:https://www.eevblog.com/forum/beginners/power-company-voltage-waveform-measurement/msg4663045/#msg4663045

author: Infraviolet
author_rank: Super Contributor
timestamp: January 04, 2024, 05:36:21 pm
content: Thanks everyone, that's given me plenty of options to work from. I'll see which works best for my use case.