How to build a web connected gas meter with your Arduino

Standard

A few months back, I bought a Current Cost electricity meter, hacked that and started pushing the data up to Pachube and displaying real-time electricity usage right here on my blog. But, electricity is only one part of the picture – we also use gas for our heating and hot water systems, and I wanted to track our usage of this too. The catch, of course, is that there doesn’t appear to be a consumer product on the market to do this for me, and I really wanted an excuse to go out and buy an Arduino and start playing with that.

My goal for this project was to hook the gas meter up to Pachube, using EEML as the format:

<eeml xmlns='http://www.eeml.org/xsd/005' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.eeml.org/xsd/005 http://www.eeml.org/xsd/005/005.xsd'>
<environment>
<location exposure='indoor' domain='physical' disposition='fixed'>
<name>London, United Kingdom</name>
</location>
<data id='0'>
<tag>gas</tag><tag>cubic metres</tag>
<value>2</value>
</data>
<data id='1'>
<tag>temperature</tag><tag>degrees</tag><tag>celsius</tag>
<value>28</value></data>
</environment>
</eeml>

What follows is how I set about using my Arduino, an Ethernet Shield and various other parts in order to build the gas meter!

Introduction

Those of you who have been following my previous blog posts will know that I’ve been working on this for a while, finding a few minutes spare to tinker as and when I can. This post is the promised amalgamation of all those recent posts.

The completed Arduino Ethernet Gas Meter unit

The completed Arduino Ethernet Gas Meter unit

So, this is the completed unit (picture, left). Whilst this isn’t intended as a complete step-by-step tutorial, my aim is to provide enough information to enable somebody else to build one of these.

To keep things nice and neat, I mounted the Arduino, Ethernet- and Proto- shields into a plastic project box from Maplin. I drilled a ventillation hole and added a mini CPU fan connected to a temperature sensor to help keep the unit cool. I also wanted to add one because it’s nice to tinker around with new sensors and I hadn’t yet played with a temp sensor ;)

How does it work?

The main sensor on this unit is a photo-reflector, which is a fancy name for an infrared LED and an infrared sensor in one assembly. When the infrared sensor detects a reflection from the infrared LED, the strength of that reflection is fed back into the Arduino. I used a pull-up resistor circuit to connect this sensor to a digital input pin, which is switched to LOW when a reflection is detected. Because my gas meter has a little reflective metal disc on one of the dials, this gives me a nice reflection to count when the dial passes.

The Arduino then keeps a tally of all the reflections it has counted, which is accessible in XML (conformant to the EEML standard) over the web via the Ethernet Shield. To keep my meter in synch with the actual gas meter, one can pass a parameter via the HTTP querystring to the gas meter module to set it’s current value (useful, for instance, after a power cut or if you need to disconnect it). Because the unit is accessible over the public internet (without authentication), I only allow the querystring parameter to reset the meter value if a certain digital pin is ‘HIGH’ – a crude (yet effective) kind of physical security.

For fun, I then added a mini-CPU fan connected to a temperature sensor which causes the fan to start up when the temperature inside the unit gets a bit too toasty. It then kicks in until it has successfully dropped the temperature to within the threshold amount. The CPU fan runs off 12v, which the Arduino will happily produce – but it gave me an opportunity to use a transistor to switch the 12V supply on/off based on the state of a digital output pin @ 5 volts.

Contents

  1. Before you begin: finding out if this will this work for you!
  2. Shopping list – what you need to buy and where to get it
  3. Constructing the sensor circuit
  4. The sketch
  5. Connect it all up, fine tune and test
  6. Acknowledgements

Before you begin: check your gas meter

Please note: this project involves mounting sensing equipment in a non-permanent, non-invasive way to your household gas meter, based on my experience and research. I strongly encourage you to check for yourself whether these instructions are suitable for you, and, if so, only to proceed if you feel competent enough to connect this unit safely. This information is provided ‘as is’, and you use it entirely at your own risk.

