Skip to content

Instantly share code, notes, and snippets.

@henrikekblad
Created January 25, 2023 12:52
Show Gist options
  • Save henrikekblad/aecfc4fc82dac39a39376e89a70115c1 to your computer and use it in GitHub Desktop.
Save henrikekblad/aecfc4fc82dac39a39376e89a70115c1 to your computer and use it in GitHub Desktop.

In some cases, newer water meters are equipped with a pulse output. However if you have an older power meter without a pulse output, then you might be able to use one of the options below to sense your water consumption.

Use the TCRT5000 IR Barrier Line Track sensor. It emits an infrared light and detects the reflection. If you aim it at the fastest turning hand on your meter, you can detect pulses or a rate.

Some water meters emit a fluctuating magnetic field that can be detected by using a Hall effect sensor. Instructions are available here.

The sensor example sketch counts the pulses from your attached sensor and converts it into liters or gallons per minute and the cummulative water volume.

There are a few parameters that need to be tuned to your water meter. Set the PULSE_FACTOR to the number of revolutions per cubic-meters (or gallons) of water.

You can also set the frequency that the sensor will report the water consumption by updating the SEND_FREQUENCY. The default frequency 3 times per minute (every 20 seconds).

The sensor has two modes of operation:

SLEEP_MODE = true

Use this mode if you power the sensor with a battery. In this mode the sensor will sleep most of the time and only report the cumulative water volume. Unfortunately the sensor cannot report the current water flow rate because the sensor can not track time while sleeping; the elapsed time between two blinks is required to calculate the current flow rate.

SLEEP_MODE = false

In this mode the sensor will not sleep and will report the current water flow rate and the cumulative water consumption to the gateway. This mode requires constant power so you will need to connect the sensor to an electrical outlet.

Wiring Things Up

Start by connecting the radio module.

Sensor Arduino Comment
GND GND Black
VCC VCC (3.3 - 5V) Red
DO (digital out) Digital pin 3 (D3) Green
@henrikekblad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment