Using an Arduino Nano and a current transformer (CT), I'm trying to sense the current flowing through a 120 V 60 Hz line.
Circuit
CT outputs 0-1 V
according to its specifications. This output is biased AREF/2
= 2.5 V.
analogRead
Values
The x-axis represents the index number of the ADC sample, while the y-axis represent the ADC value (0-1024). Sampling rate is about 9 kHz. Peak-to-peak difference is about 1026 samples.
Is this waveform what you would expect from the CT? Why are there regions where the values are flat, rather than varying continuously?
Furthermore, if we look at the curve part of the plot, why is Arduino reading values both above 512
and below 512
alternately? It reads a value above 512
, then a value below 512
, then a value above 512
and so on.
Time taken for an analogRead
was measured to be 110 microseconds for my setup and there are 1026 samples between the waveform peaks. That means there will be about 9 peaks in 1 second, although I would expect 60 peaks since we are sensing a 60 Hz line. What do you make out of this? There's a capacitor, C1
, in the circuit, would it have anything to do with this?
Are these analogRead values suitable to be used to calculate the RMS voltage, and hence the RMS current passing through the wire being sensed? The final goal of this is to calculate the power usage after determining the RMS current flowing through the wire.
Sketch used to get values for plot
void setup() {
Serial.begin(9600);
}
void loop() {
double sensorValue = analogRead(1);
Serial.println(sensorValue)
}
Actual analogRead
data points in the bump regions
487
534
487
535
488
537
484
536
487
538
486
536
484
540
484
539
485
540
483
540
484
541
481
539
481
540
484
540
480
543
484
539
481
540
484
541
486
542
485
538
485
538
488
535
489
534
491
530
491
529
493
531
492
526
498
526
499
524
499
520
503
518
502
518
507
Plot of analogRead values
The analogRead values are now stored in a buffer before being transmitted over Serial. There are now 55 ADC datapoints making up 1 period. Considering the analogRead time is 110 µs, each cycle takes 6.05 ms, giving us a frequency of 165 Hz! What may have gone wrong?
void loop() {
double sensorValue = analogRead(1);
char buf[32];
dtostrf(sensorValue, 8, 2, buf);
value = buf;
if (stop == 0) {
if (i < 10000) {
message += ',';
message += value;
i++;
}
else {
stop = 1;
Serial.println(message);
}
}
}
analogRead()
and found it to be 110 microseconds. Updated the question. – Nyxynyx Mar 22 '14 at 21:23