Description
The INA219 DC Current Measurement Module can measure high-side current and voltage of up to 3.2A with 0.8mA resolution at voltages of up to 26VDC.
PACKAGE INCLUDES:
- INA219 DC Current Measurement Sensor Module
- 6-pin Male Header
- 2-pin Screw Terminal Block
KEY FEATURES OF INA219 DC CURRENT MEASUREMENT MODULE:
- Measures current on the high side of the load
- Current measurements of up to 3.2A with 0.8mA resolution using a 12-bit DAC
- Load voltage of 0-26VDC
- I2C interface
- 3.3 and 5V logic compatible
Power Connections
The INA219 DC Current Measurement Module is inserted on the high side of the load, between the load and the load positive (+) power supply. This load power supply can range from 0V up to 26V.
The module itself is powered from 3-5V, so it is usually powered directly off the MCU.
The modules 3-5V logic supply should not be shared with motors running off the same voltage or else the device may reset due to electrical noise. If this happens, additional filter capacitance on the Vcc can be added near or on the module to try to minimize the problem.
Note that the INA219 module ground needs to be in common with the load ground or the voltage measurements will not be correct though the current measurement will be correct. If you don’t care about the voltage measurement, the grounds can be kept separate.
Current Sensing
The module uses a 0.1 ohm 1% 2W current sense resistor which provides its 3.2A current handling capability. The low resistance keeps the voltage drop to a minimum. At the full rated current, the voltage drop across the current sense resistor would be 0.32V.
If you want to change the current measurement range, this resistor can be replaced with a resistor with a smaller or larger value. As an example a 0.01 ohm resistor will allow measurement of up to 32A with 8mA resolution. A 1 ohm resistor will lower the measurement range to 320mA with a 0.08mA resolution.
I2C Communications
The module uses I2C for communications which makes hook-up to the MCU very easy.
The I2C default address is 0x40, but it can be changed to 0x41, 0x44 or 0x45 by bridging a couple of solder pads.
Changing the I2C address is generally not needed unless you are using more than one of these boards in a system or there is an address conflict with another I2C module. The address pins are labeled A0, A1 on the board.
- Board 0: Address = 0x40. No jumpers needed. This is how module is shipped.
- Board 1: Address = 0x41, Jumper A0 pads
- Board 2: Address = 0x44, Jumper A1 pads
- Board 3: Address = 0X45, Jumper both A0 & A1 pads
Note that these addresses are not sequential as you might expect, but these are the correct addresses.
Module Connections
The connections to the board can be made by soldering wires to the board, or the supplied headers and terminals can be solder on depending on the needs of the application. These can be soldered to either side of the board. For basic breadboard use, it generally works best to put the male header on the bottom of the board so that it can be inserted into the breadboard to hold it in place as shown in the pics.
There is a 6-pin header location on the assembly as well as a 2-pin screw terminal block for the main power connection.
1×6 Header
- VCC = 3-5V power for the IN219 IC. Typically connects to 3.3 or 5V from the MCU.
- GND = Ground connects to MCU and should also be in common with the ground for the load if voltage is being measured
- SCL = Connects to SCL (I2C) on MCU
- SDA = Connects to SDA (I2C) on MCU
- VIN- = Alternate connection point for Vin- rather than using screw terminal
- VIN+ = Alternate connection point for Vin+ rather than using screw terminal
1×2 Screw Terminal Block
- VIN- = Connects to the positive terminal of the load.
- VIN+ = Connects to the positive terminal of the power supply for the load
Note: If the current measurement is negative, these VIN connections have been reversed.
This block diagram shows the typical circuit connections.
OUR EVALUATION RESULTS:
These module work fairly well and can be used for applications such as monitoring the current and voltage to the motors of a robotic vehicle to keep an eye on the battery voltage and detect stall conditions.
The module current measurement has a theoretical 1.5% tolerance based on the max tolerance of the chip as well as the tolerance of the shunt resistor. In practice, expect up to about a 10% tolerance, so adequate for more coarse measurements such as detecting motor stall.
The example program below uses the Adafruit INA219 library which can be installed from the Library Manager of the IDE. The program below is based on their ‘getcurrent’ example program which is included with the library but with some modifications. When it is run, it outputs the following info.
- Bus Voltage is the voltage going to the load before the shunt resistor.
- Shunt Voltage is the voltage drop across the 0.1 ohm shunt resistor
- Load Voltage is just the bus voltage minus the voltage dropped by the shunt, so it will be a little less than the Bus Voltage.
- Current is the current as calculated by taking the Shunt Voltage and dividing it by the shunt resistance of 0.1ohm.
- Power is the calculated power using the Load Voltage and Current.
Hookup is easy. Just connect the I2C SDA and SCL pins on the module to the same pins on the MCU. Also connect Vcc and ground pins to the MCU power and ground. Lastly connect that VIN- terminal to the positive terminal of the load and the VIN+ terminal to positive lead of the power source used to power the load. Ensure there is a common ground between the MCU and power source if you want to measure the voltage.
INA219 DC Current Measurement Module Test Program
/* * INA219 DC Current Sensor Module Test * Connect the SDA (I2C) of the MCU to the SDA pin on the module * Connect the SCL (I2C) of the MCU to the SCL pin on the module * Connect power (3.3 or 5V) of the MCU to the Vcc pin on the module * Connect ground of the MCU to the GND pin on the module. * Ensure the GND of the module is also connected to the ground of the load being measured */ #include <Wire.h> #include <Adafruit_INA219.h> Adafruit_INA219 ina219; //=============================================================================== // Initialization //=============================================================================== void setup(void) { Serial.begin(9600); while (!Serial) { delay(1); // will pause Zero, Leonardo, etc until serial console opens } ina219.begin(); // Initialize the INA219. } //=============================================================================== // Main //=============================================================================== void loop(void) { float shuntvoltage = 0; float busvoltage = 0; float current_mA = 0; float loadvoltage = 0; float power_W = 0; shuntvoltage = ina219.getShuntVoltage_mV(); // Read values from INA219 busvoltage = ina219.getBusVoltage_V(); current_mA = ina219.getCurrent_mA(); loadvoltage = busvoltage - (shuntvoltage / 1000); // Calculate voltage at load power_W = current_mA * loadvoltage / 1000; // Calculate wattage of load Serial.print("Bus Voltage: "); Serial.print(busvoltage); Serial.println(" V"); Serial.print("Shunt Voltage: "); Serial.print(shuntvoltage); Serial.println(" mV"); Serial.print("Load Voltage: "); Serial.print(loadvoltage); Serial.println(" V"); Serial.print("Current: "); Serial.print(current_mA); Serial.println(" mA"); Serial.print("Power: "); Serial.print(power_W); Serial.println(" W"); Serial.println(""); delay(2000); }
BEFORE THEY ARE SHIPPED, THESE MODULES ARE:
- Inspected
- Module basic functionality verified using test program with 100mA @ 5V source.
- Packaged in a high quality resealable ESD bag for protection and easy storage.
Notes:
- At higher currents the shunt resistor can get quite hot to the touch, so use care when handling.
- These modules may be built with IN219A or IN219B parts. Basic functionality is the same, ‘B’ parts have better accuracy.
- Chip may be the pictured SOT-23 package or a larger SOIC-8
Technical Specifications
Maximum Ratings | ||
VIN | 0 – 26V | |
Vcc | 3.0 – 5.5V | |
IMax | Maximum Current | 3.2A |
Measurement | ||
Accuracy | 1.5% per spec, up to 10% (measured) | |
Resolution | 0.8mA | |
Dimensions | L x W (PCB) | 25 x 22mm (1.0 x 0.87″) |
Country of Origin | China | |
Datasheet | INA219 |