The INA226, manufactured by Sensor, is a high-side current shunt monitor with an integrated I2C interface. It is designed to measure both current and voltage with high precision, thanks to its built-in analog-to-digital converter (ADC). The INA226 is widely used in power monitoring applications, offering a versatile solution for tracking energy consumption in electronic devices.
The INA226 is a robust and versatile component with the following key specifications:
Parameter | Value |
---|---|
Supply Voltage (VCC) | 2.7V to 5.5V |
Input Voltage Range | 0V to 36V |
Current Measurement Range | Configurable via external shunt |
ADC Resolution | 16-bit |
Communication Interface | I2C (up to 400 kHz) |
Operating Temperature Range | -40°C to +125°C |
Power Consumption | 330 µA (typical) |
The INA226 is available in a small package with the following pinout:
Pin Name | Pin Number | Description |
---|---|---|
VIN+ | 1 | Positive input for differential voltage measurement |
VIN- | 2 | Negative input for differential voltage measurement |
GND | 3 | Ground connection |
SCL | 4 | I2C clock line |
SDA | 5 | I2C data line |
VCC | 6 | Power supply input (2.7V to 5.5V) |
ALERT | 7 | Alert output for programmable threshold events |
ADDR | 8 | Address pin for I2C address configuration |
The INA226 is straightforward to use in a circuit, but proper configuration and calibration are essential for accurate measurements.
The INA226 can be easily interfaced with an Arduino UNO using the Wire library. Below is an example code snippet to read voltage and current:
#include <Wire.h>
// INA226 I2C address (default: 0x40)
#define INA226_ADDRESS 0x40
// Register addresses
#define REG_BUS_VOLTAGE 0x02
#define REG_CURRENT 0x04
void setup() {
Wire.begin(); // Initialize I2C communication
Serial.begin(9600); // Start serial communication for debugging
// Configure INA226 (e.g., calibration, averaging, etc.)
configureINA226();
}
void loop() {
float busVoltage = readBusVoltage(); // Read bus voltage in volts
float current = readCurrent(); // Read current in amps
// Print the results to the serial monitor
Serial.print("Bus Voltage: ");
Serial.print(busVoltage);
Serial.println(" V");
Serial.print("Current: ");
Serial.print(current);
Serial.println(" A");
delay(1000); // Wait 1 second before the next reading
}
void configureINA226() {
// Example: Write calibration value to the INA226
Wire.beginTransmission(INA226_ADDRESS);
Wire.write(0x05); // Calibration register address
Wire.write(0x10); // High byte of calibration value
Wire.write(0x00); // Low byte of calibration value
Wire.endTransmission();
}
float readBusVoltage() {
uint16_t rawValue = readRegister(REG_BUS_VOLTAGE);
return rawValue * 0.00125; // Convert to volts (1.25 mV per LSB)
}
float readCurrent() {
uint16_t rawValue = readRegister(REG_CURRENT);
return rawValue * 0.001; // Convert to amps (example scaling factor)
}
uint16_t readRegister(uint8_t reg) {
Wire.beginTransmission(INA226_ADDRESS);
Wire.write(reg); // Specify the register to read
Wire.endTransmission();
Wire.requestFrom(INA226_ADDRESS, 2); // Request 2 bytes
uint16_t value = (Wire.read() << 8) | Wire.read(); // Combine MSB and LSB
return value;
}
No I2C Communication:
Incorrect Voltage or Current Readings:
Alert Pin Not Functioning:
By following this documentation, you can effectively integrate the INA226 into your projects for precise power monitoring and management.