#include <Wire.h>
#include <Adafruit_INA219.h>
Adafruit_INA219 ina219;
void setup(void)
{
Serial.begin(115200);
while (!Serial) {
// will pause Zero, Leonardo, etc until serial console opens
delay(1);
}
uint32_t currentFrequency;
Serial.println("Hello!");
// Initialize the INA219.
// By default the initialization will use the largest range (32V, 2A). However
// you can call a setCalibration function to change this range (see comments).
if (! ina219.begin()) {
Serial.println("Failed to find INA219 chip");
while (1) { delay(10); }
}
// To use a slightly lower 32V, 1A range (higher precision on amps):
//ina219.setCalibration_32V_1A();
// Or to use a lower 16V, 400mA range (higher precision on volts and amps):
//ina219.setCalibration_16V_400mA();
Serial.println("Measuring voltage and current with INA219 ...");
}
void loop(void)
{
float shuntvoltage = 0;
float busvoltage = 0;
float current_mA = 0;
float loadvoltage = 0;
float power_mW = 0;
shuntvoltage = ina219.getShuntVoltage_mV();
busvoltage = ina219.getBusVoltage_V();
current_mA = ina219.getCurrent_mA();
power_mW = ina219.getPower_mW();
loadvoltage = busvoltage + (shuntvoltage / 1000);
Serial.print("Bus Voltage: "); Serial.print(busvoltage); Serial.println(" V");
Serial.print("Shunt Voltage: "); Serial.print(shuntvoltage); Serial.println(" mV");
Serial.print("Load Voltage: "); Serial.print(loadvoltage); Serial.println(" V");
Serial.print("Current: "); Serial.print(current_mA); Serial.println(" mA");
Serial.print("Power: "); Serial.print(power_mW); Serial.println(" mW");
Serial.println("");
delay(2000);
}
Hello!
Beside this, you should also specify what you are measuring.
-> you measure, you check the electrical characteristics in INA219 documentation,
and you should be able to conclude by yourself whether the differences you are measuring
are within the bounds specified in the datasheet.
Dora.
INA219 Current sensor with arduino UNO with adafruit ina219 libraryHi,
first thigs first:
* which INA module exactly?
* which Arduino module exactly?
* wiring schematic of all your circuit.
* what power supply do you use?
* which library exactly?
* show the terminal software outputs.
Klaus
i've used 470 ohm resistor for the led & i've connected the Vin correctlyHi,
your picture:
* Arduino UNO shows SDA ans SCL at right top header pins. Why don´t you use them?
* LEDs usually need a current limiting resistor. I miss it.
* Why did you swap Vin- and Vin+ at the sensor PCB? (But it should work this way, too)
Klaus
Me too.I don't feel like reading the
datasheet for you.
I see the shunt as 100mOhms.
hello GuysHello!
Right. And it makes more sense for a shunt. Sorry.
That said, I didn't notice the 400 mA range, but anyway having a
fluctuation of 0.5 mA for a 400 mA range is not bad.
Dora.
Why do you guess? I think you have all the information .. we don´t. We just have the information you give.& with 1A 12v Lamp im reading 375mA with the 400mA mode(Just for testing)
i guess its a good result.
Usually the datasheet tellsin the get current example they use 2 seconds delay between readings
the lamp is not 1A i've used a dvm & the reading is almost the sameHi
Why do you guess? I think you have all the information .. we don´t. We just have the information you give.
I can´t see why a 375mA result is good for a 1A lamp...
Usually the datasheet tells
* data rate
* conversion time
* sampling rate
or something similar
Klaus
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?