# Interfacing Current shunt monitor with 16bit ADC

I am supposed to high side current measurement via shunt resistor (between source and load) and feed it to the microcontroller. For that purpose i have decided to use this IC MAX9922 which is a ultra high precision current sense monitor. The reason for selecting this IC is its high accuracy of measurement. The output of this amplifier would be fed to a 16 bit ADC ADS8319 which would then provide the digital data to the micro-controller via SPI interface.

Now while designing the circuit schematic, i came to find out that ADCs require OP-AMPS (to act as a low impedance buffer) plus RC filters (for filtering out unwanted frequency signals) on their input. And the Amplifier ICs plus the values for RC filter to be used are given in their (ADC's) datasheets normally. For eg in ADS8319 datasheet on pg no. 21 the recommended OPAMP plus the values of RC filter are given.

My question is that, as i am already using MAX9922 (for current sense measurement), is it necessary for me to insert a buffer OPAMP in between the MAX9922 and ADS8319 ? As i think my signal is already coming to the ADC from an Amplifier IC, i could just straight away (with an RC filter) feed it to my ADC input without inserting the buffer. Am i Right about it ?

Also, in MAX9922's data sheet (on page 13) the maxim IC is shown to be connected to a 12-bit ADC as an example circuit. However i would be connecting it to a 16-bit ADC. I hope that it would work as expected in my case as well. There wont be any issue about it. Am i right ?

Your helpful suggestions and comments would be appreciated.

Thankyou!

## 3 Answers

Since you've never done this sort of thing before, let me point out a few things. First, you really should have mentioned that you're monitoring battery charging up front, rather than inserting it as a comment - it's important. As a general rule, when asking questions provide more information rather less, especially your overall problem. Context matters, especially in engineering.

1) You really need to incorporate your full system description into your device selection. Using a 16-bit ADC for battery monitoring is, well, it's massive overkill, and is likely to cause you to think you have problems when you don't. To begin with, you will see noise levels which you will think must be a problem when they aren't. Think about this: a 2-volt input range at the ADC will have a resolution of $$\Delta V = \frac{2}{2^{16}} = 30.5 \mu V$$ and if you think you're not going to see millivolt noise levels - that is, 10's to 100's of lsbs - on your signal, I'm afraid you're in for a nasty surprise.

2) By the same token, I don't think you understand accuracy. Sure, your shunt amplifier has very high linearity, but its actual accuracy is limited by the gain-setting resistors you use. I note that you're using 49k/1k to give you a 50V/V gain. Have you tried finding a 49k resistor? The closest 1% is 48.7k, and that value will, of course, vary by as much as +/- 1% if you just grab a part from the box. Compare this to the resolution of the ADC, which is .0015% of full scale. In other words, using 1% resistors will give you an accuracy limit of +/- 1% on your measured current, which is about 6-7 bits. Yes, you can do a system calibration, but keep in mind that this will require that provide a current which you know is accurate to whatever level you're looking for, and this can be much more challenging than you realize. Do some research on temperature coefficients of power resistors, for instance, and keep in mind that DMMs on "current" setting may show any number of digits resolution, but you need to look into the manual to find the accuracy (usually in the vicinity of 1% for non-specialized meters).

3) Since you've not specified your sampling rate, I have to talk in general terms, but I suspect that you don't need a buffer, since sampling at more than 100 Hz is probably overkill for what you're doing. Note that the data sheet for the ADC (p.20) discusses frequency response of a buffer amplifier, and for 500 kHz sampling comes up with a frequency limit of 3 MHz. You can do the math presented in the data sheet, and for a 500 Hz sample rate you only need a 3 kHz capability, and for 100 Hz only about 600 Hz. This ought to be well within the capabilities of the shunt amplifier. Even this is wild overkill for battery charging (1-10 Hz is more reasonable - charging is a slooow process), and you're not trying for any sort of frequency analysis of the data. Plus, like I say, you're going to see a lot of noise.

EDIT - in response to your expansionary answer, I'll try to make myself clear.

First, going to a 16-bit ADC won't hurt anything, but it doesn't guarantee that you'll get the accuracy you want, and I just wanted you to be aware that you need to keep the entire system in mind when you discuss accuracy.

As to your discussion of ADC error sources, taking them in turn,

1)INL - yes, it's important, but modern ADCs ordinarily keep it below 1 lsb, and often do better.

