Skip to content
This repository has been archived by the owner on Jun 22, 2018. It is now read-only.
Arnd edited this page Jun 22, 2018 · 9 revisions

INA226 - Merged into new library INA

‼️ This library has been deprecated and is obsolete ‼️

Further development and bug fixes will be done in the new INA library.

The new INA library along with the associated example programs and documentation at https://github.com/SV-Zanshin/INA/wiki supports multiple devices of multiple types in one combined library. The INA226 library functions have been duplicated in the new INA library and several additional functions have been incorporated as well. In addition, several minor bugs were detected and fixed during the transition to the new library.

INA226

INA226 High-Side/Low-Side Bi-Directional I2C Current and Power Monitor library for the Arduino. Texas Instruments produces this family of power monitors and the series is described at on their product page at INA226.

INA219 vs INA226

Several breakout boards, tutorials and libraries exist for the INA219, which is the "little brother" to this INA226 chip. While the pin layout is similar, with the INA219 having 8 pins and the INA226 having 2 more pins, the internal configuration settings and registers are different and require the functions and methods in this library to access.

Hardware layout

The datasheet has examples of how to hook up INA226. The package is a small VSSOP and I used a blank breakout board, some solder paste, a frying pan, desoldering braid, a magnifying glass and quite a bit of time to set up the first breadboard example. I've since seen breakout boards available on the web but since only a few external components are necessary apart from connecting the 10 pins of the INA226 I'll remain with self-build.

Library description

The library will locate all INA226 devices on the I2C chain and with 2 setup parameters describing the expected voltage, shunt / resistor values the internal configuration registers will be set and the library is ready to begin accurate measurements. The Atmel's EEPROM memory is used to store the configuration details at runtime to minimize memory consumption. The details of how to setup the library along with all of the publicly available methods can be found on the INA226 wiki pages.

Great lengths have been taken to avoid the use of floating point in the library. To keep the original level of precision without loss but to allow the full range of voltages and amperes to be returned the amperage results are returned as 32-bit integers.

The INA226 has a dedicated interrupt pin which can be used to trigger pin-change interrupts on the Arduino and the examples show a program that measures readings using this output pin so that the Arduino can perform other concurrent tasks while still retrieving measurements.