Introduction: In this Instructable, I'll tell you how to make a Water Level Alarm using Arduino. It's pretty simple !
- 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;