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.
Enter image description here
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.
Enter image description here
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?
Enter image description here
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);
}
}
}
2 Answers 2
Regarding your measurements, I would completely disregard the first set with Serial.println() in the loop. I would exepect the timing of this to be unreliable.
Your second set of data that you captured in a buffer looks correct, but your Frequency Estimation / timing may be wrong. I would invert a Digital Output at each loop iteration. You can measure the frequency of that with a Multimeter and your ADC sample rate would be twice that value.
For a PC or laptop power supply that's quite a common current waveform.
Without effective Power Factor Correction the current signal shown below would be quite typical (source: http://www.nlvocables.com/blog/?p=300)
http://www.nlvocables.com/blog/?p=300
You will need to calculate RMS values and it would be wise to filter the signal.
Here's an instructable I wrote on how to build and code an Arduino Yun based Electricity Monitor with Cloud Support / Temboo and Google Drive. It should be of some help to you.
-
Thank you! The CT you've used outputs -1V to 1V. To make use of the 10 bit ADC, will you amplify the SCT output by 2.5 using an opamp? Or set your AREF to 2V and bias your CT signal by 1VNyxynyx– Nyxynyx03/23/2014 17:33:13Commented Mar 23, 2014 at 17:33
-
No I did not amplify it or change the Aref.akellyirl– akellyirl03/23/2014 23:55:08Commented Mar 23, 2014 at 23:55
-
How could you get this graph plot? With what software?Zgrknr– Zgrknr04/15/2014 05:59:30Commented Apr 15, 2014 at 5:59
if you are measuring a resistive load I would say that the burden resistor you have chosen is wrong, there are some cheap CT's on ebay (SCT-013-xxx) that have versions with and without the burden resistors, these work well for their price but you must read the datasheet. the SCT-013-000 requires a 20R resistor to get 1V out with a 100A load, if this resistor is wrong you can get a severely distorted waveform when measuring higher currents (similar to those you have provided), you would expect the signal to distort more the lower the burden resistor value but this is not the case with CT's.
Explore related questions
See similar questions with these tags.
analogRead()
and found it to be 110 microseconds. Updated the question.