I'd like to set up a few water leak sensors in/under my house to avoid the kinds of plumbers' bills that I got recently! I had been hoping somebody had built such a thing with 1-wire or I2C ready to use, and I'd just have to string some wires and write some code for the rpi, but no such luck.

I'm looking for ideas, blog posts, ... of people who have done this kind of thing before. This is a question about the hardware, not the software.

  • Related: instructables.com/id/SIMPLE-WATER-DETECTOR-EVER It's noteworthy that there are "moisture sensors" (nice keyword for future search) with interdigital electrodes available on printed circuit boards with immersion Gold protected traces. That's really a good thing as this board will sit around for a few years - preventing corrosion is definitely a key feature you want to have.
    – Ghanima
    Jan 14, 2016 at 14:37

1 Answer 1


I have built such a circuit in the past for some friend that had a small production plant and needed to keep track of water levels in a tank.

I don't have the drawings anymore, but the circuit was something like this one below (from http://www.electroschematics.com/9964/arduino-water-level-indicator-controller/). It's for an arduino and should work just fine on the Pi. enter image description here

I would place the transistor close to the measuring point to avoid interference from power cables in the house. If you only need 1 measuring point then use a pair of cables to wire it directly to the GPIO and read a high/low condition. Keep the tips of the cables in the air some 5mm (1/4") apart at the measuring height you want to detect, don't let them touch anything else.

  • 1
    The Pi's GPIO are all 3V3. They will be damaged by a 5V input. Where you show +5V transistor inputs should that be changed to 3V3?
    – joan
    Jan 14, 2016 at 14:31
  • Yes, the circuit should work equally fine on a 3.3V supply. However, a bit of tuning might be required: if the output of the transistors doesn't go low enough, then increase the value of the resistor at the collector from 470 to 1K.
    – kxtronic
    Jan 15, 2016 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.