I am planning to build a volt and amp meter for my lab power supply (3-20V, 3AMP, based on LM2596). I want to measure both voltage and current simultaneously. I am thinking of achieving the current measurement through a shunt resistance (.47R, 5W). I am planning to use ADS1115 16 bit, I2C ADC as Arduino has only 10bit ADC. Is this ADC a good choice, with this what resolution I can get in voltage and current measurements? Any suggestions are welcome.
I am thinking of achieving the current measurement through a shunt resistance (.47R, 5W).
The voltage regulation (or the voltage regulation feedback) has to be on the output side due to the voltage drop across the resistor.
I am planning to use ADS1115 16 bit, I2C ADC as Arduino has only 10bit ADC. Is this ADC a good choice, with this what resolution I can get in voltage and current measurements?
10 bits counts up to 1023. That's 1/1000 resolution. So for example, with a 10V range (1023 representing 10V) you have 10mV resolution. (1/100th of a volt).
0.47 ohm is very high for the shunt - it will drop 1.4V and waste 4.2W at 3A
Something like 0.033 ohm followed by a precision opamp to boost the voltage would be
more normal. There are chips specialised to exactly this task of current measurement.
Hi,
10bit gives you 1024 counts
16bit gives you 65536 counts.
10Bit
So for FSD of 20V you will have 20/1024 = 0.019Vdc resolution
For 3A you will have 3/1024 = 0.0029Adc
16Bit
So for FSD of 20V you will have 20/65536 = 0.0003Vdc resolution
For 3A you will have 3/65535 = 0.000046Adc
I think that is what you were asking.
This is only if you get 20V to scale as the maximum input of the ADC, ie its Vref.
This is only if you get the voltage on the shunt, with 3A flowing, to scale as the maximum input of the ADC, ie its Vref.
I am planning to build a volt and amp meter for my lab power supply (3-20V, 3AMP, based on LM2596). I want to measure both voltage and current simultaneously. I am thinking of achieving the current measurement through a shunt resistance (.47R, 5W). I am planning to use ADS1115 16 bit, I2C ADC as Arduino has only 10bit ADC. Is this ADC a good choice, with this what resolution I can get in voltage and current measurements? Any suggestions are welcome.
I wouldn't call this $2.00 module a lab supply.
Arduino's 10-bit A/D is more than capable for this application.
But this current and voltage breakout board could make things easier.
Finally I received INA219 break out board from china this week. I am using adaftruit library and I am able to measure current and voltage with slight variation. INA measures arudino voltage as 4.87V and my multi-meter reads as 4.94V. INA measures the current as 13.09mA and my multi-meter reads as 13.19mA (I am just measuring the current flowing through a LED). But INA provides strange readings without load for the current, i.e., - 0.60mA. Why its not showing 0mA when there is no loaded connected? Am I missing something?
We don't know what you're missing because we are missing a schematic of your circuit, especially how it is powered. If you don't know how to draw a schematic and post a photo of it, then post a wiring list which shows exactly what is connected to what.
The library must have maths lines to convert A/D values into mA or Volt.
Maybe you can tweak them.
There might also be commands for callibration.
You could ask on the Adafruit forum.
Or you can try adding offset and gain corrections to the print statements.
Serial.print(current_mA + 0.60);
Leo..
Thanks to fritzing.. It made my life easy.. I have attached my circuit and the sketch.
@Wawa.. thanks for your response, I thought of adding the offset value to the print.. but there is a problem, because there is always a slight variation in the current values that still doesn't give the exact 0ma current without load. I will try to explore the library for any possible calibration of the same.
#include <Wire.h>
#include <Adafruit_INA219.h>
Adafruit_INA219 ina219;
void setup(void)
{
uint32_t currentFrequency;
Serial.begin(115200);
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).
ina219.begin();
// 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;
int i;
for (i = 0; i < 20; i++){
shuntvoltage = shuntvoltage + ina219.getShuntVoltage_mV();
busvoltage = busvoltage + ina219.getBusVoltage_V();
current_mA = current_mA + ina219.getCurrent_mA();
}
shuntvoltage = shuntvoltage /20;
busvoltage = busvoltage /20;
current_mA = current_mA/20;
loadvoltage = 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.println("");
delay(2000);
}