Automatic Water Level Controller for 2 Pumps and 1 Rooftop Tank and 1 Underground Tank

Introduction: Automatic Water Level Controller for 2 Pumps and 1 Rooftop Tank and 1 Underground Tank

About: I'm a trader by profession. But electronics and mechanics are my hobby.

I made this project for the building, where I live. It was a tedious and annoying job to turn the motor on everyday and stop in time. So after a lot of research and designing on the internet. I came up with this idea and made it. It took me more than 2 months to perfect it.

We have 2 water pumps which fill the same roof top tank.

  1. Submersible 1.5 HP Pump
  2. Jet pump in underground tank.

I've used float switches in both the tanks as shown in the photo.

Parts list :

  1. Float switches - 4 pcs
  2. Atmega328 with Bootloader- 1 pc
  3. 30amps Relays - 3 pcs
  4. 5amps Relays - 4 pcs
  5. 10k ohms resistors for switch input to pulldown - 5 pcs
  6. ULN2003 - 1 pc (to give 12v power to the relays)
  7. 12v 1amp power adapter
  8. LM7805 & 1000uf Capacitors (to regulate 5v for the atmega328)
  9. Screw Terminal Connectors
  10. Some LEDS
  11. Lots of wires, soldering Iron and Lead solder.
  12. Arduino UNO to program the atmega328
  13. Diodes (to make a reverse protection).
  14. Good quality 3 core wires are used for roof top tank sensors and underground tank sensors.

Step 1: Solder the Circuit As Shown in the Circuit Diagram.

Circuit diagram shows the wiring of items.

Step 2: Program the Atmega328 Using Arduino Ide and Arduino Uno

  • Use a 28 pin mcu holder on the PCB so that Atmega328 MCU can be removed again and again for changes in program.
  • Click here to know how to program atmega328 without oscillator.
  • If the 8 mhz bootloader is done, then put the atmega328 on the arduino uno and program it directly using USB.
  • The file attached here has the arduino code to be used. You can change the pin numbers as per your requirements in the configuration section.

The Program is :

///////////Configuration Section//////////
int r1 = 11; // Atmega328 pin 17 // Relay 1 Pin Submersible Motor Main

int r2 = 12; // Atmega328 pin 18 // Relay 2 Pin Submersible Motor Boost

int r3 = 13; // Atmega328 pin 19 // Relay 3 Pin Monoblock Motor or Ground Tank Motor

int enb = 0; // Atmega328 pin 2 // Enable Switch Power to read the values

int led = 9; // Atmega328 pin 15 // Loop LED

int LED1 = 5; // Atmega328 pin 11 // S1 LED

int LED2 = 6; // Atmega328 pin 12 // S2 LED

int LED3 = 7; // Atmega328 pin 13 // S3 LED

int LED4 = 8; // Atmega328 pin 14 // S4 LED

int s1 = 4; // Atmega328 pin 6 // Switch 1 Pin (Upper level of Overhead Tank)

int s2 = 3; // Atmega328 pin 5 // Switch 2 Pin (Lower level of Overhead Tank)

int s3 = 10; // Atmega328 pin 16 // Switch 3 Pin (Upper level of Ground Tank)

int s4 = 1; // Atmega328 pin 3 // Switch 4 Pin (Lower level of Ground Tank)

int in = 2; // Atmega328 pin 4 // Inturrupt Pin, to stop the delay function.

int b1; // Holds value of Switch 1 int b2; // Holds value of Switch 2

int b3; // Holds value of Switch 3 int b4; // Holds value of Switch 4

int a=0; // Stops execution of codes again & again

long int i=0; // Loop Counter

int R2Delay= 1800; // Delay to keep R2(Boost for Submersible) On

int SwDelay = 500; // Delay between switching Motors

long int loops = 1; // Number of loops to wait

////////////Configuration END////////////////////////////////////////////////////////

////////////////Program Bigin////////////////////////////////////////////////////////

void setup()

{ pinMode(r1, OUTPUT);

digitalWrite(r1, LOW);

pinMode(r2, OUTPUT);

digitalWrite(r2, LOW);

pinMode(r3, OUTPUT);

digitalWrite(r3, LOW);

pinMode(enb, OUTPUT);

pinMode(led, OUTPUT);

pinMode(LED1, OUTPUT);

pinMode(LED2, OUTPUT);

pinMode(LED3, OUTPUT);

pinMode(LED4, OUTPUT);

pinMode(s1, INPUT_PULLUP);

pinMode(s2, INPUT_PULLUP);

pinMode(s3, INPUT_PULLUP);

pinMode(s4, INPUT_PULLUP);

pinMode(in, INPUT_PULLUP);

readWaterLevel(); }

void loop()

{ digitalWrite(led, 1);

delay(200);

if(i>=loops)

{

readWaterLevel();

i=0; }

if((digitalRead(in) == 1))

{ readWaterLevel();

if(b1==1)

{ b2=1; } }

if((digitalRead(r1) == 1) || (digitalRead(r3) == 1))

{ loops = 500; } //Number of Loops to Wait before Reading the Switches when any Motor is ON

else { loops = 5000; } //Number of Loops to Wait before Reading the Switches when Motors are off

if((a == 0) && (b1 == 1) && (b2 == 1) && (b3 == 1)) //OverHead Tank Empty

{ Submersible();

a=1; }

else if((a == 0) && (b1 == 1) && (b2 == 1) && (b3 == 0)) //Overhead Tank Empty

{ Monoblock();

a=1; }

else if((b3 == 1) && (b4 == 1) && (digitalRead(r3) == HIGH)) /////Ground Tank gets Empty

{ digitalWrite(r3, LOW);

a=0; }

else if((a==1) && (b1 == 0) && (b2 == 0)) /////Overhead tank is Full

{ AllOff(); a=0; }

digitalWrite(led, 0);

delay(300);

i=i+1;

}////////////Loop End////////

void readWaterLevel()

{ digitalWrite(enb, 1);

delay(750);

b1 = digitalRead(s1);

b2 = digitalRead(s2);

b3 = digitalRead(s3);

b4 = digitalRead(s4);

LED_Status();

delay(50);

digitalWrite(enb, 0); }

void Submersible()

{ digitalWrite(r3, LOW);

delay(SwDelay);

digitalWrite(r1, HIGH);

delay(SwDelay);

digitalWrite(r2, HIGH);

delay(R2Delay);

digitalWrite(r2, LOW); }

void Monoblock()

{ digitalWrite(r1, LOW);

delay(SwDelay);

digitalWrite(r2, LOW);

delay(SwDelay);

digitalWrite(r3, HIGH); }

void AllOff()

{ digitalWrite(r1, LOW);

delay(SwDelay);

digitalWrite(r2, LOW);

delay(SwDelay);

digitalWrite(r3, LOW);

delay(SwDelay); }

void LED_Status()

{ digitalWrite(LED1, b1);

digitalWrite(LED2, b2);

digitalWrite(LED3, b3);

digitalWrite(LED4, b4); }

//////////////////////////////////////////////

Step 3: After the Circuit Is Finished. Place It in a Box of Your Choice.

I have used a PVC box used for electrical switches which is commonly available in electrical stores/hardware stores. You can decide the box on your own depending on how you made your project.

Share

    Recommendations

    • Creative Misuse Contest

      Creative Misuse Contest
    • Fix It! Contest

      Fix It! Contest
    • Tiny Home Contest

      Tiny Home Contest

    3 Discussions

    Actually Its my first project. And before making I didn't think of Putting it here.. If you need any info I'll give u..

    When that is the case, what I always do is just take close up pictures of each part and add text describing how it was assembled and connected.