Introduction: ESP8266/ESP-01 Arduino Powered Leak Detector

Water is GREAT Stuff right? Not so much when it's forced to leave it's designated home and starts swimming around your home's floor space instead. I know this is an 'after-the-fact' project, but I hope it can help someone else avoid a potential flood and damage. Our hot water heater's expansion tank blew a pinhole leak recently and started spraying water with a fury. Thankfully the closet door it sets behind contained it's aqueous projectile path which minimized the damage. That...and the fact that I actually heard the HISSING noise saved us...THIS TIME. If I had installed the Gizmo you'll see here, I would have heard it a LOT sooner. The kicker is, I set something similar to this up last year just 'geeking' around with some of my toys. Hindsight Mannn! This particular Instructable is for a basic leak detector that only notifies with an audible alarm and visual LED. You can see a vid of this version here.

Step 1: Hardware - What You'll Need:

Step 2: Software - What You'll Need

Assumption: Working knowledge of the Arduino IDE/Libraries and knowledge of one of the methods of loading code to the ESP01. (Hopefully you have one of the Adapters mentioned in this Instructable...MUCH easier)

  • Arduino IDE

The ESP8266WiFi.h library is required ONLY if you want to disable WiFi altogether. Future Instructables will utilize WiFi for externally communicating Alarms detected by this sensor.

Save and Load the attached sketch. MAKE SURE you change the board to the 'Generic ESP8266' and choose the correct port.

Step 3: Hardware Setup and Wiring

  1. Identify a power source for your ESP. I used an older ESP programmer plugged into my laptop USB, and plugged VCC and Grnd jumpers into their respective locations. (See Pic)
  2. Straddle the ESP breadboard adapter over the center channel of the mini-breadboard so one row of 4 pins is on either side.
  3. Connect Vcc Source to the ESP's Vcc, Ch_Pd, and the Hygrometer.
  4. Connect Grnd Source to the ESP's Grnd, Hygrometer, and Piezo/LED 'short' leg.
  5. Connect the ESP pin 2 to the Hygrometer's Data (Not analog).
  6. Connect the ESP pin 0 to the Piezo/LED 'long' leg.
  • TIPS
    • DO NOT assume the jumper colors in attached pics represent Vcc or Grnd.
    • The Piezo and/or LED cannot be attached during boot. If they are, the ESP will power-up in bootload mode and will not execute the loaded code. Attach them after the ESP is powered up.
    • Adjust sensitivity as needed on Hygrometer with attached Potentiometer.


      WrapUp: I plan on making the connections on this permanent and housing it all in a decent enclosure. That enclosure may wind up being another one of my famous Lego boxes again!! When it is complete I'll share it as well. Also...I'll be adding WiFi functionality to future versions of the leak detector and will add those Instructables too.