As the max 26V was not enough for me and i did not want to add three INA226 i simply used the INA3221 as a low-side current sensor.
Simply connect POW to Minus and CH1, CH2, CH3 to the negative pole of your three loads/gains.
My setup: 240V AC inverter / Wind generator / solar panel - only one battery voltage anyway.
A load will create a negative shunt voltage, a gain a positive.
When you want to measure greater currents, you may want to solder and connect SMD shunt resistors like shown in attached photo:
No need to remove the shunt resistors on the module. You probably need to calibrate the readings anyway:
#include <SDL_Arduino_INA3221.h>
SDL_Arduino_INA3221 ina3221;
#define Current_Ac 1
#define Current_Wind 2
#define Current_Sun 3
float iAnalogRead=0;
double fIT_Ac=0, fIT_Wind=0, fIT_Sun=0;
float fI_Ac=0, fI_Wind=0, fI_Sun=0;
void AddAnalog()
{
fIT_Ac += ina3221.getShuntVoltage_mV(Current_Ac);
fIT_Wind += ina3221.getShuntVoltage_mV(Current_Wind);
fIT_Sun += ina3221.getShuntVoltage_mV(Current_Sun);
iAnalogRead++;
}
void ReadSensors()
{
fIT_Ac /= iAnalogRead;
fIT_Wind /= iAnalogRead;
fIT_Sun /= iAnalogRead;
fI_Ac = mapf(fIT_Ac, 0.0,-163.0, 0.0,80.0);
fI_Wind = mapf(fIT_Wind, 0.0,163.0, 0.0,80.0);
fI_Sun = mapf(fIT_Sun, 0.0,163.0, 0.0,80.0);
if (fI_Ac < 0) fI_Ac = 0;
if (fI_Wind < 0) fI_Wind = 0;
if (fI_Sun < 0) fI_Sun = 0;
Serial.print("IT_Ac=" + String(fIT_Ac) + "\tIT_Wind=" + String(fIT_Wind) + "\tIT_Sun=" + String(fIT_Sun)) ;
Serial.print("\t->\tI_Ac=" + String(fI_Ac) + "\tI_Wind=" + String(fI_Wind) + "\tI_Sun=" + String(fI_Sun)) ;
iAnalogRead = fIT_Ac = fIT_Wind = fIT_Sun = 0;
}
double mapf(double val, double in_min, double in_max, double out_min, double out_max) {
return (val - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
the Roland
All at your own risk !