Water Level Monitor Using Raspberry Pi

Water Level Monitor Using Raspberry Pi

Project link

Hello everybody, I am Shafin, a member of Aiversity. I am going to share about how to build a water level sensor for water tanks with a Raspberry pi. This project is going to help you to understand the working of Raspberry pi in detail. 

For the video project, see below:


  • Raspberry Pi Model 3B 
  • Ultrasonic Sensor
  • Jumper Wires
  • Buzzer

Raspberry Pi model 3B:

Raspberry Pi is a credit card-sized programmable computer that fits in your pocket. In this project, I am using a Raspberry Pi model 3B. It has 40 Gpio pins, 4 USB ports, charging and an HDMI port with an Ethernet port. It is compatible with almost all projects.


Ultrasonic Sensor:

Ultrasonic Sensor is a sensor that can measure the distance between the sensor and the object using echolocation i.e the principle which bats use.


A buzzer is a small component that gives out a sound wave when is switched on. We are going to use this to alert if our water tank is full  

In addition to these , we will need a bucket and a jug



As we are familiar with the working of the components, let's take a look at the connections.


Ultrasonic sensor Vcc to 5v of Raspberry Pi

Ultrasonic sensor Gnd to Gnd of Raspberry Pi

Trigger to GPIO 2

Echo to GPIO 3

Buzzer + to GPIO 4

Buzzer – to Gnd 



The Structure is given at the right.



Now you know the connections and the structure, let’s build the code.

1. Open the Thonny Python IDE

2. Download the Github code:


3. Run the code.


Fill water in the bucket. When the distance of the ultrasonic sensor from the water is around 4 centimeters, the buzzer will beep, alerting the bucket is almost full.

If you have any queries, please ask at hello.aiversity@gmail.com

To know more, visit aiversity.com