How far off a reading is
Three things add up to the error in a reading: the chip's zero error of 1 to 2 mA, its own error of up to 0.5 %, and the shunt's 1 % tolerance. At an amp that is under 2 %. At a few milliamps the zero error is as big as the reading, and a sleeping ESP32 is invisible.
Three errors
The zero error. With no current at all the chip may read up to 100 µV across the shunt on the narrowest range and 200 µV on the widest, which here is 1 to 2 mA. It does not grow with the current, so it matters most when the current is small.
The chip's error, up to 0.5 % of the reading at room temperature and 1 % over its whole temperature range. It grows with the current.
The shunt's tolerance, 1 %. The resistor is within 1 % of 100 mΩ, and the chip has no way to know which way.
These are TI's and Yageo's worst cases, added in the worst direction. A typical chip's zero error is a tenth of the maximum, and the two percentages rarely line up.
What that means at each current
At 1 A on the widest range the budget is 2 mA plus 15 mA: under 2 %. That is a good number for a part this size.
At 100 mA it is 2 mA plus 1.5 mA, about 3.5 %, and the narrow range brings it to about 2.5 %.
At 10 mA the zero error is a tenth of the reading. At 1 mA it is as big as the reading itself.
Taking the zero error out
The zero error is steady, which makes it the one error you can remove. Run the sketch with nothing in LOAD, note the current, and subtract it. The sketch in the next article has a line for it.
The percentage errors need a meter you trust and a known load: read both, and scale the block's readings by their ratio.
What it cannot see
One count is 0.1 mA. An ESP32 in deep sleep draws tens of microamps, well under a single count, and the zero error hides it completely.
That does not make the block useless for a battery project. It shows the current while the board is awake, the burst when Wi-Fi transmits, and how long each lasts, which is most of where a battery goes.
When it does not work
That is the zero error, and it is within specification: up to 1 mA on the narrowest range and 2 mA on the widest, worst case. It stays put, so measure it once with nothing in LOAD and subtract it in the sketch. That is the one correction worth making by hand.
No. A sleeping ESP32 draws tens of microamps, and one count here is 100 µA, with a zero error ten or twenty times that. The block shows a board at work: waking, transmitting, driving a motor. A sleep current needs a meter with a microamp range.
That is inside the budget: the shunt alone may be 1 % off. If the difference is steady, work out the ratio against the meter at a known load and multiply every reading by it. TI's datasheet does the same thing by adjusting the calibration register, which is Equation 6 in section 8.5.2.
At several amps the shunt makes up to a watt and its resistance moves a little with temperature, and the chip's own error doubles over its temperature range. Let the load run for a minute before trusting the last digit, or keep heavy loads short.
Edit this page — content/books/ina219/how-far-off.mdx
Questions about this product
See what other owners have asked, and read their solutions.
TK119 INA219 Current and Voltage Monitor
Loading 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.