Auto-ranging current sensing - Page 1
Forum section: electronics / projects

author: HwAoRrDk
author_rank: Super Contributor
timestamp: June 25, 2021, 10:06:36 pm
content: I have been thinking about how to automatically switch ranges on a current sensing application, to choose between different shunt resistors. The requirement would be to sense current on a +5V rail from below 100mA (not sure what exactly, but not really single-digits mA) to somewhere in the region of 4.5A. Initially, I was hoping to do this with a single 22mR shunt resistor, but I've realised that the accuracy would be garbage at the lower current levels. So I have been attempting to come up with a way of having 2 current shunts - one for 'low' range and another for 'high' range - and to switch between them automatically depending on load.What I've come up with is the following:I've chosen 220mR and 22mR shunt resistors. The former is for 'low' range which should handle 0-0.45A, and the latter for 'high' range, 0.45-4.5A. The current sense amplifier has a gain of 50V/V, giving an output in the range of 0-5V. The switching of current flow between the shunts is done by P-channel MOSFETs. The gates of the P-FETs are driven from a 12V rail, which should give them at least 5Vgs, yielding a decent on-resistance (will choose something with Vgs@-4.5V of <20mR) and fairly low power dissipation (<0.5W at full current). The negative input to the current sense amplifier is switched between the shunts by an analogue SPDT mux, which is a break-before-make type. The range switching input signal will be controlled by a microcontroller, which is also reading the current level with ADC.There are some uncertainties or areas of concern I have:- I'm using a 74-series inverter to drive one FET to the opposite state of the other. I'm aware that such inverters have propagation delay. Will this be an issue?- Does the on-resistance of the analogue mux have any effect on the current-sense amplifier? I'm assuming the inputs to that are very high impedance, just like an op-amp, and it won't. I chose a mux that seems to be common, a TI TS5A3159A with 1R on-resistance, but others have 5R, 15R, etc.- Are there any special tricks to implementing range-switching logic? I do plan to put some hysteresis in the change-over thresholds.Any other comments welcome.

author: viperidae
author_rank: Frequent Contributor
timestamp: June 25, 2021, 10:23:58 pm
content: You could put the shunts in series. Use both for low range, short the big one with a MOSFET for high range.

author: Benta
author_rank: Super Contributor
timestamp: June 25, 2021, 10:41:16 pm
content: Jsut drive the MOSFETs directly from two 74AHC1G14/17 inverters/buffers (5 V supplied). Plenty of drive current, and you can eliminate the bipolars and resistors completely.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: June 26, 2021, 01:56:08 am
content: Quote from: viperidae on June 25, 2021, 10:23:58 pmHey, that's a good idea!I have revised my design:Gets rid of one MOSFET and accompanying NPN, as well as the inverter, but adds a second analogue mux.

author: ledtester
author_rank: Super Contributor
timestamp: June 26, 2021, 02:38:24 am
content: You might look at the CurrentRanger for ideas:https://lowpowerlab.com/guide/currentranger/specs-architecture/

author: WattsThat
author_rank: Frequent Contributor
timestamp: June 26, 2021, 03:01:39 am
content: IMO, the CurrentRanger appears to be unnecessarily complex with its shunt switching.Dave did a good presentation on improving multimeter burden voltage with auto current ranging. IIRC, the area of interest is in episode 2.

author: magic
author_rank: Super Contributor
timestamp: June 26, 2021, 07:25:02 am
content: A design similar to µCurrent may give 0.1mA accuracy at low currents with 22mΩ shunt.Noise may be a problem, perhaps. Dunno what's the state of the art in chopper-stabilized opamps.

author: Kleinstein
author_rank: Super Contributor
timestamp: June 26, 2021, 11:17:05 am
content: The INA197 is not really high performance. The noise and dift are relatively large. So chances are a really good amplifier at the high side could give 5-10 times better performance and thus get a similar performance with only a 22 mOhms shunt, as the INA197 with a 220 mOhms shunt. It may take a low noise AZ OP (e.g. OPA189) instead of a ready made current sense amplifier.In principle the series connection is OK. One can likely get away with switching only 1 side for the amplifier part. The integrated switches are usually not good for 4.5 A - so it would likely still need a MOSFET in parallel to the higher values shunt. Without a more positive supply it would need a P Channel fet. For the low resistance it may be worth to generate a auxiliary voltage of some 10 V so one can use a N channel FET.

author: fcb
author_rank: Super Contributor
timestamp: June 26, 2021, 11:43:11 am
content: If you are only going to have two ranges and there is only a 10x difference between ranges - I don't think the juice is worth the squeeze, you might as well just use the smaller shunt and add a x10 gain stage, or increase the resolution of the ADC.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: June 26, 2021, 10:23:26 pm
content: Quote from: Kleinstein on June 26, 2021, 11:17:05 amYes, I know, but I also want to measure current on a -12V rail, and the INA197 is one of the few current sense amps I found that handles such a negative common mode voltage. I would prefer not to use different parts for different voltage rails.Quote from: Kleinstein on June 26, 2021, 11:17:05 amAh, you're right! I should have realised that the 220 and 22 shunts can be measured in series (totalling 242mR) for the low range. That means I can ditch one of the analogue muxes.Quote from: Kleinstein on June 26, 2021, 11:17:05 amNot sure what you mean - integrated switches of what?I do have a +12V supply available (for some reason in the schematics already shown I put the gate P-FET pulled up to that - I meant to put 5V), so yes, I guess I could use an N-channel FET. All I have to do is find one that gives a satisfactory on-resistance at a Vgs of about 7V.

author: viperidae
author_rank: Frequent Contributor
timestamp: June 26, 2021, 11:07:35 pm
content: You don't need the extra mux if you use the 22m for high range and 22m+220m for low range. Just a different calibration factor in the ADC code.

author: Kleinstein
author_rank: Super Contributor
timestamp: June 27, 2021, 06:34:10 am
content: There are plenty of small. low voltage (e.g. 20-30 V DS) n channel MOSFETs with low resistance (e.g. 10 mOhms range) for switching the high current. P Channel FETs are also possible but often higher resistance and not as much choice.One still needs a second switch: either a 2nd MOSFET to switch the path of the lower current or a SPDT swtich to switch the sense line. Both ways work, with no big difference in performance.