Current sense amplifier questions - Page 1
Forum section: electronics / beginners

author: HwAoRrDk
author_rank: Super Contributor
timestamp: July 05, 2016, 05:25:17 am
content: I am looking at using an off-the-shelf current sense amplifier IC, but I have a couple of questions about things.I had initially looked, and tried, a discrete op-amp solution; but as I have changed strategy with my project, there became the need to do bi-directional current sensing, which I understand is pretty tricky to do using op-amps. It requires many components, so it's way easier, convenient and cheaper to use a ready-made IC for this.But, I'm not confident I've made a good choice of IC, and there are some things I don't fully understand, so I would appreciate some advice.Firstly, the whole high- or low-side thing. Is this really a factor with bi-directional sensing? I mean, if current is flowing in either direction, technically aren't both topologies in effect? And yet, I see datasheets describing bi-dir ICs as 'high-side'. Why?Second, most bi-dir. current amplifiers seem to have a focus on battery charge/discharge monitoring - that is, with continuous current flow but at different voltages (i.e. as battery discharges). But I want to use one to current sense for small DC motors, with very off/on operation. I'm slightly concerned I'd be using it outside of it's intended application.Lastly, I'm wondering if I need to add some additional components to my design if I add a bi-dir current amplifier into the motor circuit. My motor switching is to be done with relays, so I have nothing else in that side of the circuit, but I have a feeling that inductive spikes may be damaging to a current-sense amp (even though it's measuring the relatively small voltage drop across the current-sense resistor) so I may need to add flyback diodes. Do I?The IC I'm looking at using is theSilicon Labs TS1101, probably the x25 gain version. But I'm not confident it would be an appropriate choice. However, it is cheap, and in a SOT23-6 package that I have a hope of hand soldering, rather than a more difficult SC70 with 0.65mm lead spacing as most others (particularly from TI) seem to be.If it helps, here is the scenario in which I'd be using it:- Steady-state motor current: ~90-100mA- Peak motor current: ~400-500mA- Motor operating voltage: 12V nominal (realistically 10-14V)- 5V supply- Sense resistor <= 0.5 Ohm- Output to be fed to ADC of an AVR (Atmega328P)One other option I've been looking at is the Allegro ACS712. However, I have my reservations about this one: at the steady-state current draw its output would need further amplification, as it only gives 185mV/A. It's also pretty expensive. But, I believe because it's hall-effect, there is no concern with flyback inductive spikes as I mentioned above (right?).

