This is a water level monitor with Raspberry pi which will alert you if the tank is full. It is the easiest IOT project.


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. if you want the video project, it is below.

Or, the written project is below

Extra Materials:


Water Jug


Now let’s talk about the connections of the raspberry pi, ultrasonic sensor and Buzzer.

Please follow the circuit diagram given below



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


· Attach a scale to the bucket.

· Next attach the buzzer and ultrasonic sensor to the scale



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

1. Open the Thonny Python IDE

2. Download the Github code or from below:


3. Run the code.


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

If you have any queries, please ask at [email protected]

To know more, visit

Shafin Kothia