Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use INA219: Examples, Pinouts, and Specs

Image of INA219
Cirkit Designer LogoDesign with INA219 in Cirkit Designer

Introduction

The INA219 is a high-side current shunt monitor with an integrated I2C interface, designed for precise measurement of current, voltage, and power. It is widely used in applications requiring accurate power monitoring, such as battery management systems, power supply diagnostics, and energy monitoring in embedded systems. By measuring both the voltage across a shunt resistor and the bus voltage, the INA219 calculates power consumption with high accuracy.

Explore Projects Built with INA219

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
ESP32-Based Solar Power Monitoring System with MPPT and INA219
Image of lapmag: A project utilizing INA219 in a practical application
This circuit is designed to monitor the voltage and current of a solar panel using an ESP32 Devkit V1 microcontroller and an INA219 current sensor. The ESP32 reads data from the INA219 via I2C communication (using pins D21 and D22 for SDA and SCL, respectively) and reports voltage, current, and power measurements over a serial connection. The solar panel is connected to an MPPT solar charge controller, which is in turn connected to the INA219 for monitoring its output.
Cirkit Designer LogoOpen Project in Cirkit Designer
Multi-Sensor Monitoring System with INA219, Hall Sensor, and OLED Display
Image of R8 Charger: A project utilizing INA219 in a practical application
This circuit is designed for monitoring and displaying sensor data. It includes three INA219 current sensors, a GH1248 Hall sensor, and an SSD1306 OLED display, all interfaced with a Seeed Studio RP2350 microcontroller. The microcontroller reads data from the sensors and controls the display and three LEDs.
Cirkit Designer LogoOpen Project in Cirkit Designer
ESP32-Based Motor Control System with INA219 Current Sensor and ST7735S Display
Image of test1: A project utilizing INA219 in a practical application
This circuit is a motor control system using an ESP32 microcontroller, an INA219 current sensor, and a BTS7960 motor driver. The ESP32 reads current data from the INA219 and controls the motor driver, while a display module shows relevant information. A pushbutton is included for user interaction.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Mega 2560 and INA219 Sensor for Current and Voltage Measurement
Image of INA219_Mega2560: A project utilizing INA219 in a practical application
This circuit connects an Arduino Mega 2560 to an INA219 sensor for current and voltage measurement. The INA219 sensor communicates with the Arduino via the I2C protocol, and the Arduino reads and prints the current, bus voltage, shunt voltage, and power values to the Serial Monitor.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with INA219

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of lapmag: A project utilizing INA219 in a practical application
ESP32-Based Solar Power Monitoring System with MPPT and INA219
This circuit is designed to monitor the voltage and current of a solar panel using an ESP32 Devkit V1 microcontroller and an INA219 current sensor. The ESP32 reads data from the INA219 via I2C communication (using pins D21 and D22 for SDA and SCL, respectively) and reports voltage, current, and power measurements over a serial connection. The solar panel is connected to an MPPT solar charge controller, which is in turn connected to the INA219 for monitoring its output.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of R8 Charger: A project utilizing INA219 in a practical application
Multi-Sensor Monitoring System with INA219, Hall Sensor, and OLED Display
This circuit is designed for monitoring and displaying sensor data. It includes three INA219 current sensors, a GH1248 Hall sensor, and an SSD1306 OLED display, all interfaced with a Seeed Studio RP2350 microcontroller. The microcontroller reads data from the sensors and controls the display and three LEDs.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of test1: A project utilizing INA219 in a practical application
ESP32-Based Motor Control System with INA219 Current Sensor and ST7735S Display
This circuit is a motor control system using an ESP32 microcontroller, an INA219 current sensor, and a BTS7960 motor driver. The ESP32 reads current data from the INA219 and controls the motor driver, while a display module shows relevant information. A pushbutton is included for user interaction.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of INA219_Mega2560: A project utilizing INA219 in a practical application
Arduino Mega 2560 and INA219 Sensor for Current and Voltage Measurement
This circuit connects an Arduino Mega 2560 to an INA219 sensor for current and voltage measurement. The INA219 sensor communicates with the Arduino via the I2C protocol, and the Arduino reads and prints the current, bus voltage, shunt voltage, and power values to the Serial Monitor.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications:

  • Battery-powered devices for power consumption monitoring
  • Solar power systems
  • DC motor control and diagnostics
  • Power supply efficiency analysis
  • IoT devices requiring energy usage tracking

Technical Specifications

The INA219 offers a range of features that make it versatile and reliable for power monitoring applications. Below are its key technical details:

Key Technical Details:

  • Supply Voltage (Vcc): 3.0V to 5.5V
  • Bus Voltage Range: 0V to 26V
  • Current Measurement Range: ±3.2A (with a 0.1Ω shunt resistor, configurable)
  • Shunt Voltage Range: ±320mV
  • Communication Interface: I2C (up to 3.4 MHz)
  • Resolution: 12-bit ADC
  • Accuracy: ±1% (typical)
  • Operating Temperature Range: -40°C to +125°C
  • Power Consumption: 1 mA (typical)

Pin Configuration and Descriptions:

The INA219 is typically available in an 8-pin SOIC package. Below is the pinout and description:

