Water Level Indicator Using Arduino
A water level indicator is a system that relays
information back to a control panel to indicate whether a body of water has
a high or low water leve
Today we are
going to learn about water level indicator using Arduino in the simplest way. This is very beginner level project for electronics and robotics student. Here
we are going to explain in simple 5 steps so that even school kids can understand
easily.
Components Required
- Arduino
- Bread board
- 3 LED (RED, GREEN, YELLOW)
- Buzzer
- Jumper wire
- Water level sensor
- 220 ohm Resistor (3 )
Step 1: Assemble and connect LED on Bread board
- Connect cathode of each 3 LEDs to power rail on breadboard which would be grounded.
- Connect anode to different nodes.
- Connect 220 ohm resistor in series with each LEDs
RED – indicate
low level of water
YELLOW – indicate
half water level
GREEN –
indicate full water level
Step 2: Connection with Arduino
Connect pins
of LEDs as follows:
RED= Digital
pin 1
YELLOW=Digital
pin 12
GREEN=Digital
pin 11
Step 3: Connection of water sensor
Connect
water sensor to Arduino as follows:
Water sensor
|
Arduino pin
|
-
|
GND
|
+
|
VCC
|
s
|
A0
|
Step 4: Connection of Buzzer

Make
connections of Buzzer to digital pin 8 of Arduino
Step 5: Upload the sketch:

Code:
int level;
const int analog_0=0;
int l1=13;
int l2=12;
int l3=11;
int l4=10;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(l1,OUTPUT);
pinMode(l2,OUTPUT);
pinMode(l3,OUTPUT);
pinMode(l4,OUTPUT);
pinMode(8,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
level=analogRead(analog_0);
Serial.println(level);
if(level>500&&level<550)
{ digitalWrite(l1, HIGH);
digitalWrite(l2, LOW);
digitalWrite(l3, LOW);
digitalWrite(l4, LOW);
}
else if(level>600&&level<620)
{
digitalWrite(l1, LOW);
digitalWrite(l2, HIGH);
digitalWrite(l3, LOW);
digitalWrite(l4, LOW);
}
else if(level>620&&level<630)
{
digitalWrite(l1, LOW);
digitalWrite(l2, LOW);
digitalWrite(l3, HIGH);
digitalWrite(l4, LOW);
}
else if(level>630&&level<650)
{
digitalWrite(l1, LOW);
digitalWrite(l2, LOW);
digitalWrite(l3, LOW);
digitalWrite(l4, HIGH);
digitalWrite(8, HIGH);
}
}
Great job.
ReplyDelete