2)Offset - yes, again it's important, but particularly in your application the temperature coefficient is much more important. After all, you can always perform a zero cycle, where you disconnect the load and charger, then measure the resulting zero current level and use this measured offset to compensate real readings. As long as the offset doesn't drift (especially with temperature), offset is not usually that much of a problem. In your system, you apparently have scaled your shunt resistor for a full-scale shunt voltage in the range of 20 mV, so a 1 uV/deg drift will give a .005%/deg error.

3)Gain accuracy - I tried to deal with this in my original answer. In general you can determine gain to any desired accuracy simply by measuring a known input, but particularly for current this gets a bit trickier than you might think. Fortunately, in this case you will use the same amplifier for measuring both charge and discharge currents, and presumably you will use the same measurement device for battery voltage during both cycles. This will allow you not to worry much about gain accuracy, since as long as the gain is linear you can compare the two states by taking a ratio, and any gain inaccuracy will simply drop out.

And while I'm on the subject of error sources

4) Gain linearity - While you have thought about INL in the ADC, you need to be aware that the shunt amplifier is not perfectly linear. From page 3 of the data sheet, a 9922 operating at a gain of 100 has a gain nonlinearity of 0.6% max. Since this is over your target range of 0.1 to 0.5%, you'll need to be careful.

With all that said, a 16-bit ADC certainly won't hurt, but I don't think it's necessary. A 12-bit ADC would probably be just as useful, since its resolution is .025%, so its errors will still be well under your target.

Simply measuring data to 16 bits does not guarantee that measurement is accurate to 16 bits, even if the ADC itself is that accurate. A 4 1/2 digit DMM with 0.1% accuracy which measures 10 volts as 10.000 is not producing a .01% accurate reading, even though .001 / 10.000 equals .01%. It could produce any reading between 9.990 and 10.010 and still be within the rated accuracy of the DMM. Focussing on the resolution of the ADC when this is better than your expected overall accuracy suggests that you are ignoring the forest for the trees. See, for instance error 4) above.

I've tried to point out, for instance, that self-heating in the shunt resistor may cause errors. A 100 ppm/deg resistor which heats up 10 degrees will produce a 0.1% gain error. 20 degrees, of course, will give you .2%. Are you sure your temperatures are all accounted for? Another thing you may not have taken into account is thermocouple errors where you connect to the shunt.

On a larger scale, trying for 0.1% on a battery is certainly ambitious. You'll need precision charging and discharging cycles, along with temperature monitoring of the batteries, not to mention some way of measuring and compensating for battery aging effects. Maintaining uniform timing will be important - don't think you can charge a cell up, leave it overnight, then measure the discharge energy the next day and think it will be the same as if you had just charged and tested immediately.

Just as a note, I'd suggest you don't need to do high side monitoring, assuming your test setup will be custom-made. If you do

simulate this circuit – Schematic created using CircuitLab

this will work just fine. Obviously, the charger will not be a simple voltage source, and the load may well be a controlled current sink, but you get the idea. Note that the presence of the shunt resistor distorts the battery voltage measurement, but that's OK. You're measuring the shunt resistance and that can be subtracted. Also note that, at the accuracies you want, regardless of the topology you use you need to be careful of IR drops in the wires. This is especially important for the shunt resistor - make very sure you use a Kelvin connection.

• Thanks alot for such a detailed explanation. As far as the price of 12bit and 16bit ADC's are concered, thats not much different. Also ill keep in mind all the points you made regarding errors,heating and IR drops. I will be using a Kelvin Connection shunt with 15ppm/c T.C as keeping the budget in mind this is the best i could find. And the choice for high side/low side measurement was mine, since my battery is a single cell so the voltage wont be too high, so i guess high side measurement doesnt do any harm. Also just like you mentioned i wont be needing to subtract the shunt voltage that way – yiipmann Sep 2 '15 at 10:29
• @yiipmann - My point in doing it this way is that it gets rid of the gain nonlinearity of the 9922. Your choice, of course, as to which way you prefer. Oh yes, and you can get rid of the input filter on the ADC unless you really are trying for high samples rates. Also drop the cap (currently "open") on the output of the amp - it may cause stability problems. – WhatRoughBeast Sep 2 '15 at 13:49
• OK. I have placed a few open capacitors slots in my schematic (as recommended by data sheets / design docs) so that if needed, capacitor can be inserted into them, else they can be left unused. Also i was confusing Nyquist Theorem with my sampling frequency in this case. I mean i will be using a Synchronous Buck converter to charge the battery cell which would be running at around 62kHz. So according to that, 62x2 = 124kHz sampling frequency came to my mind. But then i thought that it doesnt apply in my case, i can sample once or twice every second. Am i right ? – yiipmann Sep 2 '15 at 16:26
• @yiipmann - absolutely right on the sampling frequency. See item 3) in my first response. But you will want to put a low-pass filter on the ADC input so that you don't get aliasing from the converter switching. As for the capacitor, you need to be aware that putting a cap directly from the output of an amp to ground is A Bad Thing, and can cause the amplifier to start oscillating. – WhatRoughBeast Sep 2 '15 at 16:36

