Can this gas meter be made smart in any way?

My gas meter was recently upgraded by the council (more of a downgrade), I had made a custom hall effect sensor to measure the flow of gas, as my old one had ‘support’ for it

(here’s what my old one looked like for reference)

it has been replaced with this behemoth, it does not appear to give of any magnetic signals, nor easily support attaching one.

If anyone has had experience with this gas meter, and knows how to use an ESP to get the gas usage, it would be much appreciated :slight_smile:

(preferably without using a camera to read the numbers)

1 Like

Check out this post - Gas meter sensor

Not sure if it’s the same meter, but no doubt it has a similar interface.

But he’s already mentioned it doesn’t have the common magnetic interface?

If you can get power there, AI-on-the-edge works. You will have to rig up a mount to get the focus right. https://github.com/jomjol/AI-on-the-edge-device Opps, I noticed you didn’t want to resort to this solution

The spec sheet of a similar looking model says it has optional “Pulse-ready inductive output”. https://www.edmi-meters.com/australasia/wp-content/uploads/2018/03/MKT-FS-045-U8-Factsheet-Australasia-Rev-01.pdf Found a links for others trying to get it to work, with limited success, https://community.openenergymonitor.org/t/edmi-gas-meters-monitoring/11072/16 and https://community.home-assistant.io/t/davies-shepherd-ds-5-gas-meter-reed-switch-compatible-in-australia/343564/3

Good luck

A magnetometer has been working fantastic for me. Looking at your pictures, I can say quite confidently it’s a diaphragm type, so it should work just fine in your case.

A benefit of going that route, is you can likely put the sensor on the backside of the meter, so it’s basically hidden.

2 Likes

the gas meter looks similar (QMC5883L Magnetometer Enclosure for Reading Diaphragm Natural Gas Meter by brooksben11 - Thingiverse), but not the same. does anyone know if its the same princible? can a hall effect sensor be used in any capacity too see whether it gives off the same signals?

here are some more photos of the rear for reference, it is very tight, hard to work with lol



1 Like

It’s definitely a diaphragm meter. What I did prior to purchasing the magnetometer was to use the one built into my phone to confirm it would work (just downloaded an app that gave me access to the actual sensors in my phone, the one I used was literally called ‘Sensors’). I just ran the furnace and placed it in different spots to test it out. You’ll want to put your phone (or magnetometer sensor) on either the front or back of the meter where that large flat plate is.

are these the sort of fluctuations that we can read with the QMC5883L and convert to something meaningful?

(this was with the heater on, basically a flat line before)

and in terms of magnetic strength, is this weak or normal? would a 3D-printed enclosure hinder the sensor? or does it have to be pushed right up against the meter in the best spot?

Have you seen this one? GitHub - jomjol/AI-on-the-edge-device: Easy to use device for connecting "old" measuring units (water, power, gas, ...) to the digital world

A camera is not an optimal solution for outdoors, the meter is owned by the council, the front meter read cant be obstructed otherwise they’ll get upset when they try read it

The first part of the z-axis looks pretty similar to what I was getting on my phone (kind of looks like you maybe moved your phone to a less optimal spot afterwards). I found it tricky since I had no idea where in my phone the actual sensor was located. I do seem to remember that with my phone, one side of the meter gave much better results than the other (but for whatever reason, this didn’t seem to be the case with the QMC5883L).

You don’t need a massive difference between the peaks and valleys, the key is just that they’re consistent and that there isn’t a bunch of noise in the data.

1 Like

Hi Alex,

This is an explanation of what I did to read my dumb, analogue, rotating dial gas meter - see here - no cameras needed.

It’s been very accurate and reliable and it is cheap to do, and easy to set up too.

I hope that helps! :+1:t2:

Cheers,

Mike.

ive got the QMC5883L hooked up to an esp8266, it sees the sensor, but does not appear to be returning correct values (all 0?):

is this expected behavior?

Definitely not. I used an ESP32 but that shouldn’t make a difference. What’s your YAML look like?

its a straight copy and paste:

# settings
esphome:
  name: gas-meter
esp8266:
  board: nodemcuv2

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  use_address: 192.168.2.58
  domain: .iot

logger:

api:
  encryption:
    key: !secret api_key

ota:
  password: !secret ota_password

# configuration
globals:
   - id: gas_counter_total
     type: long
     restore_value: no
     initial_value: '0'
   - id: gas_counter
     type: long
     restore_value: no
     initial_value: '0'
   - id: gas_high
     type: bool
     restore_value: no
     initial_value: 'false'

interval:
  - interval: 0.1s
    then:
    - lambda: |-
       if (id(gasz).state > -75 && !id(gas_high)) {
          id(gas_counter_total) += 1;
          id(gas_counter) += 1;	
          id(gas_high) = true;
        } else if (id(gasz).state < -125 && id(gas_high)) {
          id(gas_high) = false;
        }   

