Gas Meter Monitoring Project – Part 2

7 Jul

Ok, so in my previous post I talked about the hardware used to read the pulses from our gas meter, connected to an old pedometer this was recording each time the right most dial completed a full revolution. Next was to record this data on my PC, similar to how The Owl saves the data in a SQLite database.

I found a couple of similar posts (here and here) but they didn’t give quite enough information on how it all worked, and the one didn’t have the source code. So I tried my favourite method, trial and error, lots of error.

I ended up using pins 2 + 4. To easily test this, I had a serial cable connected to my laptop using a serial to USB adaptor and wired to a switch which connected pins 2 to pin 4 when pressed, this seemed to work well with my c# code and counted one for each press of the button, my code then wrote an entry to the SQLite database each time it got a reading. (I’m still working on this code, contact me if you are interested in helping with it, part 3 will probably have a zip once it’s a bit more flexible, I might even MSI it)

The hardest part of this project was neatly routing the cable from the gas box up to the loft, thankfully I’d already ran some Cat5e up there so I could use the same hidden route.

Now that the SQLite database is being populated it was time to work out some useful information from it. this is a quote from the Scottish Power website:


1. Electricity (kWh) – electricity usage is displayed in kilowatt hours (kWh). This is measured in units on your meter but paid for by kilowatt hour (kWh). One unit is equal to one kilowatt hour.

2. Gas (kWh) – this is measured in units on your meter but paid for by kilowatt hour (kWh). To calculate how many kilowatt hours of gas you have used in each bill, take the number of gas units used (if you have an imperial meter, multiply the figure by 2.83), now multiply the gas units used by the calorific value (39.7) and the correction factor (1.022640), and then divide by 3.6. 

3. Total – this is the number of kilowatt hours of electricity or gas you have used in each bill. This is calculated by subtracting the previous meter reading from the present meter reading.

4. Daily average – this is the total amount of units of energy used in each bill divided by the total number of days your bill is for. These figures are rounded to the nearest whole number.

The estimated consumption figures are based on your energy use during the previous 12 months. They do not take into account any other factors.

Here’s a bit more information:

  • The correction factor is used to take account of the temperature and atmospheric conditions at a site. It is generally of the order of 1.02264.
  • The calorific value (CV) is a measurement of the amount of energy contained in the gas. CV is usually quoted in megajoules per cubic metre (MJ/m3). Gas delivered to your premises will have a CV of between 37.5 MJ/m3 and 43.0 MJ/m3.This is continually measured by Transco for each Local Distribution Zone and passed to your gas supplier daily.

As mentioned before, this is the tariff that we are currently on.

Now too add more complication, the Calorific Value changes. I pay quarterly, so I would guess that his is averaged out on my bill. Check this out:

  • April 2012 – CV = 39.2
  • Jan 2012 – CV = 39.3

I can’t go any further back on my online account and don’t have the bills to hand, but it does vary. The correction factor does not seem to change at all though. The national grid website has this page which shows the calorific values, but it’s 2 years out of date, thankfully Pete found this page which is more up to date but tricky to scrape.

The cost difference between a CV value of 39.0 and 39.7 (based on last 3 month reading of 444) would have been £6.29, so about 7p per day, nothing major but hight than I thought it would be. I think for the sake of this project I will keep this at a static value (well, an option in my config file anyway), maybe down the line this can be upgraded to give more real time data.

So, on to the calculations. I record each full revolution of the 3rd decimal place wheel, 1/100 m3 gas. Now my results are not going to be 100% accurate as the dial in one minute could be at say 9.8, and then in the next minute it would hit zero, record it in the database. But if I average it out it should give near enough values as these readings are only 1/100th’s.

Once I’ve collected a bit of data, maybe a week or two, I’ll start writing the SQL queries and plotting the graphs, watch this space.