Liquid level measurement is a very important application in industrial environment, There are several methods to measure liquid level. Here I will use ultrasonic sensor to measure the liquid level in a tank. Surely this method is one of the best method available for measurement of liquid level and the output is continuous as well.
The principle is very simple , we will send sound waves from sensor towards the liquid surface, the waves hits the surface and comes back to sensor , by measuring the time taken for the waves to hit the sensor we can calculate the distance between liquid surface and sensor.
I am going to use HC-SR04 here. The sensor working is very simple. We need to send 10us long trigger pulse on trigger pin to start measurement. Once measurement completed you will get signal on echo pin, the length of echo pulse will be equal to the time taken by sound to travel from sensor to liquid surface and back. So we need to capture the length of the echo pulse in order to measure Dm.
The following function(written for Atmega8) will calculates the Dm.
Comments