Knowing the amount of water in an overhead tank can be one tedious task. Usually, you’ll end up climbing up the stairs to the tank and checking the level manually or you’ll you hear the water overflowing from the top. But these days electronic water level indicators are available to fix this problem, but they often come with a hefty price tag and are usually difficult to install. Most of the available systems use dipped electrodes or float switches, which can be a headache in the long run. We present a different approach to knowing the water level using an Ultrasonic module with Arduino. The advantage of this method is that it is contactless, so issues like corrosion of the electrodes won’t affect this system. Furthermore, this Arduino water level indicator it is much easier to install than regular systems.
- ATMega328P microcontroller or Arduino board
- HC-SR04 Ultrasonic Ranging Module (aka PING sensor)
- 10K Resistor
- 16Mhz Crystal
- 22pf Disc capacitors: 2Nos
- Connecting wires
- LM7805 5V regulator
- 9V battery and connector
- 10uF electrolytic capacitor
- PCB or breadboard
- Wire stripper
Software needed: Arduino IDE
How Does it Work?
This Arduino water level indicator uses an ultrasonic sensor or Ping sensor to determine the level of water in the tank. The Ping sensor measures distance using sonar. An ultrasonic (well above human hearing) pulse is transmitted from the unit and distance-to-target is determined by measuring the time required for the echo return. Output from the Ping sensor is a variable-width pulse that corresponds to the distance to the target. This is then fed to the microcontroller that determines the water level and displays it through a series of LEDs.
The following project can be interfaced to an Arduino board if you have one or directly to an ATmega 328 microcontroller on a breadboard. You can also check out the DIY Hacking tutorial from Jeff to learn to interface an ultrasonic sensor to Arduino.
Code for the Arduino Water Level Indicator
Copy-paste the provided sketch in the Arduino IDE and find the line “ int d=18;” and change ‘18’ to the depth of your tank in centimeters.