Go Down

Topic: read the icon electric smart meter (Read 1 time) previous topic - next topic

pantonvich

Jun 08, 2011, 02:44 am Last Edit: Jun 08, 2011, 03:50 am by pantonvich Reason: 1
using the detector from the RadioShack #276-0142

had lot's of issues with sunlight - as it get's full sun about noon!

here are my results so far:







BilledMyReading%Delta
10291024.2860.46%
10231017.3310.55%
12121197.2931.21%
19691964.9730.20%
21332140.187-0.34%


I call the arduino every 5 minutes (actual twice) via Ethernet that I also poll some two lines of onewire Dallas Temperature sensors.

So I think I lose a watt/blink or more (i.e. 1 watt) in that time frame...

Code: [Select]

#define power_input 0
void loop()
{
 PowerLoop();
}

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; }
}





Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy