
OUTPUT VIDEO:-
Water Level Indicator & Alarm for Water tank Overflow
Full Video With Steps
COMPONENTS :
1. Arduino
2.Ultrasonic Sensor
3.Buzzer
4.Water tank (or any bucket)
5.Jumper Wire (Male - Female)
Ultrasonic Sensor :- Sensor Gives Distance bewteen Sensor itself and Any Object or Obstacle in its path.
Ultrasonic sensors sends Sound Waves,which travels and when encounter any obstacle it gets Reflected .
How, We can Calculate Distance Using Ultrasonic Sensor ?
Velocity = Distance travelled / Time Taken
Therefore, Distance = Velocity * Time
Here, Velocity of Sound in air = 342 m/s
& Time = 2t as Time taken to reach and Time taken to get Reflected
Now,Sensor sends Micro Pulses of Frequency
now, Controller gets time taken by sound to reach and reflected is known .
Velocity of Sound in air is fixed = 342 m/s
So, Distance = Velocity of sound in air * Time taken /2
STEPS :
1. Connect Ultrasonic sensor with Arduino.
2. To calibrate Ultrasonic sensor
First, Mount the sensor above the height of Tank.
Now,Calculate distance between Sensor and Bottom of Tank using Scale Measurement ,& also with ultrasonic ,in order to confirm that ultrasonic sensor is showing Correct Readings.
See, Demo
-
Calibrating Sensor
Now, Water level = Distance between Sensor & Bottom of Tank - Changing distance of sensor and water.
See, Demo
Calculation Part for Water level
Here, If total distance bewteen Sensor and Bottom of Tank = 20 cm,
than, when Water is filled ,the distance bewteen sensor & Water Decreases i.e = Water level
So, Water level = total distance bewteen Sensor and Bottom of Tank - changing distance
SETUP :-
Trig pin of sensor to Pin 8 Of Arduino
Echo pin of sensor to Pin 9 Of Arduino
Vcc to 5v
Gnd to Arduino ground
Buzzer Positive red wire to Pin 13
Buzzer ground Black wire to Ground
CODING :-
Link To download :- https://drive.google.com/file/d/1b-FphGvXEaGMTFvrBYEZvx-Yw5EDEL8_/view?usp=sharing
Expalantion :-
Copy Code from below & u can try :-
// Connections defines pins numbers
const int trigPin = 8; // Sensor Trigger pin to Arduino pin 8const int echoPin = 9; // Sensor ECHO pin to Arduino pin 9int const buzzPin = 13; // Buzzer Red wire to Arduino pin 13 & black wire to Arduino Ground
// defines variables
int waterlevel; // Variable for storing Water level values ,Water level Riselong duration;int distance; // distance between Sensor and object , here object = Water
void setup() {//depth of tank is 11cmpinMode(trigPin, OUTPUT); // Sets the trigPin as an OutputpinMode(echoPin, INPUT); // Sets the echoPin as an InputpinMode(buzzPin, OUTPUT); // buzz pin is output to control buzzeringSerial.begin(9600); // Starts the serial communication
}
void loop() {// Clears the trigPindigitalWrite(trigPin, LOW);delayMicroseconds(2);// Sets the trigPin on HIGH state for 10 micro secondsdigitalWrite(trigPin, HIGH);delayMicroseconds(10);digitalWrite(trigPin, LOW);// Reads the echoPin, returns the sound wave travel time in microsecondsduration = pulseIn(echoPin, HIGH);
// Calculating the distance
// Distance = velocity of sound in air * time taken to reach and reflect/2
distance= duration*0.034/2; // Velocity of Sound in Air = 342 m/s
// Prints the distance on the Serial Monitor
//Serial.print("Distance= cm ");
//Serial.println(distance);
waterlevel=20-distance; // Sensor placed at 20cm away from bottom of bucketSerial.println(waterlevel); // function for water levelSerial.print("\nwaterlevel= "); // PrintsSerial.print(" (cm)"); // Prints unit " cm "delay(10);
// For determining how Volume Water in litres Filled at Certain Height
// So 20 cm = 5.6 litres and, so for 1 litre = 3.2cm height
// conditional Statement
if (waterlevel ==3.2) // if water reaches to the height 3.2cm than Volume is 1 litre{Serial.print("\n Water = 1 litre\n");delay(1000);}else if (waterlevel == 6.4){Serial.print("\n Water = 2 litre\n");delay(1000);}else if (waterlevel == 9.6){Serial.print(" \n Water = 3 litre\n");delay(1000);}else if (waterlevel == 12.8){Serial.print(" \n Water = 4 litre\n");delay(1000);}else if (waterlevel == 16){Serial.print("\n Water = 5 litre\n");delay(1000);}
// For Tank OVERFLOW ALARM
// if distance between Sensor and water is 2cm or less , Buzzer should start BUZZING.. and With Message
// " WATER OVERFLOWING "
if (distance <= 2) {Serial.print("\nWater Overflowing\n "); // Indicates " Water overflowing "delay(10);// BuzzdigitalWrite(buzzPin, HIGH); // Switch Buzzer HIGH or ON or starts Buzzing} else {// Don't buzzdigitalWrite(buzzPin, LOW); // else Buzzer off}}
Other Articles :-
Covid Face Mask Tracking in Matlab
http://covidfacemaskdetectioninmatlab.blogspot.com/2021/02/blog-post.html
https://biomedicaljobsinindia.blogspot.com/2018/03/biomedical-engineering-job-options-in.html
Face tracking in Matlab using ACF Object detector and Image Labeler
Contactless Water Level indicator & Alarm for Water tank overflow
http://watertankoverflowalarm.blogspot.com/2021/02/blog-post.html
No comments:
Post a Comment