Water Tank and Water Pump Automation by Using ESP32

This project aims to automate the process of water level monitoring and water pump control using an ESP32 microcontroller, a waterproof ultrasonic sensor, a relay module, and the Blynk IoT app. By integrating these components, you can remotely monitor and control the water level in your tank via your smartphone. The system will also ensure that the pump turns on and off automatically based on the water level, preventing water overflow or the pump running dry.

Components used in this Project:

  1. ESP32:
    • The microcontroller that connects to the internet and interfaces with the sensors, relay module, and Blynk app.
    • It supports both WiFi and Bluetooth, making it ideal for IoT projects.
  2. Waterproof Ultrasonic Sensor (e.g., JSN-SR04T):
    • Used to measure the water level in the tank by calculating the distance between the sensor and the water surface.
    • The JSN-SR04T is waterproof, making it ideal for outdoor or wet environments.
  3. Relay Module:
    • A relay module will be used to control the water pump. It acts as a switch, turning the pump on or off based on the water level in the tank.
    • You can use a 5V relay module, which can handle the switching for an AC-powered water pump.
  4. Water Pump:
    • The water pump will be controlled by the relay module. The pump starts filling the tank when the water level is low and stops when the tank is full.
  5. Blynk IoT App:
    • This app provides real-time monitoring and control of the water level and pump status. It is an IoT platform that allows you to create a graphical user interface (GUI) on your smartphone to interact with your ESP32 device.
  6. Jumper Wires and Breadboard for connections.
  7. Power Supply:
    • A power supply (typically 5V or 12V, depending on the pump and relay) is needed to power the relay module and pump.

Working Principle of Project:

The automation process follows a basic flow:

  • The ultrasonic sensor continuously measures the distance between itself and the water surface in the tank.
  • Based on the distance (converted to a percentage of the water level), the ESP32 sends commands to the relay module to either turn the water pump ON or OFF.
  • You can monitor the water level in real-time using the Blynk IoT app, which connects to the ESP32 via WiFi.
  • The system also provides remote control of the pump, allowing the user to manually turn it on or off through the app.

1. Ultrasonic Sensor to Measure Water Level

The JSN-SR04T ultrasonic sensor works by emitting ultrasonic waves and calculating the time it takes for the waves to bounce back from the water surface. This time is converted to distance using the formula:Distance=Speed of sound×Time2\text{Distance} = \frac{\text{Speed of sound} \times \text{Time}}{2}Distance=2Speed of sound×Time​

In this project:

  • The sensor is placed at the top of the water tank.
  • It measures the distance from the sensor to the water level.
  • By subtracting this distance from the total height of the tank, the system calculates the current water level.

2. ESP32 Microcontroller

  • The ESP32 will receive data from the ultrasonic sensor.
  • Using the data, the ESP32 will decide whether to turn the pump on or off, depending on the predefined water levels (e.g., turn on when the tank is 20% full, turn off when 90% full).
  • The ESP32 is connected to the internet via WiFi, allowing it to send data to the Blynk app.

3. Relay Module for Pump Control

  • The relay module acts as a switch for the pump. When the ESP32 decides to turn the pump on or off, it sends a signal to the relay module.
  • The relay opens or closes the circuit, turning the water pump on or off.

4. Blynk IoT App for Remote Monitoring and Control

  • Create a Blynk Account: Download the Blynk app (available for both iOS and Android) and create an account.
  • Create a New Project: Set up a new project on Blynk with ESP32 as the board. Blynk will generate an authentication token, which you’ll use in your ESP32 code.
  • Add Widgets:
    • Use a Gauge widget or Vertical Level widget to show the current water level in the tank.
    • Add a Button widget to manually control the pump (ON/OFF).
    • Add LED indicators to show pump status (running or stopped).

Circuit Diagram:

Code:

#define BLYNK_TEMPLATE_ID "YourTemplateID"
#define BLYNK_DEVICE_NAME "Water Tank Automation"
#define BLYNK_AUTH_TOKEN "YourBlynkAuthToken"

#include <WiFi.h>
#include <BlynkSimpleEsp32.h>

// Blynk auth token
char auth[] = "YourBlynkAuthToken";

// Your WiFi credentials
char ssid[] = "YourWiFiSSID";
char pass[] = "YourWiFiPassword";

#define TRIG_PIN 4
#define ECHO_PIN 5
#define RELAY_PIN 2
long duration;
float distance, waterLevel;
const float tankHeight = 100; // Example tank height in cm

BlynkTimer timer;

void setup() {
  Serial.begin(115200);
  pinMode(TRIG_PIN, OUTPUT);
  pinMode(ECHO_PIN, INPUT);
  pinMode(RELAY_PIN, OUTPUT);

  // Start Blynk
  Blynk.begin(auth, ssid, pass);
  
  // Timer to measure water level every 5 seconds
  timer.setInterval(5000L, measureWaterLevel);
}

Applications of Project:

The project “Water Tank and Water Pump Automation using ESP32, Waterproof Ultrasonic Sensor, Relay Module, and Blynk IoT App” can have a wide range of applications across different sectors and environments. Below are some practical and impactful applications:

1. Domestic Water Tank Automation

  • Description: This system can be used in homes to automate water tanks, ensuring that the water pump operates only when the water level drops below a certain threshold. This helps avoid water overflow or the pump running dry.
  • Benefit: It saves water and electricity by ensuring that the pump runs only when necessary. Additionally, remote monitoring through the Blynk app allows users to check the water level from anywhere.

