I have just start with Arduino boards, I have picked this for my 1st project. I got the CT etc, still need a few things.
Can you please try this code out and let me know how it looks
float rms_val1 = 0;
float rms_val2 = 0;
float power_rms = 0;
for (int cnt=0; cnt<SAMPLES; cnt++) {
val1 = analogRead(S1_PIN);
val2 = analogRead(S2_PIN);
rms_val1 = rms_val1 + sq( (float)val1 );
rms_val2 = rms_val2 + sq( (float)val2 );
power_rms = power_rms + sq(val1*val2);
}
rms_val1 = sqrt(rms_val1 / (SAMPLES/2) );
rms_val2 = sqrt(rms_val2 / (SAMPLES/2) );
power_rms= sqrt(power_rms / (SAMPLES/2) );
In theory power factor will no longer be an issue, however I don't about only using half the wafeform