Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » How to use INA226 DC Current Sensor with Arduino
Arduino Projects

How to use INA226 DC Current Sensor with Arduino

Mamtaz AlamBy Mamtaz AlamUpdated:November 11, 20243 Comments10 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
INA226 DC Current Sensor Arduino
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

Overview

In this tutorial, we will learn how to interface the INA226 DC Current Sensor Module with an Arduino. The INA226, like its predecessor the INA219, is a device that can measure current, voltage, and power. However, it has an extended range, capable of measuring voltages up to 36V and current up to 20A. Thus you can make DC Energy Meter project using this sensor or a 12V Battery Monitoring System project and also the Solar Panel Monitoring System project.

The INA226 is a shunt and bus voltage monitor introduced by Texas Instruments. It offers an integrated, zero-drift, bi-directional interface that monitors shunt voltage, bus voltage, current, and power. The INA226 communicates with microcontrollers through an I2C interface, allowing for easy data transfer and interpretation.

One of the unique features of the INA226 is its configurable averaging and conversion times for both the shunt voltage and bus voltage measurements. This provides a means to optimize the device for various applications and system requirements. Furthermore, it also includes a programmable threshold and alert functionality for these measurements which can be used for system-level optimizations such as power saving and event-driven interrupt programming.

The INA226 Current Sensor Module is versatile, finding its utility in server power management, telecommunications, power supply equipment, and battery management systems. Essentially, any system requiring high-accuracy, cost-effective power and current monitoring can significantly benefit from this module.


Bill of Materials

To interface INA226 DC Current Sensor Module with Arduino, we need following components. You can purchase all of them from the given links:

S.N.ComponentsQuantityPurchase Link
1Arduino Nano1Amazon | AliExpress | SunFounder
2INA226 Current Sensor1Amazon | AliExpress
3Battery 3.7V1Amazon | AliExpress
4DC Motor1Amazon | AliExpress | SunFounder
5Jumper Wires10Amazon | AliExpress | SunFounder
6Breadboard1Amazon | AliExpress | SunFounder



INA226 DC Current Sensor Module

The INA226 is an advanced, high-side current shunt and power monitor IC developed by Texas Instruments. It operates over an I2C-compatible or SMBus-compatible interface, offering direct digital communication with a microcontroller. It provides more extensive capabilities than the INA219, including better accuracy, more extensive voltage and current range, as well as integrated math functions that directly report power in watts.

Download INA226 Datasheet: INA226 Datasheet


INA226 Board Circuit & Schematic

INA226 board

The INA226 module is built with an INA226 chip, a few resistors, and a capacitor that helps reduce noise, or unwanted electrical signals.

INA226 Board Circuit & Schematic


Features & Specifications of INA226

  1. Operational Voltage (2.7 – 5.5 Volts): The INA226 operates between 2.7 to 5.5 volts. This widens its compatibility with systems that run at different voltage levels. This trait is beneficial in accommodating an extensive range of circuit designs.
  2. Bus Voltage Range (0 – 36 Volts): The INA226 can monitor power supplies up to 36 volts, expanding the device’s applicability to various power supplies.
  3. Current Sensing Range (± 500mA to ± 50A): Depending on the value of the shunt resistor, INA226 can monitor a wide range of currents, thus catering to a myriad of applications including power management, battery chargers, and DC motor control.
  4. Power consumption: Continuous mode: 0.35 mA; Power-Down Mode: 2.3.µA
  5. Measurement modes:: continuous or on-demand (“triggered”)
  6. Averaging of 1, 4, 64, 128, 256, 512 or 1024 individual measurements
  7. A/D conversion time adjustable in eight levels: 0.14 to 8.2 ms
  8. Higher Precision: The INA226 provides increased precision through its 16-bit ADC, resulting in more accurate measurements.
  9. Programmable alarm pin for limit violations and available data




Pinout of INA226

The INA226 sensor module typically has 8 pins, which are as follows:

INA226 Pinout

  1. VCC:  It accepts an input voltage from 2.7V to 5.5V.
  2. GND: Ground pin, connected to the ground of the power supply.
  3. SDA: Serial Data line for the I2C interface. It’s used for the bidirectional transfer of data.
  4. SCL: Serial Clock line for the I2C interface. It’s used for synchronization during data transfer.
  5. ALE: This is the Alert pin. It’s an open-drain output that requires a pull-up resistor. This pin can be used for various alerts or as a conversion-ready signal.
  6. VBUS: This pin is used to measure the supply voltage. It can measure the supply voltage up to 36V.
  7. IN-: This pin connects to the Load. This is where the shunt resistor is placed for current sensing.
  8. IN+: This pin connects to the Power Source.

