Skip to content

Instantly share code, notes, and snippets.

@henrikekblad
Created January 25, 2023 12:43
Show Gist options
  • Save henrikekblad/8645fe9b5b0ee4c97d9a24be97856ce6 to your computer and use it in GitHub Desktop.
Save henrikekblad/8645fe9b5b0ee4c97d9a24be97856ce6 to your computer and use it in GitHub Desktop.
<img src="/uploads/57c420cd4d04abe84cd93e14/image/wmeter.png" class="ir" style="max-width:25%">
<img src="/uploads/57c420cd4d04abe84cd93e14/image/track.png" class="ir" style="max-width:25%">
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.
<div class="clear"/>
## Wiring Things Up
Start by [connecting the radio module](/build/connect_radio).
<img src="/uploads/57c420cd4d04abe84cd93e14/image/doao.png" class="ir" style="max-width:30%">
<img src="/uploads/57c420cd4d04abe84cd93e14/image/APM_D3.png" class="ir" style="max-width:30%">
| Sensor | Arduino | Comment |
|--------------------|--------------------|-------------------|
| GND | GND | Black |
| VCC | VCC (3.3 - 5V) | Red |
| DO (digital out) | Digital pin 3 (D3) | Green |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment