Hi everyone,
I previously tried to detect usage in my gas meter via a reed contact, but the magnet in the turning wheel isn’t strong enough. So now I’m looking into using a ky-024 hall sensor module like this one:
Does anyone have experiences with a sensor like this connected to an ESP32? I’m specifically worried about cable length, as the gas meter is roughly 2-3m away from my closest ESP32, and I don’t want to add a dedicated esphome node just for that sensor.
Also: I get mixed messages when reading about the need for debouncing on the thing. For some it works like a charm, others threw the thing out again because even the digital output created tons of onoffonoffonoff…
Therefore: curious to hear about your experiences with the thing
Cheers!
It turned out that the magnet isn’t strong enough even for that sensor :-/
I then gave up on using the magnet and switched to a TCRT5000 IR sensor, as the “0” on the gasmeter is a mirror. That works absolutely flawless for me. Except for one night where the gasmeter stopped juuuuuust at the edge, resulting in the ir sensor jumping back and forth a few times between on and off. Fixed that in the HA stats within a minute afterwards.
Oh, and about the cable length: I used 4 meters of of-the-mill electrical cable (round, white, 3 strands) between the sensor and the ESP8266, no issues.
Alright, thanks for the advice have ordered the IR sensor too!
Did you need to mount it in a specific way? 3D print something? Or just some duct tape… Can you share a photo of the setup?
I’m thinking about using an UTP cable
That’s the post (and code) I followed Then bought a second sensor and adapted everything to also work with the ferraris power meter.
Will share a photo of the setup Monday or Tuesday, I used black foam board and velcro.
Just for anyone else trying to do something similar… I tried to do this with my water meter with two different Hall effect sensors… neither one was sensitive enough to see the magnets. I finally got a 3-axis magnetometer and it is ridiculously more sensitive, and it made it very easy to see every rotation…
Playing around with this sensor myself and while I can definitely see the signals in either the X or Y axis as the water meter register rotates, it’s pretty noisy data so trying to accurately identify each rotation has been a bit of a challenge. It works fine with high magnitude, high frequency signal typical of running water at least as fast as filling a sink. In the data, I can even see high magnitude very low frequency signal (half a minute between peaks) with one sink set to a slow drip. Correctly identifying the peaks for that low frequency data has been harder. I have a testbench version running against a data extract written in python but have not yet retrofitted my esphome code.
I’m curious… what approach did you use? Mind sharing the code?
This was setup awhile ago and took quite a bit of trial and error… and stealing some ideas from other types of water total monitoring people were doing. I can’t remember where I got the info from so I can’t exactly give credit or be too helpful remembering what does what… but the gist of it is I use the heading field and have x and y disabled as you will see… and it watches for it to change… I believe that is the 250ut… here is the code, feel free to ask more about it and I will try to refresh my memory. Im leaving the commented out stuff in anyway just so you can see some of the different stuff I tried at one time or another.
Thanks! That’s similar to what I had put together initially last fall and, like you, I have lost track of where I got the original code but it mostly works.
Your code did help though as it reinforced something I had discovered about the same time by going back to the ESPHOME component docs (I’m using a QMC5883L rather than an HMC5883L - not a lot of differences): adding Delta: 1 (or similar value) flattens things out, eliminates all the noise I was getting.