In this tutorial, you’ll learn how to interface an INA226 With Arduino (DC Current Sensor), install the Arduino INA226 library, and test some code examples to Measure DC Current with Arduino + INA226. Without further ado, let’s get right into it!
Table of Contents
- Arduino INA226 DC Current Sensor
- INA226 With Arduino (Interfacing)
- Arduino INA226 Library Installation
- Arduino INA226 DC Current Measurement Example
- More Arduino Current Sensors
- Wrap Up
Arduino INA226 DC Current Sensor
The INA226 DC current sensor is an excellent choice for Arduino projects that need precision (DC current, bus voltage, and power) measurements. The INA226 current sensor provides an I2C digital output that makes it so easy to measure the DC currents with multiple INA226 sensors using only 2 wires (up to 16 different addresses).
The INA226 sensor can also determine the polarity of the current (positive or negative) while measuring DC currents up to ±0.8A. It can also measure the bus voltage (0 up to 36v) and also do power calculations (P = I x V) in hardware. All of this and other features make the INA226 an ideal choice for a wide range of power monitoring applications.
INA226 Pinout Diagram
Below is the pinout diagram of the INA226 DC current sensor.

Key Specifications of the INA226 DC Current Sensor:
- 3-5v single supply operation
- Up to ±0.8A DC current measurement
- Supply voltage measurement from 0v up to 36v
- Reports Current, Voltage, and Power (P = I x V)
- Integrated 16 Bits ADC for precise measurements
- High accuracy (0.1%) over the temperature range
- I2C digital output with 16 programmable addresses
INA226 DC Current Sensor Working Principles
The INA226 sensor depends on an external shunt resistor connected to the high side or the low side of your load circuitry. The “to be measured” DC current goes through the shunt resistor which develops a voltage drop over the current-sensing shunt resistor. The differential voltage between the shunt’s terminals (Vin+ & Vin-) is then amplified and measured by the INA226 sensor.
The internal 16-bit ADC takes the measurement and converts the input differential voltage into current output. There is also hardware support for measuring and storing the bus voltage and calculating the power consumption (P = I x V). All these digital values are stored in internal registers and sent to the microcontroller (Arduino, ESP32, or whatever) over the I2C bus. The diagram below shows the internal structure of the INA226 sensor.

The onboard shunt resistor that you’ll find on your INA226 sensor’s board is a 0.1Ω power resistor that’s used to sense the DC current going through your load. The sensor’s board has a couple of I2C pull-up resistors, so you don’t need to connect anything to the I2C lines.
Buy an INA226 Current Sensor: you can find it here on ( Amazon, AliExpress, eBay )
INA226 With Arduino (Interfacing)
Interfacing the INA226 current sensor with Arduino is so easy as it only requires two wires (I2C bus). We’ll use the INA226_WE library to handle the I2C communication with the INA226 sensor and read the measured current, voltage, and power.
Arduino INA226 Wiring (Connection)
This is a summary of the connections needed between your Arduino board and the INA226 current sensor.
| INA226 | Arduino UNO | Description |
|---|---|---|
| VCC | 5V | Power supply |
| GND | GND | Ground |
| SDA | A4 (SDA) | I2C SDA Line |
| SCL | A5 (SCL) | I2C SCL Line |
| ALE | D2 (Interrupt 0) | Sensor’s Alarm Output (Interrupt Pin) “optional” |
Arduino INA226 Library Installation
The library we’ll use in this tutorial is called INA226_WE, and this is how to install it on your system.
Step #1
Open your Arduino IDE > Tools > Manage Libraries > Search For “INA226_WE“.
Step #2
Install the INA226_WE library as shown below.

And that’s all about it. Now we can use the library as we’ll do in the next example project.
The default I2C address for the INA226 current sensor is 0x40. However, you can modify this default address by soldering the A0 & A1 address control pins on the sensor’s board. The default states for the address control pins are (A0 = 0, and A1 = 0).
In case, you need to use multiple INA226 sensors, just modify the (A0 & A1) pin states, then set the I2C device address of your INA226 in the code according to the following settings:
- 0x40: A0 = open & A1 = open
- 0x41: A0 = closed & A1 = open
- 0x44: A0 = open & A1 = closed
- 0x45: A0 = closed & A1 = closed
Arduino INA226 DC Current Measurement Example
In this example project, we’ll measure DC current with Arduino + INA226 current sensor. The measured DC current will be displayed on an I2C LCD 16×2 display using the same two (I2C) pins of the Arduino board.
I’ll use a variable DC power supply and an 8Ω load to test the INA226 current sensor. Just make sure the load current is below the maximum allowed value of ±0.8A.
Arduino INA226 Wiring (DC Current Measurement)
Here is the wiring diagram for the Arduino DC current measurement setup I’ve used to test the INA226 sensor.