This kit will only work on certain types of gas meter. Firstly, you must have the odometer-style gas meter (these are the ones with rotary dials with numbers on). Secondly, one of the dials, usually the dial representing a 100th of a Cubic Metre should have a little reflective disk between two of the digits (on mine, that is digit 5 and 6). I’ve no doubt that you could probably modify my design here to work with another type of meter, but you may need to change the photo reflector to either a pulse counter or something else appropriate. The underlying code to count the pulses and make the Arduino web-connectable should be the same.

Shopping list

1 x Arduino Duemillanove (or similar) ….. £23.81
1 x Sparkfun Ethernet Shield … £33.35
1 x 9v DC Power Supply with a 2.1mm centre-positive connector (Maplin: GS74R) … £7.99
1 x 220 ohm resistor
1 x 10K ohm resistor
1 x Transistor (if you plan to add the fan circuit and you use a 12V fan)
1 x Fairchild QRB1134 IR Photoreflector …. £2.62
1 x Project Box (eg. Maplin XYZXYZ) …. £2.99
1 x Mini CPU Fan (eg. Maplin) …. £4.99
1 x Breadboard – OR -
1 x Nuelectronics Protoshield …. £4.99

Total cost to build from scracth: £80.74
Total cost if you already have the Arduino, an ethernet shield and a few other bits and bobs: < £20.

You will also need/want the following tools to hand:

  • Soldering iron and lead-free solder (well, use whatever you like, but lead-free is better for you and the environment!)
  • Wire cutters
  • Some suitable wire/jump leads etc
  • A pair of “helping hands” if you have them

Goals

Before starting out, I had a quick think about the project’s desired behaviors. That way, coding it up would be a little easier because I’d know what I was supposed to be coding :)

Here they are:

  • Connect the photo reflector to a digital input
    • When the input goes LOW, increment a counter
  • Check the current temperature inside the unit
    • When the temperature is above the threshold, turn on the CPU fan.
    • When the temperature falls below the threshold, turn off the CPU fan.
  • Check if a web client is connecting.
    • Read the query string.
    • If the query string value contains “?x=”, change the internal count to the value of x but only when a digital pin is set to HIGH (so web users can’t set it for us!).
    • If the query string does not contain the above element, generate EEML containing the data that we need.

With these points in mind, I started to construct the sensor circuit.

Constructing the sensor circuit and preparing the project box

Ok, so first things first – let’s start by preparing the project box. Drill two holes into the box – one on top, and another on the side (as pictured):

Prepared Project Box

Prepared Project Box

It doesn’t really matter what size you make the hole on the side providing that there is sufficient room to fit a power cable, ethernet cable and the 4 wires from the photoreflector through. The hole on top should be just a shade smaller than the size of the fan that you have so that you can mount it to the inside of the case properly.

Next up, we’re going to construct the sensor circuit board. You can use either a breadboard, or – as I have used – an unassembled protoshield board from nuelectronics. I have used Fritzing to create a diagram of the entire circuit (shown below). I’ve also produced a schematic to accompany the diagram. I’m not quite sure how correct it is though, so be warned! (Corrections on a post-card, please!).

A tidier view of the wiring

A tidier view of the wiring

Schematic

Schematic

Start by soldering two wires – one each to the 5V rail and the GND rail respectively. Next, solder the resistors, transistor and temperature sensor onto the board, according to the schematic shown. Take care when soldering the transistor and temperature sensor to the board: the heat from your soldering iron may damage them.

Next, pass the bare sensor wires through the outside hole that you drilled and then solder them onto the board in the posistions shown. Make sure you use enough wire – you’ll want about 11-13cm for each connection you make (you can trim the non-soldered ends later).  Finally, solder the positive and ground wires for the CPU fan onto your board.

If you’re new to soldering (as I am), then do take extra care that your connections are good and don’t bridge multiple points on the board. If you do, you’ll likely create a short circuit and that will drive you nuts, trust me! When you’re done, you should end up with something that looks a bit like this:

The finished sensor circuit

The finished sensor circuit

The sketch

Now that you’ve done the hard part, here comes the copy and paste! Take the sketch below and place it into your Arduino suite. You’ll need to modify the following:

  • Line 13: Set your own unique MAC address
  • Line 14: Set your own unique IP address (accessible from computers on your network)
  • Line 15: Set your router’s gateway address
#include "Ethernet2.h"
#include "WString.h"
#include "stdio.h"

