Close
0%
0%

Automatic Water Level Indicator using Arduino

In this project, we are going to measure the water level by using ultrasonic sensors.

Similar projects worth following
Ultrasonic sensor HC-SR04 is used to estimate distance in the range of 2cm-400cm with an accuracy of 3mm. The sensor module includes an ultrasonic transmitter, receiver and control circuit.

Thus the distance of the obstacle from the sensor is normally estimated by the formula given as

Distance= (time x speed)/2.

Working of Automatic Water Level Controller

We have used the Ultrasonic sensor module which sends the sound waves in the water tank and identifies the reflection of sound waves that is ECHO. First of all, we need to trigger the ultrasonic sensor module to transfer signals by using Arduino and then wait to get ECHO. 

Basically Arduino indicates the time between triggering and received ECHO. We know that the speed of sound is around 340 m/s. 

so we can estimate the distance by using the given formula:

Distance= (travel time/2) * speed of sound

Where the speed of sound is approximately 340m per second.

By using this method we get distance from the sensor to the water surface. After it, we need to measure the water level.

Then we need to estimate the total length of the water tank. As we know the length of the water tank then we can determine the water level by subtracting the resulting distance coming from ultrasonic from the total length of the tank. And we will get the water level distance. Now we can convert this water level into the percent of water and can display it on LCD.

As shown in the water level controller circuit given below, the Ultrasonic sensor module’s “trigger” and “echo” pins are directly connected to pin 10 and 11 of Arduino. A 16x2 LCD is connected with Arduino in 4-bit mode.

Control pin RS, RW and En are directly connected to Arduino pin 7, GND and 6. And data pin D4-D7 is connected to 5, 4, 3 and 2 of Arduino, and the buzzer is attached at pin 12. 6 Volt relay is also connected at pin 8 of Arduino through ULN2003 for turning on or turning off the water motor pump.

A voltage regulator 7805 is also used for providing 5 volts to relay and to the remaining circuit.

In this circuit, the Ultrasonic sensor module is situated at the top of the bucket (water tank) for demonstration. This sensor module will read the distance between the sensor module and water surface and it will determine the distance on the LCD screen with the message “Water Space in Tank is:”. It means we are here showing an empty place of distance or volume for water instead of water level. Because of this functionality, we can utilize this system in any water tank.

When the empty water level carries a distance of about 30 cm then Arduino turns ON the water pump by pushing the relay. And now LCD will show “LOW Water Level” “Motor turned ON”, and Relay status LED will start glowing.

Now if the empty space touches at a distance about 12 cm Arduino turns OFF the relay and LCD will show “Tank is full” “Motor Turned OFF”. Buzzer also beeps for some time and relay status LED will be turned OFF.

Learn more about IoT Training in Pune and Mumbai which will help you to build an essential End-To-End IoT Solutions

JPEG Image - 14.57 kB - 10/01/2019 at 07:52

Preview
Download

  • 1 × Arduino Uno
  • 1 × Ultrasonic sensor module
  • 1 × 16X2 LCD Display
  • 1 × Relay 6 volt
  • 1 × Linear Regulator 7805 Electronic Components / Misc. Electronic Components

View all 7 components

  • 1
    Run a Code
    #include <LiquidCrystal.h> #define trigger 10
    #define echo 11
    #define motor 8
    #define buzzer 12 
    
    LiquidCrystal lcd(7,6,5,4,3,2);
    float time=0,distance=0;
    int temp=0; 
    void setup()
    { 
      lcd.begin(16,2); 
      pinMode(trigger,OUTPUT);
      pinMode(echo,INPUT); 
      pinMode(motor, OUTPUT);
      pinMode(buzzer, OUTPUT); 
      lcd.print("  Water Level "); 
      lcd.setCursor(0,1); 
      lcd.print("   Indicator  "); 
      delay(2000);
    } 
      void loop()
    { 
      lcd.clear(); 
      digitalWrite(trigger,LOW); 
      delayMicroseconds(2); 
      digitalWrite(trigger,HIGH); 
      delayMicroseconds(10); 
      digitalWrite(trigger,LOW);
      delayMicroseconds(2); 
      time=pulseIn(echo,HIGH); 
      distance=time*340/20000; 
      lcd.clear(); 
      lcd.print("Water Space In  ");
      lcd.setCursor(0,1); 
      lcd.print("Tank is: "); 
      lcd.print(distance);
      lcd.print("Cm"); delay(2000); 
      if(distance<12 && temp==0) 
    {     
      digitalWrite(motor, LOW);     
      digitalWrite(buzzer, HIGH);    
      lcd.clear();     
      lcd.print("Water Tank Full ");     
      lcd.setCursor(0,1);     
      lcd.print("Motor Turned OFF");     
      delay(2000);     
      digitalWrite(buzzer, LOW);     
      delay(3000);     
      temp=1; 
     }   
      else if(distance<12 && temp==1) 
    {     
       digitalWrite(motor, LOW);     
       lcd.clear();     
       lcd.print("Water Tank Full ");     
       lcd.setCursor(0,1);     
       lcd.print("Motor Turned OFF");     
       delay(5000); 
     }  
       else if(distance>30) 
     {   
       digitalWrite(motor, HIGH);  
       lcd.clear();   
       lcd.print("LOW Water Level");   
       lcd.setCursor(0,1);   
       lcd.print("Motor Turned ON");   
       delay(5000);   
       temp=0; 
     }
    }
     
    
    

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates