Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use INA219 Digital HiVolt Current Sensor [Bill Ludwig]: Examples, Pinouts, and Specs

Image of INA219 Digital HiVolt Current Sensor  [Bill Ludwig]Design with INA219 Digital HiVolt Current Sensor [Bill Ludwig] in Cirkit Designer

Introduction

The INA219, manufactured by Adafruit (Part ID: INA219), is a high-side current shunt monitor that measures both current and voltage, providing a digital output via the I2C interface. This versatile sensor is designed for high-voltage applications, capable of measuring up to 26 volts and 3.2 amps. Its compact design and high accuracy make it ideal for battery management systems, power monitoring, and energy optimization in various electronic projects.

Explore Projects Built with INA219 Digital HiVolt Current Sensor [Bill Ludwig]

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 ESP32-Controlled Smart Lighting System with Power Monitoring: A project utilizing INA219 Digital HiVolt Current Sensor  [Bill Ludwig] in a practical application
ESP32-Controlled Smart Lighting System with Power Monitoring

This circuit appears to be a multi-channel current monitoring system using several ACS712 current sensors to measure the current through different loads, likely bulbs connected to a 220V power source. The current readings from the sensors are digitized by an Adafruit ADS1115 16-bit ADC, which interfaces with an ESP32 microcontroller via I2C communication for further processing or telemetry. A buck converter is used to step down the voltage to power the ESP32 and the sensors, and the system is powered through a 2.1mm DC barrel jack, indicating it is designed for external power supply.

Open Project in Cirkit Designer

Common Applications

Technical Specifications

The INA219 sensor offers precise current and voltage measurements with a digital I2C interface. Below are its key technical details:

Key Specifications

Parameter Value
Operating Voltage 3.0V to 5.5V
Measurable Voltage Range 0V to 26V
Measurable Current Range ±3.2A (with default shunt)
Shunt Resistor 0.1Ω (default, 1% tolerance)
Communication Protocol I2C
I2C Address (Default) 0x40
Resolution 12-bit
Accuracy ±1%
Operating Temperature -40°C to +125°C

Pin Configuration

The INA219 module has the following pin layout:

Pin Name Description
VIN+ Positive input for the voltage to be measured (connect to load's positive)
VIN- Negative input for the voltage to be measured (connect to load's negative)
VCC Power supply input (3.0V to 5.5V)
GND Ground connection
SDA I2C data line
SCL I2C clock line

Usage Instructions

The INA219 is straightforward to use in a circuit, especially with microcontrollers like the Arduino UNO. Below are the steps to integrate and use the sensor:

Connecting the INA219

  1. Power the Sensor: Connect the VCC pin to the 5V or 3.3V pin of your microcontroller and the GND pin to the ground.
  2. Connect the Load:
    • Attach the VIN+ pin to the positive terminal of the power source.
    • Attach the VIN- pin to the positive terminal of the load.
  3. I2C Communication:
    • Connect the SDA pin to the Arduino's A4 pin (on an UNO) or the corresponding SDA pin on other boards.
    • Connect the SCL pin to the Arduino's A5 pin (on an UNO) or the corresponding SCL pin on other boards.

Arduino Code Example

Below is an example Arduino sketch to read current and voltage using the INA219:

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

// Create an instance of the INA219 sensor
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 execution if the sensor is not found
    }
  }
  Serial.println("INA219 sensor initialized");
}

void loop() {
  float shuntVoltage = 0.0; // Variable to store shunt voltage
  float busVoltage = 0.0;   // Variable to store bus voltage
  float current_mA = 0.0;   // Variable to store current in milliamps
  float power_mW = 0.0;     // Variable to store power in milliwatts

  // Read values from the INA219 sensor
  shuntVoltage = ina219.getShuntVoltage_mV();
  busVoltage = ina219.getBusVoltage_V();
  current_mA = ina219.getCurrent_mA();
  power_mW = ina219.getPower_mW();

  // Print the readings to the serial monitor
  Serial.print("Bus Voltage:   "); Serial.print(busVoltage); Serial.println(" V");
  Serial.print("Shunt Voltage: "); Serial.print(shuntVoltage); Serial.println(" mV");
  Serial.print("Current:       "); Serial.print(current_mA); Serial.println(" mA");
  Serial.print("Power:         "); Serial.print(power_mW); Serial.println(" mW");
  Serial.println("");

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

Important Considerations

Troubleshooting and FAQs

Common Issues

  1. No Data Output:

    • Ensure the I2C connections (SDA and SCL) are correct and secure.
    • Verify the INA219 is powered (check the VCC and GND connections).
    • Confirm the I2C address matches the one in your code (default is 0x40).
  2. Incorrect Readings:

    • Check the shunt resistor value and ensure it matches the expected configuration.
    • Verify that the load is connected properly between VIN+ and VIN-.
  3. Sensor Not Detected:

    • Use an I2C scanner sketch to confirm the sensor's address.
    • Ensure pull-up resistors are present on the SDA and SCL lines if required.

FAQs

Q: Can the INA219 measure negative currents?
A: Yes, the INA219 can measure bidirectional currents. Ensure the configuration matches your application.

Q: How do I change the I2C address?
A: Adjust the A0 and A1 pins on the module to set a new I2C address. Refer to the datasheet for address configuration.

Q: Can I use the INA219 with a 3.3V microcontroller?
A: Yes, the INA219 operates with both 3.3V and 5V logic levels, making it compatible with most microcontrollers.

Q: What is the maximum current the INA219 can measure?
A: With the default 0.1Ω shunt resistor, the maximum measurable current is ±3.2A. For higher currents, use a lower resistance shunt.

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