Hello guys! I'm using two analog inputs voltage & current with serial communication from arduino to labview. I use ACS712 for the current sensor. The readings I get are ranging from -6 to +5 from the AC signal after the calculations. If I take the RMS, I will get around 3.9 - 4.0. I use 230AC supply with load 229ohms so I should get around 1.004? The value I get should be near to 1 but I'm getting 3.9 RMS?
I've double checked the hardware(connection) and software(calculations) and I don't think there is anything wrong? What should I do? This value I'm getting is totally far from 1A that I should be getting!
I'm taking the reading from Analog input 0 to divide 1023 then * 5000. Then I minus the 2500 offset and divide 185.
Here is my code:
const int analogIn0 = A0;
const int analogIn1 = A1;
int mVperAmp = 185; // use 100 for 20A Module and 66 for 30A Module
int RawCurrentValue= 0;
int RawVoltageValue= 0;
int ACSoffset = 2500;
int Denominator = 0;
float AcVoltage = 0;
float Voltage0 = 0;
float Voltage1 = 0;
float Amps = 0;
RawCurrentValue = analogRead(analogIn0);
RawVoltageValue = analogRead(analogIn1);
Denominator = 10000/130000;
Voltage0 = (RawCurrentValue / 1023.0) * 5000;
Voltage1 = (RawVoltageValue / 1023.0) * 5000;
AcVoltage = (Voltage1 / Denominator ) ;
Amps = ((Voltage0 - ACSoffset) / mVperAmp);
Really appreciate if you guys can help!
I'm sure someone here will still try to help anyways, but is this problem related to the LabVIEW part of your system at all, or even NI equipment?
lamela is using an Arduino to measure some signals and send to result of this measurement via serial port to a PC running LabVIEW.
And lamela tends to forget about the correct forum to ask his/her questions…
@lamela: Maybe you should ask in an Arduino forum?
lamela, have you tried printing values along the way (before, during, and after calculations) to better understand what the calculations are doing? You should print the raw value themselves, so that you can tell whether the problem lies in your calculations or in the raw signals.
Is he using the Arduino as a fuse?
I like to run all of my signals through an NI-USB 6008 (AI0 > AO0, AI1 > AO1), so that I have a cheap fuse that doubles as a probe!
Thanks for the replies!
I've serial printed the 3 values, the RawCurrentValue, the Millivolt and the Current reading. I verified that the Millivolt values are correct, so I assume the rawcurrentvalue shouldn't be the problem though.. I should be getting a current close to 1.
The values of the RawCurrentValue is ranging from 290-705. Millivolt is ranging from 1400-3450 and current is from -5.96 to 5.16.
I don't think the calculation to measure the current is wrong either? What should I do? I already asked in the arduino forum but there is still no solution yet..
Your calculations look reasonable, assuming that the coefficients in your original post are accurate.
Do you have an alternative means of measuring the current? Maybe it really is 5 A peak.