Friday, November 22, 2024

Arduino Based Automatic Water Tank Filling System

Here we have designed an Automatic Water Tank Filling System using Arduino.

In India, many houses have two sources of water to fill the rooftop water tank. These are underground water storage tanks and municipal water supply. Based on the availability, the rooftop tank is filled either with municipal water or with the underground tank water with the help of an electric water pump.

Filling the overhead tank by manually switching on the electric water pump requires frequent monitoring of the water level inside the tanks. It also results in the wastage of water when it overflows from the overhead tank. This project aims to fill the overhead tank automatically without any human intervention.

- Advertisement -

The proposed system determines the level of water in the rooftop tank, checks the availability of sufficient water in the underground tank or municipal supply, and then fills the overhead tank to the desired level using any of the two available sources. The filling of the tank through municipal supply is controlled through a solenoid valve and the water pump is controlled through a contactor.

The decision making is done through a microcontroller in Arduino Nano and electronic devices like BJT, MOSFETs, and diodes. The working of the project can be explained through two cases that utilise different water sources based on their availability.

- Advertisement -

POC Video Tutorial In English:

POC Video Tutorial In Hindi:

Case 1. Water level in overhead tank is below 75% and municipal supply is not available. In this case, water will be filled through the underground tank using water pump till 75% water level is reached.

Case 2. Water level in overhead tank is below 100% and municipal supply is available. In this case, water will be filled through the municipal supply to the tank’s full capacity. A solenoid valve will be used to stop filling the tank after the tank is fully filled.

Automatic Water Tank Filling System Working
Fig. 1: Basic working design

Fig. 1 shows the basic design idea of project while circuit diagram of the automatic water system is shown in Fig. 2. The electronic and mechanical components required to make this project are listed in the Bill of Material table.

Automatic Water Tank Filling System Circuit Diagram

The circuit is built around Arduino Nano (MOD1), 16×2 LCD with I2C/IIC interface (MOD2), three BC548 transistors, two IRF530 MOSFETs, and a relay.

Automatic Water Tank Filling System Circuit diagram
Fig. 2: Circuit diagram

Working

The availability of municipal supply is detected by the two electrodes drilled into the pipe and connected to Arduino. The gap between the electrodes acts as a hindrance to the flow of current (as resistance). When the municipal water is available, the current starts flowing through the electrodes, which is detected by the microcontroller in Arduino.

The flow of water from the municipal supply is controlled through a solenoid valve and the water pump is used to fill the water from underground storage tank to rooftop tank. Two one-way valves are used to prevent reverse flow of water. The two water supplies are merged to a single outlet through a ‘T’ connector.

The water level is determined by the three BC548 BJT transistors that act as switches. The bases of the BJTs are connected to the electrodes dipped into the tank at different levels (50%, 75%, and 100%) through resistors. When the water level reaches an electrode then the corresponding transistor turns on and thus the LED connected to the transistor also turns on. The collector pins of two transistors are also connected to the digital pins of the Arduino to further define the logic of the circuit.

Bill of Material
Components Quantity
Arduino Nano (MOD1) 1
16×2 LCD display with I2C/IIC interface (MOD2) 1
12V, 2A SMPS 1
LM2596 DC-DC buck converter (manually set to 5V) 1
Solenoid valve (L1) 1
10A, 240V, 2-pole contactor 1
IRF530 n-channel MOSFET (Q1, Q2) 2
BC548 BJT (Q3, Q4, Q5) 3
1N5402 diode (D1, D2) 2
10A10 diode (D3) 1
Green, yellow, and red LED 1 Each
100-ohm resistor (R4, R5, R6) 3
1.5k resistor (R8, R9) 2
2.2k resistor (R1, R2, R3) 3
10k resistor (R7, R10) 2
1×3 JST connector for the water level probe 1
DC jack to connect solenoid valve 1
220V 3-pin connector for water pump 1
AC 220V, 10A 3-pin panel mount plug socket for 220V input 1
10A rated switch 1
5V, one changeover relay 2
MECHANICAL COMPONENTS
1HP household water pump 1
PCV pipe (cut to different sizes as per diagram) 1 metre (min)
One-way valve 2
Elbow joint 2
Female copper adaptor 4
Steel hose nipple Steel hose nipple

 

The 16×2 LCD connected to the Arduino Nano through I2C displays the status of water supply and water pump.

The solenoid valve is controlled via a relay. The relay is controlled by the IRF530 MOSFET. The gate pin of the MOSFET is connected to the digital pin D9 of Arduino Nano through a resistor. The resistor connected between the gate of the MOSFET and the ground acts as a pull-down resistor. A flyback diode is connected in parallel to the coils of the relay to protect the MOSFET from high voltage created by collapsing magnetic fields.

The water pump can be directly controlled through the relay but due to high inrush current of the pump, the contacts of the relay can easily get damaged. Hence, a contactor similar to a relay is used, but it operates on 220V AC and has a bigger and heavier metal contacts that do not damage easily. The contactor is controlled through the same relay-MOSFET system as explained above. The gate pin of the MOSFET is connected to digital pin D8 of Arduino Nano.

