Water Level Alarm Using Arduino

4,428

24

7

Introduction: In this Instructable, I'll tell you how to make a Water Level Alarm using Arduino. It's pretty simple !

Materials Required:-

  • Arduino Uno
  • Jumper Wires
  • 1 LED
  • 2 Resistors: ~200 Ohm and ~1KOhm
  • A Water Container

How do you get notified: In the water container shown in figure, when the water level reaches a height such that it touches tips of the two wires (Purple and Cyan in color) kept in the container, the LED glows and hence notifies you that the water level has reached the desired height.

Instead of LED, one can even use a speaker (that can work with 5V DC)

Step 1: Working Principle

Pin 12 is made as an OUTPUT pin in this setup, which is connected to one terminal of the LED. The other terminal of the LED is connected to GND. So whenever the state of Pin 12 is HIGH, the LED glows.

Now, whenever the water is in contact with both the wires immersed in the container, the circuit gets completed, and pin 4 (INPUT pin in the setup) reads HIGH.

In the Arduino code, the logic is that whenever pin 4 reads HIGH, Pin 12 is given a digital output of HIGH too.

In summary, whenever the water circuit gets complete, pin 4 reads high, which makes pin 12 HIGH, and this glows the LED.

Note that the 100 K Ohm resistor connected between pin 4 and GND acts as a pull down resistor. If 100 K Ohm resistor is not available, any other resistor of high value can be used, but make sure that it is not very high too.1 KOhm - 200 KOhm should be fine

Step 2: Arduino Code

Following is the Arduino Code that works with the circuitry shown in the figure in beginning :-

int out = 12;
int in = 4;

int rd;

void setup()

{

pinMode(out,OUTPUT);

pinMode(in,INPUT);

}

void loop()

{

rd=digitalRead(in);

if(rd==HIGH)

{

digitalWrite(out,HIGH);

delay(100);

}

else

{

digitalWrite(out,LOW);

delay(100);

}

}

Share

Recommendations

  • PCB Contest

    PCB Contest
  • Big and Small Contest

    Big and Small Contest
  • First Time Author

    First Time Author

7 Discussions

0
None
LarsK27

1 year ago

thanks for share, valuable info, just what I was looking for

1 reply
0
None
FlexureLarsK27

Reply 1 year ago

Thanks.. Cheers to Science !

0
None
FlexureAustC

Reply 1 year ago

The value of both the resistors is depicted in the figure as well as in the description.

Cheers,
Flexure

0
None
frxhnwzr

2 years ago

thanks sharing

0
None
wold630

2 years ago

I didn't imagine this was so simple! Thank you for sharing!

1 reply