Fill/Empty Water Level Controller

A controller for keeping the water level stays  between upper and lower limits is described here. This water level controller is actually a water pump controller that turn the pump on or off based on the detected water level. This water level controller has two modes: fill and empty. Here is the schematic diagram of the circuit:

water-pump-controller

For the empty mode, the water pump is used to suck the water from the tank. If the water reach the upper level limit, the pump will be turned on to drain the tank, until the level falls down to the lower level limit. At the fill mode, the pump is used to fill the tank with water, thus if the water level falls below the lower limit, then the pump will be turned on to fill the tank with the water.  The SW1 set the mode, with the empty mode default value (as shown in the schematic).