Hello,
I use an Arduino Nano and a 3 channel INA3221 sensor, which is connected via I2C with the Nano (address 0x40). I installed the recommended library from Tinyu. With the script below and an external voltage of around 5.1 V and an adjustable load I can increase the current up to 325 mA:
Serial output:
CH1:
U1: 5.12 V
I1: 324.00 mA
but when I increase the current above 325 mA I get a negative current value and the value starts to decrease while the real current gets higher. Can anyone explain to me what's happening here?
Serial output:
CH1:
U1: 5.12 V
I1: -302.00 mA
The same is happening on all 3 channels.
Thank's
Martin
Link to the sensor:
https://www.amazon.de/gp/product/B07XXFPNHC/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
#include <Wire.h>
#include <INA3221.h>
#define SERIAL_SPEED 115200
#define PRINT_DEC_POINTS 3
INA3221 ina_0(INA3221_ADDR40_GND);
float voltage1 = 0.0;
float current1 = 0.0;
float voltage2 = 0.0;
float current2 = 0.0;
void current_measure_init() {
ina_0.begin(&Wire);
ina_0.reset();
ina_0.setShuntRes(100, 100, 100);
}
void setup() {
Serial.begin(SERIAL_SPEED);
current_measure_init();
while (!Serial) {
delay(1);
}
// Set shunt resistors to 100 mOhm for all channels
}
void loop() {
current1 = ina_0.getCurrent(INA3221_CH1) * 1000,
voltage1 = ina_0.getVoltage(INA3221_CH1),
current2 = ina_0.getCurrent(INA3221_CH2) * 1000,
voltage2 = ina_0.getVoltage(INA3221_CH2),
Serial.println("CH1:");
Serial.print("U1: ");
Serial.print(voltage1);
Serial.println(" V");
Serial.print("I1: ");
Serial.print(current1);
Serial.println(" mA");
Serial.println();
delay(10000);
}
