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
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 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
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #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; } } |
Thanks. rain sensor, soil moisture sensor and Temperature Sensor
This is a good one introducing beginner to learn and start working on Arduino
A couple of thoughts, not a criticism, just something that might help:-
Considering that it’s in a ‘moist’ environment (which might promote corrosion -especially between dissimilar metals ) How durable is the water level sensor ?
If the capacity of the tank and the flow rate of the water supply ( via the pump ) are known, several things are possible : the filling process could be monitored – i.e. the height of the water should rise with time when the pump is active – if it doesn’t this could flag an error. Also the tank should be full after a finite period – again if not flag an error. Summary : beyond delivering the desired functionality, consider what might happen in the real world – things occasionally go wrong or operate outside the design parameters – therefore can unexpected ( but plausible ) events be detected and then can the system respond appropriately ?
Good project. Thanks for the insight. I have also been working on the same project.