The INA226 is a precision digital current and voltage monitor designed to measure bus voltage, shunt voltage, current, and power in electronic circuits.
It communicates through the I²C interface and is commonly used in battery monitoring, solar power projects, power supplies, IoT devices, and energy measurement systems.
INA226 module top view
INA226 module bottom view
Specifications
| Parameter | Value |
|---|---|
| I2C Address | 0x40 |
| Measurement | Bus voltage, shunt voltage, current, and power |
| Interface | I2C |
| Library | INA226_WE |
| Example Output | Voltage in volts (V) |
Example
The code below reads only the bus voltage between VBS and GND.
#include <Wire.h>
#include <INA226_WE.h>
INA226_WE ina226(0x40);
void setup() {
Serial.begin(115200);
Wire.begin(D2, D1);
ina226.init();
}
void loop() {
float voltage = ina226.getBusVoltage_V();
Serial.print("Voltage: ");
Serial.print(voltage, 3);
Serial.println(" V");
delay(1000);
}
The code initializes the INA226 sensor at I2C address 0x40 and reads the bus voltage using getBusVoltage_V(). The measured value is printed to the Serial Monitor in volts.
Output
This simple example is useful when you only need to monitor the voltage of a power line, battery, solar panel, or external supply connected between VBS and GND.
| Measurement | Method | Unit | Description |
|---|---|---|---|
| Bus Voltage | getBusVoltage_V() |
V | Reads the voltage between VBS and GND. |
| I2C Address | INA226_WE ina226(0x40) |
0x40 | Defines the I2C address used to communicate with the INA226 module. |
| Serial Output | Serial.print() |
Text | Displays the measured voltage in the Arduino Serial Monitor. |
Note: This example only reads the bus voltage. The INA226 can also measure current and power when a shunt resistor is used and the sensor is correctly configured.