Inductive sensor for gas meter

Motivation

If you'd like to do something good to nature or your wallet by saving some gas and with it some CO2, 1st thing to do is to visualise the consumption.
I was surprised on how much CO2 our heating is emitting. Our house with 5 parties consumes ~50'000kWh for heating a year, which results in ~20tons of C02 (0.4kg/kWh)! If we split it evenly, the consumption corresponds to one return flight from Europe to New York for 2 persons or 4tons.

It would be easy to install smart meters. The city could then visualise the consumption for each house in real time. It would even be possible to detect houses with low insulation where investments would make a huge difference. Unfortunately our city/gas company havn't yet decided on going down this path.

This is why I decided to build a low cost gas meter add-on for our house. Of course I also wanted to understand how smart meters might work.

Wohlgroth smart gas meter
Wohlgroth smart gas meter

How can we read out (gas) meters

There are different gas meters with different techniques involved.

There are multiple options to read out the counter or consumption:

  1. a hall sensor if a little magnet is incorporated on the little plate. In modern meters this is not the case anymore as one could use a magnet to influence the rotation
  2. an inductive sensor to detect a small metal on the rotating plate
  3. some meters have an infrared transmitter, which can be read out
  4. an optical interruptor to detect the luminous/reflective digit (often number 6 on the last digit of the counter)
  5. a picture by detecting the digits with a machine learning algorithm

Our gas meter from Wohlworth is a device from ltron which is equipped with a cyble target. There's a rotating little plate, where the speed is proportional to the current consumption. This rotation is mechanically fed to a counter.

A Cyble target is fitted as a standard into the Itron universal totaliser. It rotates proportionally to the registered volume of gas
itron

So I decided to go with the inductive sensor as it seemed the easiest variant which could be implemented with a very low end mcu.

Research

I found these inspirations to be very useful to implement an inductive sensor:

  • a guy who used an inductive sensor for his model railroad (german only)
  • a paper from STMicroelectronics implementing a gas sensor
  • a description how to implement an inductive switch
    schematic of inductive switch
    inductive switch by hum60hz

One approach to detect metal, is to trigger an LC-circuit with a short pulse and count the oscillations. On the presence of metal, the generated oscillation will be attenuated more. This difference can be measured.

My set-up

I 1st did some simulations with LTSpice to get a rough feeling for components needed, especially the coil and the capacitor.

ltspice simulation of LC circuit
LTSpice simulation of the LC circuit

result of the ltspice simulation
result of the LC simulation

I also checked what maximum signal the comparator of the attiny3217 can handle. It seems to be around 200kHz. So we need to select the LC values accordingly.

I quickly set up the circuit on a breadboard for a proof of concept and tested it in real with an oscilloscope.

oscilloscope output with no metal present
result without any metal

oscilloscope output with metal present
result with a small metal near the coil

As you can see with the help of the horizontal and vertical cursors, the oscillations is attenuated in presence of a paper clip. The frequency stays unchanged. The red line depicts the duration of the measure. I used the analog comparator of an attiny317, which increments a counter every time the signal passes 1.5v, until the difference of the signal is too small to be detected.
In presence of metal, the signal will be attenuated faster, which will result in less counts until the signal is too small.

Conclusion

I ended up using 15uH and 50nF (2 in series) where I could theoretically measure about 60 peaks without metal and 45 with the presence of a paper clip. But I couldn't get the signal on the gas meter. Also changing to 470uH and 2.2nF didn't change much.
Looks like the coil is not sensitive enough to fetch the needle. I could detect a very weak difference (1 tick), which is way too low for the sensor to work reliably. There are some people who seem to be successful by using the inductive sensor LJ12A3, but this sensor is bulky.
My next attempt is to go with an optical solution.

Btw most of the commercially available sensors (cyble sensors) use 3 coils to ensure proper working. This makes sense, as measures can vary. By having 3 sensors I guess that there will only be one attenuated by the metal plate while the other 2 are unaffected. This way it doesn't matter if measures vary, we can always detect it the metal plate just left or reached one of the 3 coils.