Automated Hot Water Tank Leak Detection and Shutoff System
A smart leak detection and prevention system for hot water tanks that triggers an automatic water shutoff valve and sends alerts via WiFi.
Assumptions:
- The user will install the valve on the cold water inlet pipe of the hot water tank.
- The leak sensor will be placed in a safety drain pan or on the floor at the base of the tank.
- A 12V DC motorized ball valve is preferred over a solenoid to avoid water hammer and high holding power.
- WiFi connectivity is desired for remote notification since hot water tanks are often in basements or closets.
Bill of Materials
Compatibility Notes
- The ESP32 uses 3.3V logic. Ensure the Relay module used is either 3.3V compatible or use a logic-level shifter/transistor to drive a 5V relay coil.
- The motorized valve requires 12V; ensure the relay contacts are rated for at least 2A at 12VDC (most are 10A, so this is safe).
- If using the MTCH9010, refer to the datasheet for specific trace geometry if building a custom capacitive probe.
You'll Also Need
- Plumbing fittings (NPT adapters) to splice the valve into the water line.
- Enclosure (IP65 rated recommended due to proximity to water).
- Wiring for the sensor (should be long enough to reach from the tank top to the floor).
- Flyback diode (e.g., 1N4007) across the relay coil and valve motor to prevent inductive spikes.
Estimated BOM Cost: $35-40 (based on live distributor pricing)
Design Considerations
Fail-Safe Valve State
Choose a 'normally open' motorized valve that remains open without power but closes when the relay is energized, OR use a 2-wire auto-return valve that uses a capacitor to close itself if the main power fails. For a leak preventer, the system must be able to shut the water off even if a leak causes a local electrical short.
Sensing Reliability and False Positives
Hot water heaters are often in humid environments. Capacitive sensors like the MTCH9010 should be calibrated to distinguish between high humidity/condensation and actual standing water to avoid nuisance water shutoffs for the entire house.
Valve Maintenance (Exercising)
Motorized ball valves can seize if they are not moved for years. The firmware should include an 'exercise cycle' that partially closes and re-opens the valve once a month to ensure it remains functional when an actual leak occurs.
Power Resilience
Consider adding a small LiPo battery or Supercapacitor backup for the ESP32. If a major leak causes a circuit breaker to trip, the system needs enough stored energy to complete the valve closing sequence and send a final 'Emergency' WiFi alert.
Corrosion Mitigation
If using resistive probes, implement 'AC excitation' by toggling two GPIOs to reverse polarity across the probes. This prevents metal migration and oxidation that occurs when a DC voltage is constantly applied to electrodes in water.
Want to customize this project or build something different?
Try the Project Advisor


