-
Notifications
You must be signed in to change notification settings - Fork 40
Home
Arduino library to access multiple INA2xx High-Side/Low-Side Bi-Directional I2C Current and Power Monitors at the same time. Details of the library methods and example programs are to be found at the INA wiki pages. Arduino library to access multiple INA2xx High-Side/Low-Side Bi-Directional I2C Current and Power Monitors. Texas Instruments produces this family of power monitors and the library supports the following devices:
Device | Max V | Package | Shunt mV | Description | Tested |
---|---|---|---|---|---|
INA219 (datasheet) | 26V | SOT-23 8p | ±40,±80,±160,±320mV | Yes | |
INA220 (datasheet) | 26V | VSSOP 10p | ±40,±80,±160,±320mV | identical to INA219 | INA219 |
INA220-Q1 (datasheet) | 26V | VSSOP 10p | ±40,±80,±160,±320mV | Identical to INA219 | INA219 |
INA226 (datasheet) | 36V | VSSOP 10p | ±81.92mV | Yes | |
INA230 (datasheet) | 28V | QFN 16p | ±81.92mV | Identical to INA226 | INA226 |
INA231 (datasheet) | 28V | DSBGA-12 | ±81.92mV | Identical to INA226 | INA226 |
INA260 (datasheet) | 36V | TSSOP 16p | n.a. | 2 mΩ shunt, ±15A | Yes |
INA3221 (datasheet) | 26V | VQFN(16) | ±163.8mV | 3 concurrent circuits | Yes |
Texas Instruments has a document which documents and details additional differences between the various INA-devices, this PDF document can be read at Digital Interfaces for Current Sensing Devices
The packages are quite small and unwieldy to solder, but fortunately there are several sources for breakout boards for the various devices which are worth their cost in time savings to prototype. My first test with a INA226 involved a blank breakout board, some solder paste, a frying pan, desoldering braid, a magnifying glass and far too much time spent to set up the first breadboard.The library locates all INA2xx devices on the I2C bus. The address and configuration information for each located device takes about 20 bytes per device. Considering that classic Arduino devices using Atmel microprocessors have very little available RAM memory but all have a certain amount of EEPROM memory (which most programs do not use at all), the design decision was taken to use this EEPROM memory to store INA device information. With the advent of newer processors and developers that do use their EEPROM the library was expanded as of v1.0.14 to allow using dynamically allocated RAM storage instead of EEPROM. This switch is done during class instantiation - see Class Instantiation for further details.
These wiki pages describe the library calls and usage of the example programs.
Since the Arduino Atmel-based microprocessors do not have built-in floating point, any use of floating point variables will require software emulation which is rather slow and increases program size significantly. Therefore great lengths have been taken to avoid the use of floating point arithmetic in the library. In order to keep the original level of precision without loss yet to allow the full range of voltages and amperes to be returned, the amperage results are returned as 32-bit integers.
Since the functionality differs between the supported INA2xx devices there are some functions which will only work for certain devices.
The documentation has been done using Doxygen and can be found at doxygen documentation
Overview
Installation
Class Instantiation
begin()
setI2CSpeed()
getBusMilliVolts()
getBusRaw()
getShuntMicroVolts()
getShuntRaw()
getBusMicroAmps()
getBusMicroWatts()
getDeviceAddress()
getDeviceName()
setMode()
setAveraging()
setBusConversion()
setShuntConversion()
reset()
waitForConversion()
conversionFinished()
alertOnConversion()
alertOnShuntOverVoltage()
alertOnShuntUnderVoltage()
alertOnBusOverVoltage()
alertOnBusUnderVoltage()
alertOnPowerOverLimit()