The Arduino Nano is powered with a 5V input, which is achieved through a buck converter connected to the 12V supply. A 4700µF capacitor is connected to the 12V power supply to act as a low-pass filter.

[signinlocker id=”87626″]

Water Tank Filling System Code

Arduino Uno IDE is used here. In the Arduino code, the behaviour of the hardware components is defined based on the methodology mentioned earlier.

Automatic Water Tank Filling System Code
Fig. 3: Arduino code part 1
Fig. 4: Arduino code part 2
Fig. 4: Arduino code part 2

The variables GreenState, YellowState record the states of the transistors connected to green and yellow LEDs. Since the output is 180-degree phase shifted, ‘HIGH’ corresponds to a transistor being off and ‘LOW’ corresponds to the transistor being on. Fig. 3, Fig. 4, and Fig. 5 show snapshots of the source code.

Fig. 5: Arduino code part 3
Fig. 5: Arduino code part 3

The data from this variable is further used to define if-else logic to control the solenoid and the water pump. The LCD used to display the state of the two water sources is controlled using I2C communication. The libraries, Wire.h and LiquidCrystal_I2C.h, are utilised for I2C communication with the LCD. After each loop, a delay of 2000ms is added in the execution of the code.

You can download the complete code from electronicsforu.com. After getting the code ready, upload the code to Arduino by selecting the right port and board.

Construction and Testing

You can assemble the circuit on a small general-purpose PCB. But before assembly do not forget to upload the source code into Arduino Nano. The project has two parts, the mechanical assembly, and the electrical circuit. The pipe mechanical assembly is shown in Fig. 6.

Fig. 6: Mechanical pipe and valve assembly
Fig. 6: Mechanical pipe and valve assembly

The mechanical part of this project can be constructed using a 1.3cm (½-inch) dia PVC pipe and corresponding fittings. The following fittings may be required:

  • Elbow connector
  • ‘T’ connector
  • Female copper adaptor
  • Steel hose nipple
Automatic Water Tank Filling System
Automatic Water Tank Filling System

Two metal nails are inserted into the PCV pipe to act as electrodes to detect the availability of municipal supply, as mentioned earlier.

Fig. 8: Inside and top views of the circuit in an enclosure
Fig. 8: Inside and top views of the circuit in an enclosure

The complete circuit is soldered on a perf board as per the circuit diagram shown in Fig. 2. Terminal blocks are utilised to connect the 12V DC power, level probe, electrode, and solenoid. The three LEDs are soldered on a separate perf board and mounted on the enclosure. Heat-sinks are used for the MOSFETs to dissipate heat generated during their operation.

Fig. 9: Side views showing different connectors
Fig. 9: Side views showing different connectors

The complete assembly is shown in Fig. 8, Fig. 9, and Fig. 10.

Fig. 10: Complete pipe assembly
Fig. 10: Complete pipe assembly

The circuit is enclosed inside a plastic enclosure with the lid used to mount the LCD and the LEDs. Along with the circuit board, the 12V, 3.3A SMPS and the contactor are also fitted inside the enclosure.

On the sides of the enclosure, different connectors are mounted to connect the sensing elements and devices, as shown in Fig. 9. These connectors are:

  • JST connectors to connect the water level probe and the electrodes
  • DC jack to connect the solenoid valve
  • 220V, 3-pin connector to connect water pump
  • AC 220V, 10A rated 3-pin panel-mount plug and socket for 220V input
  • A 10A rated switch
Fig. 11: Water level is below 75%
Fig. 11: Water level is below 75%

The mechanical assembly is mounted vertically on the overhead tank and through a small hole the water level probe is inserted in the tank. A 0.5HP water pump is connected to the mechanical assembly, which will be controlled through the circuit. Working and testing of the circuit is shown in Fig. 11 through Fig. 12.

Fig. 12: Water tank is full
Fig. 12: Water tank is full

Case 1: Water level is below 75% and municipal supply is not available

  • Water is filled through the pump and the red LED is on.
  • Water filling stops when 75% water level has reached and now the yellow LED switches on.

Case 2: Water level is below 100% and municipal supply is available

  • Water is filled through the municipal supply and the yellow LED is on.
  • Water filling stops (solenoid valve turns off) when the tank becomes full and the green LED
    switches on.

Improvements Possible

The project is by no means perfect and can be improved as per requirements. For instance, the water level probe can be further enhanced by adding a grid of metal contacts to precisely measure the water level.

Water remaining in the municipal supply lines, even when the supply is not available, sometimes gives false data about the availability of the supply. It can be improved by
enhancing the mechanical design or by using a pressure sensor instead of a metal electrode.

Download Source code


Naman Tanwar is an IoT and electronics enthusiast who is pursuing his engineering from the School of Electronics Engineering, Vellore Institute of Technology in Tamil Nadu

[/signinlocker]

2 COMMENTS

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics