Itron Analog Gas Meter Sensor

I wanted to share a project that provides an Itron gas meter sensor that can be used with Home Assistant.

Details can be found at GitHub Itron Analog Gas Meter Sensor.

In particular, this is for an Itron gas meter that looks like this:


This meter is rather old but it is actually a smart meter in that it provides an RF readout to a truck driving around the neighborhood once a month!

The gas meter is read by taking a picture of the gas meter faceplate and using image processing to determine the gauge’s dial setting value. It reports the value to HA using MQTT. The challenging part of the project was in getting a proper image of the faceplate. You can read more on the Github about this, but the solution I found was to use Edison LED filament lighting and a 3D printed enclosure.

This image shows what the gas meter faceplate looks like with the illumination and camera image settings, along with the needles that were found after the image was processed:

There are many pieces to this project:

  • PiCamera (Zero W) with python code modules:

    1. for turning on/off the LEDs and taking an image with the proper image settings,
    2. http server which can be used to
      i) instruct the camera to take a picture, or
      ii) retrieve the image, or
      iii) check the Pi’s CPU temperature.

    Besides the software, there is also an enclosure and parts for mounting the pi zero w and its camera module.

  • Analysis - Python code (opencv) that gets the image from the camera, determines the value of the dials, and reports them to HA using MQTT. Before running this for the first time, one has to go through a setup and alignment process to locate the needles’ axis of rotation and radius.

  • Shell Script that tells the camera to take a picture, and subsequently runs the analysis code. I use a cron job to run the script at 45 minutes after the hour, and when HA’s Energy Management runs on the hour it will have a fairly recent update from the sensor from which to calculate gas usage.

  • 3D Printed Enclosure - A multi-piece 3D printed enclosure was used for mounting the camera to the gasmeter and for housing the LED filaments.

So the project is a bit complex, and thus far I have only run the analysis code on a machine separate from HA. The analysis code does a pretty good job but it is not perfect, as it has goofed a couple of times having run it for around 3 months, and this can cause a larger than usual bar in the energy graphs.

The one aspect that I incorporated into the analysis code which may make it a bit different, is that it provides a read out down to the one-hundredths (Example: 8708.78) which comes in handy during the warm seasons as only a couple of hundredths (in my case) may be used every couple of hours or so.

3 Likes