Power and energy monitor, INA228
A 20-bit power monitor on a 15 milliohm shunt that adds up energy and charge as it goes.
- 8 pins
- 1 setting
- In 1 project

The Power and energy monitor, INA228 in brief
What it is, and every setting the properties panel gives it.
The TI INA228 is a power and energy monitor. It measures current, bus voltage and power to 20 bits through a 15 milliohm shunt, and adds up energy in joules and charge in coulombs as it goes, which makes it the monitor for a battery's state of charge or a project's energy use over a day. The chip keeps the running totals itself. It talks over I2C, with an address from 0x40 to 0x4F. In Mokxi it is used with Adafruit's library, shipped as Adafruit_INA228.h, and the sketch calls setShunt(0.015, 10.0). VBUS is the bus voltage input, tied to the load's supply side, and IN+ and IN- are the two ends of the shunt, in series with the load. The Mokxi model leaves out the limit comparisons and their alerts, the shunt temperature compensation, and noise. Nothing is draggable: the current is the circuit's own.
- Family
- Sensors
- Pins
- 8
- address
- 64
8 pins
Named as the editor names them, so a wire lands where you expect it.
How to use the INA228 with an Arduino Uno
The example project is an energy meter. An INA228 sits in series with a 12 V lamp: IN+ goes to 12 V and IN- goes to the lamp, while VBUS ties to the 12 V supply side. VCC goes to 5 V, GND to the Uno's GND, and SCL and SDA to the Uno's SCL and SDA. An OPT3001 light sensor reads the light falling on the solar panel that would charge the battery.
The sketch includes Adafruit_INA228.h and ClosedCube_OPT3001.h, calls meter.begin(), then meter.setShunt(0.015, 10.0) to set the 15 milliohm shunt. The chip keeps the running totals itself, so the loop only reads them: every 500 ms it prints bus voltage, current in mA, power in mW, energy in joules, charge in coulombs, and the panel light in lux. 3600 coulombs is one amp hour.
With default settings, the serial monitor printed: "Energy meter", "12.00 V 100 mA 1197 mW 0.65 J 0.055 C panel 19999 lux", "12.00 V 100 mA 1197 mW 1.29 J 0.108 C panel 19999 lux". The voltage, current and power stay the same because the load does not change. The joules and coulombs climb every line as the chip accumulates them.
Try swapping the lamp for another model and watch the totals climb faster or slower. Drag the light slider on the OPT3001 and watch the lux number change.
// Energy meter: an INA228 on a 12 V load adds up the energy and the charge
// that flow through its shunt, the way a battery monitor counts what is
// left, and an OPT3001 reads the light falling on the solar panel that
// would charge the battery.
//
// INA228 SDA -> SDA SCL -> SCL in series with the load
// OPT3001 SDA -> A4 SCL -> A5
//
// The chip keeps the running totals itself, so the sketch only reads them:
// joules of energy and coulombs of charge (3600 coulombs is one amp hour).
//
// Things to try. Swap the lamp for another model and watch the totals climb
// faster or slower. Drag the light slider on the OPT3001.
#include <Adafruit_INA228.h>
#include <ClosedCube_OPT3001.h>
Adafruit_INA228 meter;
ClosedCube_OPT3001 light;
void setup() {
Serial.begin(9600);
if (!meter.begin()) {
Serial.println("No INA228");
while (1);
}
meter.setShunt(0.015, 10.0);
light.begin(0x44);
OPT3001_Config config;
config.rawData = 0;
config.RangeNumber = 0b1100; // automatic range
config.ModeOfConversionOperation = 0b11; // continuous, 100 ms
light.writeConfig(config);
Serial.println("Energy meter");
}
void loop() {
delay(500);
Serial.print(meter.getBusVoltage_V(), 2);
Serial.print(" V ");
Serial.print(meter.readCurrent(), 0);
Serial.print(" mA ");
Serial.print(meter.readPower(), 0);
Serial.print(" mW ");
Serial.print(meter.readEnergy(), 2);Common Power and energy monitor, INA228 errors and fixes
Questions and answers
what is the ina228
A TI chip that measures current, bus voltage and power to 20 bits through a 15 milliohm shunt and adds up energy and charge as it goes.
what is the ina228 i2c address
The address property ranges from 0x40 to 0x4F.
how does the ina228 count energy and charge
The chip keeps the running totals itself in registers that accumulate with each conversion, until cleared.
why does the ina228 read zero power and energy
VBUS is probably unconnected. Tie it to the load's supply side.
What is true about the Power and energy monitor, INA228, here
In its help article’s own words: what the simulation gets right, and where it stops.
Not modeled
The limit comparisons and their alerts, the shunt temperature compensation, and noise.
From INA228 power and energy monitor, in full.
See the Power and energy monitor, INA228 in a project
One built-in project uses it. It opens in the editor, already wired.
The boards it is shown on
This board has a built-in project with the Power and energy monitor, INA228 in it.
The rest of the bench
Every one of these is drawn and simulated the same way.
Wire up the Power and energy monitor, INA228
Open the editor and push it into the breadboard. It is free, and it runs on your own machine.