You can create a circuit to
measure the water level of a water tank using this HC-SR04 Ultrasonic Sensor.
You only have to add few lines in to the code that I used to display
measured distance from this sensor. Revised code is given below.
int echoPin = 2;
//Define Echo pin
int trigPin = 3;
// Define Trig pin
long inches,
duration, cm; //Define variables
int height=300; //define depth of tank in cm
int firstLED = 4; // define LEDs pin
int secondLED = 5;
int thirdLED = 6;
int fourthLED = 7;
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
//Define output pin
pinMode(firstLED, OUTPUT);
pinMode(secondLED, OUTPUT);
pinMode(thirdLED, OUTPUT);
pinMode(fourthLED, OUTPUT);
pinMode(echoPin, INPUT);
//Define input pin
}