π Lesson 7.1 β What is an Ultrasonic Sensor?
π What is an Ultrasonic Sensor?
An Ultrasonic Sensor is an electronic device that measures distance by using high-frequency sound waves (ultrasound).
It works on the principle of:
Sound Wave Reflection (Echo Principle)
The sensor sends ultrasonic waves and measures the time taken for the echo to return after hitting an object.
This time is converted into distance.
π¦ Common Ultrasonic Sensor Used
π Working Principle
1οΈβ£ Trigger pin sends ultrasonic pulse
2οΈβ£ Sound waves travel in air
3οΈβ£ Waves hit object (like water surface)
4οΈβ£ Echo returns to sensor
5οΈβ£ Echo pin measures return time
6οΈβ£ Distance is calculated using formula
π Distance Formula
Distance = Speed of SoundΓTime \ 2
Speed of sound β 343 m/s
In Arduino/ESP32 projects, we use:
π Pins of HC-SR04
| Pin | Function |
|---|---|
| VCC | 5V Power |
| Trig | Sends pulse |
| Echo | Receives echo |
| GND | Ground |
π Why Use Ultrasonic Sensor in Water Tank?
Instead of detecting water by contact (like conductive sensor), ultrasonic:
β Measures distance from top of tank
β No direct contact with water
β No corrosion
β More accurate
β Long life
β Suitable for permanent installation
π How It Works in Water Tank System
-
Sensor placed at top of tank
-
Measures distance to water surface
-
If distance is large β Tank Empty
-
If distance is small β Tank Full
Example:
| Distance | Tank Status |
|---|---|
| 25 cm | Low Water |
| 5 cm | Tank Full |
π Advantages
β Non-contact measurement
β Accurate distance calculation
β Long lifespan
β Works with ESP32 easily
β Industry-level solution
π Disadvantages
β Affected by temperature changes
β Not good in heavy mist or steam
β Slightly higher cost than conductive sensor
π Applications
-
Water tank monitoring
-
Smart irrigation systems
-
Liquid level monitoring
-
Obstacle detection
-
Parking sensors
-
Industrial automation
π― What Students Will Learn in This Lesson
-
Ultrasonic sensor working principle
-
Echo timing concept
-
Distance calculation
-
Non-contact liquid measurement
-
Why ultrasonic is better than basic water sensor
π Lesson Summary
An ultrasonic sensor measures distance using sound wave reflection.
In the Smart Water Management System, it is used to:
-
Measure water level accurately
-
Prevent overflow
-
Prevent dry run
-
Improve system reliability
This makes the system more professional and industry-ready.