Water Level Detection System Using ESP32

Water Level Detection System Using ESP32

Water Level Detection System Using ESP32
Water Level Detection System

Water Level Detection System Using ESP32

In this Article, we learn about how to make Water Level Detection System Using ESP32.

In the Last post, we learned about how to Interfacing RC522 RFID Sensor with ESP32 Using Arduino IDE.

Let’s dive into

Components Require:

  1. ESP32 module
  2. Relay Module
  3. DC water motor
  4. Water detection sensor
  5. Jumper wires

Circuit Diagram: 

Water Level Detection System Using ESP32
Circuit Diagram

How it works:

The water level detection system using ESP32 works by utilizing a water level detection sensor to measure the distance from the sensor to the water surface.

The ESP32 development board is the brain of the system. It is a powerful microcontroller with built-in Wi-Fi capabilities.

The water level detection sensor is used to measure the distance between the sensor and the water surface.

Water Level Detection System Using ESP32
Before Detection
Water Level Detection System Using ESP32
After Detection

Usages:

Water level detection system using the ESP32 microcontroller is a great project that can be useful in various applications, such as monitoring water levels in tanks, rivers, or other water bodies. Some of them are below:

  1. Home Water Tanks Monitoring
  2. Agricultural Irrigation
  3. Flood Monitoring
  4. Smart Gardens
  5. Swimming Pool Maintenance

Video Tutorial:

 

[dt_code]

#define RELAY_PIN 13 // The ESP32 pin GPIO13 that connects to the relay to control the pump
#define POWER_PIN 32 // The ESP32 pin GPIO32 that provides the power to the water sensor
#define SIGNAL_PIN 34 // The ESP32 pin GPIO36 that reads the value from the water sensor

#define THRESHOLD 1000 // The threshold for water detection

void setup() {
Serial.begin(9600);
pinMode(RELAY_PIN, OUTPUT); // configure D2 pin as an OUTPUT
pinMode(POWER_PIN, OUTPUT); // configure D7 pin as an OUTPUT
digitalWrite(POWER_PIN, LOW); // turn the water sensor OFF
digitalWrite(RELAY_PIN, LOW); // turn the pump OFF
}

void loop() {
digitalWrite(POWER_PIN, HIGH); // turn the water sensor’s power ON
delay(10); // wait 10 milliseconds
int value = analogRead(SIGNAL_PIN); // read the analog value from sensor
digitalWrite(POWER_PIN, LOW); // turn the water sensor’s power OFF

if (value < THRESHOLD) {
Serial.print(“The water is detected”);
digitalWrite(RELAY_PIN, LOW); // turn the pump ON
} else {
digitalWrite(RELAY_PIN, HIGH); // turn the pump OFF
}

delay(1000); // pause for 1 sec to avoid reading sensors frequently to prolong the sensor lifetime
}

[/dt_code]