I have the same meter cl200
I got a simple IR from radio shack and used software to filter - mine is in direct sunlight - used duck tape to make a shield.
been running for 2 years - total error rate is .25% over that time rate - varies month to month most of the time about .5% and max about 3.5% - as I don't know what time the read it I always use 12 noon from my readings.
on a side topic - this month it all got discounted as I had to pull my meter to replace a main breaker that was over heating (and not tripping) and filling the house with a dead squirrel/fish type of smell. I'm guessing the anti what ever works because the power company came out and pulled all my stuff off the meter. When I pulled the meter it all came a part on me - the clear plastic twists off and the gray cover is only held on with some tabs also came off with out trying. I didn't push the (what looked like a reset) button under it all.... i should have taken't pictures but at the time was only trying to get the power off to replace the meter so my home wouldn't burn down
anyways here's my code - the odd filtering is to try and account for different sunlight levels then reading the meter.
unsigned long powerCount = 0;
unsigned long powerCountLast = 0;
unsigned long powerLastBlink = 0;
unsigned long powerK5count =0;
unsigned long powerW1=0;
unsigned long powerW2=0;
unsigned long powerW3=0;
unsigned long powerW4=0;
unsigned long powerW5=0;
float powerBlinkLength = 80;
float powerBlinkRate = 200;
int powerBlinkFlag = 1;
float powerFilterR = 600;
float powerFilterH = 600;
float powerFilterC = 600;
float powerMaxL = 1;
float powerMaxH = 0;
int powerReading = 0;
void PowerLoop() {
powerReading = analogRead(power_input);
powerFilterR += .55 * (powerReading-powerFilterR);
powerFilterH += .01 * (powerReading-powerFilterH);
powerFilterC += .9 * (powerReading-powerFilterC);
if (powerFilterC/powerFilterH < powerMaxL) powerMaxL = powerFilterC/powerFilterH;
if (powerFilterC/powerFilterH > powerMaxH) powerMaxH = powerFilterC/powerFilterH;
serialPrint();
if ((powerFilterC/powerFilterH <.9 && powerBlinkFlag ==1 && millis()-powerLastBlink > 50) || powerLastBlink > millis())
{
powerBlinkFlag = 0;
powerCount++;
float rate = millis()-powerLastBlink;
if(rate>0) powerBlinkRate += .05 *(rate-powerBlinkRate);
powerLastBlink = millis();
}
else if (powerFilterC/powerFilterH > 1.01 && powerBlinkFlag == 0)
{
if ( millis()-powerLastBlink > 30|| powerLastBlink > millis()){
float rate = millis()-powerLastBlink;
if (rate>0) powerBlinkLength += .05*(rate-powerBlinkLength);
powerBlinkFlag = 1;
}
}
unsigned long w = millis() - lastconnect;
if ( w < 60000) { powerW1 = powerCount; }
else if (w < 120000) { powerW2 = powerCount; }
else if (w < 180000) { powerW3 = powerCount; }
else if (w < 240000) { powerW4 = powerCount; }
else if (w < 300000) { powerW5 = powerCount; }
}