LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong AC Current reading?

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;

void setup(){
 Serial.begin(9600);
}

void loop(){
 
 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);
 
 
Serial.print(Amps);
Serial.print(", ");
Serial.println(AcVoltage);

}

 

 

Really appreciate if you guys can help!

 

0 Kudos
Message 1 of 12
(4,121 Views)

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?

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 12
(4,111 Views)

Hi James,

 

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 12
(4,105 Views)

Gotcha, ok.

 

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.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 4 of 12
(4,090 Views)

You've probably already heard this before to, but is there a reason you aren't using LIFA, or the newer LINX?

0 Kudos
Message 5 of 12
(4,043 Views)

@Hooovahh wrote:

You've probably already heard this before to, but is there a reason you aren't using LIFA, or the newer LINX?


He's got bigger problems.

 

Note his statement:    I use 230AC supply with load 229ohms so I should get around 1.004

I really hope he isn't working with 230 VAC !

 

0 K