Water Tank Level Controller Using Arduino

Water is very essential in our daily life. As we know the earth is made of 3 parts of water. But only 3% of this is fresh water. So we have to stop the wastage of water. There are many ways where water gets wasted. One of these is overflowing of tank or reserver of multiplexes, houses, flats, etc. We have an excellent solution to this problem. In this project, we are going to make an Arduino based Water Tank Level Controller System. This project is going to be very interesting.

Principle Behind Arduino Based Water Level Controller

The principle of the Arduino based water level controller is very normal. This project is based on Arduino and ultrasonic sensors.

Ultrasonic sensors are working on the basis of ECHO. We all know ultrasonic sensor works using sound waves. Sound waves get transmitted in the environment and received back to the sensor as ECHO.

We just need to calculate the time of both sound waves travelling time. When they strike obstacles and return to the sensor. After calculation, we have the distance in the result. We used this concept to control the water tank. The water pump is automatically turned on when the water level is low and turned off when the level is high.

Must Read Water Tank Overflow Alarm

Project

Water Tank Level Controller Using Arduino

Circuit Diagram

Water Tank Level Controller Circuit Diagram
Water Tank Level Controller Circuit Diagram

Components Required

  • Arduino
  • Ultrasonic Sensor HC-SR04
  • 16×2 LCD Display
  • 5V Relay Module
  • BC547 NPN Transistor
  • Resistors (1K, 10K, 100 (x2))
  • Red LED
  • Green LED
  • 5V HI-Link AC-DC Converter (For PCB Use Only)
  • Veroboard
  • 5V Power Supply

About Parts

Arduino UNO

Arduino uno
Arduino UNO

Arduino Uno is a microcontroller board based on the ATmega328P chip. It has 14 digital I/O pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller, simply connects it to a computer with a USB cable or power it with a DC supply.

HC-SR04 Ultrasonic Sensor Module

ultrasonic-sensor
Ultrasonic Sensor

This is a sensor that can measure the distance of an object from the sensor position by ultrasonic sound waves. It sends ultrasonic waves of 40 KHz in the medium. If the waves are reflected on the object and bounce back to the sensor, it calculates the distance by calculating the travelling 111time and speed of sound.

Circuit Connection of Water Level Controller using Arduino

The circuit is the same as the diagram. You just need to fix the ultrasonic sensor module at the top of the tank. So that the module can measure the water surface and collect the data from the tank. When the water level is low about 30 cm, the Arduino turns on the pump and the LCD display shows “LOW WATER LEVEL” and the Led starts glowing.

When the space in the tank is about 12cm the pump will turn off and the LCD display shows “TANK IS FULL“. The buzzer starts beeping at this time and the LED turns off at this moment.

Working Principle of Water Tank Level Controller

The working of this circuit is very simple. We use an ultrasonic sensor that detects the reflection of sound waves from the water surface. At first, we trigger the ultrasonic sensor to transmit the signal and then wait for the ECHO. Arduino calculates the time between triggering and receiving ECHO. We know sound travels with a 340 m/s speed in the air. So we use,

Distance = (Travel time / 2) × Speed of Sound

Now we have the distance between the sensor and the water level in the tank. Now we need to calculate the length of the water tank. Then subtract the resulting distance. Now we have the water level. The Arduino converts it into a percentage. The LCD Display shows the percentage of water present in the tank every moment.

By this process, we can control the water level. The second part is when the water level is low and the relay activates the pump and the pump starts to fill up the tank. When the tank water level gets high the pump turns off automatically.

Arduino 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; }}

Post a Comment

Previous Post Next Post