i2c:
  sda: D2
  scl: D1


sensor:
  - platform: qmc5883l
    address: 0x0D
#    field_strength_x:
#      name: "Gas Meter Field Strength X"
#      id: gasx
#    field_strength_y:
#      name: "Gas Meter Field Strength Y"
#      id: gasy
    field_strength_z:
      name: "Gas Meter Field Strength Z"
      id: gasz
      internal: true
#    heading:
#      name: "Gas Meter Heading"
    range: 200uT
    oversampling: 512x
    update_interval: 0.1s

#8 counts per cubic foot, multiplied by 2 to get per minute based on update interval
  - platform: template    
    name: "Gas Rate"
    lambda: |-
      int temp = id(gas_counter);
      id(gas_counter) -= temp;
      float temp2 = temp;
      float temp3 = (temp2/8)*2; 
      return temp3;
    update_interval: 30s
    unit_of_measurement: ft³/min
    device_class: 'gas'

  - platform: template    
    name: "Gas Total"
    lambda: |-
      float temp = id(gas_counter_total);
      return temp/8;
    update_interval: 1s
    unit_of_measurement: 'ft³'
    state_class: 'total_increasing'
    device_class: 'gas'

First thing I’d try is remove everything but the QMC58831 stuff. I’d also uncomment the other parameters and lower the update interval (maybe the 8266 can’t handle such a small interval?). Basically just end up with this:

i2c:
  sda: D2
  scl: D1

sensor:
  - platform: qmc5883l
    address: 0x0D
    field_strength_x:
      name: "Gas Meter Field Strength X"
      id: gasx
    field_strength_y:
      name: "Gas Meter Field Strength Y"
      id: gasy
    field_strength_z:
      name: "Gas Meter Field Strength Z"
      id: gasz
    heading:
      name: "Gas Meter Heading"
    range: 200uT
    oversampling: 512x
    update_interval: 1s

You should definitely be getting values (and they should be moving all around if you move the sensor around, it is essentially a fancy compass after all). Lastly, you are giving the magnetometer board 3V and GND, right? Maybe try swapping the SDA & SCL pins? Other than all that, I’m kind of at a loss. The only other difference is like I said before, that I’m using an ESP32 but I don’t know why that would make a difference.

It did actuall work when i first set it up, only after i made a nice case for it and assembled it all it stopped working. idk how i2c works, but if it sees the sensor that means it should work no? it either says no device found or it should work?

Far from an expert, but yeah, that would be my assumption too.

My best guess is either a connection came loose or for some reason the magnetometer board died.

Turns out the ESP was cooked - probably becase a bit had corroded and it was covered in hot glue, the more you know :expressionless:

Would you have any suggestions on how to calibrate the esphome template?

I assume I would first install the magnetometer on the gas meter, and gather some data, change some values and i should have a pretty accurate readout?..

…I dont even know where to start after installing it

Thanks

Always good to find the root of a random issue like that!

What I did originally is left all the magnetometer sensors visible (so didn’t change them to internal: true or have them commented out). Set everything up and ran the furnace for a few minutes (which might be tricky now, depending where in the world you are). I picked the sensor/axis that had the largest/best variation (read: nice, big and clean sinusoidal waves). Then I edited the firmware, commenting out the other magnetometer sensors that weren’t needed and updated this part of the code:

interval:
  - interval: 0.1s
    then:
    - lambda: |-
       if (id(gasz).state > -75 && !id(gas_high)) {
          id(gas_counter_total) += 1;
          id(gas_counter) += 1;	
          id(gas_high) = true;
        } else if (id(gasz).state < -125 && id(gas_high)) {
          id(gas_high) = false;
        }  

Going off of memory, I believe the values I got for the sensor I ended up using (z-axis in my case) ranged from around -150 to -50. I ended up choosing values that were close to the peaks (-75 & -125), but still a little bit away from them (mainly just as a safety factor in case the values in the future become a little less extreme). In your case, you’ll want to change the above part of the code to use the axis (x,y or z) that has the best readings and change the -75 and -125 to whatever values make sense based on what you see when you’re using gas.

Upload your edited YAML and you should start getting useful data for gas usage/consumption. I ultimately ended up keeping an eye on the raw readings from the z-axis for a week or 2 just to make sure it didn’t change and everything was working as it should. Ultimately though, I changed it to internal: true so that it wouldn’t be sending so much data to HA (every 1/10th of a second) that I don’t actually care about.

The other thing I’ll mention, is if you haven’t already, you’ll need to calibrate it to match your meter (how many cycles of the diaphragm equal how many units of gas). In my case, the wave output from the sensor would go through exactly 8 cycles for 1 cf of gas. So while you’re calibrating things up above, pull up the raw data on your phone and while standing in front of the meter count how many cycles you see when the meter reads 1 of whatever unit it’s counting: presumably it should line up perfectly.

And that was it. Let me know if you run into any issues and good luck!

2 Likes