The INA226 is a precision current shunt monitor designed to measure the voltage across a shunt resistor, enabling accurate current measurement. It features a high common-mode voltage range (up to 36V) and integrates a 16-bit ADC for precise measurements. The INA226 communicates via an I2C interface, making it easy to integrate into digital systems for power monitoring and energy management.
Parameter | Value |
---|---|
Supply Voltage (VCC) | 2.7V to 5.5V |
Common-Mode Voltage Range | 0V to 36V |
Input Offset Voltage | ±10 µV (typical) |
Measurement Accuracy | ±0.1% (typical) |
ADC Resolution | 16-bit |
I2C Address Range | Configurable (7-bit address) |
Operating Temperature Range | -40°C to +125°C |
Pin Name | Pin Number | Description |
---|---|---|
VIN+ | 1 | Positive input for differential voltage measurement across the shunt resistor. |
VIN- | 2 | Negative input for differential voltage measurement across the shunt resistor. |
GND | 3 | Ground connection. |
VCC | 4 | Power supply input (2.7V to 5.5V). |
SCL | 5 | I2C clock line for communication. |
SDA | 6 | I2C data line for communication. |
ALERT | 7 | Alert output pin for programmable threshold monitoring. |
ADDR | 8 | Address pin to configure the I2C address. |
The following example demonstrates how to configure and read data from the INA226 using an Arduino UNO.
#include <Wire.h>
// INA226 I2C address (default: 0x40)
#define INA226_ADDRESS 0x40
// Register addresses
#define CONFIG_REGISTER 0x00
#define SHUNT_VOLTAGE_REGISTER 0x01
#define BUS_VOLTAGE_REGISTER 0x02
void setup() {
Wire.begin(); // Initialize I2C communication
Serial.begin(9600); // Initialize serial communication for debugging
// Configure the INA226
Wire.beginTransmission(INA226_ADDRESS);
Wire.write(CONFIG_REGISTER); // Point to the configuration register
Wire.write(0x45); // MSB: Set averaging, bus voltage conversion time, etc.
Wire.write(0x27); // LSB: Set shunt voltage conversion time, mode
Wire.endTransmission();
}
void loop() {
int16_t shuntVoltage = readRegister(SHUNT_VOLTAGE_REGISTER);
int16_t busVoltage = readRegister(BUS_VOLTAGE_REGISTER);
// Convert raw values to meaningful units
float shuntVoltage_mV = shuntVoltage * 0.0025; // 2.5µV per LSB
float busVoltage_V = busVoltage * 0.00125; // 1.25mV per LSB
// Print the results
Serial.print("Shunt Voltage (mV): ");
Serial.println(shuntVoltage_mV);
Serial.print("Bus Voltage (V): ");
Serial.println(busVoltage_V);
delay(1000); // Wait 1 second before the next reading
}
int16_t readRegister(uint8_t reg) {
Wire.beginTransmission(INA226_ADDRESS);
Wire.write(reg); // Point to the desired register
Wire.endTransmission();
Wire.requestFrom(INA226_ADDRESS, 2); // Request 2 bytes
while (Wire.available() < 2); // Wait for data
int16_t value = (Wire.read() << 8) | Wire.read(); // Combine MSB and LSB
return value;
}
No I2C Communication:
Incorrect Current or Voltage Readings:
Device Not Responding:
Q: Can the INA226 measure negative currents?
A: Yes, the INA226 can measure bidirectional currents if configured appropriately. Refer to the datasheet for details on setting the calibration register.
Q: What is the maximum shunt voltage the INA226 can measure?
A: The INA226 can measure a maximum shunt voltage of ±81.92mV.
Q: How do I calculate the current from the shunt voltage?
A: Use Ohm's Law: Current (A) = Shunt Voltage (V) / Shunt Resistance (Ω). Ensure the shunt resistor value is known and precise.
Q: Can I use the INA226 with a 5V microcontroller?
A: Yes, the INA226 supports a supply voltage range of 2.7V to 5.5V, making it compatible with 5V systems.