Documentation of the Project [DIY Coursework Project ]


Objective- To Create an automated Water Pumping system using an ultrasonic sensor

(software and Hardware)


Skills Required(software)


Materials Required(Hardware)


Pictorial representation of the circuit
Circuit diagram

How does it work?


Source Code


source code 01 source code 02 source code 03 source code 04 source code 05 source code 06 source code 07

This Code is an Arduino sketch written in the C programming language. It controls a water level monitoring system using an ultrasonic sensor and an RGB LED. Here's a breakdown of the code:

  1. Libraries and Definitions: The necessary libraries are included, and some constants and pin assignments are defined.
  2. Variable Declarations: Various variables are declared, including the jar height, empty percentage, and timing variables.
  3. Setup Function: The setup function is executed once the Arduino board starts. It initializes the serial communication, sets pin modes, and prompts the user to enter the jar's height. It also sets the initial state of the pump and displays the initial water level percentage.
  4. Loop Function: After the setup function, the loop function is repeated. It continuously checks for serial input from the user and performs different actions based on the received commands. It also monitors the water level using the ultrasonic sensor and adjusts the pump, and RGB LED accordingly.
  5. Helper Functions: Several helper functions are defined, such as tell_percent (calculates the water level percentage based on the distance measured by the ultrasonic sensor), check_empty (checks if the water level is below the empty threshold), ask_mode (prompts the user to select a mode: default or custom), set_colour (sets the color of the RGB LED based on the water level percentage), display_percent (displays the water level percentage at regular intervals), and display_mode (displays the current mode and its specifications).

Overall, this code allows the user to monitor the water level in a jar or tank and control a pump based on the specified water level thresholds. It also provides visual feedback using an RGB LED.


Code Successfully Compiled.

Code Successfully Compiled

• The demonstration Video is uploaded to my YouTube channel, the link is given below Demonstration Video and the video can played here too




• Some Glimpse of the video demonstration is attached below


image0001 image0002 image0003 image0004 image0005 image0006