π Pond Monitor System
A real-time IoT monitoring system for aquaculture ponds using ESP32, displaying water quality parameters (Temperature, pH, and TDS) on a beautiful web dashboard.

π Live Dashboard
View Live Dashboard β
β¨ Features
- π‘οΈ Real-time Temperature Monitoring (DS18B20 sensor)
- π§ pH Level Tracking (Analog pH sensor)
- π TDS Measurement (Total Dissolved Solids)
- π± Mobile-Friendly Dashboard (responsive design)
- π Audio Alarm (triggers when temperature exceeds threshold)
- π Historical Data Charts (24-hour temperature graph)
- βοΈ Cloud Data Storage (Google Sheets integration)
- π₯οΈ OLED Display (local monitoring)
- π Auto-Refresh (dashboard updates every 30 seconds)
π οΈ Hardware Components
| Component |
Model/Type |
Purpose |
| Microcontroller |
ESP32 DevKit |
Main controller with WiFi |
| Temperature Sensor |
DS18B20 (Waterproof) |
Water temperature measurement |
| pH Sensor |
Analog pH Sensor |
Water pH level measurement |
| TDS Sensor |
Analog TDS Meter |
Water quality (dissolved solids) |
| Display |
SSD1306 OLED (128x64) |
Local data display |
| Buzzer |
Active Buzzer |
Temperature alarm |
| Resistor |
4.7kΞ© |
Pull-up for DS18B20 |
π Wiring Diagram
ESP32 Pin Connections:
βββ GPIO 4 β DS18B20 Data Pin (with 4.7kΞ© pull-up to 3.3V)
βββ GPIO 18 β Buzzer Positive
βββ GPIO 34 β TDS Sensor Analog Output
βββ GPIO 35 β pH Sensor Analog Output
βββ GPIO 21 β OLED SDA
βββ GPIO 22 β OLED SCL
βββ 3.3V β Sensors VCC & OLED VCC
βββ GND β All Grounds
Detailed Connections:
DS18B20 Temperature Sensor:
- Red (VCC) β ESP32 3.3V
- Black (GND) β ESP32 GND
- Yellow (Data) β ESP32 GPIO 4
- 4.7kΞ© resistor between Data and VCC
pH Sensor:
- VCC β ESP32 5V (or 3.3V depending on sensor)
- GND β ESP32 GND
- Analog Out β ESP32 GPIO 35
TDS Sensor:
- VCC β ESP32 5V (or 3.3V depending on sensor)
- GND β ESP32 GND
- Analog Out β ESP32 GPIO 34
OLED Display (I2C):
- VCC β ESP32 3.3V
- GND β ESP32 GND
- SDA β ESP32 GPIO 21
- SCL β ESP32 GPIO 22
Buzzer:
- Positive β ESP32 GPIO 18
- Negative β ESP32 GND
π¦ Software Requirements
Arduino Libraries (Install via Library Manager)
- WiFi (built-in)
- HTTPClient (built-in)
- BlynkSimpleEsp32
- Adafruit GFX Library
- Adafruit SSD1306
- OneWire
- DallasTemperature
External Services
- Google Sheets - Data storage (free)
- Google Apps Script - Data logger (free)
- GitHub Pages - Dashboard hosting (free)
- Blynk (optional) - Mobile app monitoring
π Quick Start Guide
1. Hardware Setup
- Connect all sensors according to the wiring diagram above
- Double-check all connections (especially polarity!)
- Ensure 4.7kΞ© pull-up resistor is connected for DS18B20
2. Google Sheets Setup
Create Data Logger:
- Create a new Google Sheet
- Open Extensions β Apps Script
- Paste the Google Apps Script code (see
google-apps-script.js)
- Deploy as Web App (Execute as: Me, Access: Anyone)
- Copy the Web App URL
Publish Sheet as CSV:
- Click File β Share β Publish to web
- Select SensorData sheet
- Choose Comma-separated values (.csv)
- Click Publish and copy the CSV URL
3. ESP32 Configuration
- Open
esp32-pond-monitor.ino in Arduino IDE
- Update WiFi credentials:
char ssid[] = "YOUR_WIFI_SSID";
char pass[] = "YOUR_WIFI_PASSWORD";
- Update Google Script URL:
String GOOGLE_SCRIPT_URL = "YOUR_WEB_APP_URL";
- Enable/disable sensors as needed:
#define ENABLE_PH_SENSOR true // Set to false if not connected
#define ENABLE_TDS_SENSOR true // Set to false if not connected
- Upload to ESP32
4. Dashboard Setup
- Open
pond-dashboard.html
- Update the CSV URL (line ~193):
const SHEET_CSV_URL = 'YOUR_GOOGLE_SHEET_CSV_URL';
- Upload to this GitHub repository
- Enable GitHub Pages in repository settings
- Access dashboard at:
https://YOUR-USERNAME.github.io/pond-monitor/pond-dashboard.html
βοΈ Configuration
Temperature Alarm Threshold
#define TEMP_THRESHOLD 32.0 // Temperature in Celsius
pH Sensor Calibration
float ph4Voltage = 2.03; // Voltage reading at pH 4.0
float ph7Voltage = 1.65; // Voltage reading at pH 7.0
How to Calibrate:
- Place pH probe in pH 7.0 buffer solution
- Read voltage from Serial Monitor
- Update
ph7Voltage value
- Repeat with pH 4.0 buffer solution
- Update
ph4Voltage value
Dashboard Alert Thresholds
Edit in pond-dashboard.html:
const TEMP_MIN = 20; // Minimum safe temperature (Β°C)
const TEMP_MAX = 32; // Maximum safe temperature (Β°C)
const PH_MIN = 6.5; // Minimum safe pH
const PH_MAX = 8.5; // Maximum safe pH
const TDS_MIN = 300; // Minimum safe TDS (ppm)
const TDS_MAX = 800; // Maximum safe TDS (ppm)
Data Upload Frequency
unsigned long googleSheetsInterval = 30000; // 30 seconds (30000ms)
π± Using the Dashboard
On Desktop/Laptop:
- Open the dashboard URL in any browser
- Auto-refreshes every 30 seconds
- Click βRefresh Nowβ for manual update
On Mobile:
- Open dashboard URL in mobile browser
- Add to Home Screen for app-like experience:
- Android: Chrome menu β βAdd to Home screenβ
- iPhone: Share button β βAdd to Home Screenβ
- Icon appears on home screen like a native app!
π Data Flow
ESP32 Sensors
β
WiFi Connection
β
Google Apps Script (Web App)
β
Google Sheets (Data Storage)
β
Published CSV Feed
β
Web Dashboard (Auto-refresh)
β
User's Phone/Computer
π§ Troubleshooting
ESP32 Issues
WiFi Wonβt Connect:
- Verify SSID and password are correct
- Ensure using 2.4GHz WiFi (ESP32 doesnβt support 5GHz)
- Check router is in range
Sensors Reading 0 or Invalid Values:
- Check wiring connections
- Verify sensor power (3.3V or 5V as required)
- Enable sensors in code (
ENABLE_PH_SENSOR / ENABLE_TDS_SENSOR)
- For DS18B20: ensure 4.7kΞ© pull-up resistor is installed
Data Not Sending to Google Sheets:
- Verify Google Apps Script URL is correct
- Check deployment is set to βAnyoneβ can access
- Look for error codes in Serial Monitor
Dashboard Issues
Dashboard Shows βError loading dataβ:
- Verify Google Sheet is published as CSV
- Check CSV URL in dashboard code is correct
- Ensure βSensorDataβ sheet exists and has data
Charts Not Displaying:
- Check internet connection (Chart.js needs to load)
- Verify at least 2 rows of data exist
Data Not Updating:
- Check ESP32 is powered and sending data
- Wait 30 seconds for auto-refresh
- Click βRefresh Nowβ button
- Clear browser cache if needed
π Future Enhancements
π€ Contributing
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π¨βπ» Author
Your Name
- GitHub: @Hzqmo
- Email: haziqmohd65@gmail.com
π Acknowledgments
- Thanks to the open-source community
- Blynk for IoT platform inspiration
- Google for free cloud services
- Arduino and ESP32 communities
π Support
If you find this project helpful, please consider:
- β Starring this repository
- π Reporting bugs
- π‘ Suggesting improvements
- π’ Sharing with others
Made with β€οΈ for sustainable aquaculture