Intelligent water level detection using HC-SR04 and ESP32

ESP32 17-05-26
20 0

Tutorial plan

1- Objective of the project

2- Required Components

3- Circuit Connections of system

4- MicroPython code for ESP32

Objective of the project

The objective of this project is to design an intelligent water level detection system using an Espressif Systems, an HC-SR04 ultrasonic sensor, an LCD I2C display, and a glass container.

The system measures the water level in real time and displays the results on the LCD screen using graphical bars or percentage values.

This project helps users monitor the amount of water inside the glass automatically and accurately.

Functioning

When water is poured into the glass, the HC-SR04 ultrasonic sensor emits ultrasonic waves toward the water surface.

These waves are reflected by the water and return to the sensor.

The ESP32 calculates the distance between the sensor and the water surface using the returned signal time.

According to the measured distance:

- If the water level increases, more bars are displayed on the LCD screen.

- If the water level decreases, fewer bars are displayed.

The LCD I2C display continuously shows the water level in real time, allowing easy and intelligent monitoring of the water quantity inside the glass.

 

Required Components

1. ESP32 board

The ESP32 is a powerful microcontroller board used to control the entire system. It processes the data received from the ultrasonic sensor and sends the results to the LCD display.

2. HC-SR04 sensor

HC-SR04

The HC-SR04 sensor is used to measure the distance between the sensor and the water surface. It works by transmitting ultrasonic waves and receiving the reflected waves from the water.

3. LCD Display with I2C Module

The LCD I2C display is used to show the water level information in real time. It can display percentage values and graphical bars representing the water level.

4. Jumper Wires

Jumper wires

Jumper wires are used to establish electrical connections between the ESP32, the sensor, and the LCD display.

5. Breadboard

The breadboard is used to connect the electronic components without soldering. It simplifies circuit assembly and testing.

 

Circuit Connections of system

 

1- Connection of HC-SR04 sensor to ESP32

HC-SR04 sensor ESP32 board
VCC 5V
GND GND
Trig GPIO 18
Echo GPIO 19

 

2- Connection of LCD I2C display to ESP32

LCD I2C display ESP32 board
VCC 5V
GND GND
SDA GPIO 21
SCL GPIO 23

 

MicroPython code for ESP32

This MicroPython program is designed to implement a smart water level monitoring system using an Espressif Systems, an HC-SR04, and an LCD I2C display.

You need to install this two libraries : i2c_lcd et lcd_api for I2C LCD screen.

 

How it works ?

- The HC-SR04 sensor measures the distance between the sensor and the water surface.

- The ESP32 calculates the actual water level based on this distance.

- The water level is converted into a percentage (0% to 100%).

- The LCD I2C displays: the water level percentage and a graphical bar representation of the water level

0 comment

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