Skip to main content

You are here

Gas Meters

29 posts / 0 new
Last post
Gas Meters

I spotted somewhere that some of the Actaris gas meters are equipped with a magnetic pulsing mechanism that can be used instead of scanning for the silver dot on the zero. Amazingly I have one of these meters. If you position a compass to the left of the counter display the compass swings between NORTH and SOUTH as the highest precision digit rotates from 0 though 9. I am setting up a hall effect switch and expect to be able to trigger interrupts twice per revolution. I'm testing with this device:

JohnO may be too sensitive.

I guess it would be possible to measure the rate of change with some sort of a compass module.


It's actually not as uncommon as you'd think. A lot of meters have a little magnet behind one of the numbers.

I've also seen the reflective patch on the 6, no idea why!


Measuring gas flow well enough to use for customer billing is surprisingly tricky. You really want to measure mass (how many molecules of some blend of hydrocarbons did I ship you for oxidation?) but that's even harder directly. So conventionally, it is by volume with all sorts of fudge factors for mean temperature etc. The dynamic range needed is huge - a zero that must not "creep", a pilot light that sips a few ml a minute and then the 25kW furnace turns on !

The classic solution (dating back over 200 years) is to use a bellows/valve arrangement.
Bag A fills from the supply to a known volume, that triggers change-over valves to switch the filling Bag B and open the outlet from Bag A. The force from filling Bag B transfers as pressure to empty Bag A. Eventually Bag A is empty and the roles reverse again. A counter is kicked at each reversal providing a count of "bags full of gas" - not an official S.I. unit ;-)

Choosing the bag size and some scaling gets this into more consumer friendly units which are displayed on some totalising counter. But note, the data is fundamentally quantised - either one bag is finally emptied, or not yet. So this imposes a limit on the granularity of monitoring. There is no observable difference between the pilot light running for hours on just less than one bag full or the furnace blasting on for a short while. JCW wrote about this issue.

Curious to know the size of your bellows? Just eyeball the gas meter, estimate its volume, deduct ~20% for mechanism and divide by two. This becomes your quantising limit - any greater implied precision on the little wheels is entirely spurious....


A very interesting read @martynj, thank you. I now understand @jcw's and your point about simply counting pulses. However, if a compass type sensor was scanned then the rate of change of the compass heading would be linked to the rate of consumption as this is linked to the speed of rotation of the little wheels. It would be possible to know when the flow had stopped or restarted. I think it could get over the limitation of pulse counting that @jcw describes so well.


The same limitation to counting pulses also applies to electricity meters too. The background electricity usage gives the impression of a continuous process but a large electrically powered heater versus a low power LED bulb would give a similar model to the one questioned in the gas example.


@johno - an interesting approach. Keep us gas hogs posted. And don't get too annoyed the utility company was too mean to add what is often now a standard option that gives a pulse output every litre or so. ;-)


Still on my infinite todo list: shining a laser at the wheel/digits, and detecting smaller amounts of motion than complete revolutions.


My magnetic gas meter would be a walk in the park. I see you are out of stock of the compass module. Is the compass module able to produce interrupts as the bearing changes?


@JCW, it's a pity the USB interface is so complex to implement on the host end, otherwise you could use an optical mouse's bits to do all the work for you... You might be lucky and find a PS2 connector optical mouse you could use.


Have you looked at the vusb project ? They implement USB protocol in software on AVR: One of the reference projects specifically implements HID class compliant USB, therefore no extra software is required on the OS:


Nice project, thanks for the share callix. Unfortunately, from my quick glance through the pages, it looks like it's the wrong end. It implements the "client" end, i.e. the device such as mouse, keyboard (HID devices), and doesn't implement the "host" which would be the end required to communicate with a mouse... There is code on the arduino playground for interfacing to a PS2 mouse, unfortunately the example they give is an old rolling ball style... Did optical mice appear with PS2 connections? Now I'm starting to wonder. Pity because the optical tracking abilities of a mouse is really quick a feat of processing in its own right.

Oh, update, yes, PS2 optical mice exist, and the code is available to read them with an Arduino! Cool... Now will they work with 3.3v, and can we fiddle with the optics enough to get it to register rotation of a meter wheel? Oh, and what's the power consumption going to be to keep the mouse alive?


