Pages: [1]   Go Down
Author Topic: read the icon electric smart meter  (Read 1157 times)
0 Members and 1 Guest are viewing this topic.
Atlanta, GA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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





* electric_meter_cut.JPG (34.94 KB, 640x480 - viewed 21 times.)
« Last Edit: June 07, 2011, 08:50:34 pm by pantonvich » Logged

Pages: [1]   Go Up
Jump to: