Hello there,
I've just built emontx (v. 2.2.1), plugged in single CT (no wire inside) and started current_only, expecting to get zeroes. Instead I have (power, irms): 1170.46 4.88
1168.62 4.87
1177.42 4.91
1176.04 4.90
1188.65 4.95
1174.85 4.90
1190.38 4.96
When I unplug the CT, I get:
49.30 0.21
48.35 0.20
49.08 0.20
Tried to check the signal with oscilloscope connected to atmega's analog 0 (I'm using CT2 for tests) -
on no load horizontal line, 2kW load produces nice sin wave, so CT looks ok.
Tried as well to read the input directly with readAnalog, under no load got strange values:
451 - 545 : 94
459 - 548 : 89
461 - 546 : 85
with loop():
int mi, ma;
mi = p.anaRead();
ma = mi;
for (int i=0; i<20000; i++) {
int v = analogRead(0);
mi = min(mi, v);
ma = max(ma, v);
}
Serial.print(mi);
Serial.print(" - ");
Serial.print(ma);
Serial.print(" : ");
Serial.println(ma - mi);
Other ports do the same.
Has anyone experienced similar behaviour? Any ideas how to fix this?
Thanks,
ms.
Re: Nonzero Irms reading when wire not under load
It is normal to see a small amount of noise on the analogue input - we believe it comes from the digital side of the processor. However, what you are seeing is way above the amount that we normally see. I would expect to see a spread of a few counts - certainly nowhere near the 100 you seem to have. That represents 0.3 V p-p and you didn't see it on your 'scope? That makes me think power supply noise might be the culprit. Did you think to look at the 3.3 V rail?
I've just run essentially the same test as you have, but with only 200 iterations inside the inner loop, and I get this:
port min-max spread
3 513-514 2
0 507-509 3
1 507-508 2
3 513-514 2
0 507-509 3
1 506-508 3
3 513-514 2
0 507-509 3
1 507-508 2
3 513-514 2
0 507-509 3
1 507-508 2
3 513-514 2
0 508-509 2
1 507-509 3
That represents about 200 mA max with the calibration set for 100 A max. Perhaps not obviously, when you are calculating real power, the power is a lot less because the noise is random and there is no rectification in the maths which you get with the rms calculation of current.