INA219 For highter Amps

hello guys, i'm using the INA219 for some power analyses on some devices of mine and i would like to make a new project with higher ranges because the current measurement is "limited" to 3.6 Amps.

So my objective is to change the INA219's shunt resistor to get a measurement of current to 6.5 Amps max.

I think removing the R100 shunt resistor of 0.1ohm by a new one of 0.05 ohms to measure 6.4 max Amps.

Am i right about this new value of shunt?

Then i know i have to change something in Adafruit INA219's headerfiles because this code no longer belong for 6.4 range amps sensor.

I know there is a lot of other current sensors but i do appreciate a lot this one. Simply learning how to change its range (without burning anything) would help me a lot!

Any suggestion about changes i have to do in the code?
I know i have to look for the TI instructions and how to calculate the calibration parameters and insert them in the plugin but i'm still learning so...

Thank you

Quentin78:
I think removing the R100 shunt resistor of 0.1ohm by a new one of 0.05 ohms to measure 6.4 max Amps.

Adding a common/through-hole 0.1ohm resistor to the screw terminal might be a lot easier.
Leo..

Wawa:
Adding a common/through-hole 0.1ohm resistor to the screw terminal might be a lot easier.
Leo..

Yes, indeed.

6.4A through 0.05 ohm dissipates over 2W. Replacing the PCB shunt with 0.05 ohm resistor would
just bake a hole in the PCB or desolder itself.

Adding a second 0.1 ohm resistor in parallel with the existing shunt, preferably a 2W or higher,
will give 0.05 ohm with enough power handling, so long as the new resistor isn't too close to
the PCB one.

Ok i understand the meaning of adding a second resistor in parallels.

But i think, i have to, but not sure, do i have to change my code too? Because here we will reduce the incoming amps? So i won't measure the real amps that come throught my load.

Sorry i'm not so good in electronics but i really want to try; so if you can tell me more details :)!

Thank you already for your previous answers.

The value of the shunt resistor in the code needs to match reality, of course...

A second 0.1 ohm resistor in parallel with the existing one will halve the shunt resistance,
and halve the displayed current.

All you have to do in the code is multiply the returned current by two before printing.
That could ofcourse be * 2.015 or * 1.952 if the resistor is not exactly 0.1 ohm.
Calibrate with a DMM (set to current) in series with the load.

Post the code (with code tags) if you're not sure how.
Leo..

I have been working on sending INA219 data by radio frequency in the last 2 days (thanks NRF24) so I haven't changed my code yet as you told me. I post it here as soon as it's done! I also ordered my shunt resistance, it should arrive within a few days

Thank you for your help, first time on arduino and with his community and I am not disappointed for the moment.

Note that there are also the code parts concerning the NRF for remote data transmission by radio frequency, a display on LCD and also data recording on an SD card.
If you have any comments to make, don't hesitate. I am far from being an arduino professional!

Since the internal shunt of INA219 is 0.1 ohm, and i added a 0.1 ohm in parallels i have to multiply my current value by 2 like you said:

#include <BlockDriver.h>
#include <FreeStack.h>
#include <MinimumSerial.h>
#include "SdFat.h"
#include <SdFatConfig.h>
#include <sdios.h>
#include <SysCall.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SPITFT.h>
#include <Adafruit_SPITFT_Macros.h>
#include <gfxfont.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <splash.h>
#include <Adafruit_INA219.h>
#include <NRFLite.h>
SdFat SD;
Adafruit_INA219 ina219;
#define OLED_RESET     4
Adafruit_SSD1306 display(OLED_RESET);

const static uint8_t RADIO_ID = 1;
const static uint8_t DESTINATION_RADIO_ID = 0;
const static uint8_t PIN_RADIO_CE = 7;
const static uint8_t PIN_RADIO_CSN = 8;

unsigned long previousMillis = 0;
unsigned long interval = 100;
unsigned long currentMillis;

const int chipSelect = 10;

float energy = 0;
float power_mW = 0;
float shuntvoltage = 0;
float busvoltage = 0;
float current_mA = 0;
float loadvoltage = 0;

File DataFile;

struct RadioPacket1
{
    uint8_t FromRadioId;
    float energy = 0;
    float power_mW = 0;
    float current_mA = 0;
    float loadvoltage = 0;
    unsigned long previousMillis;
    
};

NRFLite _radio;
RadioPacket1 _radioData1;

void setup() {
  //Serial.begin(115200);
//  if (!_radio.init(RADIO_ID, PIN_RADIO_CE, PIN_RADIO_CSN))
//    {
//        Serial.println("Cannot communicate with radio");
//        while (1);
//    }
  _radio.init(RADIO_ID, PIN_RADIO_CE, PIN_RADIO_CSN);

  _radioData1.FromRadioId = RADIO_ID;
  
  SD.begin(chipSelect);
  ina219.begin();
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  File DataFile =SD.open("datalog.txt",FILE_WRITE);
    if (DataFile){
      DataFile.print("mS");
      DataFile.print(";");
      DataFile.print("V");
      DataFile.print(";");
      DataFile.print("mA");
      DataFile.print(";");
      DataFile.print("mW");
      DataFile.println(";");
      DataFile.close();
    }
}

void loop() {
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >=interval)
  {
    ina219values();
//    if (_radio.send(DESTINATION_RADIO_ID, &_radioData1, sizeof(_radioData1)))
//        {
//            Serial.println("...Success");
//        }
//        else
//        {
//            Serial.println("...Failed");
//        }
    _radio.send(DESTINATION_RADIO_ID, &_radioData1, sizeof(_radioData1));
    File DataFile =SD.open("datalog.txt",FILE_WRITE);
    if (DataFile){
      DataFile.print(currentMillis);
      DataFile.print(";");
      DataFile.print(loadvoltage);
      DataFile.print(";");
      DataFile.print(current_mA);
      DataFile.print(";");
      DataFile.print(power_mW);
      DataFile.println(";");
      DataFile.close();
    }       
  displaydata();
  
  }

}
void ina219values(){
    previousMillis = currentMillis;
    shuntvoltage = ina219.getShuntVoltage_mV();
    busvoltage = ina219.getBusVoltage_V();
    current_mA = 2 * ina219.getCurrent_mA();    //this is where I multiply by 2
    loadvoltage = busvoltage + (shuntvoltage / 1000);
    power_mW = ina219.getPower_mW();
    energy = energy + power_mW * (0.1/(60*60));
    
    _radioData1.loadvoltage=loadvoltage;
    _radioData1.current_mA=current_mA;
    _radioData1.power_mW=power_mW;
    _radioData1.energy=energy;
    _radioData1.previousMillis=previousMillis;
}
void displaydata(){
  display.clearDisplay();
  display.setTextColor(WHITE);
  display.setTextSize(1);
  display.setCursor(0,0);
  display.println(loadvoltage);
  display.setCursor(35,0);
  display.println("V");
  display.setCursor(50,0);
  display.println(current_mA);  
  display.setCursor(95,0);
  display.println("mA");
  display.setCursor(0,10);;
  display.println(power_mW);
  display.setCursor(65,10);
  display.println("mW");
  display.setCursor(0,20);
  display.println(energy);
  display.setCursor(65,20);
  display.println("mWh");
  display.display();
}

Thanks for your time.

Since 'current' is a float, you should use '2.0' instead of '2'.

Halving shunt resistance also halves shunt voltage.
You also might have to multiply 'shuntvoltage' by 0.5.
Leo..

I dont know why, but i dont need to multiply my voltage by 0.5, yet by calculation it should actually be done...
Otherwise we find practically the value that we expect!
Still more precise at low current and volts