A comprehensive ESP32-based water level monitoring system with WiFi connectivity, web dashboard, and customizable alerts.
AquaLevel is an IoT water level monitoring solution built on the ESP32 platform, using an HC-SR04 ultrasonic sensor to track water levels in tanks with high precision. The system provides real-time monitoring through an elegant web interface, allowing users to visualize water levels, configure tank parameters, and receive alerts when water levels reach critical thresholds.
- Live water level percentage and volume display
- Animated tank visualization
- Configurable measurement intervals
- Reading smoothing for stability
- Modern, responsive interface works on all devices
- Real-time updates without page refreshes
- Dark mode UI for better visibility
- Easy-to-use settings controls
- WiFi connectivity with fallback AP mode
- mDNS support for easy access (aqualevel.local)
- Simple network configuration interface
- Automatic reconnection if connection drops
- One-click calibration for empty and full states
- Configurable tank dimensions and parameters
- Intelligent volume calculation
- Persistent settings with EEPROM storage
- Configurable high and low water level thresholds
- Visual alert indicators
- Expandable notification system
- ESP32 development board
- HC-SR04 ultrasonic sensor
- Jumper wires
- Power supply (5V)
- Optional: mounting hardware for sensor placement
| Component | ESP32 Pin |
|---|---|
| HC-SR04 Trigger | GPIO 1 |
| HC-SR04 Echo | GPIO 3 |
**NOTE: **Solar is Optional. You can provide direct power supply as well.
- Connect the HC-SR04 ultrasonic sensor to the ESP32:
- VCC to 5V
- GND to GND
- Trigger to GPIO 1
- Echo to GPIO 3
- Mount the sensor at the top of your tank, facing down toward the water surface
You can install AquaLevel on your ESP32-C3 SuperMini in two ways:
- Clone this repository or download the source code
- Open the
WLSv1.0.inofile in Arduino IDE - Install required libraries from Library Manager:
- ESP32 board support
- EEPROM
- WiFi
- WebServer
- ESPmDNS
- Select "ESP32C3 Dev Module" from the Board menu
- Connect your ESP32-C3 SuperMini via USB
- Click Upload to flash the code
You can flash the pre-compiled binaries directly to your ESP32-C3 using one of the following methods:
The ESP Flash Download Tool provides a user-friendly GUI for flashing ESP devices.
-
Download ESP Flash Download Tool:
- Download from the official Espressif website
- Flash tool User guide: Flash Download Tools Guide
-
Extract and run the tool:
- Extract the ZIP file
- Run "flash_download_tool_x.x.x.exe" (where x.x.x is the version number)
- Select "ESP32-C3 RISC-V" from the chip type dropdown
-
Configure the tool as follows:
- Set SPI SPEED to "80MHz"
- Set SPI MODE to "DIO"
- Set FLASH SIZE to "4MB" (or match your ESP32-C3's flash size)
-
Download and add the binary files with these specific addresses:
- Click [+] and add
AquaLevel-ESP32C3-bootloader.binat address0x0 - Click [+] and add
AquaLevel-ESP32C3-partitions.binat address0x8000 - Click [+] and add
AquaLevel-ESP32C3.binat address0x10000 - Ensure all three checkboxes next to the file paths are checked
- Click [+] and add
-
Select the appropriate COM port where your ESP32-C3 is connected
-
Set the baud rate to
921600for faster flashing -
Click the "START" button to begin flashing
-
Wait for the tool to display "FINISH" when the flashing is complete
-
Press the reset button on your ESP32-C3 board
esptool is a command-line utility for flashing ESP devices. Here's how to use it:
- Install esptool using pip (requires Python):
pip install esptool
- Open Command Prompt (cmd) and navigate to your binary files:
cd C:\path\to\your\binaries
- Flash your ESP32-C3 with this command (replace COM3 with your actual port):
esptool.py --chip esp32c3 --port COM3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 AquaLevel-ESP32C3-bootloader.bin 0x8000 AquaLevel-ESP32C3-partitions.bin 0x10000 AquaLevel-ESP32C3.bin
-
Troubleshooting:
- If you have connection issues, try erasing the flash first:
esptool.py --chip esp32c3 --port COM3 erase_flash- If you still have issues, try a lower baud rate:
esptool.py --chip esp32c3 --port COM3 --baud 115200 write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 AquaLevel-ESP32C3-bootloader.bin 0x8000 AquaLevel-ESP32C3-partitions.bin 0x10000 AquaLevel-ESP32C3.bin- For detailed logs, add the
-vflag:
esptool.py -v --chip esp32c3 --port COM3 --baud 921600 write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 AquaLevel-ESP32C3-bootloader.bin 0x8000 AquaLevel-ESP32C3-partitions.bin 0x10000 AquaLevel-ESP32C3.bin
After flashing is complete, proceed with the below steps.
- Power on your AquaLevel device
- Connect to the WiFi network named "Aqualevel-XXXXX-Setup"
- Open a web browser and navigate to
192.168.4.1 - Go to "Network Settings" and configure your home WiFi
- After restarting, access your device at
http://aqualevel-[name].local
- Navigate to "Tank Settings"
- Enter your tank dimensions:
- Height (cm)
- Diameter (cm)
- Volume (liters) - will be calculated automatically but can be overridden
- Ensure the tank is empty
- Click "Calibrate Empty" on the dashboard
- Fill the tank to your desired "full" level
- Click "Calibrate Full"
- Go to "Alert Settings"
- Set the low water percentage threshold (default: 10%)
- Set the high water percentage threshold (default: 90%)
- Toggle alerts on/off as needed
All settings are persistent and saved to EEPROM:
- Tank height (cm)
- Tank diameter (cm)
- Tank volume (liters)
- Sensor offset (distance from sensor to max water level)
- Empty distance (reading when tank is empty)
- Full distance (reading when tank is full)
- Measurement interval (seconds between readings)
- Reading smoothing (number of readings to average)
- Low alert level (percentage)
- High alert level (percentage)
- Alerts enabled/disabled
- WiFi SSID
- WiFi password
- Device name (used for mDNS)
The HC-SR04 sensor measures distance by sending ultrasonic pulses and timing how long they take to bounce back. The system calculates water level by comparing the current distance reading to the calibrated empty and full distances.
- Empty calibration: Records the distance reading when the tank is empty (maximum distance)
- Full calibration: Records the distance reading when the tank is full (minimum distance)
- The system calculates percentages based on the range between these two values
Volume is calculated based on tank dimensions (for cylindrical tanks):
- For custom tank shapes, you can override the calculated volume with your own value
The system uses a dynamic buffer to average multiple readings, providing stable measurements even with choppy water surfaces or sensor noise.
- Edit
config.hto change default parameters - Modify pin assignments for different hardware setups
- Adjust serial output for debugging
The system includes hooks for expanding the alert system:
- Add relay controls for pumps or valves
- Implement MQTT for external notifications
- Connect additional indicators or buzzers
| Issue | Solution |
|---|---|
| Cannot connect to WiFi | Check credentials; reset WiFi settings with button on Network page |
| Inaccurate readings | Ensure sensor is properly mounted; recalibrate; increase smoothing |
| Cannot access web interface | Verify IP address; check WiFi connection; restart device |
| Erratic measurements | Adjust sensor position; increase smoothing; check for interference |
This project is licensed under the MIT License - see the LICENSE file for details.
- Based on the original concept by Ravi Singh
- Thanks to all contributors who have helped improve this project
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request



.jpg)