Modifying the INA226: From 0.8A to High-Power Current Sensing

For my DIY battery build (4S LiFePO4 40Ah), I decided to add a “smart” monitoring system. Sure, I could have just bought an off-the-shelf Smart BMS with Bluetooth or Wi-Fi, but that’s not my style. I want to understand the entire process and build something of my own.

First and foremost, I need to track the charge and discharge current. Based on this data, I’ll later be able to develop an algorithm for accurate State of Charge calculation.

First and foremost, I need to track the charge and discharge current. Based on this data, I will eventually be able to develop an algorithm to calculate the State of Charge (SoC). I’m not going to claim that this will be a high-precision instrument - it’s not. It is more of a ‘rough gauge’ to help me stay oriented: to see if everything is fine or if the power consumption has become abnormally high and something has gone wrong.

To measure the current, we’ll use the INA226 module. Typically, these boards come with a 0.1 Ohm (100 mOhm) shunt resistor, which limits the measurement range to only ±0.8 A. That is nowhere near enough for a high-capacity power battery, so I’ll show you how to modify the module to suit our needs.


A shunt is a resistor with a very low and precise resistance. The following types are most commonly used:

  • Ceramic (cement) resistors – The most affordable option, but they lack precision. Their main drawback is high thermal drift: as they heat up, their resistance changes significantly, leading to large measurement errors.

  • Constantan wire shunts, staple-style – These are made from a special alloy (copper, nickel, and manganese) that is thermally stable. However, they often require individual calibration because the actual resistance can vary from the specification depending on the leg length or the way they are soldered to the board.

  • SMD shunts – Compact, high-precision resistors designed for direct surface mounting on a PCB. The most common high-power packages are 2512, 3920, and 5930. They are ideal for automated assembly and take up minimal space.

  • External shunts, panel-mount – Heavy-duty solutions for high currents (e.g., the FL-2 series, approx. 116 x 23 x 26 mm), ranging from 10 to 600 Amps. They are typically rated for a 75 mV voltage drop at their maximum rated current. These shunts feature two massive terminals for power cables and two smaller terminals for voltage sensing. This design enables a 4-wire (Kelvin) connection, which eliminates the resistance of the contacts and cables from the measurement results—a critical factor when working with millivolts.

In my case, a 1 mOhm shunt would be ideal, but I don’t have one on hand right now. Ultimately, as experience has shown, it is better to experiment with lower currents gradually and fix any bugs along the way, rather than trying to build a high-power measuring device right from the start.

While waiting for my order to arrive, I will use a 5 mOhm constantan wire shunt. This will allow me to measure currents up to ~16 A, which is more than enough for initial testing and software debugging.

The shunt will be mounted on an auxiliary PCB, which will then be connected to the INA226 module.

 

I’m cleaning the board with a Dremel and drilling holes for the bolts—these will serve as our terminals for connecting the high-current power wires. I’m also adding sense leads from the shunt directly to the INA226 module pins.


Since 16 Amps is a significant load, I won’t rely solely on the thin copper foil of the PCB. To reduce resistance and improve heat dissipation, I’m adding additional copper shims (8mm x 0.15mm).


Now, let’s tin everything thoroughly.


I didn’t manage to get the shims perfectly aligned—it’s quite a challenge with just a standard soldering iron. As soon as the solder melts, one side or the other tends to shift or “float” away.


Finally, we remove the stock SMD shunt from the module and securely solder the interconnects between the module and the new shunt board. I’m also adding a solder bridge between IN- and VBUS. This allows the module to measure the bus voltage directly from one side of the shunt.


Testing and Calibration

Measuring the resistance after all the modifications:


The milliohmmeter showed 4.29 mOhm. Time to hook up the microcontroller, do some “coding shamanism,” and see what results we get. For testing, I’m using a popular ESP32-based module with a built-in display, often called the Cheap Yellow Display (CYD).


The zero-point matches perfectly. I’ve heard that some INA226 units always have a slight offset from zero, but I got lucky. For calibration, I took several measurements at each current level from 1 A to 10 A. After recalculating and averaging the data, the calculated shunt resistance came out to 4.392 mOhm. This differs slightly from the initial multimeter reading, and this refined value is what I’ll use in the ESP32 code.

Let’s compare the results with the UNI-T UT61:

 

There is a deviation, but it’s minor—roughly 30–40 mA. For a DIY “rough gauge,” this is an excellent result.

Errors and Issues

Heating. Even at 10 A, the thermal camera clearly captures the temperature rise. At 17 A, you can feel it by hand—the shunt heated up to 113°F (45°C)).


You might think, “Big deal, it’s only 113 degrees, what does it matter?”. Actually, it does. I noticed that after such a load, the reading doesn’t return to zero immediately after disconnection. For a while, the shunt maintains a few tenths of a millivolt, which translates into dozens of “phantom” milliamps on the screen.

This happens due to the Thermo-EMF effect (or Seebeck effect). Since the solder joints of the shunt have different temperatures or consist of different metals, they act as a thermocouple, generating voltage “out of thin air.” Once the node cools down after a few minutes, the effect disappears.

This phantom current issue due to heating is perhaps the most interesting challenge of the whole project. Seeing 50 mA when it should be zero is annoying, especially if you want to accurately track the battery’s State of Charge (SoC). Future Improvements

I’m currently considering several ways to solve this:

  • Software filtering: Ignoring small shunt voltages for a certain period after a high-current event.

  • Thermal compensation: Adding a temperature sensor (NTC or DS18B20) to calculate and subtract the drift in real-time.

  • Active or passive cooling: Adding a heatsink or even a small cooling fan that triggers at high currents.

  • Material swap: Trying a shunt made from a different material. Both Google and AI suggest Manganin, as it has a much lower Thermo-EMF coefficient compared to other alloys.

Comments

Popular posts from this blog

Orange Pi Zero 3 - exploring GPIO

YD-RP2040 Module

How to use SPIFFS for ESP32 with Platform.IO