SALES INQUIRIES: 1 (888) 767-9864

How to Make an Arduino Water Detection Alarm

This lesson will explain how to make a simple water detection alarm using an Arduino.

Breadboard Layout:
Combined_Speaker_WaterDetector_bb_OPHere is the code that is used in the video when making the alarm portion:

/*Make a tone on your Arduino using an external 8-Ohm speaker
  8-ohm speaker
  100-Ohm Resistor
  2 jumper wires / 2 alligator clips
  100 Ohm resistor connected Arduino Pin 8
  Other side of resistor connected to the positive terminal of the speaker
  Negative termial of the speaker connected to Ground
 created 21 Jan 2010
 modified 31 May 2012
 by Tom Igoe, with suggestion from Michael Flynn  
 heavily modified Jul 2014 by
 Michael James
Home This code is in the public domain */ void setup() { pinMode(8, OUTPUT); //The Speaker is attached at this pin }//close setup void loop() { //Tone takes three arguments tone(pin, frequency, duration) tone(8, 2000, 1000); //The loop does not wait for the tone to finish, so lets delay to here 2 seconds to hear //one second of noise and one second of silence - essentially a beep delay(2000); }//Close Loop



  1. Avatar James Seiwert on June 12, 2015 at 4:50 pm

    If it tells you when there is water, it should also let you know when there is no water by reversing the button code. Is this statment correct?

  2. Avatar Greg Webster on March 7, 2016 at 11:58 pm

    This is really bad. This circuit can’t overcome the resistance of water. I suspect you didn’t try this.

    • Avatar tweeksdisqus on November 12, 2017 at 10:06 am

      It depends..

      Condensed water (from an AC unit for example) will not conduct immediately.. however it’s also a solvent and will partially break down any metals it comes in contact with and eventually conduct. One “solution” (pardon the pun) would be to put some salt between your leads. This would make the puddle conductive.. and after drying out would stop conducting.. and the next water puddle (if not fully washed away) would conduct again. You might need to occasionally replenish this consumable.

      For me.. I’m measuring well water and ground water leaking in from the ground.. so mine would be hard already, and so conductive.

  3. Avatar Aditi Jain on March 15, 2017 at 12:00 pm

    Why is the 10k ohm resistor used?

    • Avatar Jayden Lawson on April 19, 2017 at 5:49 pm

      On the YouTube video, this question was asked, and the answer was “Because the current would be so high and will probably burn the speaker but when a resistor is added the current decrease”

  4. Avatar Michael Faux on April 20, 2017 at 4:47 pm

    My dad used to have a water detector that was kind of expensive, but one time use, making me think there was some material that dissolved, triggering a loss of material alarm. Or a conductive material that melts or dissolves in water.

  5. Avatar tweeksdisqus on November 12, 2017 at 10:09 am

    You’ll also want to define pin2 as in INPUT.

Leave a Comment