Example Code
Here is the full code listing for this example.
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 | /* * LAB Name: Arduino INA226 DC Current Measurement Example * Author: Khaled Magdy * For More Info Visit: www.DeepBlueMbedded.com */ #include <Wire.h> #include <INA226_WE.h> #include <LiquidCrystal_I2C.h> #define INA226_I2C_ADDRESS 0x40 INA226_WE ina226(INA226_I2C_ADDRESS); LiquidCrystal_I2C MyLCD(0x27, 16, 2); float current_mA = 0; void setup(void) { MyLCD.init(); MyLCD.backlight(); MyLCD.setCursor(0, 0); Wire.begin(); ina226.init(); } void loop(void) { ina226.readAndClearFlags(); current_mA = ina226.getCurrent_mA(); MyLCD.setCursor(0, 0); MyLCD.print("I = "); MyLCD.print(current_mA); MyLCD.print(" mA"); delay(1000); } |
The INA226 sensor initialization configurations are set in this line of code:
1 | INA226_WE ina226(INA226_I2C_ADDRESS); |
The getCurrent_mA() function is used to read the measured DC current in (mA) unit.
1 | current_mA = ina226.getCurrent_mA(); |
Testing Results
Here are the results of testing this project code example on my Arduino UNO board using a 6.5digit DMM.
The measurement error percentage is very low in all test cases as you’ve seen in the demo video. The INA226 current sensor has much higher accuracy compared to the INA219 current sensor.
Other Useful Functions in The INA226 Library
Here are some other useful functions that you can use from the INA226 library as well:
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 | // Constructors: if not passed, 0x40 / Wire will be set as address / wire object INA226_WE(const int addr = 0x40) : _wire{&Wire}, i2cAddress{addr} {} INA226_WE(TwoWire *w, const int addr = 0x40) : _wire{w}, i2cAddress{addr} {} bool init(); void reset_INA226(); void setCorrectionFactor(float corr); void setAverage(INA226_AVERAGES averages); void setConversionTime(INA226_CONV_TIME convTime); void setConversionTime(INA226_CONV_TIME shuntConvTime, INA226_CONV_TIME busConvTime); void setMeasureMode(INA226_MEASURE_MODE mode); void setCurrentRange(INA226_CURRENT_RANGE range); void setResistorRange(float resistor, float range); float getShuntVoltage_mV(); float getShuntVoltage_V(); float getBusVoltage_V(); float getCurrent_mA(); float getCurrent_A(); float getBusPower(); void startSingleMeasurement(); void startSingleMeasurementNoWait(); bool isBusy(); void powerDown(); void powerUp(); void waitUntilConversionCompleted(); void setAlertPinActiveHigh(); void enableAlertLatch(); void enableConvReadyAlert(); void setAlertType(INA226_ALERT_TYPE type, float limit); |
You can check the library examples and/or the source code by navigating to the following directory:
1 | C:\Users\john_doe\Documents\Arduino\libraries\INA226_WE\src |
This tutorial will give you in-depth information about using I2C LCD 16×2 with Arduino boards, and how to install & use the LiquidCrystal_I2C library with multiple demo code examples to learn from. Check it out!
Required Parts List
Here is the full components list for all the parts you’d need to perform the practical LABs mentioned in this tutorial and the whole Arduino Programming series of tutorials found here on our website.
* Please, note that those are affiliate links and we’ll receive a small commission on your purchase at no additional cost to you, and it’d definitely support our work.
| QTY. | Component Name | Amazon.com | AliExpress | eBay |
| 1 | INA226 Current Sensor | Amazon | AliExpress | eBay |
| 1 | Arduino UNO Kit | Amazon | AliExpress | eBay |
| 1 | Complete Arduino Sensors/Modules Kit | Amazon | AliExpress | eBay |
| 1 | DC Power Supply | Amazon | AliExpress | eBay |
| 1 | BreadBoard | Amazon | AliExpress | eBay |
| 1 | LEDs Kit | Amazon & Amazon | AliExpress | eBay |
| 1 | Resistors Kit | Amazon & Amazon | AliExpress | eBay |
| 1 | Capacitors Kit | Amazon & Amazon | AliExpress & AliExpress | eBay & eBay |
| 1 | Jumper Wires Pack | Amazon & Amazon | AliExpress & AliExpress | eBay & eBay |
| 1 | Push Buttons | Amazon & Amazon | AliExpress | eBay |
| 1 | Potentiometers | Amazon | AliExpress | eBay |
★ Check The Links Below For The Full Course Kit List & LAB Test Equipment Required For Debugging ★
Download Tutorial’s Attachments
You can download all attachment files for this Article/Tutorial (project files, schematics, code, etc..) using the link below. Please consider supporting our work through the various support options listed in the link down below. Every small donation helps to keep this website up and running and ultimately supports the whole community.
More Arduino Current Sensors

Arduino SCT-013 AC Current Sensor
Wrap Up
To conclude this tutorial, we’ve covered how to interface an INA226 DC Current Sensor with Arduino, and how to use this sensor to measure DC current, bus voltage, and power with your Arduino board. You can build on top of the provided example projects and use the INA226 current sensor with your Arduino boards.
If you’re just getting started with Arduino, you need to check out the Arduino Getting Started [Ultimate Guide] here.
And follow this Arduino Series of Tutorials to learn more about Arduino Programming.
References:




“Great tutorial on using the INA226 with Arduino! The detailed explanation of the library functions and the sample code makes it super easy to understand how to implement the DC current sensor. I’m excited to try this out in my next project! Thanks for sharing!”