//Pin definition //Current #define I_1 34 #define I_2 35 #define I_3 32 #define I_4 33 #define I_5 25 #define I_6 26 #define I_7 27 #define I_8 14 #define I_9 12 #define I_10 21 //Voltage #define V_0 13 //Light pulse #define Pulse 2 //Declaration of variables float rI_1; float rI_1_conv; float rI_2; float rI_3; float rI_4; float rI_5; float rI_6; float rI_7; float rI_8; float rI_9; float rI_10; float rV_0; float rV_0_conv; float rPulse; //Resolution int res = 4095; float vcc = 3.3; void setup() { // put your setup code here, to run once: pinMode(I_1,INPUT); pinMode(I_2,INPUT); pinMode(I_3,INPUT); pinMode(I_4,INPUT); pinMode(I_5,INPUT); pinMode(I_6,INPUT); pinMode(I_7,INPUT); pinMode(I_8,INPUT); pinMode(I_9,INPUT); pinMode(I_10,INPUT); pinMode(V_0,INPUT); pinMode(Pulse,INPUT); //Serial.begin(115200); //Serial.begin(9600); Serial.begin(250000); } void loop() { // put your main code here, to run repeatedly: rI_1 = analogRead(I_1) * vcc / res; rI_1_conv = (rI_1 - (vcc/2)) * 2000 * ((100000+10000)/10000) * 30; //2000 = turns on secondary coil //((100000+10000)/10000), voltage reduction bridge //30 because the clamp is a 30A/1V //Primary peak-current = RMS current × √2 = 100 A × 1.414 = 141.4A //c) Divide the peak-current by the number of turns in the CT to give the peak-current in the secondary coil. //The YHDC SCT-013-000 CT has 2000 turns, so the secondary peak current will be: //Secondary peak-current = Primary peak-current / no. of turns = 141.4 A / 2000 = 0.0707A //d) To maximise measurement resolution, the voltage across the burden resistor at peak-current should be equal to one-half of the Arduino analog reference voltage. (AREF / 2) //If you're using an Arduino running at 5V: AREF / 2 will be 2.5 Volts. So the ideal burden resistance will be: //Ideal burden resistance = (AREF/2) / Secondary peak-current = 2.5 V / 0.0707 A = 35.4 Ω //Primary current = 2000 * secondary current = 2000 * AREF/2 / Burden resistance //float rI_2 = analogRead(I_2) * vcc / res; //float rI_3 = analogRead(I_3) * vcc / res; //float rI_4 = analogRead(I_4) * vcc / res; //float rI_5 = analogRead(I_5) * vcc / res; //float rI_6 = analogRead(I_6) * vcc / res; //float rI_7 = analogRead(I_7) * vcc / res; //float rI_8 = analogRead(I_8) * vcc / res; //float rI_9 = analogRead(I_9) * vcc / res; //rI_10 = analogRead(I_10) * vcc / res; rV_0 = analogRead(V_0) * vcc / res; rV_0_conv = (rV_0 - (vcc/2)) * (220/8.1) * ((100000+10000)/10000); rPulse = analogRead(Pulse) * vcc / res*50; //Serial.print(rI_1); //Serial.print(" "); //Serial.print(rI_2); //Serial.print(" "); //Serial.print(rI_3); //Serial.print(" "); //Serial.print(rI_4); //Serial.print(" "); //Serial.print(rI_5); //Serial.print(" "); //Serial.print(rI_6); //Serial.print(" "); //Serial.print(rI_7); //Serial.print(" "); //Serial.print(rI_8); //Serial.print(" "); //Serial.print(rI_9); //Serial.print(" "); //Serial.print(rI_10); //Serial.print(" "); //Serial.print("V_BeforeConv:"); //Serial.print(rV_0); //Serial.print(", "); //Serial.print("V_afterConv:"); //Serial.print(rV_0_conv); //Serial.print(", "); Serial.print("I_BeforeConv:"); Serial.println(rI_1); //Serial.print(", "); //Serial.print("I_afterConv:"); //Serial.println(rI_1_conv); //Serial.print(" "); //Serial.println(rPulse); //delay(1); //Wait 1ms -> 20points per cycle (50Hz) }