Depending upon the type of monitoring bandwidth you want to achieve with this measurement system you may want to consider adding the opamp buffer. The output of the current sensing part appears to have quite a long settling time specification at only 7pF of load capacitance. Any filters that you add and the input capacitance of the A/D will increase the settling time of the current sense amplifier part.

The data sheet for the MAX9322 does not give a real good description of the output drive capability of the part other than the the VOH and the VOL specifications. These are rated with the part driving a 10K ohm load. So it may take some additional questions to the manufacturer as to the drive capability. When I looked at the input characteristics of the A/D part that you linked it appears that there should be no issue to use the two parts directly connected.

I could comment that the A/D converter may be over specified for this application at 500KHz sample rate. Considering the settling time and bandwidth characteristics of the current sensing part you may want to investigate if there are lower performance A/Ds that would be lower cost. (Although nothing says that you have to use the ADS8319 at the full sample rate).

• Yes you are right,I wont be needing to use it at 500kHz,as ill be monitoring the battery charging current, so i guess my samples would be very low compared to that. But the reason for selecting this ADC is its External Refernce feature, high resolution (16-bit) plus very high precision and accuracy (INL,Gain error and Offset error very low). However its my first time with implementing hardware so i am confused alot with so many questions in my head, one being at what frequency should i be sampling the battery current and voltage for measuring the energy provided to the battery during charging? – yiipmann Sep 1 '15 at 13:04
• Battery charging is a very slow and steady process, so a few kHz seem more than enough to me. Moreover the capacity of a battery varies a lot with temperature and time, so using high precision parts for this task seems like overkill. I'd start with the needed charge measurement accuracy and choose parts from there, I'm not sure that more than 0.1% precision (10 useful bits) is actually needed... – Nicolas D Sep 1 '15 at 14:01

@WhatRoughBeast I am posting this as an answer, because comment wont allow me to write as much as I want to. As I said that I am new to this stuff, so I gathered all my information on the internet, which means I can be wrong, but I did what I thought was right.

Actually I am supposed to charge and discharge a Li-Ion battery, and I am supposed to measure its energy efficiency at the end. The key thing in that is that I have to do it (measure the efficiency) with highest accuracy possible (0.1% - 0.5%). Now if we look we have to measure the current and voltage for power calculation, and multiply that with the time instances to get the energy. So current and voltage have to be measured with some defined accuracy, so that at the end we get an energy efficiency which can be claimed to be measured with a certain defined high accuracy.

For having a highly accurate result at the end, ADC’s accuracy should be high offcourse. While going through its literature what I found out is that apart from resolution, INL (Integral-non-Linearity) Error, Offset Error and the Gain Error are the 3 main sources of error which contributes the most to ADC’s inaccuracy. So one has to look for an ADC which has the lowest of all these 3 errors to ensure high accuracy.

As given in this document, one can calculate the overall error which our system has (ADC’s error + other errors). Its written that if an ADC (12-bit) has 1LSB INL, then in terms of % we can calculate it to be : 1/2^12 = 0.0244%. In the same way we can calculate for Gain Error and Offset Error, and add them up to have a total error that ADC offers. And for overall error calculation we can add up the voltage reference (to the ADC) error plus other errors (if any) in our circuit. For e.g if I am using a shunt for current measurement which is 0.5% accurate, and my external voltage reference has 0.25% accuracy, I would add up these values in the previously calculated error value to get the total error for my current measured. The same way I can calculate the error for my voltage measurement, and adding these 2 will give me total error for the “Power”.

The reason of explaining all this, is that I wanted to tell you why I went for a 16-bit ADC. Having higher no. of bits = lesser error on ADC part. As error = LSB/2^N , the larger the N, the smaller the error. And i checked the data sheets for some 12 bit ADCs as well. The total error (INL + Offset + Gain Error) which i calculated for them, using the above given formula, turned out to be larger than that which i calculated for this 16 bit ADC.

So what do you have to say about it ? Am I right about selecting a 16-bit ADC for reducing the error or increasing the measurement accuracy ?

• yiipmann - see edit. – WhatRoughBeast Sep 1 '15 at 21:46