For a solar setup, I plan to read load currents of a 12v lithium Iron Phosphate battery between 0-100 amps with a SparkFun INA169 breakout board. The INA169 is reading from a 100A 75mv shunt (.00075 ohms resistance). The INA169’s load resistor has been removed and replaced with a 100,000 ohm resistor (to be replaced again with a 60,000 ohm, I just didn't have one on hand). As I understand it, the built in 10ohm shunt resistor will have a negligible effect.
The test load is from Peltier cooler and fan on a cheap 30V, 10A adjustable power supply. This power supply has negative, positive, and ground terminals. Load at 12v is about 3.7 to 4 amps.
At first, I tried Reading from an Arduino R4 wifi with an OLED display added, but values were extremely inconsistent, jumping around wildly, even when the multimeter read Vout values as consistent and changing with amperage as expected.
To simplify the setup, I switched to an Uno R3 with only the INA169 attached. Details are below, but a summary in case much of it is unnecessary to the answer: On an R3 with a .104uf capacitor placed before the analog pin, and the arduino powered via my Laptop off of battery power, the INA169 outputs a voltage changing with current as it should, and the Arduino reads it accurately and consistently. Though, based on my calculations, the voltages outputted are higher than they should be. With almost any other power source configuration, including powering the arduino directly from the load’s power supply using a buck converter, either the Arduino doesn’t read correctly or the INA169 doesn’t output voltage.
So I’m pretty sure my issues have to do with finding the proper ground/negative configuration and filtering the signal properly (and/or using better power sources). I’m just not sure of the exact methods and ‘rules’ I’m missing, and I’m also not sure why the output voltage is not at the expected scale. Any insight is greatly appreciated.
Here’s more detailed results with different configurations. I can sketch out the setup if this ends up being hard to follow:
-
With the simplest circuit, only the R3 and the INA169: I got jumping values as with the R4.
-
Adding a .104uf capacitorin parallel right before the Analog input, with the Arduino plugged into my laptop’s USBC port but the laptop not plugged into a power supply: I get consistent readings that match what the multimeter reads and scale with changing amperage as expected (Example: it was about .7v when load is 3.7 amps at 12v). Adding back the OLED screen, results stayed the same. Progress…
-
When I plug my MacBook Pro into its power supply, it still reads consistently, but the readings rise by about 10-20 millivolts. Multimeter at Vout and Arduino readings both show this change.
After adding the capacitor (and later a small resistor in series) and getting these promising results, the following configurations did not work:
-
If powering the R3 via its own AC-DC power supply (reading results via OLED screen), readings jump around again and don’t match Vout voltage via multimeter, which still scales with amperage correctly, but the voltage is lower than before. (Eg: Vout reads: .47v at 3.7A and .38v at 1.9A).
-
Just to see what happened, I connected the Arduino ground to the power supply’s ground terminal (not its negative): Readings occur when the load's power supply is on, and are a consistent value, but don’t scale at all with change in current. Readings don’t scale when reading Vout from the multimeter either.
-
I also tried connecting the Arduino directly to the Load’s power supply negative and positive terminals using its Vin pin and a ground pin and a DC/DC Step-down converter purchased from Adafruit, so all components share the same power source. The Arduino powers up correctly, but the INA169 does not output anything at Vout, even testing with multimeter. This is also true if I connect the VCC of the INA169 to the load’s higher voltage (12v) power supply power directly, keeping its negative/ground on the Arduino’s.
The other issue is even when I get consistent readings matching the actual Vout voltage, the scale of the INA169’s Vout voltage is wrong according to my calculations. The INA169’s Vout scales up and down with changes in current, but the voltage is much higher than predicted based on the resistors I’m using on the INA169. Example: .7v when load is 3.7 amps when calculations say .7v volts should be almost 10 amps.
Here’s the code I’m using, minus any OLED screen code that was included. I had it do bursts of reads:
const int SENSOR_PIN = A0; // Input pin for measuring Vout
// const int RS = 10; // INA169 board's built in Shunt resistance value
const float RS = .00075; // Ohms, 100A 75mv Shunt resistance value
const float RL = 100000; // Ohms, Load resister in INA169 chip
const float R_INA169 = 1000; // Ohms, internal resistance constant for INA169 chip
const float VOLTAGE_REF = 5; // Reference voltage for analog read
float vout;
float current;
void setup() {
Serial.begin(9600);
// Set unused analog pins to pull up to reduce signal noise.
pinMode(A1, INPUT_PULLUP);
pinMode(A2, INPUT_PULLUP);
pinMode(A3, INPUT_PULLUP);
pinMode(A4, INPUT_PULLUP);
pinMode(A5, INPUT_PULLUP);
}
void loop() {
uint16_t sensor_read;
for (uint8_t t = 0; t < 5; t++). // Burst of reads
{
sensor_read = analogRead(SENSOR_PIN);
vout = (sensor_read * VOLTAGE_REF) / 1023;
current = (vout * R_INA169) / (RS * RL);
Serial.print("Analog Read Value: ");
Serial.println(sensor_read);
Serial.print("Voltage at Vout: ");
Serial.println(vout);
Serial.print(current, 3);
Serial.println(" A\n");
delayMicroseconds(50);
}
delay(5000);
}














