Ultrasonic Water Level Indicator

by Gallium Nitride in Circuits > Arduino

336 Views, 9 Favorites, 0 Comments

Ultrasonic Water Level Indicator

WhatsApp Image 2024-07-15 at 17.58.18.jpeg

Have you ever been in a situation when you open your water tap and there's nothing coming? When your tanks are empty, we will not know unless and until the water inside the tank drains entirely. Also, every year, a very large amount of fresh water is being wasted because we often forget to turn of our water pump or we don't really know how much water has been filled unless we see in the tank. In order to fix these problems, I have made a very simple and cheap water gauge display with a simple ultrasonic sensor and an Arduino Nano.

Supplies

WhatsApp Image 2024-07-14 at 21.40.59 (1).jpeg
WhatsApp Image 2024-07-14 at 21.40.59 (2).jpeg
WhatsApp Image 2024-07-14 at 21.40.59.jpeg
WhatsApp Image 2024-07-14 at 21.41.00.jpeg
WhatsApp Image 2024-07-14 at 22.39.31.jpeg

1) An Arduino nano

2) A breadboard

3) An ultrasonic sensor

4) Jumper wires

5) SSD1306 OLED display

Why an Ultrasonic Sensor ?

Screenshot 2024-07-15 at 17.56.13.png

An ultrasonic sensor will sense the distance by using sound. So, I have used an ultrasonic sensor in order to measure the distance that varies based on the level of water in the tank. The main reason why I used an ultrasonic sensor is that its simple to install and most importantly, we don't have any problem with corrosion that we face in a sensor that senses the water level underwater.

Connection to the Ultrasonic Sensor

Screenshot 2024-07-15 at 16.57.55.png

An ultrasonic sensor will have 4 terminals. VCC, Trig, Echo and Gnd. The VCC and Gnd are self explanatory. While the Trig pin connects to D9 and Echo pin connects to D10.

Connection to the SSD1306 OLED Display

Screenshot 2024-07-15 at 17.01.50.png

The OLED display will have Gnd, VCC, SCK and SDA. The Serial Clock (SCK) connects to A5 of the Arduino. The Serial Data (SDA) connects to A4.

Code

Screenshot 2024-07-15 at 17.13.05.png

Once the connections are made, upload the code given below. Make adjustments based on your tank's height in the variable "TANK_HEIGHT_CM". Currently, it is set to 30cm.

Enjoy!

WhatsApp Image 2024-07-15 at 17.35.17.jpeg

Now, you can sit relaxed, knowing that you can see the amount of water left in your tank and also, save some water.