Smart water level measurement with Arduino UNO and HC-SR04

Arduino 10-05-26
3871 1

Tutorial plan

1- Objective of the project

2- Required Components

3- Circuit Connections of system

4- Arduino program

 

 

Objective of the project

The objective of this project is to create a smart water level measurement system using an Arduino Uno, an HC-SR04 Ultrasonic Sensor, and an LCD display.

The system is designed to measure the water level in real time without direct contact with the liquid.

The measured level is then displayed on the LCD screen using graphical bars, allowing users to easily monitor the amount of water inside a tank, container, or reservoir.

Functionment

The HC-SR04 Ultrasonic Sensor is placed above the water tank to continuously send ultrasonic waves toward the water surface.

When these waves hit the water, they are reflected back to the sensor. The sensor calculates the distance between itself and the water surface based on the travel time of the ultrasonic waves.

Next, the Arduino Uno processes the received distance data and converts it into a water level value. According to the measured level, the Arduino generates graphical bars on the LCD display.

As the water level increases, more bars appear on the screen, and as the level decreases, fewer bars are displayed.

This graphical representation makes the monitoring system simple, clear, and user-friendly.

 

Required Components

1. Arduino UNO

Arduino Uno

The Arduino UNO is the main controller of the system. It receives the distance measurements from the ultrasonic sensor, processes the data, calculates the water level, and sends the results to the LCD display. It also controls the graphical bar display according to the measured water level.

2. HC-SR04 sensor

HC-SR04

The HC-SR04 sensor is used to measure the distance between the sensor and the water surface. It sends ultrasonic waves toward the water and receives the reflected waves to calculate the water level.

3. LCD Display with I2C Module

The LCD display is used to show the measured water level in real time. It can display text information as well as graphical bars that represent the amount of water in the tank. This makes the monitoring system easy to understand and visually interactive.

4. Jumper Wires

Jumper wires

Jumper wires are used to connect the Arduino UNO, FC-51 sensor, and LCD display together. They ensure proper electrical connections between all components.

 

Circuit Connections of system

 

1- Connection of HC-SR04 sensor to Arduino UNO

HC-SR04 sensor Arduino UNO
VCC 5V
GND GND
Trig D2
Echo D3

 

2- Connection of LCD I2C display to Arduino UNO

LCD I2C display Arduino UNO
VCC 5V
GND GND
SDA A4
SCL A5

 

Arduino program of system

This Arduino program is designed to measure the water level in real time using an HC-SR04 Ultrasonic Sensor, an Arduino Uno, and an I2C LCD display. The system continuously calculates the amount of water inside a tank or container and displays the result as a percentage and as graphical bars on the LCD screen.

You need to install this library : LiquidCrystal_I2C for I2C LCD screen.

 

At the beginning of the program, the necessary libraries for I2C communication and LCD control are included. The LCD display is then initialized with its I2C address and screen dimensions. The TRIG and ECHO pins of the ultrasonic sensor are configured to allow the Arduino UNO to communicate with the sensor and measure distances.

The program also creates several custom LCD characters that represent different bar fill levels. These custom characters are used to build a graphical progress bar on the LCD display, making the water level visualization more interactive and easier to understand.

Inside the loop() function, the Arduino sends an ultrasonic pulse through the HC-SR04 sensor. The sensor measures the time taken for the ultrasonic waves to travel to the water surface and return back. Using this time, the Arduino calculates the distance between the sensor and the water surface.

Next, the program converts the measured distance into a water level value based on the maximum tank height. The water level is then transformed into a percentage value. This percentage is displayed on the LCD screen together with a graphical bar indicator that increases or decreases according to the amount of water detected in the container.

Finally, the system repeats the measurement every 500 milliseconds, allowing continuous real-time monitoring of the water level.

1 comment

Image
edwin medina 13-05-2626

estoy interesado en arduino

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

Pictures of the articles

Robotic site created by Mohamed Ali Haj Salah - Teacher info