// --- [ Pin setup ] ---
int sensorPin = 5;
int ledPin = 9;
int fanPin = 7;
int tempPin = 3;
int unlockPin = 8;

// --- [ Ethernet setup ] ---
static uint8_t mac[6] = { 0x02, 0xAA, 0xAA, 0xCC, 0x00, 0x22 };
static uint8_t ip[4] = { 192, 168, 1, 99 };
static uint8_t gateway[4] = { 192, 168, 1, 2 };
int serverPort = 80;

String url = String(25);
int maxLength=25;

// --- [ Variables to control when the unit fan kicks in/cuts out... ] ---
float maxTemp = 26.0;
float minTemp = 24.0;

// --- [ Variables to store our sensor values ] ---
volatile int totalTicks = 0;
float tempc = 0.0;
int maxi = -100, mini = 100;

// --- [ Misc. vars ] ---
float inputVolts = 5.01;
int previousState = -2;
int delayMs = 1500;
int i;
boolean lock;

Server server(serverPort);

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(fanPin, OUTPUT);
  pinMode(sensorPin, INPUT);
  pinMode(unlockPin, INPUT);
  previousState = digitalRead(sensorPin);
  Serial.begin(115200);                                   // Use serial for debugging locally...
  Serial.println("Ardugas server saying: Howdy!");
  Ethernet.begin(mac, ip, gateway);
  server.begin();
}

void loop() {
  checkUnitTemp();                                      // Take action based on unit temp
  checkSensor();                                        // Check the gas meter sensor
  getCurrentTemperature();                              // Get the unit temperature
  listenWeb();                                          // Handle any web connections
  digitalWrite(ledPin, !digitalRead(sensorPin));        // Light LED if sensor is LOW
}

// Serve pachube EEML and accept a querystring param to set the current value
void listenWeb() {   

 boolean read_url = true;
 boolean unlock = false;

 Client client = server.available();
  if (client) {

    Serial.println("Ethernet client connected...");

    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    int valuesChanged = 0;
    while (client.connected()) {

      if (client.available()) {

        char c = client.read();
          if (url.length() < maxLength) {
            url.append(c);
          }
        if (c == '\n' && current_line_is_blank) {

           // send a standard http response header, but change the response type to text/xml
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/xml");
          client.println();

          // This is our unlock pin. When set to high, we allow the querystring parameter 'x' to force-set our meter value.
          if (digitalRead(unlockPin) == HIGH) {
            unlock = true;
          }

          if (url.contains("x") && unlock) {
            Serial.println(url);
            String v = String(10);
            int startIndex = url.indexOf('=')+1;
            int stopIndex = url.indexOf('H');
            v = url.substring(startIndex, stopIndex);
            Serial.println(v);
            totalTicks = atoi(v);
          } 

          int t = tempc;

          // EEML
          client.println("");
          client.println("");

          client.println("");
          client.println("Ardugas Server");
          client.println("");

          // Gas Meter Reading
          client.println("");
          client.println("gascubic metres");
          client.print("");
          client.print(totalTicks);
          client.println("");
          client.println("");

          client.println("");
          client.println("temperaturedegreescelsius");
          client.print("");
          client.print(t);
          client.print("");
          client.println("");         

          client.println("");
          client.println("");

          client.println(); 

          break;

        }

        if (c == '\n') {
          // we're starting a new line
          current_line_is_blank = true;
        } else if (c != '\r') {
          // we've gotten a character on the current line
          current_line_is_blank = false;
        }

      }
    }
    // give the web browser time to receive the data
    url = "";
    delay(5);
    client.stop();
  } 

}

// Switch the cooling fan on if it's too hot!
void checkUnitTemp() {
 if (tempc >= maxTemp) {
   digitalWrite(fanPin, HIGH);
 }
 if (tempc  maxi) {maxi = tempc;} // record max temperature
  if(tempc < mini) {mini = tempc;} // record min temperature
}

// Count sensor values
void checkSensor() {
  int currentState = digitalRead(sensorPin);
  if (currentState == LOW && previousState == HIGH) {
    if (!lock) {
      lock = true;
      delay(delayMs);
      totalTicks++;
    }
  }
  if (currentState == HIGH && previousState == LOW) {
    lock = false;
  }
  previousState = currentState;
}

