INA3221 three-channel current monitor

The TI INA3221 measures three shunts and three bus voltages at one I2C address, for a project with several supply rails.

Aliases: INA3221 module, Adafruit INA3221, triple current sensor. Each channel is a 0.1 ohm shunt in series with its load, and the bus voltage is read at the shunt's load end.

Pins

Pin What it does
VCC, GND Supply, 2.7 to 5.5 V.
SCL, SDA I2C. The board carries the pull-ups.
IN1+, IN1- Channel 1's shunt.
IN2+, IN2- Channel 2's shunt.
IN3+, IN3- Channel 3's shunt.

Properties

address, 0x40 to 0x43. Nothing to drag: each channel reads the circuit's own current.

Reading it on an Arduino

With Adafruit's library, which Mokxi ships as Adafruit_INA3221.h (channels 0 to 2):

#include "Adafruit_INA3221.h"
Adafruit_INA3221 ina3221;

void setup() {
  Serial.begin(9600);
  ina3221.begin(0x40, &Wire);
  for (uint8_t i = 0; i < 3; i++) ina3221.setShuntResistance(i, 0.1);
}

void loop() {
  Serial.println(ina3221.getCurrentAmps(0) * 1000);
  delay(500);
}

How it talks

Sixteen-bit registers: 0x00 configuration (the three channel enables, averaging, conversion times and mode), 0x01 to 0x06 each channel's shunt (40 uV a count) and bus (8 mV), both in bits 15 to 3, 0x0D the shunt sum, 0x0F mask/enable with the conversion ready flag, 0xFE 0x5449 and 0xFF 0x3220. A cycle converts each enabled channel in turn: 6.6 ms by default.

What it does not model

The critical and warning alerts and their pins, and the power-valid window.

Common mistakes

Leaving the library's 0.05 ohm default with a 0.1 ohm board: the current reads double.