Pin Name Description
1 V+ High-side connection to the positive terminal of the shunt resistor.
2 V- High-side connection to the negative terminal of the shunt resistor.
3 GND Ground connection.
4 SDA I2C data line for communication.
5 SCL I2C clock line for communication.
6 ALERT Configurable alert output for overcurrent or other fault conditions.
7 Vcc Power supply input (3.0V to 5.5V).
8 NC No connection (leave unconnected or grounded).

Usage Instructions

The INA219 is straightforward to use in a circuit, thanks to its I2C interface and built-in ADC. Below are the steps and considerations for using the INA219:

Steps to Use the INA219:

  1. Connect the Shunt Resistor:

    • Place a shunt resistor (e.g., 0.1Ω) in series with the load whose current you want to measure.
    • Connect the V+ pin to the positive terminal of the shunt resistor and the V- pin to the negative terminal.
  2. Power the INA219:

    • Connect the Vcc pin to a 3.3V or 5V power supply.
    • Connect the GND pin to the ground of the circuit.
  3. Set Up I2C Communication:

    • Connect the SDA and SCL pins to the corresponding I2C pins on your microcontroller (e.g., Arduino UNO).
    • Use pull-up resistors (typically 4.7kΩ) on the SDA and SCL lines if not already present.
  4. Configure the INA219:

    • Use an I2C library to communicate with the INA219.
    • Configure the INA219 for your specific application (e.g., shunt resistor value, bus voltage range).
  5. Read Measurements:

    • Use I2C commands to read the shunt voltage, bus voltage, and current.
    • Calculate power using the formula: Power = Voltage × Current.

Example Arduino Code:

Below is an example of how to use the INA219 with an Arduino UNO to measure current, voltage, and power:

#include <Wire.h>
#include <Adafruit_INA219.h>

// Create an instance of the INA219 class
Adafruit_INA219 ina219;

void setup() {
  Serial.begin(9600); // Initialize serial communication at 9600 baud
  while (!Serial) {
    delay(10); // Wait for the serial monitor to open
  }

  // Initialize the INA219 sensor
  if (!ina219.begin()) {
    Serial.println("Failed to find INA219 chip");
    while (1) {
      delay(10); // Halt if the INA219 is not detected
    }
  }
  Serial.println("INA219 initialized successfully");
}

void loop() {
  float shuntVoltage = ina219.getShuntVoltage_mV(); // Get shunt voltage in mV
  float busVoltage = ina219.getBusVoltage_V();      // Get bus voltage in V
  float current = ina219.getCurrent_mA();           // Get current in mA
  float power = ina219.getPower_mW();               // Get power in mW

  // Print the measurements to the serial monitor
  Serial.print("Shunt Voltage: ");
  Serial.print(shuntVoltage);
  Serial.println(" mV");

  Serial.print("Bus Voltage: ");
  Serial.print(busVoltage);
  Serial.println(" V");

  Serial.print("Current: ");
  Serial.print(current);
  Serial.println(" mA");

  Serial.print("Power: ");
  Serial.print(power);
  Serial.println(" mW");

  delay(1000); // Wait 1 second before taking the next measurement
}

Important Considerations:

  • Shunt Resistor Selection: Choose a shunt resistor with a low resistance value to minimize power loss, but ensure it provides a measurable voltage drop.
  • I2C Address: The INA219 has a default I2C address of 0x40, but it can be changed by configuring the address pins.
  • Pull-Up Resistors: Ensure proper pull-up resistors are present on the I2C lines for reliable communication.
  • Voltage Limits: Do not exceed the maximum bus voltage of 26V to avoid damaging the device.

Troubleshooting and FAQs

Common Issues and Solutions:

  1. INA219 Not Detected on I2C Bus:

    • Solution: Check the wiring of the SDA and SCL pins. Ensure pull-up resistors are present.
    • Tip: Use an I2C scanner sketch to verify the INA219's address.
  2. Incorrect Current or Voltage Readings:

    • Solution: Verify the shunt resistor value and ensure it matches the configuration in your code.
    • Tip: Check for loose connections or incorrect wiring.
  3. No Output on Serial Monitor:

    • Solution: Ensure the correct baud rate is set in the serial monitor (e.g., 9600).
    • Tip: Verify that the INA219 is properly powered and initialized.
  4. Overcurrent or Fault Alerts:

    • Solution: Check the load current and ensure it does not exceed the configured range.
    • Tip: Use the ALERT pin to monitor fault conditions programmatically.

FAQs:

  • Q: Can the INA219 measure negative currents?
    A: Yes, the INA219 can measure bidirectional currents if configured appropriately.

  • Q: What is the maximum sampling rate of the INA219?
    A: The INA219's ADC can sample at up to 12-bit resolution, with a configurable conversion time.

  • Q: Can I use the INA219 with a 3.3V microcontroller?
    A: Yes, the INA219 is compatible with both 3.3V and 5V logic levels.

  • Q: How do I change the I2C address of the INA219?
    A: The I2C address can be changed by connecting the address pins (A0 and A1) to GND or Vcc in different combinations.

By following this documentation, you can effectively integrate the INA219 into your projects for accurate power monitoring and diagnostics.