author: MosherIV
author_rank: Super Contributor
timestamp: July 05, 2016, 06:43:48 am
content: HiFirstly, I have not tried current sense devices, been planning to so I cannot answer some of your questions."My motor switching is to be done with relays, so I have nothing else in that side of the circuit, but I have a feeling that inductive spikes may be damaging to a current-sense amp (even though it's measuring the relatively small voltage drop across the current-sense resistor) so I may need to add flyback diodes. Do I?"Yes, when switching inductor, a motor is an inductor, flyback protect diodes are a must. They protect everything in the circuit from the voltage spikes. You will also need flyback diodes for the relays.Incidentally, you can use a circuit called a H bridge to control motor both turning the motor on/off and direction. Do a search for H-bridge motor control.Placing the current sense above the H bridge should also mean the current only flows in one direction.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: July 05, 2016, 08:55:42 am
content: I have not included flyback diodes for the motors thus far as I feel that part of the circuit is sufficiently isolated for it not to matter (but I might be wrong). And the original circuit where these motors are installed had none anyway (it's just raw switches directly switching current). I am using a ULN2003 for relay coil drive, which has integrated flyback diodes, so I am covered on that side. I am more concerned about the potential effect, if any, inductive spikes have on whatever circuitry a current sense amp uses.Am well aware of H-bridge motor control, and indeed I started off using motor driver ICs, but have specifically moved to using relays instead as it significantly reduces complication and component count. Plus I don't need anything like PWM speed control.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: July 07, 2016, 01:44:56 pm
content: Bump.Anyone?

author: rstofer
author_rank: Super Contributor
timestamp: July 07, 2016, 02:09:37 pm
content: Quote from: HwAoRrDk on July 05, 2016, 05:25:17 amIt is usually the case that switching will be done on the low side with a MOSFET or something. We can't let the Source float up above ground due to the voltage drop of the shunt because that changes the switching threshold. So, we put a shunt between the battery and whatever switching mechanism we use, H-bridge or relays. Everything switches on the low side. Given that the shunt will be on the high side, we need a high side sensor.QuoteThe application is the same and measuring motor current is very common and measuring it on the high side is probably the best way to do it although there are motor driver chips that do it on the low side like those from Allegro.QuoteWell, you clearly need a shunt resistor in the supply side and it needs to be sized such that the voltage drop uses a significant percentage of the IC's full range. The shunt resistor may very well work to clamp the spikes between the amplifier inputs but there will still be switching spikes everywhere else.Maybe MOSFETs are the way to go because you can implement soft-start and soft-stop. Most power MOSFETs already have a reverse current diode as part of the design.QuoteI think Linear Technology makes a series of devices as well. Hall effect would be interesting! Adding an op amp between the sensor and the ADC makes a lot of sense.You may find it necessary to offset and scale to use the maximum range of your ADC so read Chapter 4 of Op Amps For Everyone. It takes one op amp and 4 resistors.http://web.mit.edu/6.101/www/reference/op_amps_everyone.pdfOne other issue with uC ADCs is their relatively low input impedance. Some uCs require that the ADC be driven from a source around 2k Ohms. Regardless of what happens with the sensor, the op amp output will be capable of driving the ADC.

author: Brutte
author_rank: Frequent Contributor
timestamp: July 07, 2016, 02:37:00 pm
content: Quote from: HwAoRrDk on July 05, 2016, 05:25:17 amMind your Allegro IC is a current sensing devicewith isolation. Well, the current sensing requirement as such does not include isolation requirement.The classical scheme is to use a differential amplifier arrangement. IIRC that requires an op-amp and 4 (matched) resistors.Another thing is that if you do not need a floating shunt resistor then you can simplify even further.For bipolar operation just add an offset.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: July 08, 2016, 08:00:28 am
content: Quote from: rstofer on July 07, 2016, 02:09:37 pmAh, I think I understand what you mean. It is to do with what you are using to switch your current. Even a bi-directional current sense amp will be described as 'high side' because they assume you're using some kind of MOSFET to switch. But if you're not, the nomenclature is irrelevant?Quote from: rstofer on July 07, 2016, 02:09:37 pmI was doing some experiments yesterday with a 0.33 Ohm sense resistor and the presence of the resistor didn't seem to nullify any voltage spikes. I was still getting 80-160V spikes unless I stuffed some 1N4007's I had to hand in there (then reduced to no more than 20V - I guess some faster Schottky diodes would reduce further).I don't need anything like soft-start/stop.(By the way, does everyone have to keep suggesting I use transistors to switch my motors?I already went down that road, and have decided to go with relays. I don't want to be impolite here, but focusing on the current sense amplifiers and bi-directional sensing would be great.)Quote from: rstofer on July 07, 2016, 02:09:37 pmCouldn't find any bi-directional current sense amps from Linear. Do they even make any? Plenty of uni-directional. Anyway, their stuff is far too expensive.I don't think it's necessary to use an op-amp to offset the output from these bi-dir ICs. As far as I understand from reading datasheets, it's common for them to offset by VCC/2 for you. At least, the TS1101 says it does that, and I think the ACS712 does too. I only mentioned further amplifying the output from the Allegro because it's output would still be so small given my lowest levels of current being measured.Quote from: rstofer on July 07, 2016, 02:09:37 pmNot quite sure I understand this point. What should I be looking for on a current sense amp's datasheet that will tell me whether it satisfies this?

author: Ravenghost
author_rank: Contributor
timestamp: July 08, 2016, 07:41:37 pm
content: Unidirectional and bidirectional high-side current sense amplifiers can both be used in high-side or low-side configurations.Analog Devices have good documentation about such ICs and includes application information. Hope you find it useful.http://www.analog.com/media/en/technical-documentation/data-sheets/AD8211.pdfhttp://www.analog.com/media/en/technical-documentation/data-sheets/AD8210.pdf

author: HwAoRrDk
author_rank: Super Contributor
timestamp: July 09, 2016, 09:34:41 am
content: Those Analog Devices parts look nice, and exceptionally well-written datasheets, in plain english.I understand things a little better after reading those. But, damn, they're really expensive parts!I'm not able to find the AD8210 in single-digit quantities for less than £3 each; in contrast to the TS1101 which is £0.65 each.I was again contemplating the need for mitigation of inductive spikes when using a current sense amp, and assuming I do need to put something in place, I was thinking maybe a TVS diode would be a good space-efficient solution. If I place a bipolar/bi-directional one across the motor connections (and below the current sense resistor), this will clamp the high voltage spikes and recirculate them back through the motor, right?.Would something with perhaps a 25V clamping voltage and a 15V stand-off voltage be suitable? Or, to put it another way, I guess anything with a clamping voltage inside the amp's common mode range and a stand-off voltage greater than my max supply voltage (i.e. 14V). For example, a BZW04-15B?The only downside I can ascertain for this - versus a more common pair of diodes to power and ground on each side of the motor - is that it may cause the motor to run on slightly more than intended (as the spike voltage itself continues to power the motor after shut-off). But this supposedly amounts to no more than a couple of msec, which in my case should be acceptable. Is this right? Any other downsides?

