Read the itron 100g dl gas meter

so the meter - if you look closely you can see the gear that rotates in the attached pictures

I used the RadioShack Emitter and Detector #276-0142 set and some pvc and duck tape (to block the sun light and to hold it in place)

here's the meat of the code
because it get's full on sun I use filters for the cross over counts

#define gas_analog_in 4
#define gas_digital_out 4
void loop()
{
    GasLoop();
}

unsigned long gasTotalCount = 0;
unsigned long gasLastCount = 0;
unsigned long gasG5count = 0;

unsigned long gaslastMillis = millis();
unsigned long gasReading = 0;
unsigned long gasReadingMax = 0;
unsigned long gasReadingMin = 1023;
unsigned int gasFlag = 0;
unsigned long gasTripHigh = 0;
unsigned long gasTripLow = 1023;
int gasTripOffset = 75;
float gasFilterL = 900;
float gasFilterOff = 900;

int gasOut = HIGH;

void GasLoop()
{
  gasReading = analogRead(gas_analog_in);
  
  gasFilterL += .01 * (gasReading-gasFilterL);
  
    gasReading = gasFilterL;
    
  if(gasReading>gasReadingMax) gasReadingMax = gasReading;
  if(gasReading<gasReadingMin) gasReadingMin = gasReading;
    
  if(gasReading<gasTripLow) {
    gasFlag = 1;
  } else if (gasFlag == 1 && gasReading>gasTripHigh) {
    gasFlag =0;
    gasTotalCount++;
  }
    
  if (gasReading>gasTripHigh) {
    gasTripLow = gasReading - gasTripOffset;
    gasTripHigh = gasReading;
  }
  if (gasReading<gasTripLow) {
    gasTripHigh = gasReading + gasTripOffset;
    gasTripLow = gasReading;
  }

}

over the last two months I had:

Billed MyReading %Delta
12 11.88 1.00%
11 11.16 -1.45%

so over the 2 months -0.17% (seeing they bill at 1ccf and I measure at .01)

I'm happy with results so far!

gas_meter_front.jpg

Nice work!
My utility company has recently installed the 100G DLN wireless module on my gas meter (DL and LDN are the same except that the DLN has more power for fixed network reads...whatever that is).
I'd like to read the meter electronically and your solution seems to be the simplest. The option of reading it wirelessly seems more involved.

Can you provide a little more detail on how the gear rotation works to allow passage of the infrared? I see from the pictures how you have mounted it, but the details aren't entirely clear to me.

Thanks in advance!

pantonvich:
so the meter - if you look closely you can see the gear that rotates in the attached pictures I could not see this.What does the IR beam do . Is it cut by the gear moving? I take it you have nothing inside the meter so how are your devices positioned
I used the RadioShack Emitter and Detector #276-0142 set and some pvc and duck tape (to block the sun light and to hold it in place)Its "duct" tape I think .How does this keep out the sunlight though?
here's the meat of the code
because it get's full on sun I use filters for the cross over counts Could you explain this a bit more please?

sorry never got a notice - this is late but you never know

the gear blocks the beam - so the analog reading varies with the position of the cam

yes duct tape - blocks or limits the amount of light that the sensor see's - noon with full sun would get lots of false readings

but having a slow moving filter varying sunlight conditions didn't trigger false readings

gasFilterL += .01 * (gasReading-gasFilterL);

so if your current gasFilterL was 700 and then you get a bright spot and read 300 your new reading is lowed by .04

if you used an unfiltered value the 400 delta would have triggered a count

20110216_152233_1.jpg

20110216_215241_1.jpg

20110218_101741_2.jpg