Introduction
     - In this article, I have explained how to measure water level and purity in a Tank with Arduino Mega 2560.
     
- It can be used to give information about the purity of a tank and the water level.
 
Parts
     - Arduino Mega 2560
- SRF-05 ultrasonic
- LED-2
- Hookup wires
 
SRF-05 Ultrasonic
Step 1: Connection from Sensor to Arduino board
     - Connect the GND of the sensor to the Gnd of the board.
- Connect the VCC of the sensor to the 5V of the board.
- Connect the trigger of the sensor to the digital pin 03 of the board.
- Connect the echo of the sensor to the digital pin 04 of the board.
 
Step 2: Connection From LEDs to Arduino board
 
 
Led 1 connection:
     - positive pin = 13
- negative pin = Gnd
 
 
Led 2 connection:
     - positive pin = 12
- negative pin = Gnd
 
Programming
     - #define ECHOPIN 03                            // Pin to receive echo pulse  
- #define TRIGPIN 04                          // Pin to send trigger pulse  
-   
- void setup(){  
-   Serial.begin(9600);  
-   pinMode(ECHOPIN, INPUT);  
-   pinMode(TRIGPIN, OUTPUT);  
-   pinMode(13, OUTPUT);  
-   pinMode(12, OUTPUT);  
- }  
-   
- void loop(){  
-   digitalWrite(TRIGPIN, LOW);                     
-   delayMicroseconds(2);  
-   digitalWrite(TRIGPIN, HIGH);                    
-   delayMicroseconds(10);  
-   digitalWrite(TRIGPIN, LOW);                     
-   int distance = pulseIn(ECHOPIN, HIGH);          
-   distance= distance/58;                          
-   Serial.println(distance);                       
-   delay(50);                                      
-   digitalWrite(13, HIGH);      
-   digitalWrite(12, HIGH);     
-   delay(1000);                
-   digitalWrite(13, LOW);       
-   digitalWrite(12, LOW);      
-   delay(1000);                
-     
- }  
 
Explanation: 
     - It is used to check the range of the water in a tank
- The pulse and distance are shown in the serial monitor
- When the tank meter is on, led is ON
- When the tank meter is off, led is OFF.