So yeah... I saw a competition sponsored by an insurance company looking for cheap sensor technology that worked with water.

There were three tasks:

1) A modification to an existing stopcock. An example is shown below.

Stop cock (1)

2) Be able to detect a leak/standing water. In case you don't know what water is... see below.

Lac Peyto (4)

3) Be able to measure the amount of water being used at a property. Here is a graph for you... At least it's related to water usage.

Cape Town water graph Jan 2018

So what did we do?

Well ∀ inline flow meters [citation needed].

The inline flow meters that exist utilise two different methods to measure the flow rate through a pipe ∴ we should investigate both avenues and identify if any hobbyist electronics/hacks could be used to achieve similar results.

1) Doppler Shift Flow Metering - Measure the Δ(frequency) caused by interactions/reflections with particulate, air bubbles or turbulence in the fluid.

2) Time of Flight Metering - Measure the difference in the time-of-flight (ToF) for an ultrasonic pulse as it travels inline with and opposed to the propagation medium.

My colleague and I agreed that for a residential water supply, Doppler Shift Flow metering was unsuitable. Mostly due to the desirable property of a low particulate count for quaffable water. Additionally whilst turbulence would exist in the medium (in this case water) near bends in pipe and near the terminals this could introduce additional installation challenges and in some cases, would have to move such a system in to the users vision.

So this left Time of Flight Metering.

Desirable properties for a Time of Flight meter:

  • Signal propagation into/through the medium
  • Primary propagation path through the medium would be ideal

The challenge?

  • The speed of sound in water is variable but more importantly... Fast!
TemperatureSpeed of Sound


At 20ᵒC, a 30cm propagation will take approximately 202.6µs and when taking a naive approximation of the velocity, using a pipe velocity calculator,  some flow rates and some guess work at pipe diameters (15mm) we get a water velocity of 0.56588ms⁻¹.

As a proportion of the speed of sound this is:

$\frac{0.56588ms^{-1}}{1481ms^{-1}} = 0.03821\% $

This has a tiny impact on the overall propagation speed of a signal. $1481 \pm 0.56588 ms^{-1}$.

When examining the time difference, when travelling with the water flow it would take $\approx 202.5\mu s$ and against the flow it would be $\approx 202.6\mu s$.

This equates to a $100ns$ difference for the peak flow scenario through a 15mm pipe.

If we flip this on its head, and look to calculate the flow rate using the ToF formula (shown below)

$ v = \frac{L}{2\cos{\alpha}} \frac{t_{up}-t_{down}}{t_{up}t_{down}}$

and that pipe calculator again.

The first bit of that equation is going to be constant in a measurement device. So we can for now... ignore it.

Let us go ahead with the same 30cm length of pipe we had before. We know that when the flow is zero, the time taken for the signal to propagate is: $202.6\mu s$ and that it will be equal in both directions. This means that $t_{up}$ and $t_{down}$ are equal and set to $202.6\mu s$.

At maximum realistic flow, of a 15mm pipe, as taken from the aforementioned source, 6 l/min, we have a water velocity of 0.56588m/s. Working backwards from the ToF formula we can work out the timing component.

$\frac{t_{up}-t_{down}}{t_{up}t_{down}} = \frac{0.56588 ms^{-1} * 2 \cos{\alpha}}{L} = 2.66758 s^{-1}$