meta data for this page
This is an old revision of the document!
lamaPLC: INA modules with Arduino libraries
Several INA series ICs have excellent Arduino support, with libraries provided by Adafruit and the community. The following table summarizes the most popular models and their technical specifications
| IC Model | ADC Res. | Max Bus Voltage | Shunt Voltage Range | PGA | Alert Pin | Communication | Arduino Library | Key Functionality |
|---|---|---|---|---|---|---|---|---|
| INA219 | 12-bit | 26V | ±40,±80, ±160,±320 mV | Yes (1, 2, 4, 8) | No | I²C/SMBus | Adafruit_INA219 | Basic current, voltage, and power monitoring. |
| INA226 | 16-bit | 36V | ±81.92 mV | No | Yes | I²C/SMBus | INA226 (Rob Tillaart) | High precision; monitors current, voltage, and power. |
| INA228 | 20-bit | 85V | ±163.84.92 mV | No | Yes | I²C/SMBus | INA228 (Rob Tillaart) | Ultra-high precision; includes energy and charge accumulation. |
| INA237 | 16-bit | 85V | ±163.84.92 mV | No | Yes | I²C/SMBus | Adafruit_INA237 | High voltage support (up to 85V) for current and power. |
| INA238 | 16-bit | 85V | ±163.84.92 mV | No | Yes | I²C/SMBus | - | High voltage support (up to 85V) for current and power. |
| INA260 | 16-bit | 36V | Integrated Shunt | No | Yes | I²C/SMBus | Adafruit_INA260 | Built-in 2m shunt; supports up to 15A continuous. |
| INA3221 | 13-bit | 26V | ±163.84.92 mV | No | Yes | I²C/SMBus | Adafruit_INA3221 | 3-Channel monitoring of voltage and current. |
INA219: digital current, voltage, and power monitor with I²C communication
The INA219 is a digital current, voltage, and power monitor with an I²C- or SMBUS-compatible interface. It is primarily used for high-side current sensing but can also be configured for low-side sensing.
INA219: Key Specifications
- Bus Voltage Range: Senses from 0V to 26V.
- Supply Voltage: Operates on a single 3V to 5.5V supply.
- Current Draw: Maximum of 1 mA.
- Accuracy: Up to 0.5% maximum over temperature (for the B-grade version).
- Interface: I²C/SMBUS with 16 programmable addresses via A0 and A1 pins.
- ADC Resolution: Integrated 12-bit ADC.
- Temperature Range: Operates from –40°C to 125°C.
INA219: Pin Description
| Pin | Name | Type | Description |
|---|---|---|---|
| 1 | VCC | Power | Supply Voltage: Powers the chip (3.0V to 5.5V). |
| 2 | GND | Power | Ground: Common ground for the sensor and logic. |
| 3 | SCL | Digital I/O | I²C Clock: Serial clock line for communication. |
| 4 | SDA | Digital I/O | I²C Data: Serial data line for communication. |
| 5 | V+ (IN+) | Analog Input | Positive Shunt: Connect to the power source side. |
| 6 | V- (IN-) | Analog Input | Negative Shunt: Connect to the load side. |
| 7 | A0 | Digital Input | Address 0: Connect to GND, VS, SDA, or SCL to set I²C address. |
| 8 | A1 | Digital Input | Address 1: Connect to GND, VS, SDA, or SCL to set I²C address. |
Important Considerations
- Maximum Limits: Do not exceed 26V or 3.2A, or the shunt resistor might be damaged.
- I²C Address: The default address is 0x40. You can bridge solder pads on the board to change it to 0x41, 0x44, or 0x45 to use multiple sensors.
- Negative Current Readings: If current reads negative, you have swapped the Vin+ and Vin- connections.
- Precision: If measuring very low currents, increase sensitivity by changing the Gain using ina219.setCalibration_16V_400mA().
Standard Breakout Board Address Table
The INA219 current sensor has a base I2C address of 0x40. Most breakout boards, like those from Adafruit, feature two address jumpers (A0 and A1) that allow you to set up to four unique addresses by bridging them with solder.
| Address | A1 Jumper | A0 Jumper | Description |
|---|---|---|---|
| 0x40 | Open | Open | Default address |
| 0x41 | Open | Closed | Bridge A0 |
| 0x44 | Closed | Open | Bridge A1 |
| 0x45 | Closed | Closed | Bridge A0 and A1 |
INA219 Arduino example code
#include <Wire.h> #include <Adafruit_INA219.h> Adafruit_INA219 ina219; void setup(void) { Serial.begin(115200); if (!ina219.begin()) { Serial.println("Failed to find INA219 chip"); while (1); } // Optional: Set calibration for higher precision (e.g., 32V 1A) // ina219.setCalibration_32V_1A(); } void loop(void) { float shuntvoltage = 0; float busvoltage = 0; float current_mA = 0; float loadvoltage = 0; float power_mW = 0; shuntvoltage = ina219.getShuntVoltage_mV(); busvoltage = ina219.getBusVoltage_V(); current_mA = ina219.getCurrent_mA(); power_mW = ina219.getPower_mW(); loadvoltage = busvoltage + (shuntvoltage / 1000); Serial.print("Load Voltage: "); Serial.print(loadvoltage); Serial.println(" V"); Serial.print("Current: "); Serial.print(current_mA); Serial.println(" mA"); Serial.print("Power: "); Serial.print(power_mW); Serial.println(" mW"); Serial.println(""); delay(1000); }
INA226: current/voltage/power monitor with I²C communication
36V, 16-bit, ultra-precise i²c output current/voltage/power monitor w/alert
The INA226 is a current shunt and power monitor with an I²C or SMBUS-compatible interface. It monitors both a shunt-voltage drop and the bus supply voltage. Programmable calibration values, conversion times, and averaging, combined with an internal multiplier, enable direct readouts of current in amperes and power in watts.
The INA226 is a current shunt and power monitor with an I²C or SMBUS-compatible interface. The device monitors both a shunt voltage drop and bus supply voltage. Programmable calibration value, conversion times, and averaging, combined with an internal multiplier, enable direct readouts of current in amperes and power in watts. The INA226 senses current on the common-mode bus, which can range from 0V to 36V, independent of the supply voltage. The device operates from a 2.7V to 5.5V supply, drawing a typical supply current of 330 μA. The device is specified for an operating temperature range of –40°C to 125°C and features up to 16 programmable addresses via an I2C-compatible interface.
The INA226 supports the fast mode (1 kHz to 400 kHz) and high-speed mode (1 kHz to 2.94 MHz) transmission protocols. All data bytes are transmitted in most significant byte-first order.
INA226: Features
- Senses Bus Voltages: 0 V .. 36 V
- Shunt Voltage Maximum: 81.9 V
- Current Maximum: 20 A
- High-Side or Low-Side Sensing
- Reports Current, Voltage, and Power
- High Accuracy:
- 0.1% Gain Error (Max)
- 10 μV Offset (Max)
- Configurable Averaging Options
- 16 Programmable Addresses
- Operates from 2.7V to 5.5V Power Supply
- 10-Pin, DGS (VSSOP) Package
If you'd like to support the development of the site with the price of a coffee — or a few — please do so here.
Here's a handy tip: you can quickly save this page as a PDF by clicking “export to PDF” in the menu on the right side of the screen.
INA226 Pin Description
| Pin Name | Description |
|---|---|
| V+ / VS | Power Supply: 2.7V to 5.5V for the chip's own logic |
| GND | Ground: Reference point for power and I²C |
| SCL | I²C Clock: Connect to the microcontroller's SCL pin |
| SDA | I²C Data: Connect to the microcontroller's SDA pin |
| VBUS | Bus Voltage Input: Connect this to the high-side or load-side to measure the actual bus voltage (up to 36V) |
| IN+ | Shunt Positive: Connect to the supply side of the external shunt resistor |
| IN- | Shunt Negative: Connect to the load side of the external shunt resistor |
| A0 & A1 | Address Pins: Used to set the I²C address by tying them to GND, VS, SDA, or SCL |
| ALERT | Programmable Alert: Open-drain output that can trigger on over/under voltage or current thresholds |
Typical Wiring (High-Side Sensing)
- V+ and GND: Connect to your microcontroller's 3.3V or 5V power and ground.
- SDA and SCL: Connect to your microcontroller's I²C pins.
- IN+ and IN-: Place the shunt resistor in series with your load's positive line. Connect IN+ before the resistor and IN- after it.
- VBUS: Connect this pin to IN- (load side) for standard high-side power monitoring.
INA226 I2C Address Table
The Texas Instruments INA226 supports up to 16 unique I²C addresses. The address is set by connecting the two address pins (A0 and A1) to one of four possible points: GND, VS (power supply), SDA, or SCL.
The default address is 0x40 (when both pins are connected to GND).
| A1 Pin | A0 Pin | Hex Address |
|---|---|---|
| GND | GND | 0x40 |
| GND | VS | 0x41 |
| GND | SDA | 0x42 |
| GND | SCL | 0x43 |
| VS | GND | 0x44 |
| VS | VS | 0x45 |
| VS | SDA | 0x46 |
| VS | SCL | 0x47 |
| SDA | GND | 0x48 |
| SDA | VS | 0x49 |
| SDA | SDA | 0x4A |
| SDA | SCL | 0x4B |
| SCL | GND | 0x4C |
| SCL | VS | 0x4D |
| SCL | SDA | 0x4E |
| SCL | SCL | 0x4F |
INA226 Arduino wiring
- VCC/VSS → Arduino 5V (or 3.3V)
- GND → Arduino GND
- SDA → Arduino SDA (A4 on Uno)
- SCL → Arduino SCL (A5 on Uno)
INA226 Arduino example code
In the Arduino IDE, go to Tools > Manage Libraries, search for “INA226_WE”, and install the version by Wollewald.
This sketch initializes the sensor at the default address (0x40) and prints current, voltage, and power to the Serial Monitor.
#include <Wire.h> #include <INA226_WE.h> #define I2C_ADDRESS 0x40 INA226_WE ina226 = INA226_WE(I2C_ADDRESS); void setup() { Serial.begin(9600); Wire.begin(); // Initialize INA226 if (!ina226.init()) { Serial.println("Failed to find INA226 chip. Check wiring!"); while (1); } /* Optional: Calibrate for your shunt. The default is usually 0.1 Ohm. Parameters: (Shunt value in Ohms, Max expected current in Amps) */ ina226.waitUntilConversionCompleted(); Serial.println("INA226 Ready!"); } void loop() { float shuntVoltage_mV = 0.0; float loadVoltage_V = 0.0; float busVoltage_V = 0.0; float current_mA = 0.0; float power_mW = 0.0; // Read values ina226.readAndClearFlags(); shuntVoltage_mV = ina226.getShuntVoltage_mV(); busVoltage_V = ina226.getBusVoltage_V(); current_mA = ina226.getCurrent_mA(); power_mW = ina226.getBusPower_mW(); loadVoltage_V = busVoltage_V + (shuntVoltage_mV / 1000); // Print results Serial.print("Bus Voltage: "); Serial.print(busVoltage_V); Serial.println(" V"); Serial.print("Current: "); Serial.print(current_mA); Serial.println(" mA"); Serial.print("Power: "); Serial.print(power_mW); Serial.println(" mW"); Serial.println("---------------------------"); delay(2000); }
INA228: ultra-precise, high-resolution digital power, energy, and charge monitor with an I²C interface
The INA228 is an ultra-precise, high-resolution digital power, energy, and charge monitor with an I2C interface. It is significantly more advanced than the INA219 or INA226, featuring a 20-bit ADC and a common-mode voltage range of –0.3V to +85V.
Key Specifications
- ADC Resolution: 20-bit delta-sigma ADC for high-precision measurements.
- Bus Voltage: Supports 0V to 85V (more than double the INA226's 36V limit).
- Measured Data: Reports current, bus voltage, temperature, power, energy, and charge accumulation.
- Temperature Sensor: Integrated sensor with ±1°C accuracy for die temperature monitoring.
- Precision: Very low offset voltage (±1 µV max) and low gain drift allow for micro-amp to kilo-amp sensing.
- Interface: High-speed I²C (up to 2.94 MHz) with 16 programmable addresses via A0 and A1 pins.
I²C topics on lamaPLC
This page has been accessed for: Today: 3, Until now: 40





