Automatic Water Tank Level Controller With Dry Pump Run Protection Using Arduino
Automatic Water Tank Level Controller With Dry Pump Run Protection Using Arduino
ARDUINO PROJECTS
Automatic Water Tank Level Controller with Dry Android home automation using
ROBOTICS
FOLLOW US
Block Diagram
Let’s learn the Designing and Working of this project using given block diagram. Facebook
Google+
Follow up on Linkedin
Follow us on Instagram
The irst block is Arduino Nano, Arduino is the brain of this project. It will take input
from the sensors and control all other units according to the value received.
The second block is 16x2 LCD display. This unit will display the Water Level in
percentage as well as in Bar Diagram, it will also show the Pump status. This section will
also notify us whenever the Sump tank is empty.
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 1/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
The third block is the Sonar Sensor. This is used to measure the water level present on
the overhead water tank.
Let’s understand the working principle of the Sonar sensor.
Sonar Sensor emits an ultrasound at 40 kilohertz, which travels through the air, and if
there is an object or obstacle on its path, It will bounce back to the module.
Arduino will use the echo pin, present on Ultrasonic sensor to measure sound wave travel
time in microseconds.
Considering the travel time and the speed of the sound, you can calculate the distance
using the formula shown here.
The fourth block is the Sump Water level sensor. These are two copper wires which are
dipped in to the Sump Water Tank. And Analog pin present on the Arduino Nano will be
used to sense the presence of water.
The ifth block is the 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.
The sixth block is the Internal Relay plush Water Pump. Arduino will control the Water
pump using the Internal relay. The relay present on the circuit can be used to start any
kind of 1 HP single phase Water pump without starters.
The Seventh block is also the used for the same purpose, you can use this section to
replace the internal relay with any relay which is operating in 5V DC to get better power
rating for driving the Water pump.
The Eight block is the Buzzer, this is used to notify when the sump tank is empty.
Required Components
Now let’s move to the components required to build this project. You can buy all these
components from third party vendors like E-bay, Amazon etc.
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 2/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
Refer the Circuit diagram shown here to make one by your own. Please visit the link in the
description to know more about the Circuit. I have also added wire sensors to measure the
Overhead tank water level in this circuit and I will be doing a separate video to show you
how to replace the sonar sensor and measure the water level using these wire sensors in
my next video. In this video let’s stick to Sonar sensor.
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 3/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
Go to PCB tab, you could see the PCB Layout automatically created according to the design
that we made in Breadboard tab.
Arrange the components on to the PCB.Now Go to Routing and Click on Autoroute. This
will rearrange the connections to it with the PCB.
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 4/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
Create a new folder and click on Select Folder. This will export all iles to that folder.
Now compress the Folder to ZIP or RAR format using any of the Zipping Software.
We are going to use JLCPCB website for placing the order for our PCB’s. JLCPCB provides
great quality PCB’s.
The basic price goes $2 for 10 pieces of PCBs if you order a two-layer PCB of size up to 100
x 100 mm. This is perfect price if you want to make prototype of your hobby projects or
even for your professional products.
I am ordering my PCB’s from this website from past couple of months, I am totally
satis ied with the build quality of the PCB’s.
Now let’s see how to order the PCB’s.
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 5/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
To order PCBs, irst of all you need to make an account in this website. You can do so by
clicking on register option if you are not yet registered.
Provide a user name, then input your email id and inally set a password. Now you are
ready to upload your gerber ile that we created earlier.
Click on Quote now button.
Once it is successfully uploaded then You will be able to view your PCB in the gerber
viewer.
If you need the Gerber ile that I have used for this project for ordering your PCB’s, please
let me know through Contact us Option.
The PCB dimensions are automatically adjusted here. JLCPCB also gives a choice for
choosing the color of PCB masking. You can choose any color from this available options.
You can leave all the other parameters as default. You can see it is only costing you $2 for
10 PCBs.
Now we will click on save to cart option, after that click on checkout securely.
Now you need to add your shipping address and shipping method.
Talking about the delivery speed, DHL will deliver it in 3 to 4 business days while airmail
will deliver it in 15 to 20 business days. Chose the method according to your need.
After that select the payment method. You can pay using your credit or debit card or you
can even pay using your paypal account. Complete the payment and wait for the delivery
It took me 7 days to get this delivered at my home address in India.
Unboxing
Once you tear of the wrapper, you could see your PCB's inside a cardboard box with
JLCPCB printed on top of the box.
The PCBs are covered on a bubble wrap. Here one thing to notice that JLCPCB takes
ultimate care of our PCBs.
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 6/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
Now let’s tear off the seal and take our PCBs, as you could see the PCB which comes look
same as per the design that we uploaded to the JLCPCB website. And the PCB came with
green masking if you could remember we had selected green color while ordering the
PCB.
Now let’s have a closer look to check the quality of the PCB.
The silk screen perfectly overlaps with the pads. The silk screen is neat and clearly
visible.
Then we have this shiny solder pads on both sides which makes the soldering of the
components very easy.
Soldering Process
Now let's try to solder the components. Please follow the order shown in this video while
soldering the components to the PCB.
The soldering of the components makes very easy because of the perfect solder pads. I
would like to give a big thumps up for JLCPCB for it’s cheap price and good build quality.
1. Solder 220 ohm resistor
2. Solder the 10K resistors
3. Solder the 1K and 10K resistors at the Left hand side of the PCB
4. Solder the Diode
5. Solder the Push Button
6. Solder the 10K trimport
7. Solder the LED
8. Solder the Male Header Pin
9. Solder the transistor
10. Solder the Female Header Pin
11. Solder the Relay Port
12. Solder the Buzzer
13. Solder the Relay
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 7/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
Now we can upload the sketch to our Arduino. Connect Arduino to your computer using
the USB cable and upload the code shown below.
Click here to download the program or else copy the code shown below to your Arduino
IDE
/*
LiquidCrystal Library - Hello World
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* LCD VSS pin to ground
* LCD VCC pin to 5V
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
http://www.arduino.cc/en/Tutorial/LiquidCrystalHelloWorld
*/
#include <LiquidCrystal.h>
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 8/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 9/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
byte Level3[8] = {
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111
};
byte NoLevel[8] = {
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
};
void setup() {
Serial.begin(9600);
lcd.createChar(0, Level0);
lcd.createChar(1, Level1);
lcd.createChar(2, Level2);
lcd.createChar(3, Level3);
lcd.createChar(4, NoLevel);
Serial.println( lag);
lcd.begin(16, 2); // set up the LCD's number of columns and rows:
pinMode(RELAYPIN,OUTPUT);// Relay pin as output pin
pinMode(EXTRELAYPIN,OUTPUT);// External Relay pin as output pin
digitalWrite(RELAYPIN,LOW); //Turn off the relay
digitalWrite(EXTRELAYPIN,HIGH); //Turn off the external
relay(External Relay I used was turning on while giving LOW signal,
Check your one while doing the program)
pinMode(BUZZER,OUTPUT);// Buzzer pin as output pin
digitalWrite(BUZZER,LOW); //Turn off the Buzzer
lcd.print("Automatic Water");
lcd.setCursor(0,1);
lcd.print("*Pumping System*");
delay(2000);
lcd.clear();
lcd.print("Long Press Button to Change Tank Height");
delay(1000);
for (int positionCounter = 0; positionCounter < 23; positionCounter++)
{
// scroll one position left:
lcd.scrollDisplayLeft();
// wait a bit:
delay(300);
}
delay(1000);
lcd.clear();
lcd.print("Tank must be Empty!");
delay(1000);
for (int positionCounter = 0; positionCounter < 3; positionCounter++) {
// scroll one position left:
lcd.scrollDisplayLeft();
// wait a bit:
delay(300);
}
delay(1000);
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 10/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
lcd.clear();
TankHeight= EEPROM.read(addr);
lcd.clear();
lcd.print("Tnk Height Set:");
lcd.setCursor(0,1);
lcd.print(" ");
lcd.print(TankHeight);
lcd.print("cm ");
delay(2000);
lcd.clear();
MaxWaterLevel=0.85*TankHeight;
EmptySpace=TankHeight-MaxWaterLevel;
}
void loop() {
// put your main code here, to run repeatedly:
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 11/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
ZeroPercentage();
}
else if(percentage>20 && percentage<=100)
{
lag= EEPROM.read(addr2);
if(percentage>20 && percentage<=100 && lag ==1)
{
digitalWrite(RELAYPIN,HIGH);
digitalWrite(EXTRELAYPIN,LOW);
lcd.setCursor(0,0);
lcd.print("PMP ON ");
if(percentage>20 && percentage<=25)
{
TwentyFivePercentage();
}
else if(percentage>25 && percentage<=50)
{
FiftyPercentage();
}
TwentyFivePercentage();
}
else if(percentage>25 && percentage<=50)
{
FiftyPercentage();
}
SeventyFivePercentage();
}
else if(percentage>75 && percentage<=100)
{
HundredPercentage();
}
}
}
else if(percentage>100)
{
delay(500);
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 12/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
lcd.setCursor(0,0);
lcd.print("PMP OFF ");
lcd.setCursor(8,0);
lcd.print("Lev:");
lcd.print("100");
lcd.print("% ");
digitalWrite(RELAYPIN,LOW);
digitalWrite(EXTRELAYPIN,HIGH);
lag=0;
EEPROM.write(addr2, lag);
lag= EEPROM.read(addr2);
HundredPercentage();
}
}
else if(SpmpsensorValue<=100)
{
lag= EEPROM.read(addr2);
if( lag==1)
{ lcd.clear();
lcd.setCursor(0,0);
lcd.print("*SumTank Empty*");
lcd.setCursor(0,1);
lcd.print("*Pump kept OFF*");
digitalWrite(BUZZER,HIGH);
digitalWrite(RELAYPIN, LOW);
digitalWrite(EXTRELAYPIN, HIGH);
delay(100);
digitalWrite(BUZZER,LOW);
delay(100);
}
else if( lag==0)
{
lcd.setCursor(0,0);
lcd.print("STnk MT ");
if(percentage<=20)
{
ZeroPercentage();
}
else if(percentage>20 && percentage<=25)
{
TwentyFivePercentage();
}
else if(percentage>25 && percentage<=50)
{
FiftyPercentage();
}
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 13/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
}
void ZeroPercentage()
{
lcd.setCursor(3, 1);
lcd.write(byte(4));
lcd.setCursor(4, 1);
lcd.write(byte(4));
lcd.setCursor(5, 1);
lcd.write(byte(4));
lcd.setCursor(6, 1);
lcd.write(byte(4));
lcd.setCursor(7, 1);
lcd.write(byte(4));
lcd.setCursor(8, 1);
lcd.write(byte(4));
lcd.setCursor(9, 1);
lcd.write(byte(4));
lcd.setCursor(10, 1);
lcd.write(byte(4));
}
void TwentyFivePercentage()
{
lcd.setCursor(3, 1);
lcd.write(byte(0));
lcd.setCursor(4, 1);
lcd.write(byte(0));
lcd.setCursor(5, 1);
lcd.write(byte(4));
lcd.setCursor(6, 1);
lcd.write(byte(4));
lcd.setCursor(7, 1);
lcd.write(byte(4));
lcd.setCursor(8, 1);
lcd.write(byte(4));
lcd.setCursor(9, 1);
lcd.write(byte(4));
lcd.setCursor(10, 1);
lcd.write(byte(4));
}
void FiftyPercentage()
{
lcd.setCursor(3, 1);
lcd.write(byte(0));
lcd.setCursor(4, 1);
lcd.write(byte(0));
lcd.setCursor(5, 1);
lcd.write(byte(1));
lcd.setCursor(6, 1);
lcd.write(byte(1));
lcd.setCursor(7, 1);
lcd.write(byte(4));
lcd.setCursor(8, 1);
lcd.write(byte(4));
lcd.setCursor(9, 1);
lcd.write(byte(4));
lcd.setCursor(10, 1);
lcd.write(byte(4));
}
void SeventyFivePercentage()
{
lcd.setCursor(3, 1);
lcd.write(byte(0));
lcd.setCursor(4, 1);
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 14/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
lcd.write(byte(0));
lcd.setCursor(5, 1);
lcd.write(byte(1));
lcd.setCursor(6, 1);
lcd.write(byte(1));
lcd.setCursor(7, 1);
lcd.write(byte(2));
lcd.setCursor(8, 1);
lcd.write(byte(2));
lcd.setCursor(9, 1);
lcd.write(byte(4));
lcd.setCursor(10, 1);
lcd.write(byte(4));
}
void HundredPercentage()
{
lcd.setCursor(3, 1);
lcd.write(byte(0));
lcd.setCursor(4, 1);
lcd.write(byte(0));
lcd.setCursor(5, 1);
lcd.write(byte(1));
lcd.setCursor(6, 1);
lcd.write(byte(1));
lcd.setCursor(7, 1);
lcd.write(byte(2));
lcd.setCursor(8, 1);
lcd.write(byte(2));
lcd.setCursor(9, 1);
lcd.write(byte(3));
lcd.setCursor(10, 1);
lcd.write(byte(3));
}
Make sure to download the ping.h library and add it to the Arduino IDE.
Click here to download the Ping Library(v1.9.0)
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 15/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
I have added comments in the program for better understanding of each codes. I have also
added links to watch Arduino IDE installation for Windows and Ubuntu in the description.
This will help you to understand more about Arduino if you are using it for the First time.
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 16/18
12/1/2019 Automatic Water Tank Level Controller with Dry Pump Run Protection Using Arduino - Robots- The Next Species On Earth
For the demo purpose we are using a 12V DC water pump. This circuit can support up to
1 HP Single phase water pump if you wish to use this circuit for Application level.
If you wish you can also connect a 5V relay having better current rating on to this circuit.
Automatic Water Tank Level Controller with Dry Pump Run Prote…
Prote…
So, our project is working as per our design. We hope that you enjoyed the Project. And I
would like to thank you once again for watching this video.
https://www.robotsthenextspeciesonearth.com/p/hi-all-welcome-to-yet-another-video.html 17/18