Current Sensing Resistor Selection

The maximum current that the INA226 can measure is not determined directly by the chip itself, but rather by the value of the shunt resistor used in conjunction with it.

The INA226 measures the voltage drop across a shunt resistor, and from that calculates the current using Ohm’s law (I = V/R). Since the INA226 can measure a maximum shunt voltage of 81.92mV (with a resolution of 2.5µV), the maximum current is dependent on the resistance of the shunt.

Below is a table of suggested shunts.

Shunt Resistance Max Current (A) Part Size Part Number Power Rating (W) Max Power (W)
0.003 27.31 2512 ERJMS4SF3M0U 3 2.24
0.004 20.48 2512 ERJMS4SF4M0U 3 1.68
0.005 16.38 2512 ERJMS4HF5M0U 3 1.34
0.006 13.65 2512 ERJMS4HF6M0U 3 1.12
0.007 11.70 2512 ERJMS4HF7M0U 2 0.96
0.008 10.24 2512 ERJMS4HF8M0U 2 0.84
0.009 9.10 2512 ERJMS4HF9M0U 2 0.75
0.010 8.19 2512 ERJMS4HF10MU 2 0.67



ADC Resolution

The bus voltage register of the INA226, a 16-bit signed entity, features a least significant bit (LSB), or resolution, of 1.25mV. This permits a full-scale voltage measurement range of +/-40.96V.

The INA226’s analog input designed for the shunt resistor is capable of accepting a maximum (full scale) voltage of 81.92mV. When paired with a shunt resistor of 4mOhm, it enables the measurement of a current up to +/-20.48A with a resolution as precise as 625µA.


I2C Address

Similar to INA219, the INA226 uses the I2C protocol to communicate with microcontrollers. The default I2C address for the INA226 is 0x40. This address can be changed to facilitate the use of multiple INA226 sensors on the same I2C bus. The INA226 allows up to 16 different I2C addresses, from 0x40 to 0x4F. You can change the I2C address by modifying the connections of the A0 and A1 pins.


Register Address & Values Calculations

The INA226 also has internal registers which are accessed via the I2C interface. Some of the essential ones are:

  1. Configuration Register (Address = 00h): Similar to INA219, this register is used to control various aspects of the INA226.
  2. Shunt Voltage Register (Address = 01h): This register holds the raw measurement for the shunt voltage.
    Shunt Voltage (V) = Shunt Voltage Register Value * 2.5 µV
  3. Bus Voltage Register (Address = 02h): This register holds the raw measurement for the bus voltage.
    Bus Voltage (V) = Bus Voltage Register Value * 1.25 mV
  4. Power Register (Address = 03h): This register holds the calculated power value.
    Power (W) = Power Register Value * Power_LSB
  5. Current Register (Address = 04h): This register holds the calculated current value.
    Current (A) = Current Register Value * Current_LSB
  6. Calibration Register (Address = 05h): This register is used to set the calibration value for the current and power calculations.




How to use INA226 DC Current Sensor with Arduino

Now let us interface the INA226 DC Current Sensor Module with Arduino. The hardware interfacing is very simple.

Here is a simple connection diagram that can be used to interface INA226 Current sensor with Arduino along with external load and power source.

INA226 DC Current Sensor with Arduino

Connect the VCC, GND, SCL & SDA pin of INA219 to 5V, GND, A5 & A4 of Arduino respectively. The Vin+ pin should be connected to power source and the Vin- to the load as shown in the image above. The INA226 Sensor has VBus Pin, which is used to measure the source Voltage. Connect the VBus pin to Vin- pin.

For test, I used 3.7V and 9V Battery as a Power Source. As a load, I used a DC Motor for this circuit.

INA226 Current Sensor Arduino Connection

The Vin+ pin can accept input voltage upto 36V. The device is rated to 36V (40V absolute maximum) on the input pins. Therefore, do not supply anything above 36V.

You may need to desolder the shunt resistor and replace it with above mentioned resistor in case, you want to measure higher current.


INA226 Arduino Library

There are many versions of INA226 library available for use. I tested most of them. I found the library from Wollewald as accurate one.

You can download the library from GitHub or install it directly with the Library Manager of the Arduino IDE.

Download: INA226 Library

There is a total of seven example sketches used to present the functions of the library. I have used the example of continuous mode. Many of the functions are used in all sketches and therefore only need to be explained once.




Source Code/Program