Attach the Ethernet Shield to your Arduino, attach your sensor circuit, upload the sketch and then test it out according to the behaviours mapped out above. For testing, I used a a square of foil and passed it under the sensor. This should cause the sensor pin to swith to LOW, and increment the counter by one. To test if your cooling fan circuit is working, change the threshold values in the sketch above.

Connect it all up, fine tune and test

Now for the exciting bit… it’s time to connect it up to your gas meter. Now, my gas meter was really quite awkward because there is a curved plastic bezel cover over the meter dials, which made it had to find the best point to get a reflection. That is, in the end, why I opted for a very sturdy and reliable ‘blu-tac’ mount! I think I’ll definitely replace that with a bracket at some point in the futre though.

 [Photo to follow shortly]

Now, connect up your circuit. Make sure you’ve got your test LED inserted into the ledPin you defined in the sketch. This will light up when your sensor detects a reflection. At this point it would be good if you have someone to help you by turning your hot water on/off, or, turn your gas hob or heating on for the duration of the setup. The object here is to have the dial start to turn so that you can find the best position for your sensor. Begin by holding the photoreflector just over the dial with the reflective disc. Wait for it to turn one revolution. The LED should light when the sensor detects a reflection – so make sure that it only lights up when the dial is directly underneath it. As the disc approaches the sensor, there is a period of ‘noisy reflection’ that my sketch accounts for by forcing a delay after the first detection. This prevents artifical inflation of the meter count.

Once you’ve found the ideal position, firmly fix it in place – I used blu tac quite successfully but you can use whatever you need to, providing it doesn’t pierce or physically interfere with the meter in any way. Now that it’s attached, you need to program your arduino with your current gas meter value.  To enable this, you must first connect a jumper lead from 5V to resetPin. Then, browse to the IP address you set, but add the querystring value ‘x=[your meter reading]‘. For example, to set a meter reading of 894.121, and your IP address is 192.168.1.99, your URL would look like: http://192.168.1.99/?x=894121.

So, that’s it! I’ve been sitting on this article for about a week now, but due to work and other commitments I’ve not really had as much time as I’d have liked to work on it – so I thought I’d just get it out there and take as much feedback as possible from my readers to help improve it.

I hope you enjoyed reading and that you can derive some use from this.

Thanks!

About these ads

39 thoughts on “How to build a web connected gas meter with your Arduino

  1. John

    Hello Richard,
    I am new to Arduino and would like to make a similar project as yours on gas metering. I work with IDE 1.0 (last one) and modified a bit your sketch . It compile ok but do not know if it is correct. Could you let me know if it sounds rigth ?
    That would be super .
    Thanks

    #include
    #include
    #include

    #include
    #include
    #include

    // — [ Pin setup ] —
    int sensorPin = 5;
    int ledPin = 9;
    int fanPin = 7;
    int tempPin = 3;
    int unlockPin = 8;

    // — [ Ethernet setup ] —
    static uint8_t mac[6] = { 0×02, 0xAA, 0xAA, 0xCC, 0×00, 0×22 };
    static uint8_t ip[4] = { 192,168,123,99};
    static uint8_t gateway[4] = { 192,168,123,254};
    int serverPort = 80;

    String url = String(25);
    int maxLength=25;

    // — [ Variables to control when the unit fan kicks in/cuts out... ] —
    float maxTemp = 26.0;
    float minTemp = 24.0;

    // — [ Variables to store our sensor values ] —
    volatile int totalTicks = 0;
    float tempc = 0.0;
    int maxi = -100, mini = 100;

    // — [ Misc. vars ] —
    float inputVolts = 5.01;
    int previousState = -2;
    int delayMs = 1500;
    int i;
    boolean lock;

    EthernetServer server(serverPort);

    void setup() {
    pinMode(ledPin, OUTPUT);
    pinMode(fanPin, OUTPUT);
    pinMode(sensorPin, INPUT);
    pinMode(unlockPin, INPUT);
    previousState = digitalRead(sensorPin);
    Serial.begin(115200); // Use serial for debugging locally…
    Serial.println(“Ardugas server saying: Howdy!”);
    Ethernet.begin(mac, ip, gateway);
    server.begin();
    }

    void loop() {
    checkUnitTemp(); // Take action based on unit temp
    checkSensor(); // Check the gas meter sensor

    listenWeb(); // Handle any web connections
    digitalWrite(ledPin, !digitalRead(sensorPin)); // Light LED if sensor is LOW
    }

    // Serve pachube EEML and accept a querystring param to set the current value
    void listenWeb() {

    boolean read_url = true;
    boolean unlock = false;

    EthernetClient client = server.available();
    if (client) {

    Serial.println(“Ethernet client connected…”);

    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    int valuesChanged = 0;
    while (client.connected()) {

    if (client.available()) {

    char c = client.read();
    if (url.length() 0) && unlock) {
    Serial.println(url);
    String v = String(10);
    int startIndex = url.indexOf(‘=’) + 1;
    int stopIndex = url.indexOf(‘H’);
    v = url.substring(startIndex, stopIndex);
    Serial.println(v);
    char buf[100];
    v.toCharArray(buf, 100);
    totalTicks = atoi(buf);
    }

    int t = tempc;

    // EEML
    client.println(“”);
    client.println(“”);

    client.println(“”);
    client.println(“Ardugas Server”);
    client.println(“”);

    // Gas Meter Reading
    client.println(“”);
    client.println(“gascubic metres”);
    client.print(“”);
    client.print(totalTicks);
    client.println(“”);
    client.println(“”);

    client.println(“”);
    client.println(“temperaturedegreescelsius”);
    client.print(“”);
    client.print(t);
    client.print(“”);
    client.println(“”);

    client.println(“”);
    client.println(“”);

    client.println();

    break;

    }

    if (c == ‘\n’) {
    // we’re starting a new line
    current_line_is_blank = true;
    } else if (c != ‘\r’) {
    // we’ve gotten a character on the current line
    current_line_is_blank = false;
    }

    }
    }
    // give the web browser time to receive the data
    url = “”;
    delay(5);
    client.stop();
    }

    }

    // Switch the cooling fan on if it’s too hot!
    void checkUnitTemp() {
    if (tempc >= maxTemp) {
    digitalWrite(fanPin, HIGH);
    }
    if (tempc > maxi) {maxi = tempc;} // record max temperature
    if(tempc < mini) {mini = tempc;} // record min temperature
    }

    // Count sensor values
    void checkSensor() {
    int currentState = digitalRead(sensorPin);
    if (currentState == LOW && previousState == HIGH) {
    if (!lock) {
    lock = true;
    delay(delayMs);
    totalTicks++;
    }
    }
    if (currentState == HIGH && previousState == LOW) {
    lock = false;
    }
    previousState = currentState;
    }

  2. John

    Hello,
    I found your project and am very interrested to do something similar.
    What is the status ? Was it working and if yes , on which IDE was it made ?
    Thanks a lot
    Regards

    • Hi John,
      This article is quite old now; but yes the project did work and it still does today. This version here was written using the Arduino IDE available from arduino.cc, however recently I’ve upgrade this to use Netduino and the Visual Studio 2010 IDE (don’t forget there is also a free version of Visual Studio you can use).
      Good luck with your project!
      Richard.

  3. Malcolm

    Hi Richard , Thanks for the gas meter reader info.
    Just for your info most gas meters that have a silver spot, also have a magnet going round with the index. I use a micro reed switch RS 530-8933 & blue tac in to a one-wire DS 2423.
    To check for a magnet, place a compass near the reading when your using gas. Seasons regards MT.

    • Hi Malcom, thanks for stopping by and for taking the time to leave a comment. The tip about the magnet is golden – I wish I had known that when I started the project! I’ve ordered a reed switch to test with as I don’t have a compass, so I’ll check it out ASAP. Merry Christmas! :)

    • Hi Paul, thanks for the comment! Would recommend the Arduino, for sure, but if you’re a .NET developer, take a look at the new Netduino! They’re pretty awesome too. Thanks for stopping by!

  4. graham

    i know what your saying take this for example the meter that i have been asked to price is nearly £4000 and i can build one that is reading direct to the computer and i will keep you in the loop see what you think when i come up with a design

    • £4000 for a Gas Meter with pulse output? http://www.gasproducts.co.uk/acatalog/G4_Gas_Meter_with_Pulse.html – £85.61 including VAT. It is legal for use, providing installed by either your gas transporter/registered installer (if you have permission to change the meter). I really don’t think I know enough about what it is you need to achieve, or how you plan to go about it, but providing it’s safe I’d be more than happy to have a look at the design you come up with. Good luck and thanks for reading!

  5. graham

    hi richard
    thanks for the reply the reason i came across your project is because iam try to develop a similar thing but a with a screw in sensor so all info goes to the computer and the meter can stay in the pipe collecting all the info
    ive been the challange by a customer of mine with a big officee block am just checking out the ardiuno web site to see what type of boards i can use

    • Ok, I see. Again, my advice to you would be not to screw anything in or between the gas pipes and your meter. Apart from this being dangerous, I don’t know if it is legal and I’m pretty sure it’s not necessary. For a relatively small cost, you can simply purchase a new gas meter with pulse output which you can then read by attaching a sensor to the arduino and your meter, without having to physically cut into pipes.

  6. graham

    hi
    just want to say this a brilliant idea well done can i ask you a question would this system work if the sensor was placed it side the gas pipe and the box clamped on the pipe would this still give a gas reading to the internet

    • Hi Graham

      Thanks for the positive feedback :)

      With regards to your question, I’m not sure I understand you properly. This system only detects the ‘optical reflections’ of the metallic disc on the meter dials itself – it is not designed for connection to the gas meter (or any connecting pipework). It was designed to connect to an existing gas meter that has the reflective metallic disc without any modification, which is certainly dangerous but I believe also illegal. If you’d like to reply and clarify what it is you’re trying to achieve I’d be happy to let you know whether this is suitable or not but as it stands I would re-iterate: this device is for passive use only; it requires no direct connection at all to your meter or supply.

      Thanks,

      Richard.

  7. Jay

    Hi – this is a very nice project. I am just starting to try out connecting my Arduino to the internet so I can monitor/control devices remotely and don’t quite understand how to get the data from my device to a place where I can see it on the internet. For instance the ethernet shield webserver example to display analog pin values on a local web page. Do you have any suggestions or examples on how to either make this page accessible remotely or perhaps send the data somewhere else where it is accessible outside my local network? I realize there are probably many sources for this information but I haven’t quite sorted this out and your project seems to be doing this… Thanks.

    • Hi Jay, thanks for posting a comment. If you’re referring to the example on the Arduino.cc site, then it’s really not that hard to adapt. All you need is your external IP address, which you can get easily by going to something like http://www.whatismyipaddress.com. Be advised, your IP may be dynamic – which means it will change whenever your router disconnects. If that is the case, you’ll need to check that site often to figure out what your IP is. Most ISPs will let you request a static IP address (that is, one that won’t change) so you can avoid the extra hassle. Once you know your IP, you can configure your ethernet shield to ‘listen’ on it. I’d recommend using a non-standard port, like 81 for instance. You’ll then be able to access your ethernet shield by going to http://%5Byour_externa_ip%5D:81/. You’ll then need to configure your ADSL router to allow traffic through on port 81. To do this, you can set up ‘port forwarding’ which basically says to your router: “send all incoming traffic on TCP port 81 through to [this local IP address]” (which would be the local IP address of your ethernet shield). Hope this makes sense. Feel free to contact me on twitter if you want to ask anything else. Thanks!

  8. Thanks for your reply, Richard. The idea of pattern recognition of characters is something I have done for work, so might be doable, but, oh, what a hack :-).

  9. Richard — this is a very cool project, and along the lines of a problem I have been trying to solve (mostly in my head :-) for a while. Yes, I want electrical data, but I also want gas as well — our house is heated with gas, too.

    My goals are:
    * record gas and electrical consumption
    * get the data into Google Power Meter
    * extend pre-built components where possible
    * keep the price low

    I am looking at a new electrical metering device called “TED 5000″ (in the US only, for now, I think). It has an Ethernet port, power supply, an on-board web server, an API of unknown capability. I am quite sure the data from this device can easily be coerced into Google Power Meter. So this device would seem to solve many aspects of the problem.

    So getting the gas data seems to be the problem. My meter doesn’t have much in the way of a readable interface. It seems to be readable via RF, but I can’t find any way to get at that data — otherwise, it’s just an odometer-like counter on the front.

    I did a different experiment — using a Lego NXT (usually for building robots :-) I hooked up its light sensor and had it take and record whether it could see light every 5 minutes. Then I put the device so it could see the flame from the furnace and let it run for a day, and then another day for the water heater.

    The readings were clean, so then I had to figure out how much gas was used — I used the BTU/hour rating on the devices. After doing a few days of these readings and calculations, it looked like it was roughly accurate — it tied out pretty closely to what the gas meter recorded. (Here’s a link to my blog post: http://fivepercent.us/2009/02/26/heat-and-hot-water-energy-usage-for-my-house/)

    But there has to be some better, yet still inexpensive way to measure gas flow. I am not sure if there are any inline meters available to home owners — they would probably be expensive and I would need to hire a gas fitter to have it installed, and then I would still need to read the data.

    I wonder if there’s some device similar to the induction-based meters like the Owl, Cent-a-meter, and TED that could measure gas-flow non-invasively?

    Anyway, I am glad I came across your site. What you’re doing is very cool.

    Tom

    • Hi Tom,

      Thanks for your comments. I see your point – and that’s exactly why I decided to create my ‘arduinometer’ project. It’s (hopefully) one day going to be an open-source metering platform for utility meter monitoring, all off the same board.

      I’m not sure of the TED 5000′s capabilities, but I’ll certainly take a look – it sounds like an interesting piece of kit. Using the Lego NXT was a cool idea, too. It certainly must be frustrating to have a gas meter that you can’t read very easily!

      An inline sensor probably wouldn’t be allowed in the UK, on the pipeline side (that’s usually owned by the gas transporter), but in your own property, providing it is fitted by a registered/qualified gas installer you’d probably be OK – though you’d need to check that. It would be great if there was a passive means for reading the usage, as you suggest.

      For now though, I think your options are pretty limited. Either contact your gas company and ask for another meter (preferably one with a pulse output or at least the opto-reflective disc) or perhaps you could explore the possibility of using a cheap web cam and a laptop to do pattern recognition.

      It should be relatively simple to write a program capable of recognising the digits in sequence on your gas meter; you could take an image every 1s or so and process the digits into an integer and compare it against the last reading. When it changes, you can update your meter value. That would probably be a very accurate way to read your meter, too.

      Whatever path you decide to go down it’d be great to hear about your progress so please feel free to get back in touch and share your experiences.

      Thanks for stopping by!

      Richard.

  10. I’m working on a similar project monitoring my fuel oil tank, but I’m planning on using an ultrasonic range finder to measure the amount of fuel in the tank and get rid of the current gauge. I’m just waiting for a few parts to put it all together. Great project, I’d be interested in seeing pictures of your install.

  11. Chris

    Thanks, I suspected that may be the case. Unfortunately I don’t have a compatible meter but I have subscribed to your RSS feed and look forward to your future articles

    • Hi Chris, does your gas meter have an optical ‘port’ – like a blinking LED or something? I’m keen to develop this project so that a single Arduino board can track usage from your gas, electricity and water meters. Some meters will use a pulse counter, others won’t, etc. If your meter doesn’t have either, perhaps you could send me a picture (or the make/model) so I can get some more details? I suspect some of the very old meters may have neither! Thanks…

    • Hi Chris, thanks for stopping by. I suspect it would be possible with the Nuelectronics ethernet shield, but just to forewarn you: when I begun this project, I started with one and it was a constant source of frustration. While the shield is good, it’s not what I would refer to as ‘user friendly’ (that’s probably because there’s so much work that the Arduino community as a whole has already invested – and continues to invest – in the Arduino Ethernet Shield). So, while it is most likely possible that you can switch the board if you prefer, I’d recommend against it, particularly if you’re new to the world of Arduino. If you can save up for the the one I’ve used, I think it’ll be worthwhile!

Comments are closed.