Water Level Monitor Using Ultrasonic

Introduction: Water Level Monitor Using Ultrasonic

About: I am Professional Engineer and Part timely hobbyist in Arduino, NodeMCU, IoT Cloud,AI ,Robotic, College & School student projects.

One of the major problems faced by most of the countries is the issue of water scarcity in the world. The scarcity is mainly due to the wastage of the water. There is a need to control the water wastage to save the environment and water resources. Water level monitoring system is one of the techniques to address the control of water wastage. It observes the level of water and provides the information to the registered users through wireless. In view of this, Bluetooth module based Water Level Monitoring system is an innovative idea that will inform the users about the level of liquid and will prevent it from overflowing. The water level monitoring system is a automatic process to detect and indicate the level of water in the reservoirs, overhead tank or any other storage containers, etc. All the householders are storing the water in overhead tanks by using the motor pumps. When the water is stored in the tank, no one can identify the level of water and also, no one can know when the water tank will be filled. So, there is an overflow of water in the tank, which results wastage of energy and water. To resolve this type of problems by using implementation of water level monitors and control systems using wireless technology which will transmit the information to the smart phone and indicate the level of water in the overhead tanks. And also to design a contactless water level indicator and controller using ultrasonic sensor with DRY PUMP RUN PROTECTION.

Step 1: Level Monitoring and Control With Dry Pump Run Protection Using Ultrasonic Sensor and Android Applcation Via Bluetooth HC-05.

Level Monitoring and Control with dry Pump run protection using Ultrasonic Sensor and Android Applcation via bluetooth HC-05.

One of the major problems faced by most of the countries is the issue of water scarcity in the world. The scarcity is mainly due to the wastage of the water. There is a need to control the water wastage to save the environment and water resources. Water level monitoring system is one of the techniques to address the control of water wastage. It observes the level of water and provides the information to the registered users through wireless. In view of this, Bluetooth module based Water Level Monitoring system is an innovative idea that will inform the users about the level of liquid and will prevent it from overflowing. The water level monitoring system is a automatic process to detect and indicate the level of water in the reservoirs, overhead tank or any other storage containers, etc. All the householders are storing the water in overhead tanks by using the motor pumps. When the water is stored in the tank, no one can identify the level of water and also, no one can know when the water tank will be filled. So, there is an overflow of water in the tank, which results wastage of energy and water. To resolve this type of problems by using implementation of water level monitors and control systems using wireless technology which will transmit the information to the smart phone and indicate the level of water in the overhead tanks. And also to design a contactless water level indicator and controller using ultrasonic sensor with DRY PUMP RUN PROTECTION

HC-SR04 ultrasonic sensor

The HC-SR04 ultrasonic module is a module that can provide non-contact measurement within the range of 2cm to 400cm with ranging accuracy that can reach 3mm. It works on the principle of echolocation.

The ultrasonic sensor as a trigger and an echo pin. The arduino provides a high signal of 10microseconds to this pin. After the HC-SR04 is triggered, it sends out eight 40Khz sound waves to the surface of the water. On getting to the surface of the water, the wave is echoed back to the sensor and the arduino reads the echo pin to determine time spent between triggering and receiving of the echo.

Since we know that the speed of sound is around 340m/s then we can calculate the distance using;

Distance = (time/2)*speed of sound

To determine the level of the water in the tank we must know the total length of the tank. It is this value that will enable us calibrate the tank.Here introduced a push button, this is used to measure the Tank height at the time of installation of this Circuit. This can further used if you wish to replace the water tank with a new one.

Gap between Ultrasonic and Max water level adjusted in Arduino code. Buzzer, this is used to notify when the sump tank is empty.

Sump Water level sensor, which are dipped in to the Sump Water Tank or Use non-contact sensor for Pump suction line, And Analog pin present on the Arduino Nano will be used to sense the presence of water.

LCD 20x4 line display. This unit will display the Water Level in percentage, Pump status, tank Height and Sump tank status.

Conditions:
If Water level below 20% then Pump will start Running and

If Water level above 100% then Pump will stopped.

If Pump running and Sump tank empty then Pump will stopped.

If Pump stopped and Sump tank empty then Pump will stopped.

Tank water level monitored in Android Mobile using app.

Arduino Code:
#include LiquidCrystal_I2C lcd(0x27,20,4);

#include #define TRIGGER_PIN 6

#define ECHO_PIN 7

#define MAX_DISTANCE 500 // Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); #define MOTORPIN 8 // Pump relay #define BUZZER 9

float val;

#include int addr = 0;

int addr2 = 1;

int flag;

byte readval;

#define buttonPin 10

int buttonState = 0;

float TankHeight, WaterLevelMAX, GapbwSonar, SonarReading, ActualReading, Temp;

int percentage;

int DRYSensorPin = A0;

int DRYsensorValue = 0;