Copy the following code and paste it on your Arduino IDE editor window. Before you upload the code, you may need to make some modifications.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include <Wire.h>
#include <INA226_WE.h>  
#define I2C_ADDRESS 0x40
 
INA226_WE ina226 = INA226_WE(I2C_ADDRESS);
 
void setup()
{
  Serial.begin(9600);
  while (!Serial); // wait until serial comes up on Arduino Leonardo or MKR WiFi 1010
  Wire.begin();
  ina226.init();
 
  /* Set Number of measurements for shunt and bus voltage which shall be averaged
    Mode *     * Number of samples
    AVERAGE_1            1 (default)
    AVERAGE_4            4
    AVERAGE_16          16
    AVERAGE_64          64
    AVERAGE_128        128
    AVERAGE_256        256
    AVERAGE_512        512
    AVERAGE_1024      1024*/
 
  //ina226.setAverage(AVERAGE_16); // choose mode and uncomment for change of default
 
  /* Set conversion time in microseconds
     One set of shunt and bus voltage conversion will take:
     number of samples to be averaged x conversion time x 2
 
       Mode *         * conversion time
     CONV_TIME_140          140 µs
     CONV_TIME_204          204 µs
     CONV_TIME_332          332 µs
     CONV_TIME_588          588 µs
     CONV_TIME_1100         1.1 ms (default)
     CONV_TIME_2116       2.116 ms
     CONV_TIME_4156       4.156 ms
     CONV_TIME_8244       8.244 ms  */
 
  //ina226.setConversionTime(CONV_TIME_1100); //choose conversion time and uncomment for change of default
 
  /* Set measure mode
    POWER_DOWN - INA226 switched off
    TRIGGERED  - measurement on demand
    CONTINUOUS  - continuous measurements (default)*/
 
  //ina226.setMeasureMode(CONTINUOUS); // choose mode and uncomment for change of default
 
  /* Set Resistor and Current Range
     if resistor is 5.0 mOhm, current range is up to 10.0 A
     default is 100 mOhm and about 1.3 A*/
 
  ina226.setResistorRange(0.1, 1.3); // choose resistor 0.1 Ohm and gain range up to 1.3A
 
  /* If the current values delivered by the INA226 differ by a constant factor
     from values obtained with calibrated equipment you can define a correction factor.
     Correction factor = current delivered from calibrated equipment / current delivered by INA226*/
 
  ina226.setCorrectionFactor(0.93);
 
  Serial.println("INA226 Current Sensor Example Sketch - Continuous");
 
  ina226.waitUntilConversionCompleted(); //if you comment this line the first data might be zero
}
 
void loop()
{
  float shuntVoltage_mV = 0.0;
  float loadVoltage_V = 0.0;
  float busVoltage_V = 0.0;
  float current_mA = 0.0;
  float power_mW = 0.0;
 
  ina226.readAndClearFlags();
  shuntVoltage_mV = ina226.getShuntVoltage_mV();
  busVoltage_V = ina226.getBusVoltage_V();
  current_mA = ina226.getCurrent_mA();
  power_mW = ina226.getBusPower();
  loadVoltage_V  = busVoltage_V + (shuntVoltage_mV / 1000);
 
  Serial.print("Shunt Voltage [mV]: "); Serial.println(shuntVoltage_mV);
  Serial.print("Bus Voltage [V]: "); Serial.println(busVoltage_V);
  Serial.print("Load Voltage [V]: "); Serial.println(loadVoltage_V);
  Serial.print("Current[mA]: "); Serial.println(current_mA);
  Serial.print("Bus Power [mW]: "); Serial.println(power_mW);
  if (!ina226.overflow)
  {
    Serial.println("Values OK - no overflow");
  }
  else
  {
    Serial.println("Overflow! Choose higher current range");
  }
  Serial.println();
 
  delay(3000);
}


Code Modifications & Setup

From this code, you need make some modifications in order to get the result accurately.

1
ina226.setResistorRange(0.1, 1.3);

This line set Resistor and Current Range. If resistor is 5.0 mOhm, current range is up to 10A. By deefault is 100 mOhm and about 1.3A.

1
ina226.setCorrectionFactor(0.93);

If the current values delivered by the INA226 differ by a constant factor from values obtained with calibrated equipment you can define a correction factor.

Correction factor = current delivered from calibrated equipment / current delivered by INA226

You may connect a multimeter in Series with Vin- and measure the current and verify with the value in Serial Monitor.


Some of the other fucntionalities and setup required are as follows:

  1. Set the number of individual measurements for the shunt and bus voltage conversion with setAverage()
    • 1, 4, 16, 64, 128, 256, 512, or 1024 individual measurements are averaged
  2. Set the A/D conversion time for the shunt and bus voltage with setConvTime()
    • 8 levels adjustable between 140 µs and 8.244 ms
    • Note: obtaining a data set of shunt and bus voltage takes twice the time
  3. Set the measurement mode with setMeasureMode()
    • CONTINUOUS – continuous measurement
    • TRIGGERED – “on request”: I explain in the next example.
    • POWER_DOWN – turns off the INA226. But better use the more comfortable powerDown() function, which is explained below.
    • The INA226 actually allows determining shunt or bus voltages – but I did not implement that. Using my library, the measurements are only available in a double pack.
  4. Set the current range with setCurrentRange()
    • You can set 400 or 800 mA as the maximum current. The smaller the current range, the higher the resolution for the current and the power.

Test Results

After you upload the code to the Arduino board, you can start testing the setup.

First connect 3.7V Lithium-ion Battery to the Vin+ Pin and a DC motor to Vin- Pin. The DC motor will start rotating.

INA226 Current Sensor Load Test

Now open the Serial Monitor and you will see the following results for 3.7V Source.

Remove the 3.7V Battery and connect the 9V Battery.

The same circuit when tested with 9V DC source gives following results.


Conclusion

In conclusion, the INA226 DC Current Sensor Module is a highly versatile and capable device, perfect for a wide variety of applications where precise power, current, and voltage monitoring is needed. It has an extended range compared to its predecessor, the INA219, enabling the measurement of up to 36V in voltage and 20A in current.

Interfacing this INA226 Current Sensor module with an Arduino allows us to leverage its advanced capabilities in a straightforward manner, making it an invaluable tool for those seeking high-accuracy and cost-effective monitoring solutions. Thus, by mastering the interfacing of the INA226 with an Arduino, we can significantly enhance our capacity to monitor and manage power within electronic systems.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleHow to use INA219 DC Current Sensor Module with Arduino
Next Article Make an Accurate ESP32 Decibel Meter (SPL) with Data Logger

Related Posts

DC Energy Meter using Arduino

Build a DC Energy Meter using Arduino – 32V/5A

Updated:August 26, 20252K
Interfacing ADXL375 Accelerometer with Arduino

Interfacing ADXL375 Accelerometer with Arduino (±200g)

Updated:June 28, 2025
PZEM-004T Arduino Energy Meter

DIY AC Energy Meter using PZEM-004T & Arduino

Updated:March 6, 20258K
Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Updated:February 2, 20259K
Password Based Door Lock Security System Using Arduino & Keypad

Password Based Door Lock Security System Using Arduino & Keypad

Updated:February 2, 20252436K
Earthquake Detector Alarm with with Accelerometer & Arduino

Earthquake Detector Alarm with Accelerometer & Arduino

Updated:February 2, 2025661K
View 3 Comments

3 Comments

  1. TheWild Webster on October 20, 2023 12:32 PM

    None of the links i can find are clear on what you are actually supposed to do to change the address? Are you supposed to shunt/short the a0 and/or a1 pads to one of the other pins as specified in the table or is this some kind of software configuration somehow?

    Reply
    • Admin on October 20, 2023 12:38 PM

      The INA226 has address pins A0 and A1 to set the I2C address. To change the address:

      The A0 and A1 pins can be connected to one of three voltage levels: GND, VS (supply voltage), or left floating (ADDR).
      Depending on how these pins are connected, the I2C address of the INA226 will change. This is a hardware configuration, not software. You physically connect these pins to set the desired address as per the datasheet’s table.

      To answer your question: Yes, you are supposed to connect the A0 and/or A1 pads to the specific pins (GND, VS, or left floating) to set the address as per the datasheet’s table.

      Reply
  2. Oded on December 28, 2024 3:59 AM

    Does anyone use DONGKER INA226 or INA228 modules?

    Reply

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 21, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • ESP32 Fingerprint Attendance System with Live Web Dashboard
    ESP32 Fingerprint Attendance System with Live Web Dashboard
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
    ESP32 CAN Bus Tutorial | Interfacing MCP2515 CAN Module with ESP32
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • LD2410 Sensor with ESP32 - Human Presence Detection
    LD2410 Sensor with ESP32 - Human Presence Detection
  • IoT Based Patient Health Monitoring on ESP32 Web Server
    IoT Based Patient Health Monitoring on ESP32 Web Server
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • How to use INA226 DC Current Sensor with Arduino
    How to use INA226 DC Current Sensor with Arduino
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.