Hi, I've recently taken up the task of automatically reading my main utility meters because I think I can do it better and cheaper than my Electricity, Gas and Water suppliers, or if not, at least have more fun finding it out if I can. I already tackled the Electricity and Water meters and this weekend had a go at my gas meter, now that the components were received and I had some time. This gasmeter is an old Instromet 1987 type without any of the read-out options listed on the internet or here on this forum, ie no reflector on the last digit, no magnet to switch a reed relay, no lights flashing to show consumption of gas.

So my options were, and I was willing and gearing up to try any of the following:

  • 1) optically detect changes in the last digit
  • 2) detect the small marker-lines on the last digit (see attachment? can't seem to attach a jpg?), already had some nice plastic lenses and small focusable 650nm laser and I did see it works, but somehow I don't like the idea of focussing a laserbeam into my gasmeter glass window, I'd have to explain time and again that it's not dangerous ...
  • 3) detect the sound of the gasmeters' mechanical innerworks (yes, this gas-meter makes a lot of noise, its squeeks and grinds, you just know when it's running)
  • 4) look for weak magnetic signals the gasmeter is emitting when it runs, as I did notice that the needle of a compass was moving ever so gently when I held it a certain places close against the gas meter.

    The laser-beam (2): looked to me as most fun and most accurate in terms of resolution and actually would be a great conversation piece, opening the door of my meter-closet showing small laser beam scattering (I can still do it just as a mock-up..)

    However, I advanced most on option (4). I 1st used a A3214EUA-T (Ultra Sensivitive Hall effect sensor), no luck, the magnetic effect turned out to be >50x too small, as I checked with my smartphone (every smartphone has an ultra-sensitive magnetic field sensor built in, so with the appropriate Android App I can measure magnetic field in in X,Y,Z and in ridiculous sensitvity, like 1uT resolution, 60uT being the Earth magnetic field) Then I tried a MAG3110 X,Y,Z axis compass with I2C interface (1$ chip on a breakout board, costing about 10$ as a set, basically a similar device as in smartphones), and when placed at the right spot on the gasmeter, I can detect a turning magnetised object inside the gas-meter, not just allowing to see if it made a full turn, no the actual angle at which it is at any moment, also if it's not turning.

    I had this device merely attached with some poster buddies running for 24 hr now, and I plotted measured gas flow against the actual meter's reading with R2 of 0,999993, ie I did not miss a single rotation/digit. I''m detecting 4 angles per magnetic rotation giving me a resolution of around 0.4 liter of gas per count, the meters' last digit is in liter.

    I've now added some digital noise suppression on the XYZ signals and prepared for some offset/drift compensation, I think I nailed this one. Too bad for options 1 to 3 though, now I need to find another application for cheap red focusable lasers.

  • JohnO

    Excellent job and analysis. Are you able to post the sketch that reads the MAG3110?


    Ah, and it can use interrupts on new data - are you running through interrupts?


    Perhaps @jcw will build us a Heading Board II since he enjoys surface mount so much! :-)


    Didn't know you're into mind-reading! Yes, the current Heading Board is going to be replaced by something else soon.


    I have not implemented this on an Arduino or Jeenode, so sorry, I don't have a 'sketch'.
    I've written it in Basic on a Duinomite.
    MAG3110 Characteristics in current setup:

  • Dynamic range: +/- 10mT
  • Offset per axis: depending on axis and positioning on the meter, +/- 0,5-2.0mT
  • Magnetic effect of this 'rotating magnet': +/- 25-100 uT, (indeed same order as Earth's magnetic field), speed: 0.0-0.5 RPM

    On the subject of interrupts, I'm currently running a separate test-program to check the setup's accuracy, stability and drift in offset (looking good, less than 3 uT per 24hr so far). Basic program runs as an endless loop with an adjustable pause of 50-100 ms per iteration.
    So, no, I currently don't run through interrupts in the sense that a change in measured value would trigger an interrupt. In the 'permanent' program that should run for years, I intend to use polling the most recent count value from the measurements every 10s. If there has been no count-increment, then the new counter value is equal to the old value, and the consumption per time unit was 0.
    So on a long term usage per time graph over time I can expect to see clear quantization dithering in case of very low usages levels eg. <0,10 l/s on a scale expected to be from 0 to 5 l/s (?).

    I'm having similar behaviour with my water-meter pulses, water being on or off for a long time.

    If I wanted the measured gas-values to generate an interrupt, I'd use a dedicated [NANO 8] or PICAXE 08M2 to do all the measurements, offsetting, conversions, counting and have that device generate an interrupt as and when programmed to do so.

    As said, I'm intending to go for a synchronous data-logging approach, not asynchronous. Plenty of storage space, using old uSD card of 2GB in the Duinomite.

  • JohnO

    Thanks for that ThierryP. I wasn't aware of the Duinomite - interesting box - soon to be challenged by the Raspberry Pi I guess.


    You're welcome. Happy to share code or algorithm if you want. I'll be rewriting and integrating the code with the existing code for my water- and electricity-meter and prepare for long term stable programs and storage and access through my LAN.

    Yes, Raspberry Pi has definitely drawn my attention too. Not sure if it'll be as easy as Jeenode, Arduino or Maximite/Duinomite to boot in <1 s, add analog measurements, add modules and write code though, plus it'll be high summer before I'll ever touch one


    ThierryP, where did you pick up the magnetic field on your gas meter? I think I have the same meter. Mine is a 'BV Ermaf', also from 1987, also without any reflectors or magnets... A quick search on google shows that 'BV Ermaf' has been taken over by Instromet so maybe these are the same meters.

    I've attached a picture of my meter, maybe you can verify if this the same one. image


    Jorrit, I placed the MAG3110 on it's breakout board flat in the middle of the protruding part of the gasmeter with the counters. Seems my meter is a bit flatter on the top there.
    With X and Y axes in horizontal plane and Z in vertical, X and Y are strongest signals with a bit of noise, Z axis is half as strong and more noise.
    Plotting X and Y values on the VGA screen connected to the Duinomite, ignoring Z for now, I get an almost open circle.
    Sorry, can't seem to upload pictures here, else I would


    I hope this works, as pictures tell a lot more
    image 1: xyz plots of magnetic field measured on top of my gasmeter (yellow spot)
    On the left XYZ vs time
    On the right X vs Y

    image 2: my gasmeter with yellow spot for the MAG3110 placement

    (no, I don't dust-off my gas meter very often, still I got clean readings)


    Nice plots! :-D


    @ThierryP Nice plots... I've checked with my smartphone if my meter also has an altering magnetic field. This is the case. I'm now planning to order the compass module from @jcw to do the same trick you do. Thanks for the hint.


    Currently my algorithm is tracking the field in 3-dimensions.
    See 3D plot:

    red=3D plot, the others are projections on 'the walls'


    @ThierryP: I wonder how much you gas you consume during one 3D-loop. And do you use a vector mapping to determine the counter value?


    By counting number of rotations with the gasmeter's output on the dials I got 0.8333 liter per rotation in my case.

    The magnetic pickup device gives values X, Y, Z, which will have relatively large offsets XO, YO and ZO. Adjusting for these offsets provides x,y,z, which are small values centered around 0.

    I use an algorithm with a state machine.
    I've identified 4 states, defined by x, y, and z being either positive or negative. Theoretically that would give 8 states, but some of them are too 'noisy', so I neglect them, only selecting the clear cases, called state 1, 2, 3 and 4.
    One can only go from state 1 to 2 to 3 to 4 and then back to 1, which is full circle.
    Issue is the long term stability:
    The gasconsumption can be zero for days
    and the offsets, see above, could drift
    I correct for any drift in offset but I have not noticed much drift so far.


    @ThierryP, great plots!
    Just a thought, since the actual motion seems to have two distinct planes, perhaps orientating the detector to have one axis coincident with one of those planes (physically or by transforming the 3D data) would make the state transitions more distinct?


    Would it help to put a high-pass filter (in software) on the measurement? Then you needn't worry about drift, since that'll be too slow to register anyway. When you are consuming gas, it's always at a similar (high) rate I guess---the central heating system generally turns its flame on or off; the same for boilers. Only a gas stove can have a low consumption, but that should give a much faster changing magnetic field than the drift (so it passes the high-pass filter).

    Premium Drupal Themes by Adaptivethemes