The HC-SR04 ultrasonic sensor emits high-frequency sound waves that bounce off the water surface and return. The Arduino Nano measures the round-trip time, calculates the distance using the speed of sound, and translates that distance into a water level percentage based on the tank's total height. This calculated percentage is then displayed in real-time on the I2C OLED screen.
Why Build This
Prevent water tank overflow in homes and buildings
Automate and optimize water usage for agriculture
Learn to interface displays and sensors with microcontroller boards
Real-World Application
This system is used in residential overhead tanks to prevent water wastage, in agricultural irrigation systems to manage water reservoirs, and in industrial settings for liquid level monitoring.
Skills You'll Learn
Interfacing HC-SR04 ultrasonic sensor with Arduino
Connecting and driving I2C OLED displays
Calculating distance and percentages from time-of-flight data
Basic circuit assembly on a breadboard
Safety Precautions
Ensure all wiring connections are double-checked before plugging in the 5V power supply to prevent short circuits. Keep the electronic components away from direct water splashes or high humidity environments to avoid damaging the Arduino and display.
Technology Tags
ARDUINO NANO
ULTRASONIC SENSOR
HC-SR04
OLED DISPLAY
SSD1306
WATER LEVEL
Frequently Asked Questions
Check your I2C connections (SDA to A4, SCL to A5) and verify the display's I2C address, which is typically 0x3C or 0x3D.
Ensure the tankHeight variable in your code accurately matches the physical height of your water tank.
You can power the circuit using a standard USB cable connected to your computer or a portable 5V battery pack.
This page is part of Kitkraft's Project Hub — a curated collection of electronics & robotics projects gathered from the maker community to help students and hobbyists discover and learn to build. Kitkraft does not claim authorship of the original project, and makes no representation as to the accuracy, completeness or safety of third-party source material. The summary and "How It Works" explanation above are AI-generated, rewritten with reference to the original tutorial — not a reproduction of it. Full credit and a direct link to the original source are provided above. If you're the original creator and have a concern about how your work is represented here, please contact us and we'll address it promptly.