top of page
maxresdefault.jpg
Arduino Automatic WaterPump System

★ᴀʀᴅᴜɪɴᴏ ᴀᴜᴛᴏᴍᴀᴛɪᴄ ᴡᴀᴛᴇʀᴘᴜᴍᴘ ꜱʏꜱᴛᴇᴍ 

IMG20190922002933.jpg
COMPONENTS AND SUPPLIES
IMG20190910113532.jpg
IMG20190910115834.jpg
Schematic
Download Button Ui 1.png
Circuit Diagram.jpg
Automatic WaterPump System Pin Connection's

1) Ultrasonic Sensor~~

 

Connect ultrasonic sensor's VCC and gnd pin to 5v and GND of aduindo board respectively.Now connect echo pin to digital pin 7 and trig pin to digital pin 8 on board.


 

2) Pizo Buzzer~~

 

Connect Pizo Buzzer positive pin connect to arduino digital pin 9 and, Pizo Buzzer negative pin connect to arduino GND pin.


 

3) Red LED~~

 

LED positive pin connect to arduino digital pin 9 and, LED negative pin connect to arduino GND pin.


 

4) Relay Module~~

 

Connect power(center) pin of module to positive terminal of battery and gnd(right) of module to bread board which in turn will be connected to negative terminal of battery and gnd of arduino board. And relay signal pin connect to arduino digital pin 10.


 

(Note:- We are using a bread board because we have to connect gnd pin of relay module to negative terminal of battery and also with gnd of arduino board.Remember we have to always connect negative terminal of external power supply(like battery) to gnd.)


 

Now replace the switch of the water pump with relay by connecting the two wires of switch to normally closed(left) and common(center) outlet of the relay module.


 

Working~~

 

Place the ultrasonic sensor on top of the tank. Ultrasonic sensor calculates the distance and according to the code if distance is less than or equal to 5cm it switch offs the pump and if the distance is grater than 80(which is recommended to be changed according to your need) the relay turn on the pump.


 

(Note:- Ultrasonic sensor is placed at the top hence if the distance increases it means level of water is decreasing and vice-versa.)

Code For Small Water Tank
Download Button Ui 1.png
CODE Window 4.png

float d;

   void setup() {

      Serial.begin(9600);

    pinMode(7,INPUT);//echo pin of ultraSonic         

    pinMode(8,OUTPUT);//trig pin of ultraSonic     

    pinMode(10,OUTPUT);// relay

    pinMode(9,OUTPUT);// buzzer pin

 }

   int low=23;

   int high=5;

    void vol() //distance calculaion...

 {

    digitalWrite(8,HIGH);

       delayMicroseconds(8);

   digitalWrite(8,LOW);

       delayMicroseconds(2);

   d=pulseIn(7,HIGH);

   d=d/69;

 }

    void loop() {

   vol(); while(1)

 {

    b: digitalWrite(10,HIGH);// Pump On...

        delay(2000); vol();

    if(d<high) //check high...

  {

     digitalWrite(9,HIGH);// buzzer on.....

        delay(1000);

     digitalWrite(9,LOW);

     goto a;

   }

 }

     while(1)

    {

        a: digitalWrite(10,LOW);// pump off...

             delay(100);

     vol(); if(d>low) //check low

  {

      digitalWrite(9,HIGH);//Buzzer beeping...... 

          delay(1000);

      digitalWrite(9,LOW);

          delay(1000);

      digitalWrite(9,HIGH);

          delay(1000);

      digitalWrite(9,LOW);

          delay(1000);

       goto b;

     }

   }

 }

Code For Big Water Tank
Download Button Ui 1.png
CODE Window 5.png

float d;

   void setup() {

      Serial.begin(9600);

    pinMode(7,INPUT);//echo pin of ultraSonic         

    pinMode(8,OUTPUT);//trig pin of ultraSonic     

    pinMode(10,OUTPUT);// relay

    pinMode(9,OUTPUT);// buzzer pin

 }

   int low=80;

   int high=5;

    void vol() //distance calculaion...

 {

    digitalWrite(8,HIGH);

       delayMicroseconds(8);

   digitalWrite(8,LOW);

       delayMicroseconds(2);

   d=pulseIn(7,HIGH);

   d=d/69;

 }

    void loop() {

   vol(); while(1)

 {

    b: digitalWrite(10,HIGH);// Pump On...

        delay(2000); vol();

    if(d<high) //check high...

  {

     digitalWrite(9,HIGH);// buzzer on.....

        delay(1000);

     digitalWrite(9,LOW);

     goto a;

   }

 }

     while(1)

    {

        a: digitalWrite(10,LOW);// pump off...

             delay(100);

     vol(); if(d>low) //check low

  {

      digitalWrite(9,HIGH);//Buzzer beeping...... 

          delay(1000);

      digitalWrite(9,LOW);

          delay(1000);

      digitalWrite(9,HIGH);

          delay(1000);

      digitalWrite(9,LOW);

          delay(1000);

       goto b;

     }

   }

 }

bottom of page