author: Brutte
author_rank: Frequent Contributor
timestamp: July 09, 2016, 02:29:26 pm
content: Quote from: HwAoRrDk on July 09, 2016, 09:34:41 amWith inductive load and voltage source there is a transient voltage when disconnecting a charged inductor. If these are your "spikes" then these are in voltage domain, not in current domain. You won't see any "current spikes" by connecting and disconnecting inductive load. Thus there would be absolutely no mysterious "voltage spike" across that shunt resistor, no matter how hard you tried.For current spikes you should have connected and disconnected for example a capacitor with low esr zapped to a voltage source of low impedance. Like for example a 100F cap and a 0V piece of thick wire would do "current spike" trick, weld something to something else and kill a current sense amp.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: July 09, 2016, 03:18:30 pm
content: Yes, that I understand - can't have any increase in sense voltage without increase in current through the resistor.Let me try to put more clearly the thing I'm concerned about:When my DC motor is switched off, depending on the direction of current flow, there will either be a large negative or positive voltage spike. Now, this will suddenly be way outside of the common mode range of the current sense amp, even though the voltage drop across the sense resistor hasn't changed. Would this damage the current sense amp?

author: rstofer
author_rank: Super Contributor
timestamp: July 09, 2016, 03:55:33 pm
content: Side issue... Why do you need bi-directional sensing? I read over the previous posts (briefly) and I didn't see any mention of a generator. Clearly you aren't using regenerative braking so why would their be bi-directional current flow? Is there some kind of battery charger involved?How much voltage drop do you expect across your current sense resistor? Does it make sense to just put a pair of Schottky diodes around the resistor? Maybe a pair of silicon diodes? With a 50 mV shunt, the Schottky diodes make a lot of sense.I'm assuming you are planning to put the sense resistor between the power source and the first switching device.Industrial shunt resistors drop 50 mV at full scale, whatever it might be, 1A, 10A, 1000A, whatever. Using these with a sense amplifier may not result in much output swing so some sense amplifiers have a bit of gain. Let's say I only wanted to use 1/2 of full scale or 25 mV because my load is only half of the shunt range and there is no shunt specifically for my load. So, I will see 25 mV of swing. I also want to use the entire 5V range of my ADC (making an assumption of the allowable input voltage). Therefore, I need a gain of 200 to get where I want to be. This may, or may not, require an op amp between the sense amplifier and the ADC. Given a 10 bit ADC and a 5V range, each bit count is worth about 5 mV and if I only have a 25 mV swing, it's not going to use very many bits of resolution. Like 3?

