

Introduction
In India, many houses have mainly two sources of water to fill the rooftop water tank. These are underground storage tank and municipal water supply. Based on the availability, the rooftop tank is filled either with the municipal supply or with the underground storage tank manually. The rooftop tank is filled with water from underground storage tank which the help of a water pump.
This manual way of filling the tank requires a lot of manual monitoring of the water level inside the tank and also increase the wastage of water. To reduce water wastage and to improve the quality of life, this project aims to fill the tank automatically without any human intervention.
This project will determine the level of water in the rooftop tank, check for the availability of any supply to fill the tank, and then fill the tank to the desired level using any of the two available source. 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 i.e., Arduino Nano and many analog electronic devices like BJT, MOSFETs, and diodes are also utilised.
Design
Methodology:
The working of the project can be defined using two cases which will utilise different water source based on availability.
Case 1: Water level is below 75% and municipal supply is not available.
In this case, water will be filled through the underground tank using water pump till a maximum of 75% water level is reached.
Case 2: Water level 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.
Mechanical Design:

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 (Resistance). When the supply is available then the current starts flowing through the electrodes which then is detected by the Arduino (Microcontroller).
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 supply is merged to a single outlet through a T-connector.
Circuit Diagram:

The water level is determined by the 3 BJTs acting as a switch. The base of the BJTs are connected to the electrodes dipped into the tank at different levels (50%, 75% and 100%) through a resistor. When the water level reaches an electrode then the corresponding BJT turns on and thus the LED connected to the BJT also turns on. The collector pins from the two BJT is also connected to the Digital pins of the arduino to further define the logic of the circuit.
A 16×2 LCD is connected to the arduino nano through I2C communication to display the status of 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. A resistor is connected between gate of the MOSFET and ground which acts as a pull down resistor. A flyback diode is connect 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 eaisly get damaged. Hence, we are using a contactor. A contactor is similar to a relay but it is operated with a 220V AC and has a bigger and heavier metal contacts which can’t get damaged eaisly. 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. The 5V achieved through a buck convertor connected to a 12V supply. A 4700uF capacitor is connect to the 12 supply to act as a Low-Pass filter.
Arduino Code:



In the Arduino code, the behaviour of hardware components is defined based on the Methodology mentioned eairlier.
The variables GreenState, YellowState records the state of the transistors connected to green and yellow LEDs. Since the output is 180 degree phase shift, ‘HIGH’ corresponds to transistor being off and ‘LOW’ correcponds for the transistor being on.
The data from these variable is further used to define if –else logic to control the solenoid and the water pump.
A 16×2 LCD is used to display the state of the two water sources. The LCD is being controlled using I2C communication. The libraries, Wire.h and LiquidCrystal_I2C.h is utilised for I2C communication to the LCD.
After each loop, a delay of 2000ms is added in the execution of the code.
Design Implementation
Mechanical Build:
The mechanical part of this project is constructed using ½ inch PVC pipe and its fittings.

The following fittings are used:
- Elbow connector
- T- connector
- Female copper adapter
- Steel Hose nipple
Two metal nails are inserted into the PCV pipe to act as electrode to detect the availability of municipal supply (As discussed in Mechanical Design Section)

Circuit:
The complete circuit is soldered on a perfboard as per the circuit diagram. Terminal blocks are utilized to connect the 12v dc power, level probe, electrode and the solenoid.
The three LEDs are soldered on a separate perfboard in order to mount it to the enclosure.
Heat skins are added to the MOSFETs to dissipate heat generated during MOSFET’s operation.

Complete Electronic Assembly:
The circuit is enclosed inside a plastic enclosure with the lid being used to mount the LCD and the LEDs. Along with the circuit, a 12V 3.3A SMPS and a Contactor is also enclosed inside the enclosure.

On the Sides of the enclosure, different connectors are mounted to connect deferent sensing elements and devices.
These connectors are:
- JST connectors to connect the water level probe and the electrodes
- DC jack to connect Solenoid Valve
- 220v 3pin connector to connect Water Pump
- AC 220V 10A 3pin Panel Mount Plug Socket for input 220V
- A 10 A rated switch
Complete Assembly:
The mechanical part is mounted vertically on a small tank. And through a small hole, the water level probe is inserted in the tank.

A 0.5 HP water pump is connected to our mechanical build which will be controlled through the circuit.
Working:
Case 1: Water level is below 75% and municipal supply is not available.

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



Future Improvements
- The water level probe can be further enhanced by adding a grid of metal contacts to precisely measure the water level.
- Water tends to fill in the supply checking electrode which sometimes tends to give 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 metal electrodes.