INA3221

3-Channel Current And Voltage Monitoring Via Shunt

INA3221 is a microchip from Texas Instruments that measures current and voltage for three different channels concurrently. It supports both 3.3V and 5V environments.

  • Load voltage must not exceed 26V
  • All loads and the chip must share a common GND

With the typical R100 shunt resistor found on most breakout boards:

  • Current must not exceed 1.638A

INA3221 is typically used in breakout boards that come with a shunt resistor and cost less than €2.00. but can also be used directly in own PCB designs.

Breakout boards are available with purple and black PCBs which are technically identical. Avoid old breakout board versions (see below) as they have serious flaws.

Quick Overview

The INA3221 is a three-channel, high-side current and voltage monitor with I2C- and SMBUS-compatible interface. Its default I2C address is 0x40. Three additional I2C addresses are manually configurable.

Parameter Description
Supply Voltage 2.7V - 5.5V
Current consumption 350uA (typical)
Detected Voltage 0-26V, 8mV increments
Maximum Detected Current depends on shunt resistor value, 4095 steps resolution
I2C Default Address 0x40 (four addresses configurable)

The device power supply (VC) and the three input channels are separated (but must share a common GND). To not influence measurements, the chip should be powered via a separate power source.

Bus voltages can be present with the supply voltage off and vice versa.

Due to its three separate channels, the chip is suited for analyzing complex power monitoring scenarios like charging analysis for solar panels: you can monitor power generated by the solar panel, power going into a battery, and power consumption taken from the battery all in one device.

The chip has programmable conversion times and averaging modes and offers both critical and warning alerts to detect multiple programmable out-of-range conditions for each channel.

Wiring And Measuring

The current is measured as a voltage drop across the shunt resistor for a particular channel. Each channel uses its own shunt resistor.

Shunt resistors can have different values per channel however identical values are required to use some of the built-in averaging functions.

The voltage is measured as a high side measurement against GND and excludes any voltage drop at the shunt resistors: The channel bus voltage is measured between VNx- and GND.

Connecting Channels

Each channel has two connectors: VNx+ and VNx-.

  • VNx+ must always be connected to the positive voltage (high side).
  • VNx- then connects to the positive side of the load you want to measure.
  • all three channels must share the same GND.

Breakout Boards

INA3221 breakout boards are available in two colors (functionally identical):

With the purple version, PCB traces are better recognizable which helps understand the breakout board schematics and to identify old PCB versions with their design flaw (see below).

Design Flaw In Old PCB Versions

The first version of this breakout board had a seriously limiting design flaw: all three IN+ pins were connected with each other.

Because of this, the three INA3221 channels always had to share the same positive voltage source.

This made it impossible to measure i.e. solar panel appliances where you would want to measure at different circuitry locations with different voltages: the old board design required all three channels to use the same high side (positive input voltage).

How users fixed the old INA3221 breakout board design flaw

Users initially fixed this PCB design flaw manually which worked but took a lot of cutting and reworking tracks.

Depending on how it was done, the result wasn’t always looking necessarily trustworthy either.

The PCB design has meanwhile been fixed, and the tracks on the PCB have been redesigned completely. Compare the new track routing to the three channel solder pads with the earlier design above:

New PCBs without the flaw can be recognized on the top side by looking at the three big connectors: they are now labeled VPU, GND, and GND. The old version did not have labels (and used these pins differently).

Caveats

Since the INA3221 breakout board has undergone substantial redesign (as discussed above), old and new boards are not compatible.

This affects example schematics you may find in the Internet. Always make sure the schematics of a particular project apply to the same INA3221 breakout board version you are planning to use.

Shunt Value and Maximum Current

INA3221 measures current via voltage drop at a shunt resistor. The INA3221 can sense this voltage drop in 40uV increments up to a maximum of 163.8mV, providing a 12-bit resolution with a total of 4.095 steps (one step is used internally).

Setting Maximum Current

The maximum current that can be measured depends on two aspects:

  • Shunt Resistor Value: With the default 0.1 Ohm (R100) shunt resistor found on most breakout boards, a maximum current of 1.638A can be measured. Likewise, a 1 Ohm shunt resistor could measure currents of up to 0.1638A at a higher precision.
  • PCB Traces: The total current needs to go through the shunt resistor, so terminals and PCB traces must be capable of handling this load.

The shunt resistor value must ensure that the highest possible current produces a voltage drop of no more than +/-163.8mV.

Changing Shunt Resistor Value

While you can replace the default R100 SMD shunt resistor with i.e. a R020 (0.02 Ohms) and measure currents of up to 8A, it is doubtful whether the PCB traces would allow such currents.

f you must measure high currents, use external shunt resistors in which case the PCB traces are only exposed to the tiny currents produced by the voltage drop across the (external) shunt resistor.

There is a Power Monitor Tool available for free from Texas Instruments (a Microsoft Excel sheet with embedded formulas) that lets you calculate the required shunt resistor values for your scenario.

Pin Layout

Pin Label Description
IN1+ positive pin of power supply for load 1
IN1- positive side of load 1
IN2+ positive pin of power supply for load 2
IN2- positive side of load 2
IN3+ positive pin of power supply for load 3
IN3- positive side of load 3
VS INA3221 power supply, 2.7-5.5V
GND Common ground (must be shared with all connected loads)
SCL I2C SCL
SDA I2C SDA
PV power valid alert, open-drain output
CRI critical alert, open-drain output, conversion-triggered
WAR warning alert, open-drain output, average-triggered
TC timing control alert, open-drain output
VPU pull-up supply voltage used to bias power valid output circuitry (on top side of board)
A0 defines the I2C address. Default address is 0x40 (on top side of board)

I2C Address

By default, I2C address 0x40 is used unless configured otherwise via pin A0:

I2C Address Pin A0 connected to pin
0x40 n/c
0x40 GND
0x41 VS
0x42 SDA
0x43* SCL

On breakout boards, pin A0 is exposed on the front side, along with solder pads for the four possible counterparts. Add a solder bridge to one of the other pins to manually change the I2C address.

Schematics

The INA3221 is a high side device. Here are the rules:

  • Common Ground: all loads channels and the INA3221 power supply must share the same GND.
  • High Side: the positive pin of each channel must be connected to the positive power supply. The negative pin of the channel connects to the positive side of the load. The negative side of the load connects to common GND.

Basic Example

This is an example of hooking up a ESP32 microcontroller to the I2C interface of INA3221, and exposing three screw terminals for three different loads to be measured:

This schematic uses the minimal wiring, and hooking up three devices to the three channels isn’t necessarily intuitive:

  • Positive power source that drives your load is connected to VNx+
  • The device’s positive pole is connected to the VNx-
  • Both negative power source and negative device pole are connected to GND

Enhanced Example

With just slight wiring changes, a device can be created that uses two screw terminals per channel and can be used much more intuitively:

  • One screw terminal connects the power supply for the particular channel.
  • The other screw terminal connects the load for the particular channel.

Measurement Details

At its heart, INA3221 is a ADC (Analog-to-Digital Converter) and can measure analog voltages.

INA3221 performs two measurements on up to three power supplies of interest:

  • Current: the current is measured indirectly as the voltage drop at the shunt resistor and is measured between INx+ and INx-.
  • Voltage: the bus voltage is measured between INx- and GND.

If bus voltage is of no interest, its monitoring can be disabled (effectively also disabling “power valid alerts). This enables the chip to focus entirely on *current monitoring at a higher rate.

Since the voltage drop at the shunt resistor is neglectible, the bus voltage is roughly the power supply voltage. The exact voltage (between INx+ and GND) would have to take into account the voltage drop across the shunt resistor (which can be derived from the current measurements).

Normal Mode

In normal mode, the chip continuously measures shunt voltage, then bus voltage for one channel, then moving to the next channel. Channels are measured sequentially. Channels can be independently enabled and disabled. Disabled channels are bypassed.

Single Shot Mode

In single shot mode, the chip sequentially measures all enabled channels once, then enters a power-down mode. Values can still be read in this mode. They represent the last measurement cycle.

Power Down Mode

Power down mode is entered automatically at the end of a measurement cycle in single shot mode, and can be entered manually as well. In this mode, quiescent current is reduced while all registes stay fully functional. Only the current flowing into INA3221 inputs is cut off.

Wake up from this mode takes 40us

Alerts

INA3221 supports four different alerts with programmable thresholds per channel. Alert states are available at designated pins. Breakout boards also connect these pins to built-in LED to indicate the alert state of the device:

  • VS: power supply to the board is present
  • PV: all enabled channels have a valid voltage (power valid)
  • C: at least one channel has exceeded the critical current
  • W: at least one channel has exceeded the warning current
  • TC: the power rails on channel 1 and channel 2 did not start up quickly enough (timing control)
  • Critical: very fast-acting alert that triggers whenever any enabled channel current exceeds a programmed threshold. Pin goes low in alert state. Can optionally use the sum of all enabled channels instead (provided all channels use the same shunt resistor value).
  • Warning: less quickly-acting but more fault-tolerant alert that triggers when the average current exceeds a programmed threshold. Pin goes low in alert state.
  • Power Valid: changes from low to high once all enabled channels reach a predefined voltage (by default 10V). Goes back to low once any channel voltage drops below a second threshold (by default 9V). As long as this pin is high, the device power supply is in expected shape. All thresholds can be reprogrammed to a minimum voltage of 2.7V.
  • Timing-Control: This is a very specific alert that can be used to ensure proper power-supply sequencing but requires appropriate assignment of channels to the power supplies in question. This alert is not used for most typical application. Here is how it works: At power-up only (or after a reset), the chip measures the bus voltage at channel 1, and once it exceeds 1.2V, it continues to monitor the bus voltage at channel 2. If this voltage does not also exceed 1.2V after 28.6ms (four complete measurement cycles at default values), this pin pulls low, indicating that no valid power rail was present on channel 2.

Conversion Time And Averaging

Measurement errors can occur: current is measured via very low voltages. Such voltages can be subject to trace inductance and other parasitic impedances between the shunt resistor and the chips input pins.

When using breakout boards, such interferences are minimized by the close proximity of the shunt resistors. When you are required to use external shunt resistors to measure large currents, measurement errors may become a problem.

Noise And Errors

INA3221 can limit the impact of noise on single measurements by two separate types of averaging:

  • Conversion Time: this is the time the internal ADC can use to perform a single measurement. The more conversion time it is granted, the more accurate the results are: internally, the ADC uses its conversion time to take more samples, effectively averaging its single measurement.
  • Averaging: INA3221 can also average. It can take multiple ADC measurements and average them once more.

Both techniques significantly decrease the effect of noise and increase the accuracy of measurements. The price you pay for both optimizations is a lower response times.

This graph illustrates the effect of averaging:

In a nutshell, you can optimize the accuracy in a number of ways:

  • Hardware Design: move the shunt resistor as close to the INA3221 input pins to minimize noise effects in the first place.
  • Conversion Time: give more time to the ADC for better sampling.
  • Average: average the raw ADC samples, effectively filtering out single bad measurements.

Good hardware design is most important: it minimizes noise, so expensive conversion time and post-averaging is less needed, effectively improving response time.

Datasheet

INA3221 (Texas Instruments)

Slow Website?

This website is very fast, and pages should appear instantly. If this site is slow for you, then your routing may be messed up, and this issue does not only affect done.land, but potentially a few other websites and downloads as well. Here are simple steps to speed up your Internet experience and fix issues with slow websites and downloads..

Comments

Please do leave comments below. I am using utteran.ce, an open-source and ad-free light-weight commenting system.

Here is how your comments are stored

Whenever you leave a comment, a new github issue is created on your behalf.

  • All comments become trackable issues in the Github Issues section, and I (and you) can follow up on them.

  • There is no third-party provider, no disrupting ads, and everything remains transparent inside github.

Github Users Yes, Spammers No

To keep spammers out and comments attributable, all you do is log in using your (free) github account and grant utteranc.es the permission to submit issues on your behalf.

If you don’t have a github account yet, go get yourself one - it’s free and simple.

If for any reason you do not feel comfortable with letting the commenting system submit issues for you, then visit Github Issues directly, i.e. by clicking the red button Submit Issue at the bottom of each page, and submit your issue manually. You control everything.

Discussions

For chit-chat and quick questions, feel free to visit and participate in Discussions. They work much like classic forums or bulletin boards. Just keep in mind: your valued input isn’t equally well trackable there.

  Show on Github    Submit Issue

(content created Jul 07, 2024)