This is a fairly involved process as it seems that no one currently makes a pre-made product that measures water usage from a household meter.
It took quite a while to set up due to WiFi issues and the flow rate code still needs some work as the output is semi-random at the moment.
If you get stuck anywhere I'm happy to answer questions provided this doesn't go viral 😂
- DFRobot Beetle ESP32 microcontroller (https://www.littlebird.com.au/products/beetle-esp32-microcontroller)
- Water meter pulse probe for the specific meter model (https://www.aquatrip.com.au/accessories is one of the only places I've found that sells them)
- 2 core wire to connect probe to microcontroller
- Project box, heatshrink and other miscellaneous tools and components to clean up the build
Basically all that needs to happen is that the output of the pulse probe is connected between A GND
and D7
on the ESP32.
I did this by cutting off the probe wire from the plug as supplied by Aquatrip, then soldering on an extension wire and sealing the joint in heatshrink.
The wire can then be run from the water meter to inside and into the ESP32.
Firstly the ESP32 needs to be flashed with the MicroPython firmware https://docs.micropython.org/en/latest/esp32/tutorial/intro.html
The below boot.py
and main.py
can then be uploaded to the board with a program such as uPyCraft
after entering your WiFi details and changing the timezone details if necessary.
Upon powering up, the board will briefly turn on the green led, then turn it back off until a WiFi connection is made. This specific board seems to have fairly poor reception so close proximity to an access point is necessary.
Once working, the board will be waiting for http connections on port 80 and will serve the litres used today and current flowrate in Prometheus text exposition format, along with a couple of debug headers.
Depending on how your water meter sends pulses, you may also need to change the volPerPulse
variable to ensure an accurate reading. You can do this by checking the change in the reported water usage before and after filling up a bucket with a known capacity.
Once it's working, you can add a job to prometheus with something like this:
scrape_configs:
- job_name: 'water'
scrape_interval: 30s
static_configs:
- targets: ['ESP32_IP_ADDRESS']
Then onto Grafana dashboard design.