Skip to content

A pump/induction motor controller with dry running protection, timer, error detection, time-left to fill, diagnostics and other smart features.

License

Notifications You must be signed in to change notification settings

desiFish/ESP32-Advanced-Water-Pump-Controller

Repository files navigation

🌊 Advanced Water Pump Controller

A smart pump/induction motor controller with advanced features and protection systems

Release License Top Language Issues Last Commit Repo Size Stars ESP32 Ready Arduino Compatible

⚠️ Important Disclaimer

Project Status: Active Development & Testing
This is a new project under continuous development. Features, documentation, and test data will be updated regularly.

Safety Notice:
• This project uses hobby-grade components and is NOT designed for 24/7 commercial operation
• While safety features are implemented, they should not be considered fail-safe
• Use appropriate commercial-grade equipment for critical applications
• No liability is accepted for any damages resulting from using this project

🎯 Key Features & Capabilities

💪 Core Features
  • ⚡ Dual Core ESP32 - One core for UI, one for sensor monitoring
  • 🔄 OTA Updates - Over-the-air firmware updates via local network
  • 📱 WiFi Manager - Easy device setup using smartphone
  • 💾 Preferences - Persistent settings storage
🛡️ Protection Systems
  • 🚱 Dry Run Protection - Prevents pump damage from running dry
  • ⚠️ Overload Detection - Monitors current draw and shuts off if exceeded
  • 🔌 Short Circuit - Advanced electrical protection features
  • 📊 Load Monitoring - Real-time current and power monitoring
🎮 Smart Controls
  • 🔘 One-Button System - Short press to navigate, long press to select
  • 📟 OLED Display - 128x64 clear visual interface
  • 🚥 RGB Indicators - Status and warning indicators
  • ⏲️ Timer Controls - Scheduled operations
📊 Monitoring & Logging
  • 💧 Water Level - Real-time tank level monitoring
  • 📈 Google Sheets - Data logging and analysis
  • 🔍 Diagnostics - Comprehensive system monitoring
  • ⚡ Power Stats - Current and power consumption tracking

Note: Settings and parameters can be customized through an intuitive menu system.

ESP32 Dual Core Advanced Protection OLED Interface Logging Enabled

🔧 Hardware

Item Description Notes
1. Tested on: DOIT ESP32 DEVKIT V1 (30 pin)
2. 128x64 OLED Display
3. ZMPT101B Voltage Sensor Removed
4. DS1307 RTC
5. SCT013 30A/1V Current sensor Check for Wiring
6. AJ-SR04 Ultrasonic Sensor(Water Proof) Check Mode 2 for connection
7. WS2812B LED (Single LED Module)
8. Any Push Button I used metal one, feels sturdy
9. Any desired float sensor
10. Wires, connectors, etc According to your need
11. Fotek 100Amps SSR

🚀 Upcoming Features

Check Issues

📸 Pictures & Schematics

Schematics

Circuit Schematic

Controller View 1

Front View

Controller View 2

Front View 2

Controller View 3

Front View 3

Controller View 4

Full View

Controller View 6

Ultra Sonic

Controller View 5

Ultra Sonic USB

Controller View 7

Complete Setup

⭐ Features

🎛️ System Architecture

  • 🧮 Dual Core Processing

    • 🖥️ Core 1: User Interface & Display
      • 🎨 UI Rendering
      • 📱 Menu System
      • 🔄 Display Updates
    • 🤖 Core 2: Sensor & Safety
      • 📊 Real-time Monitoring
      • ⚡ Power Management
      • 🛡️ Protection Systems
  • 💾 Memory System

    • 🎚️ Dynamic Sensor Configuration
    • 📦 Persistent Settings Storage
    • 🔧 Resource Optimization

🛡️ Protection Systems

  • 💧 Pump Safety
    • 🚱 Dry Run Prevention
      • 🔍 Continuous Monitoring
      • 🛑 Auto Shutdown
    • ⚡ Overload Protection
      • 📈 Current Monitoring
      • 🚨 Threshold Alerts
    • 🔌 Short Circuit Guard
      • ⚠️ Fault Detection
      • 🚫 Emergency Cutoff

🎮 Smart Controls

  • 🔘 One-Button Interface
    • 👆 Short Press Navigation
    • 👇 Long Press Selection
    • 🌈 RGB Status Feedback
  • 📟 Display System
    • 📱 1.3" OLED Screen
    • 📊 Real-time Stats
    • 🚦 Status Indicators
    • 🔊 Audio Alerts

💧 Water Management

  • 📏 Level Monitoring
    • 🎚️ Float Sensor (Primary)
      • ✅ Reliable Detection
      • 🛑 Overflow Prevention
    • 📡 Ultrasonic Sensor
      • 📊 Real-time Monitoring
      • 📈 Level Tracking

🌐 Connectivity

  • 📡 WiFi Features
    • 📱 Smart Device Setup
    • 🔄 OTA Updates
    • ⏰ Auto Time Sync
    • 📊 Remote Monitoring

⏱️ Time Management

  • 🕒 RTC Features
    • 📅 Scheduling
    • ⚡ Power Monitoring
    • 🔄 Auto Recovery
    • 📊 Time Tracking

📊 Data Analytics

  • ☁️ Cloud Integration
    • 📈 Google Sheets Logging
    • 📊 Performance Analytics
    • 📉 Usage Statistics
    • 🔍 System Diagnostics

💡 Pro Tips:

  • 🔧 Configure sensors based on your setup
  • ⚙️ Adjust thresholds for optimal performance
  • 📱 Use WiFi features for remote monitoring
  • 🔄 Keep firmware updated for best results
Safety Monitoring Power

📊 Data Logging System

Cloud Logging

📡 Overview

This project offers two methods for logging pump data to Google Sheets:

  1. 🌟 Using PythonAnywhere as middleware (Recommended, Advanced)
  2. 🔗 Direct Google Sheets integration (Comparatively Simpler, Not Recommended)

Method 1: Using PythonAnywhere 🚀

🔧 Setup Process

  1. 🌐 Google Cloud Setup

    • Follow this guide up to step 2
    • 🔑 Obtain necessary Google Cloud credentials
    • 📊 Set up your Google Sheet for data reception
  2. ⚙️ PythonAnywhere Configuration

    • 🔄 Deploy provided Flask code to PythonAnywhere
    • 📂 Code available in /resources folder
    • 📡 Handles JSON data from ESP32
    • 📝 Manages Google Sheets communication
  3. 📊 Data Collection

    • ⏱️ Records fill time duration
    • 📈 Logs sensor parameters
    • 📊 Tracks system performance
    • 💾 Stores historical data

Method 2: Direct Integration ⚡

ℹ️ Important Notes

  • 📂 Located in /resources folder
  • 💻 Requires different partition scheme
  • 🔧 Higher memory usage
  • 📋 Check header comments for configuration

📈 Logged Parameters

⏱️ Duration 💧 Water Level ⚡ Power Usage 🔄 System Status

💡 Tip: Choose Method 1 for better memory management and system stability. Use Method 2 only if you need direct integration and have configured the appropriate partition scheme.

Data Analysis

  • Track system efficiency
  • Monitor fill patterns
  • Identify potential issues
  • Analyze performance trends

⚠️ ISSUES

Known Issues 1.2.0 1. Same as 1.1.1-beta 2. Ultrasonic works as of now (when it is connected), because the water is falling from height and waves are forming, hence accuracy is affected.
Known Issues 1.1.1-beta 1. When ultrasonic is not connected, but turned on in settings, the ESP32 restarts in loop. The primary issue is that the Serial Monitor for ultrasonic returns garbage values even when nothing is connected and ESP32 tries to make sense of it and fails. The secondary issue is that it is running on CORE 0 and hence there is some kind of issue that is not faced by CORE 1 a.k.a. loop(). I'll check it in detail later. 2. Removed voltage sensor completely for now.
Known Issues 1.1.0-beta 1. Same as 1.0.2-alpha
Known Issues 1.0.3-alpha 1. Same as 1.0.2-alpha
Known Issues 1.0.2-alpha 1. Voltage Monitoring is not working (Giving higher values than individual test results, will look into it later). 2. Wattage is dependent on voltage, so it is also not working.

⚙️ Calibration & Setup

Setup Required

📡 Core Sensors

⚡ Current Sensor

SCT013

💧 Float Sensor

Water Level

📏 Distance Sensor

Ultrasonic

🔌 Current Sensor Calibration

1️⃣ Initial Setup

📊 Default Value: 27
🔧 Adjustable via program
📈 Reference: Home electricity meter
🎯 Goal: Match readings

2️⃣ Expected Readings (1HP Pump)

⚡ Voltage 📊 Current
220-240V AC 2.6A - 3.3A

3️⃣ Calibration Steps

1. 🏃 Run pump normally
2. 📊 Compare readings
3. 🔧 Adjust values
4. ✅ Verify results

⚡ Important Notes

  • 🔌 Voltage Protection: External voltage protection is recommended
  • 📊 Current-Voltage Relationship:
    • 📈 Current increases when voltage drops
    • 📉 Current decreases when voltage rises
    • 🔍 This relationship helps detect power quality issues

🛡️ Safety Recommendations

Protection Required Monitoring Active
  1. 🛡️ Always have external circuit protection
  2. 📊 Monitor initial readings carefully
  3. 📝 Document your calibration values
  4. 🔄 Perform periodic calibration checks

💡 Pro Tip: The relationship between current and voltage provides indirect power quality monitoring even without dedicated voltage sensors.

⚠️ Safety First

- External Protection
- Regular Checks
- Documentation

📊 Monitoring

- Track Readings
- Record Changes
- Verify Values

🔧 Maintenance

- Regular Calibration
- Keep Records
- Update Settings

🔧 Made with ❤️ for the IoT Community 🌐

🐛 Report Bug · ✨ Request Feature

📝 License

This project is licensed under the GNU General Public License v3.0 - see below for details.

                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
  software and other kinds of works.

  When we speak of free software, we are referring to freedom, not
  price. Our General Public Licenses are designed to make sure that
  you have the freedom to distribute copies of free software (and
  charge for them if you wish), that you receive source code or can
  get it if you want it, that you can change the software or use
  pieces of it in new free programs, and that you know you can do
  these things.

  To protect your rights, we need to prevent others from denying
  you these rights or asking you to surrender the rights. Therefore,
  you have certain responsibilities if you distribute copies of the
  software, or if you modify it: responsibilities to respect the
  freedom of others.

For the complete license text, see the LICENSE file in this repository or visit GNU GPL v3.

Key Points of GPL v3:

  • You can freely use, modify, and distribute this software
  • If you distribute modified versions, you must:
    • Make the source code available
    • License it under GPL v3
    • State your modifications
  • No warranty is provided