2. Apartment and Building Water Management

  • Description: In multi-story buildings or residential complexes with shared water tanks, this system can automate the filling process and provide residents or maintenance teams with real-time monitoring of water levels.
  • Benefit: It helps ensure a continuous water supply to all residents while preventing unnecessary pump usage, thereby reducing water wastage and energy consumption.

3. Agricultural Irrigation Systems

  • Description: In agriculture, water storage tanks are often used to supply water to irrigation systems. Automating the water pump based on the tank’s water level ensures a consistent water supply to crops, improving irrigation efficiency.
  • Benefit: Automating irrigation systems helps optimize water usage, reduce manual intervention, and prevent the risk of the pump running dry, which is particularly beneficial in water-scarce areas.

4. Industrial Water Supply Systems

  • Description: Industries that require large volumes of water for cooling, manufacturing, or processing can use this automated water management system to maintain optimal water levels in their storage tanks.
  • Benefit: It ensures the continuous availability of water for industrial processes, minimizes human supervision, and prevents operational downtime caused by water shortages or tank overflows.

5. Rural and Remote Water Management

  • Description: In rural or remote areas, where water supply and pump maintenance might be difficult, this system can automate the process and provide remote monitoring via the Blynk IoT app. Even in off-grid locations, solar-powered versions of this system can be implemented.
  • Benefit: It reduces the need for manual water level monitoring and pump operation in remote areas, making water management more reliable and efficient.

6. Rainwater Harvesting Systems

  • Description: This system can be integrated with rainwater harvesting setups where collected rainwater is stored in tanks. Automated control ensures that the tank does not overflow and can activate a pump to move excess water to secondary storage or use it for irrigation.
  • Benefit: By automating the system, rainwater is effectively stored and used, reducing reliance on freshwater sources, and contributing to sustainable water management practices.

7. Commercial Buildings and Office Complexes

  • Description: In office buildings, commercial complexes, or shopping malls, large water storage tanks are used for both regular water supply and firefighting systems. Automating the water supply to these tanks ensures adequate water levels for emergencies and day-to-day use.
  • Benefit: It eliminates the risk of running out of water for essential operations and improves the reliability of the building’s water management system.

8. Hotel and Hospitality Water Systems

  • Description: Hotels and resorts often require large quantities of water for their operations. This system can automate the monitoring and refilling of water tanks used for guest rooms, laundry, swimming pools, and landscaping.
  • Benefit: It ensures that water supply remains consistent and avoids disruptions in service, contributing to improved guest satisfaction and operational efficiency.

9. Smart City Water Management Systems

  • Description: In smart city projects, IoT-enabled water management systems can be deployed to monitor and control multiple water storage tanks in real-time across urban areas, optimizing the overall distribution of water.
  • Benefit: It helps reduce water wastage, ensures efficient distribution, and supports the sustainable management of urban water resources.

10. Emergency Water Storage Systems

  • Description: This project can be used in areas prone to natural disasters (e.g., droughts, floods) to automate the management of emergency water storage systems. During emergencies, the water supply can be managed more effectively, ensuring availability when needed.
  • Benefit: It enhances the resilience of communities by ensuring that emergency water storage systems are kept at optimal levels without requiring constant manual supervision.

11. Water Distribution Systems for Parks and Gardens

  • Description: Public parks, gardens, and landscapes often rely on stored water for irrigation. This system can automate water distribution to ensure that plants are watered based on the available water in the tank.
  • Benefit: It saves water by optimizing irrigation schedules and preventing unnecessary pump usage, leading to better plant health and reduced water consumption.

12. Fish Farms and Aquaculture

  • Description: In fish farms and aquaculture, where water levels in tanks or ponds need to be carefully monitored and maintained, this system can automate water refilling and pumping processes.
  • Benefit: It ensures a stable water level, which is critical for the health of aquatic animals, and reduces the need for manual water management, allowing for more efficient farm operations.

13. Smart Homes Integration

  • Description: For homes that are part of a larger IoT ecosystem, this project can be integrated into a smart home system, enabling it to work with other IoT devices like water leak detectors, smart irrigation systems, and home automation platforms.
  • Benefit: It adds another layer of automation to smart homes, making the home more efficient in water usage and control. Homeowners can manage their water systems from their phones, along with other smart devices.

14. Municipal Water Supply and Sewage Systems

  • Description: In municipal water supply systems, automation of water tanks and pumps can help optimize the distribution of water across different parts of a city or town, reducing water wastage and ensuring a consistent supply to residents.
  • Benefit: Automated water management can help municipalities better manage their resources, reduce water shortages, and monitor the overall system performance in real time.

Benefits of Project:

Energy Savings: By automating the control of the pump, energy is saved since the pump is only turned on when necessary, reducing unnecessary operation time.

Water Conservation: Preventing water overflow helps conserve water, especially in areas where water is a scarce resource.

Remote Monitoring and Control: Using the Blynk IoT app, users can monitor the water level and control the pump remotely, adding convenience and flexibility.

Reduced Manual Labor: The system eliminates the need for constant manual supervision, making it highly useful in remote areas or large systems.

Safety: Automated systems reduce the risk of pump damage due to dry running or other malfunctions, extending the lifespan of the pump.

Conclusion:

With this project, you’ll be able to automate the water pump and monitor the water tank level in real-time using the Blynk IoT platform. This setup ensures efficient water usage and prevents overflow or the pump running dry, all while providing remote control via the internet.

Leave a Reply

Your email address will not be published. Required fields are marked *

Facebook
YouTube
× Contact us