Introduction: Water Level Detector Using Ultrasonic Sensor
The ultrasonic sensor works on the same principles as that of the radar system.
An ultrasonic sensor can convert electrical energy into acoustic waves and vice versa.
The famous HC SR04 ultrasonic sensor generates ultrasonic waves at 40kHz frequency.
Typically, a microcontroller is used for communication with an ultrasonic sensor. To begin measuring the distance, the microcontroller sends a trigger signal to the ultrasonic sensor. The duty cycle of this trigger signal is 10µS for the HC-SR04 ultrasonic sensor. When triggered, the ultrasonic sensor generates eight acoustic (ultrasonic) wave bursts and initiates a time counter. As soon as the reflected (echo) signal is received, the timer stops. The output of the ultrasonic sensor is a high pulse with the same duration as the time difference between transmitted ultrasonic bursts and the received echo signal.
Theoretically, the distance can be calculated using the TRD (time/rate/distance) measurement formula.
Since the calculated distance is the distance traveled from the ultrasonic transducer to the object—and back to the transducer—it is a two-way trip. By dividing this distance by 2, you can determine the actual distance from the transducer to the object.
Ultrasonic waves travel at the speed of sound (343 m/s at 20°C). The distance between the object and the sensor is half of the distance traveled by the sound wave. The following equation calculates the distance to an object placed in front of an ultrasonic sensor.
DISTANCE = (TIME TAKEN * SPEED OF SOUND)/2
Step 2: THINGS REQUIRED:
1) ARDUINO (UNO).
Step 3: SCHEMATICS FOR WATER LEVEL INDICATOR USING ULTRASONIC SENSOR.
Step 4: PROGRAM(calculate Distance in Metres)
program for measuring distance to program for measuring water level
Step 5: PROGRAM(CALCULATE DISTANCE IN CENTIMETRE)
Step 6: DISTANCE BEFORE WATER IS FILLED
DISTANCE BETWEEN LOWER PART AND ULTRASONIC SENSOR (6.38 CM)
Step 7: DISTANCE AFTER WATER IS FILLED
DISTANCE BETWEEN LOWER PART AND ULTRASONIC SENSOR (3.66 CM)
YOU CAN SEE THAT THE DISTANCE REDUCED IN LCD DISPLAY WHEN WATER IN THE PLASTIC GLASS IS FILLED.THIS SHOWS THAT OBJECT IS COMING CLOSE TO THE ULTRASONIC SENSOR.
ALSO THE ULTRASONIC SENSOR CANNOT DETECT THE DISTANCE LESS THAN 3CM AND ALSO ABOVE 400CM,SO TO AVOID THIS ERROR KEEP OBJECT IN RANGE 3CM TO 400CM.