Disassembled Mouse Keeps Track Of Gas Meter

After building devices that can read his home’s electricity usage, [Dave] set out to build something that could measure the other energy source to his house: his gas line. Rather than tapping into the line and measuring the gas directly, his (much safer) method was to simply monitor the gas meter itself.

The major hurdle that [Dave] had to jump was dealing with an ancient meter with absolutely no modern electronics like some other meters have that make this job a little easier. The meter has “1985” stamped on it which might be the manufacturing date, but for this meter even assuming that it’s that new might be too generous. In any event, the only option was to build something that could physically watch the spinning dial. To accomplish this, [Dave] used the sensor from an optical mouse.

The sensor is surrounded by LEDs which illuminate the dial. When the dial passes a certain point, the sensor alerts an Arduino that one revolution has occurred. Once the Arduino has this information, the rest is a piece of cake. [Dave] used KiCad to design the PCB and also had access to a laser cutter for the enclosure. It’s a great piece of modern technology that helps integrate old analog technology into the modern world. This wasn’t [Dave]’s first energy monitoring system either; be sure to check out his electricity meter that we featured a few years ago.

33 thoughts on “Disassembled Mouse Keeps Track Of Gas Meter

    1. I was wondering the same thing. He wrote “It is designed to be easily removable. The power companies don’t like things attached to their meters.” But then he never mentions it again.

  1. This is a fantastic write-up. It reads like a good novel. A question, why not just use an IR wifi webcam? You could receive the data and process it anywhere. You would also possible have a lot more contrast from a better webcam. (That said I am sure glad this was done in the existing manner).

  2. I love hacks like this that use common cheap hardware instead of some expensive purchase.

    He has gone one step further than I would have because I would have used the complete circuitry of the mouse.

    The common mouse is so so overlooked and yet it has the perfect interface for microcomputers. Most mouse’s auto-detect if they are plugged into a USB or PS2 port and work with either.

    In PS2 mode they are a plain 5 Volt serial device so they are no harder to interface to with a micro than I2C or two wire serial.

    The micro clocks the ‘CLK’ and the ‘Data’ pin is used for both directions. The serial data has 2 bits (one for each button) for button state and lots of other bits for the difference in x and y since the last read. They’re a bit mixed up but that’s easy to fix with a micro.

    The mouse is perfect for motion detection. You could have it fixed under an x/y table for feedback and use DC motors. You can put it on the bottom of moving robotics to sense the ground for motion feedback. So many overlooked uses and cheap.

  3. Fantastic hack, but I wonder if it wasn’t overly-complicated? I wouldn’t try to photograph the dial and read it like a human brain does. I would simply measure the reflected brightness of a slice of the dial. When the brightness has bottomed out and returns to regular level again, I know the hand has passed once. I would log the timestamp when this event happens. This marks the consumption of “0.071 ft3”. No sharp image needed, no image processing. Just an LED and a PV cell, and something measuring voltage levels. Keep track of typical maximums and minimums to decide when the threshold has been passed.

    Work out the gas consumption by the interval between timestamped events. As you may already know, this is how consumer electric meter monitors work, by logging the moment it’s embedded IR LED blinks. That marks the moment a full Kwh has been consumed. Calculating consumption by the intervals turns out to be very accurate.

    As far as illumination goes, you might get better contrast by positioning the led on the side of that clear cover. I suggest an IR LED to help keep the gas company’s meter reader from becoming too alarmed. The whole gadget might be simplified down to nothing more than a pair of clear suction cups, connected to a long 3 or 4 strand wire leading back to the Arduino. No circuit board over the meter, nothing valuable exposed to the elements. One cup would have the LED embedded in it, and the other, the PV cell. They would be stuck straight onto the plastic cover.

    1. Well, my thinking as well – instead of trying to read a HUGE area with a sensor made to read a small area (and even that with a lens) what about using an array of proximity sensors? (well, not an array, a circle would be best). Use the analog output ones perhaps, put it on ADC and detect the change in reflectivity when the dial passes under the sensor? That would remove all the image processing and so on – all software could be contained on arduino.

    2. Well, my thinking as well – instead of trying to read a HUGE area with a sensor made to read a small area (and even that with a lens) what about using an array of proximity sensors? (well, not an array, a circle would be best). Use the analog output ones perhaps, put it on ADC and detect the change in reflectivity when the dial passes under the sensor? That would remove all the image processing and so on – all software could be contained on arduino.

  4. last winter set up a webcam to watch dials on meter. open source image processing tools to read it. No big deal and doesn’t interfere with meter reader. Cost was $5 for the webcam and a few hours or time to get full reading. Never finished the software to fully track usage and build statistics, but it did fine during the worst of the cold to track daily use.

  5. Great idea! Well done, I would like to build something like this but need something that is weather proof. Also, the illumination will likely attract insects at night which could mess with the optics if not protected. My current plan is to put in a volume counting sensor inline in the pipe – seems most dependable. Not sure I understand the comment above about that not being safe. Anyone care to educate me?

    1. Good luck managing to splice anything in-line with the flammable gas lines without either irritating the utility company (if before their meter) or your insurance company (if after the meter)…

        1. The utility company would be irritated if you installed something upstream of the meter, because that’s “their” section of the line, and all they know about the device is that it’s unmeterable. I doubt they’d care if you put it on your end.

      1. Gas meters are outside for a good reason. The more connections you have the more chance there is of a leak. The diagnostic process for detecting gas leaks outdoors is use soapy water. The diagnostic process for indoors is to count dead bodies.

        1. Where I live, all gas meters are inside. Besides, inside the house are plenty of connections. I have working gas lines to the kitchen and attic, plus some old ones running to the fireplace and bathroom. Inside the house, you can also use soapy water (as well as your nose).

        2. Also, utility companies also do periodic leakage checks. I think the riskiest place for gas leaks is near the appliance(s) where the owner may be messing with things, and not near the meter, which is properly secured and installed by a professional.

        3. Gas meters are outside for convenience. Two extra connections on the meter aren’t any sort of significant leak risk compared to the numerous pipe and appliance fittings inside. Generally the meters get relocated indoors or under cover for better protection against the elements when they are upgraded to remote-read setups.

  6. To clarify a few things :

    The device measures the angle of the dial, it doesn’t simply count rotations. This gives me a working resolution of around 1/32 of a rotation. Yes, counting rotations would be simpler.

    The device simply sits on the front of the meter. It doesn’t interfere with its operation – which would be illegal.

    I could have used a webcam, but I wanted to see what image processing could be done using the underpowered Atmel AVR.

    1. The reason I would be satisfied with just counting rotations, is that the gas meter itself probably isn’t absolutely precise. Attempting to get data as granular as the angle of the dial seems unnecessary, since the inventor says running the water in the sink (instant hot water heater i guess?) is enough to make the dial go around once. That’s quite a bit of movement, so small changes in the dial’s angle probably represent truly minute amounts of consumption. There’s probably a low level of consumption that doesn’t even make the dial turn.

      Ultimately, the gas meter doesn’t indicate how much gas you’ve consumed, it just displays what the company is going to bill you for, haha. I’d run my sensor system for a couple of months, and compare with the utility’s measurements to derive an offset that makes my system’s results agree. Of course, the problem with that is if the utility, like many these days, doesn’t read the meter every month and usually just bills you for projected typical consumption. You’ll be wondering why your fudge factor needs constant updating.

      1. Actually the meter is doing just that, measuring the actual gas consumed. A positive displacement meter (residential) will usually fall within a 99 to 101% accuracy range and very very rarely do they estimate bills. There are two things you have to remember though, when they bill you they will adjust for the pressure and temperature of the gas (boyle’s law) and depending on where you live the meter already compensates for the temperature and the billing dept will do the pressure. More than likely it has a regulator before the meter and therefore the pressure stays constant and the temp will vary with conditions, that is probably where the fudge factor is. I work for a gas company and can say with certainty if our techs found a device like this on the meter they wouldn’t stop at just the device they would remove the whole meter and lock your service. Usually anything after the meter is fair game, you can do what you want but if you call in a gas leak and the utility finds a problem they will probably lock off the meter. That being said i like the concept good work.

        1. OK, so the meter’s probably pretty accurate, but still, measuring the angle of the dial instead of just revolutions, is probably unnecessarily precise. It depends on how much gas “0.071 ft3″ is, and how much work it does for me.

          Mike, would your techs object to the presence of an obviously factory-constructed consumer device that is passively “reading” the dial? How about my idea of a couple of minimalist suction cups and wires that keep an LED and PV cell in place?

          1. Is that device just reading the dial or does only appear to do so, but in reality it attempts to interfere with the meter using some neodymium magnets (as is/was popular with water meters)? They won’t care what it is/does, they would either need to trust the consumer (yeah, good luck with that) or some 3rd party experts (which would cost money – again, no chance). In cases like this all doubt works against the consumer.

          2. Yeah, measuring revolutions is probably enough. There is a lot of dial configs out there but looking at the pic of this one its labeled 0.5 underneath so i would say one rev equals half a cubic foot, plenty of resolution seeing the bill probably comes in 100 cf increments as it would in the US. not sure what the 071 ft3/rev means, seems like an odd amount? to find out how much work it does would need to convert it to BTUs .5 ft3 is about 500 BTUs
            Also, I asked around and any device found on the meter would probably not be allowed. Some exception might be made if it was a known meter or index manufacturer. The newer read by radio devices do have tilt and magnetic tamper sensors in them and will be flagged for inspection. That being said, if it was read by radio by the utility and never tripped the tampers it would probably never be found…

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.