Hello,

i'm trying to build energy cosmuption monitor for my home. here we have 220V@50Hz

i red about CT and bought some from sparkfun.

basically i read the voltage across some load resistor and from that i can calculate the secendory current (I=V/RLoad)

from the turn ratio (2000) i can deduce the primery current.

here is my code:

int SensorValue = 0;

int WireTurns = 2000; // the ratio between I primery and I secondary

int Num_of_Samp = 500;

int DelayMicros = 20000/Num_of_Samp; // 1/50Hz is 20ms period

float Rload = 2000.0/(float)WireTurns;

float volt = 0;

float RMS = 0;

float I=0;

void setup() {

Serial.begin(115200);

}

void loop() {

RMS = 0;

for (int ii=0;ii<Num_of_Samp;ii++){

SensorValue = analogRead(A0);

volt = 0.00489*SensorValue; // 5/1023 = 4.88mV

volt = volt-2.5;

volt = volt*volt;

RMS = RMS + volt;

delayMicroseconds(DelayMicros);

}

RMS = RMS/(float)Num_of_Samp;

RMS = sqrt(RMS);

I = RMS/Rload;

Serial.print("Max Voltage:");

Serial.print((RMS*1.44)+2.5);

Serial.print(" RMS current:");

Serial.print(I);

Serial.print(" Power cons.:");

Serial.println(I*220);

}

i read the voltage 500 times, calculate the square value and finaly after the loop ends i take the mean and then the square.

here is my problem:

i get different RMs current reading when using different resistors.

when using 5K ohm i get 0.16A and when using 2k ohm i get 0.22 A

anybody here tried doing something like this?

thanks,

Etay