void setup() {

Serial.begin(9600); lcd.init(); // initialize the lcd // Print a message to the LCD.

lcd.backlight(); lcd.begin(20, 4); // set up the LCD's number of columns and rows:

pinMode(MOTORPIN,OUTPUT);// Relay pin as output pin

digitalWrite(MOTORPIN,LOW); //Turn off the relay

pinMode(BUZZER,OUTPUT);// Buzzer pin as output pin

digitalWrite(BUZZER,LOW); //Turn off the Buzzer

lcd.setCursor(0,0);

lcd.print("SMART WATER LEVEL ");

lcd.setCursor(0,1);

lcd.print("CONTROL SYSTEM ");

lcd.setCursor(0,2); lcd.print("USING ULTRASONIC ");

lcd.setCursor(0,3);

lcd.print("AND ANDROID APP ");

delay(2000); lcd.clear(); lcd.setCursor(0,0);

lcd.print("Starting ARDUINO, ");

lcd.setCursor(0,1);

lcd.print("Press SCAN Button to");

lcd.setCursor(0,2);

lcd.print("Change Tank Height ");

lcd.setCursor(0,3);

lcd.print("If Required ");

delay(2000);

// delay(1000);

lcd.clear();

lcd.setCursor(0,0);

lcd.print("Confirm Tank Must be");

lcd.setCursor(0,1);

lcd.print("Empty to Set Tank ");

lcd.setCursor(0,2);

lcd.print("Height using Sonar ");

delay(2000);

lcd.clear();

lcd.setCursor(0,0);

lcd.print("Now Scan to Change ");

lcd.setCursor(0,1);

lcd.print("Tank Height to New ");

delay(2000); lcd.clear();

lcd.setCursor(0,0);

lcd.print("Long Press Button...");

for (int i=0; i<=5; i++)

{ lcd.setCursor(0,1);

lcd.print(" Hold : ");

lcd.print(5-i);

lcd.print(" Seconds ");

buttonState = digitalRead(buttonPin);

if (buttonState == HIGH) {

TankHeight =sonar.ping_cm();

EEPROM.write(addr, TankHeight); }

delay(1000); }

{TankHeight= EEPROM.read(addr);

lcd.clear(); lcd.setCursor(0,0);

lcd.print("Tank New Height Set@");

lcd.setCursor(0,1); lcd.print(" ");

lcd.print(TankHeight);

lcd.print("cm ");

lcd.setCursor(0,2);

lcd.print("Cheers ");

lcd.setCursor(0,3);

lcd.print("WELCOME to SMART ");

delay(2000); lcd.clear();

lcd.setCursor(0,2);

lcd.print("TANK HEIGHT: ");

lcd.setCursor(12,2);

lcd.print(TankHeight);

lcd.print("cm ");

WaterLevelMAX=0.9*TankHeight; // 10CM GAP BETWEEN MAX WATER LEVEL TO SONAR FIX GapbwSonar=TankHeight-WaterLevelMAX;}

} void loop() {

delay(300);

SonarReading=sonar.ping_cm();

DRYsensorValue=analogRead(DRYSensorPin);

//Serial.println(DRYsensorValue);

Temp= SonarReading-GapbwSonar;

ActualReading= WaterLevelMAX-Temp;

percentage=(ActualReading/WaterLevelMAX*100);

Serial.println(percentage); //Serial.println(TankHeight);

lcd.setCursor(0,0);

lcd.print("WATER LEVEL:");

lcd.print(percentage);

lcd.print("% ");

if(DRYsensorValue>=100)

{

if(percentage<=20)

{ lcd.setCursor(0,3);

lcd.print("SUMP: WATER FILLED ");

lcd.setCursor(0,1);

lcd.print("PUMP STATUS: RUNNING");

digitalWrite(MOTORPIN,HIGH);

flag=1; EEPROM.write(addr2, flag);

flag= EEPROM.read(addr2);

// ZeroPercentage();

}

else if(percentage>20 && percentage<=100)

{

flag= EEPROM.read(addr2);

if(percentage>20 && percentage<=100 && flag ==1)

{ digitalWrite(MOTORPIN,HIGH);

lcd.setCursor(0,1);

lcd.print("PUMP STATUS: RUNNING"); }

else if(percentage>20 && percentage<=100 && flag ==0)

{ digitalWrite(MOTORPIN,LOW);

lcd.setCursor(0,1);

lcd.print("PUMP STATUS: OFF ");

}

}

else if(percentage>100)

{

delay(500);

lcd.setCursor(0,1);

lcd.print("PUMP STATUS: OFF ");

lcd.setCursor(0,0);

lcd.print("Water Level:");

lcd.print("100"); lcd.print("% ");

digitalWrite(MOTORPIN,LOW);

flag=0;

EEPROM.write(addr2, flag);

flag= EEPROM.read(addr2);

// HundredPercentage();

}

}

else if(DRYsensorValue<=100)

{

flag= EEPROM.read(addr2); if(flag==1)

{ // lcd.clear(); lcd.setCursor(0,3);

lcd.print("SUMP: WATER FILLED ");

lcd.setCursor(0,1);

lcd.print("PUMP STATUS: DRYRUN!");

digitalWrite(BUZZER,HIGH);

digitalWrite(MOTORPIN, LOW);

digitalWrite(BUZZER,LOW); }

else if(flag==0)

{ lcd.setCursor(0,3);

lcd.print("SUMP: NOWATER/CHECK");

}

}

}

Download: Arduino Code: https://drive.google.com/file/d/11egiPu2fzW4Sn2yp...

App: https://drive.google.com/file/d/1_5t3tVkQNHQk60k0...

Block Code Contest

Participated in the
Block Code Contest

Be the First to Share

    Recommendations

    • Rice & Grains Challenge

      Rice & Grains Challenge
    • Lamps Challenge

      Lamps Challenge
    • CNC and 3D Printing Contest

      CNC and 3D Printing Contest

    Comments