author: Brutte
author_rank: Frequent Contributor
timestamp: July 09, 2016, 06:14:12 pm
content: Quote from: HwAoRrDk on July 09, 2016, 03:18:30 pmacross the switching device (transistor or relay in your case). Sure. But this topic is about current sense circuit. Well, the current sense circuitry is tied to either GND or VCC so during switch off the common voltage would drop to GND in case it is a low side arrangement or to VCC if that is a high side arrangement.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: July 10, 2016, 03:32:36 pm
content: Quote from: rstofer on July 09, 2016, 03:55:33 pmNo, no generator or charger. I simply need bi-directional sensing because I will be measuring at a point in the circuit where current is flowing in either way depending on motor direction. I am pretty much forced to do so because I am constrained by existing wiring to these motors that I cannot change.Quote from: rstofer on July 09, 2016, 03:55:33 pmAt expected peak current draw (as detailed in my initial post), no more than a couple-hundred mV. Although that depends on the value of the sense resistor, which depends on the gain of the amp I select...When you mention the Schottky diodes, do you mean in an arrangement like the following?So the idea is that as long as the sense voltage is lower than the diode's forward voltage, they do nothing, but excess sense voltage will cause them to conduct and essentially bypass the amp? This diagram is from an Analog Devices app. note I have been reading, where this is something they talk about. But, is this not for protection only against excess sense voltage, and not common-mode voltage? I am more worried about the latter, although it won't hurt to have protection for both.Quote from: rstofer on July 09, 2016, 03:55:33 pmNo, the sense resistor will be between the switching relays and the motor. I believe this is 'high-side'.Quote from: rstofer on July 09, 2016, 03:55:33 pmAs I said above, I can chop-and-change the sense resistor to get an appropriate sense voltage to suit whatever gain my potential choice of current sense amp will be. This isn't a sticking point for me; I pretty much understand what's needed there to take full advantage of the resolution of my MCU's ADC. Seeing as many current sense amps seem to come in a gain of x50, I figured using a 0.15 Ohm resistor will be good. Gives me voltages of 86.25mV x 50 = 4.31V @ 575mA and 13.5mV x 50 = 0.68V @ 90mA. So, a little headroom at peak current draw, and still some meaningful resolution at steady-state.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: July 10, 2016, 03:50:49 pm
content: By the way, I have been doing some research today and am now pretty sure that inductive voltage spikesarea concern for inputs to current sense amps.I found these two reference design articles from TI that talk about mitigating over-voltage transients:EMC Compliant High Side Current Sensing Reference Design with Overvoltage ProtectionTransient Robustness for Current Shunt MonitorEven though they discuss slightly different designs (with one much more complex than the other), I think I get the common theme between them: that you can use a pair of unidirectional TVS diodes to ground, one on each amp input pin, so as to divert the excess voltage away from the inputs. This seems like a better solution than the one I thought about before - to put a bidirectional TVS across the motor connections.The one thing I don't quite understand yet with both these designs (and others, like the Analog app note I mentioned in my previous post) is the exact function of the pair of series resistors. Some kind of current limiting I gather - but I can't quite fathom under what circumstances you'd get a current surge into the amp's inputs.

author: StillTrying
author_rank: Super Contributor
timestamp: July 10, 2016, 11:12:26 pm
content: Quote from: HwAoRrDk on July 10, 2016, 03:50:49 pmThe high current sense resistor might have some inductance, - especially if it's wire wound.I think the 2 resistors are just to stop the current through the protection diodes being infinite.

author: Brutte
author_rank: Frequent Contributor
timestamp: July 11, 2016, 08:10:24 am
content: Quote from: HwAoRrDk on July 10, 2016, 03:32:36 pmIMHO high side is when shunt is tied to VCC. Low side is when it is tied to GND.Your configuration is a floating one when the shunt flows between the rails.Overengineered.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: August 07, 2016, 06:52:43 pm
content: Hi all, back again. I finally got my hands on someTS1101-50, soldered them up in some DIP adapters and put one to work on a breadboard layout.But... I'm not getting the output I was expecting, and I think I may have misinterpreted the datasheet for this IC. Hoping someone can confirm that's the case.My sense resistor is 0.15 Ohm, and at peak current draw I am getting 86mV across it, and at steady-state current about 13mV. So, as I am using the x50 gain version of this chip, I was expecting about 4.3V peak output, and about 0.6V steady-state output signal. But instead, I was surprised to get around 8-9V peak and around 2V steady! I even tried another chip, but same results.I was under the assumption that the output voltage would be relative to VDD (in my case, 5V), but I think I got that wrong, and it seems to me that the VDD is actually only used to provide the SIGN output signal. The OUT voltage appears to be relative to the voltage at the sense pins (RS+/-) - in my case, I was testing with 13.8V.Why then do they describe the gain in terms of V/V? I assumed that to mean 1V across the sense resistor = 50V output. Either they mean something else by that, or that only holds true under the assumption that the supply voltage of the load being measured will be the same as your ADC's reference voltage - i.e. the case of something battery powered.I also made another dumb mistake, and in my mind confused this chip's common-mode voltage spec with another, and thought it was 0-25V, rather than the 2-25V it actually is.Therefore, it's useless when my current flow is switched the opposite way (when the IC is now technically on the low-side I now realise), as the common-mode voltage will be near zero, and certainly under 2V.What a waste of time and effort.I'm going to have to try something else. Perhaps theTI INA199is a better match for my use case? But I'mreallynot keen on trying to solder an SC70 package...

author: HwAoRrDk
author_rank: Super Contributor
timestamp: August 07, 2016, 10:52:18 pm
content: I was reading more on the TI INA199, and I think it may be a much better match for my application. Its common-mode range is -0.3 to 26V and so can work either high- or low-side. It also has a dedicated power supply pin (V+), which its output is bounded by.However, it also has a voltage reference pin (REF) which is used to supply a 'zero current' offset for use in bi-directional scenarios. Now, I guess normally one would simply use a voltage divider or something and supply half the V+ - 2.5V in my case - there and call it a day; output will be >2.5V for current flow one direction, <2.5V the other. But, I want to make full use of the range of my micro's ADC, and I don't need anything to tell me what direction the current is flowing (because I already know that), only how much. A full 0-5V output range regardless of current flow direction would be ideal.I have an idea about how I might be able to do something like this. If I take an I/O pin on my micro and connect that to the INA199's REF pin, I could make the reference be either 0V or 5V (high or low output). When the current being measured is going 'forward', if I output low on the I/O pin, the output from the INA199 will increase from 0V towards 5V with greater current. When the current is going in 'reverse', if I output high on the I/O, the INA199 output will decrease from 5V towards 0V with greater current. In the latter case, I can then simply invert the reading from the ADC.Question is: will that work?Otherwise, I can envisage having to do something like connect the output from the 2.5V voltage divider to another ADC input and use that as a reference for where the 'middle' point is at any given moment, so I can calculate an absolute ADC value from that. And that still leaves me with compromised ADC resolution...

author: HwAoRrDk
author_rank: Super Contributor
timestamp: August 16, 2016, 11:45:47 pm
content: Okay, I am getting exasperated now...I purchased a fewON Semi NCS199A1- they appear to be a straight-up clone of the TI INA199, but at half the price. I soldered a couple of them to DIP adapter boards (as it happened, SC70/SOT-363 isn't as hard as I feared) and put one to work...Hooked up to test as follows: a voltage divider (pair of 10K resistors) to supply the REF pin with 2.5V; VS supplied with 5V; the IN+/- pins attached across my 0.15 Ohm shunt resistor as before.When I run the motors that are the load, the OUT voltage, depending on current direction, just shoots straight to 5V or 0V! Again, I seem to be getting an over-amplification of the input.What the $#%&ing hell is going on?I can only conclude that either I'm being monumentally stupid and missing something obvious, or these kind of current-sense amps won't ever work in my situation.By the way, yes, I checked that my supplier actually sent me the right gain version of this chip. According to the markings on them, they are indeed the x50 version.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: August 17, 2016, 08:04:43 pm
content: Tried a few more things today.Spotted a section in the datasheet for TI's INA199 about impedance on the REF input. When using a resistive divider to supply the reference voltage, they suggest that an op-amp in a voltage-follower configuration should be used to buffer the pin. I assume similar would apply to the NCS199, seeing as it appears to be a clone of the TI. I took an LM358 op-amp and did so, but it didn't change anything with the output.Tried varying the common-mode voltage used to drive the DC motor load. Turned it down to 10V (from 13.8V), but no change in output either.Okay, how about a smaller input signal? I don't have any shunt resistors to hand smaller than 0.15, so I put two in parallel to make 0.075 Ohms.Success!I get a sensible output signal. For 43mV (575mA) input, I get about 2V above my 2.5V reference offset, and for 6mV (80mA) input, I get about 0.5V above reference, which roughly matches what I would expect from doing the math.Of course, this is where I realise I've been slightly stupid in not accounting for the 2.5V offset in my previous expectations. I mean, it's right there on the NCS199 datasheet on the first page: VOUT= (ILOADx RSHUNT) x GAIN + VREF. How could I miss it? (0.575A x 0.15R) x 50 + 2.5V = 6.8V. Of course the output signal is clipping at 5V!However, this doesn't explain why I saw the output clipping at 5V when using 0V as the REF voltage.I should have got 4.3V peak output in that situation, but I didn't. Why?Edit:This is getting weirder. To avoid doubt I decided to re-test the configuration with 0.15 Ohm shunt and ground hooked to the REF pin. I got roughly the same as before - output wasn't totally clipped to 5V, but pretty near as to be useless. I then decided to check that my '0V' reference was actually 0V, so hooked my meter between my power supply ground and the REF pin. Got a reading of about 12mV - pretty close to 0V as to not make a difference, right? Then I ran the motor again and checked the output. It's workingalmostproperly now!?!Peak output gets to 5V, but my steady-state output is about 1.5V; not the 4.3V and 0.6V the maths says to expect, but still useful nonetheless. I take the meter off: back to clipping near 5V. Put the meter back again; this time, again, a more sensible output, but higher than last time, with peak clipped too much. After repeating several times, the output varies all over the place. The meter doesn't even have to beon, just connected.Why would attaching my meter between the REF pin and supply ground affect the output?