pond-monitor

🐟 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.

Dashboard Preview Platform License

πŸ“Š Live Dashboard

View Live Dashboard β†’


✨ Features


πŸ› οΈ 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:

pH Sensor:

TDS Sensor:

OLED Display (I2C):

Buzzer:


πŸ“¦ Software Requirements

Arduino Libraries (Install via Library Manager)

- WiFi (built-in)
- HTTPClient (built-in)
- BlynkSimpleEsp32
- Adafruit GFX Library
- Adafruit SSD1306
- OneWire
- DallasTemperature

External Services


πŸš€ Quick Start Guide

1. Hardware Setup

  1. Connect all sensors according to the wiring diagram above
  2. Double-check all connections (especially polarity!)
  3. Ensure 4.7kΞ© pull-up resistor is connected for DS18B20

2. Google Sheets Setup

Create Data Logger:

  1. Create a new Google Sheet
  2. Open Extensions β†’ Apps Script
  3. Paste the Google Apps Script code (see google-apps-script.js)
  4. Deploy as Web App (Execute as: Me, Access: Anyone)
  5. Copy the Web App URL

Publish Sheet as CSV:

  1. Click File β†’ Share β†’ Publish to web
  2. Select SensorData sheet
  3. Choose Comma-separated values (.csv)
  4. Click Publish and copy the CSV URL

3. ESP32 Configuration

  1. Open esp32-pond-monitor.ino in Arduino IDE
  2. Update WiFi credentials:
    char ssid[] = "YOUR_WIFI_SSID";
    char pass[] = "YOUR_WIFI_PASSWORD";
    
  3. Update Google Script URL:
    String GOOGLE_SCRIPT_URL = "YOUR_WEB_APP_URL";
    
  4. 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
    
  5. Upload to ESP32

4. Dashboard Setup

  1. Open pond-dashboard.html
  2. Update the CSV URL (line ~193):
    const SHEET_CSV_URL = 'YOUR_GOOGLE_SHEET_CSV_URL';
    
  3. Upload to this GitHub repository
  4. Enable GitHub Pages in repository settings
  5. 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:

  1. Place pH probe in pH 7.0 buffer solution
  2. Read voltage from Serial Monitor
  3. Update ph7Voltage value
  4. Repeat with pH 4.0 buffer solution
  5. 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:

On Mobile:

  1. Open dashboard URL in mobile browser
  2. Add to Home Screen for app-like experience:
    • Android: Chrome menu β†’ β€œAdd to Home screen”
    • iPhone: Share button β†’ β€œAdd to Home Screen”
  3. 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:

Sensors Reading 0 or Invalid Values:

Data Not Sending to Google Sheets:

Dashboard Issues

Dashboard Shows β€œError loading data”:

Charts Not Displaying:

Data Not Updating:


πŸ“ˆ Future Enhancements


🀝 Contributing

Contributions are welcome! Feel free to:


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘¨β€πŸ’» Author

Your Name


πŸ™ Acknowledgments

πŸ“ž Support

If you find this project helpful, please consider:


Made with ❀️ for sustainable aquaculture