Where the error comes from
Three contributions: a fixed zero-point error in microvolts, a percentage error on the reading, and the shunt's own tolerance. Two of them shrink with the current and one does not, which is why a 0.5 per cent chip can be 20 per cent wrong.
Three errors, and only one of them is honest about its size
Drag the slider from one end to the other and watch the bottom bar. The percentage in the readout swings from a fraction of a per cent to something absurd, and nothing about the board changed.
The three contributions are:
Offset. A fixed voltage the chip reports when there is none across the shunt. TI's worst case for the A-grade INA219 fitted here is ±100 microvolts at the narrowest gain setting and ±200 at the widest; for the INA3221 it is ±80. Across the TK119's 100 milliohms that is ±1 to ±2 milliamps; across the INA3221's 50 milliohms the same kind of microvolts make ±1.6 milliamps, because a smaller resistor turns each microvolt into more current. Either way it is the same whether the load draws an amp or nothing.
Gain error. A percentage of the reading — up to 0.5% on the INA219, 0.25% on the INA3221. This one behaves the way people expect an error to behave.
The shunt. 1% on the TK119, and it multiplies straight into every current. The INA3221's 50 milliohm resistor's tolerance is not confirmed, so the figure assumes 1% for it and says so. It is often the largest of the three at sensible currents, which is the part people do not expect: the resistor is a bigger source of error than the chip.
Why the percentage explodes at the bottom
Because one of the three does not scale. At 1 A the offset is a thousandth of the reading and invisible. At 10 mA it is a tenth of it. At 1 mA the board is telling you that something is drawing current, and very little more.
That is the honest boundary for both of these boards, and it is not a defect — it is what a fixed-offset instrument does. Below a few tens of milliamps, treat the reading as an indication — a little higher on the INA3221. Above about 100, treat it as a measurement.
Calibrating away the biggest one
The shunt's tolerance and the chip's gain error are both multiplicative, which means one measurement cancels both.
Put a known load on the board — a resistor you have measured, or a meter in series — read what the board says, and scale. On the INA219 the scaling can go into the calibration register itself, so the chip returns corrected amps and your sketch stays clean; TI describes exactly this in the datasheet's calibration section. On the INA3221 you multiply in your own code.
What calibration cannot fix is the offset, because it does not scale. For that, record the reading at zero current and subtract it.
And the one nothing fixes
Temperature. The shunt turns current into heat, heat changes its resistance, and changed resistance changes every reading. At half an amp it is negligible. At two amps the TK119's resistor is dissipating 0.4 watts and it moves; the INA3221's smaller one dissipates half that for the same current.
If you need a number that holds still over an hour at high current, let the board warm up first and calibrate it warm. That is the same advice a bench instrument's manual gives, for the same reason.
When it does not work
That is the offset, and it is normal. TI quotes up to ±100 µV of zero-point error on the INA219 fitted here and ±80 µV on the INA3221, which is about ±1 mA across the TK119's 100 mΩ and ±1.6 mA across the INA3221's 50 mΩ. Some boards read a little positive and some a little negative. Record the reading at zero current and subtract it in your sketch — it is stable, so subtracting it works.
Expected, and mostly the resistors. Each shunt has its own tolerance — 1% on the TK119 — and each chip adds its own gain error — up to 0.5% on the INA219 and 0.25% on the INA3221 — so two boards can legitimately differ by a few per cent at the same current. Calibrate each one separately against a known load if they have to agree with each other.
The shunt is heating up. At 2 A the TK119's is dissipating 0.4 W in a part 6 mm long, and the INA3221's half that, and a resistor's value moves with temperature. It is the largest source of drift on either board and nothing in software corrects for it. If a reading has to be stable over an hour at high current, let the board reach temperature before you trust it.
More repeatable, not more accurate. Averaging removes noise — the scatter between one reading and the next — and does nothing whatever to the offset or the gain error, which are the same every time. A perfectly steady reading that is 3% high is still 3% high. Averaging is worth turning up; calibration is what fixes accuracy.
Edit this page — content/books/inaset/where-the-error-comes-from.mdx
Questions about this product
See what other owners have asked, and read their solutions.
This page covers several products. Choose yours to see the right discussions.
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.