Water sensor

Published Sep 19, 2022
 5 hours to build
 Beginner

A water sensor is designed to detect the presence of water for purposes such as to provide an alert in time to allow the prevention of water leakage and logging.

display image

Components Used

Arduino UNO
Arduino UNO
1
Breadboard
Breadboard
1
Connecting Wire Jumper Wires
Connecting Wire Breadboard wires
7
Resistor 200 Ohms
Metal Film Resistors - Through Hole 200 OHM 1/4W 1%
1
Resistor 10 kOhms
Metal Film Resistors - Through Hole 10 kOhms 250 mW 1% 100 PPM / C
1
Speaker
Speakers & Transducers 28 mm, Round Frame, 0.25 W, 32 Ohm, Neodymium Magnet, PET Cone, Speaker
1
USB Type A to B Cable
USB Cables / IEEE 1394 Cables USB A-B 28/26 BLACK 1.3 M
1
Description

Water Sensor :

Procedure to build the circuit

Step 1:  We connect a wire between digital pin 2 of Arduino and the breadboard. Also, connect the ground pin of the Arduino and the breadboard.

Step 2: We then connect one end of the 10k ohm resistor along the same vertical line of the breadboard that is connected to the Arduino and another end to the ground.

Step 3: Connect one wire between the 5V pin of Arduino and the water source and another wire between pin 2 of Arduino and the water source. When the wires are dipped into the water, the water completes the circuit and the Red LED bulb glows on the Arduino.

 

 

Step 4:  Connect a wire from pin 8 of the Arduino to the 10-ohm resistor which another end will connect to the speaker. Also, connect the other end of the speaker to the ground.

Step 5: Now we  do the necessary coding on the Arduino IDE and upload it to the Arduino and get the desired results as the red LED glows once the two wires touch the water and the 8 A speaker produces a sound.

 

Applications:-
    1)nuclear power plants 
    2)Automobiles for measuring the amount of gasoline left in the fuel tank 
    3)Cooling water
    4)Engine oil .

ADVANTAGES:

  • Automatically warn against water logging
  • Compact design
  • High accuracy
  • Easy to build

DISADVANTAGES :

  • It needs to be replaced frequently as the wires touching the water might get corroded with time..
  • We have to replace LED time to time
  • The sound coming out of the speaker needs to be amplified.

Code:

// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
}

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);

   //tone takes three arguments tone(pin,frequency,duration)
  tone(8,2000,1000);

  //the loop does not wait for the tone to finish so let us delay to here 2 seconds to hear
  //1 second of noise and 1 second of silence-essentially a beep
  delay(2000);
  } 
  else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}
Codes

Downloads

Watersensorschematic Download

Institute / Organization

North Eastern Hill University, Shillong
Comments
Ad