The Ultrasonic Sensor is used to detect the surface of water, which sends digital signals to the 8051 microcontroller. The 8051 takes in those signals, measures out the distance between the sensor and the surface of water using the code. Then the same code is used to light up the LEDs colourwise and also display live water amount percentage information depending on the percentage of water left.