*WINNING ENTRY* The smart-home approach to leak detection
I will begin by giving an overview of my recommended solution to the problem of detecting water leaks in the home. I will start by highlighting a recently announced product which demonstrates several of the features of my solution but differs in a couple of significant aspects. The product is Buoy and consists of a monitor connected to the mains water supply. In Buoys implementation, a single sensor/switch widget is connected to the main water inlet and sends data via wifi to a cloud service. Data on water flow is gathered via the sensor, and machine learning (henceforth ML) applied to determine ‘unusual flow’. In the event that unusual flow is detected, the switch then cuts off the water supply. According to a press release, this service costs $799 to install and maintain. In my opinion, this system suffers from three key deficiencies:
- Single sensor directly detecting flow: problem = very limited data for ML model. No direct detection of leaks.
- Single switch to cut off the water supply at main inlet: problem = potentially significant volume of water behind the switch.
- Dependence on connection to a cloud: problem = internet connections, even in developed countries, are not 100% reliable. Privacy concerns.
- High initial cost: self-explanatory – need to break down hardware vs installation cost.
My proposed solution differs in the following respects:
- Multiple sensors detecting flow, leaks and potentially other activities: justification = direct detection of leak and more data for the ML model.
- Multiple locations of water shutoff and user alerts via smartphone.
- Local processing of sensor data with optional cloud connection only for ML model: justification = low cost to guarantee 100% uptime via direct detection.
- Low initial cost (200 - 300 pounds), perhaps subsidised if the user is willing to share their data (anonymously) with our servers – note that car insurance companies operate a similar model for drivers who are happy to stick a box in their car for 3 months initially.
Sensor distributed about the home will report measurements to a central hub over wifi. In my own home-automation system, I run Home-assistant on a Raspberry Pi, with a unit cost 5-30 pounds depending on the model. Data can be stored in a database on an SD card. The hub serves multiple purposes:
- Ensure that the system has a minimum of 100% uptime for direct detection of leaks via leak sensors.
- Collect data from sensors over wifi and ingest data to a local database.
- Interact with sensors, eg sending them firmware updates or modifying the operational parameters such as refresh rate to save battery life.
- Indicate (via an LED) that the system is operational.
- Interact with an ML model that could be running on the hub or on a remote server.
Machine learning is computationally expensive, and whilst a hub like the Pi lacks significant computing power, a dedicated compute module (such as the intel Movidius) could be added if ML on the hub is required. The total cost of Pi, storage and compute module would be less than 100 pounds. Shifting the ML computation to a cloud server would reduce hardware costs but may not be optimal.
ML models improve with the amount of data input. The model of ‘typical flow’ would primarily take the sensor flow readings as inputs, but a more general model of ‘typical home activity’ (incorporating flow) could be built up by ingesting data from a wide range of sensors within the home. For example, presence detection (via PIR sensors) can be used to correlate the water flow readings with the number of people at home. A model of home activity that accounted for the number of people home would be far more predictive than one which had no knowledge of the number of people potentially running taps. For example, if nobody was home and there was significant water flow (not attributable to something like a washing machine), this would be a strong indicator of a leak. Note that home security systems typically place PIR motion sensors in the home, so this hardware may be in place. In my own home, I use these sensors to trigger lights etc, so acceptance of these sensors can be increased by giving them multiple uses.
detect ‘unusual activity’ – e.g. water flowing for longer periods than normal
Flow detectors will consist of simple ‘in-line’ flow rate sensors such as the £6 sensor on Amazon: HALJIA YF-S201 1-30L/min Water Flow Hall Counter. I rigged up one of these to a low-cost Arduino and monitored water flow rates. Total hardware cost per widget could be sub 10 pounds.
These sensors should be placed at strategically significant locations as identified from a statistical study of historically documented leaks. Obvious locations include the main inlet, in the kitchen, bathroom, outhouses. As the sensors are cheap, they could in principle be mounted at individual outlets, right down to the tap level. Assuming a typical family home has around 5-10 highly significant flow locations, the sensor budget would be less than 100 pounds.
Detect and monitor leaks
Detect where there shouldn’t be water – e.g. under appliances, boiler, water tank, bath etc.
Here I differentiate between direct detection of leaks (via a sensor that physically senses a leak) and inferred leaks, which are those identified by the ML model. Direct detection via sensors should be considered the ‘first line of defence’ against significant leaks, whilst inferred detection via ML is a ‘second line’ defence against more subtle leaks, such as a tap left dripping into a plugged basin whilst the homeowner is on holiday.
Direct detection of leaks can be performed via low-cost sensors. I wrote an article about such a sensor on Hackster. The sensor is attached to a microcomputer and reports readings via wifi to the hub. The cost per sensor widget is approximately 10 pounds per unit. These widgets could run off a battery or mains power supply.
Options for sensors include water detection via current (as in my Hackster article), humidity detection (perhaps indicative of leak if not correlated with mean humidity within the home), pressure detection within pipes, chemical sensors which could detect a reaction between water and some material placed at the site of the leak. Again the location of these sensors should be determined by the study of historical leaks and experimentation, but obvious locations are under boilers, washing machines, etc. These sensors would trigger a leak detection event if their reading is above a predetermined threshold, as discussed in my Hackster article. These thresholds could be adapted by the ML model as trained via user input in a smartphone app.
Inferred detection by ML is a signal from the ML model indicating that the probability of ‘unusual’ flow is above a probability threshold. A limitation of inferred detection via ML is that true leak events are likely very rare, so a significant volume of data would need to be collected to train the model. As mentioned in the introduction, this model should take as input, as much data as possible. The benefit of sending this data to the cloud is that significant volumes of data can be collected rapidly once the user base is sufficient. The model would also benefit from data about typical household activities, e.g. provided by homeowners through an app. For example, the user might state when they will be on holiday (i.e. home empty), how many baths/showers a week are typical, the age of pipework in their home. The water company could also supply data to the model, e.g. to indicate high pressure or leaks reported in the area. Mining of social media data (Twitter etc.) could also indicate leaks in an area and be used as input to the model.
Supply shut off
Automatic/remote shut off of water supply to avoid damage to the home. Could also include other elements, for example, power shut off.
The Bouy product has a switch at the main inlet which physically cuts the water supply in the event of a leak. A limitation of this approach is that a significant volume of water is likely within the system (e.g in a central immersion heater) and cutting the supply would not immediately terminate a leak within the system. Ideally, switches should be distributed throughout the home. Again these are simple switches which physically block water flow.
I propose that an automated system physically blocking water supply may not be the preferred approach since during the initial deployment there are likely to be false alarms from sensors with un-optimised thresholds and due to the ML model. Alternatively, homeowners should be alerted to possible leaks via a smartphone app. They would then investigate and report (via the app), cutting off supply via the app. Giving the user ultimate control to switch the supply is the equivalent of the home button on an iPhone – it gives them the confidence of control and a familiar home state.
This proposal recommends a local hub and multiple low-cost sensors, combining both direct detection of significant leaks with a machine learning approach to infer subtle leaks. Optionally, cloud computing can be used to aggregate data from multiple home and data sources, to improve system performance whilst reducing local hardware costs. The homeowner can interact with the system via a smartphone app, both to input data to the system, receive updates, and have ultimate control. The total cost of hardware for a typical family home should be in the range of 200-300 pounds, but the cost could be supplemented using a similar model to the car insurance industry.