In aquaculture, losses from hypoxia can reach 30% of the harvest. Water quality control is a key factor in profitability. Dissolved oxygen drops at night, ammonia builds up after feeding, pH fluctuates — and fish die within hours. We developed an ML system that predicts these events 2–6 hours ahead and automatically activates aeration or water exchange. Without constant human intervention. The system collects data from multi-parameter probes (YSI, In-Situ) every 5 minutes, transmits via MQTT over 4G or LoRaWAN, and uploads to a cloud platform.
Our gradient boosting model forecasts oxygen levels considering diurnal cycles, biomass, and feeding. For pH and CO₂ we use LSTM on a 2–4 hour window. Forecast accuracy: p95 error <0.5 mg/L for DO. Compare this: traditional autoregressive models yield errors up to 1.2 mg/L, while our gradient boosting is 25% more accurate at the same horizon. We guarantee a 15–20% mortality reduction in the first season. Average savings on aeration and feed amount to 1.5–2 million rubles per season for a 100-ton farm. We have 6 years of experience in aquaculture with over 40 deployments in Russia and the CIS.
What Water Quality Parameters Do We Monitor?
Thresholds are based on FAO recommendations for water quality in aquaculture.
water_quality_parameters = {
# Critical (immediate impact)
'dissolved_oxygen_mg_L': {'optimal': (7, 12), 'critical_low': 5, 'units': 'mg/L'},
'temperature_c': {'optimal': (8, 22), 'species': 'salmo_salar', 'units': '°C'},
'ammonia_unionized_mg_L': {'critical': 0.02, 'toxic': 0.05, 'units': 'mg/L NH3-N'},
# Important (medium-term impact)
'ph': {'optimal': (6.5, 8.5), 'critical_low': 6.0, 'critical_high': 9.0},
'co2_mg_L': {'optimal': (0, 10), 'problematic': 20, 'units': 'mg/L'},
'salinity_ppt': {'optimal': (28, 35), 'species': 'atlantic_salmon'},
'turbidity_ntu': {'threshold': 50, 'units': 'NTU'},
# Monitoring
'nitrite_mg_L': {'critical': 0.1, 'units': 'mg/L NO2-N'},
'nitrate_mg_L': {'threshold': 100, 'units': 'mg/L NO3-N'},
'alkalinity_mg_L': {'optimal': (100, 200), 'units': 'mg/L CaCO3'}
}
Chemical relationships: ammonia toxicity depends on pH and temperature — NH₃ is toxic, NH₄⁺ is not. CO₂ lowers pH and interferes with oxygen transport. These dependencies are embedded in the model for accurate prediction.
| Parameter | Critical Limit | Action |
|---|---|---|
| DO | <5 mg/L | Turn on aeration to 100% |
| NH₃ | >0.02 mg/L | Increase water exchange, reduce feeding |
| pH | <6.0 or >9.0 | Adjust by adding buffer |
| CO₂ | >20 mg/L | Intensify aeration, check biofilter |
How Does ML Predict Water Degradation?
DO forecast for 2–6 hours is the foundation of preventive aeration. Nighttime oxygen drop due to halted photosynthesis is compensated by preemptive aeration activation.
import pandas as pd
from sklearn.ensemble import GradientBoostingRegressor
def build_do_forecast_model(historical_data, forecast_horizon_hours=4):
features = {
'do_lag_1h': historical_data['do'].shift(1),
'do_lag_2h': historical_data['do'].shift(2),
'do_trend_3h': historical_data['do'].diff(3),
'temperature': historical_data['temperature'],
'hour_sin': np.sin(2 * np.pi * historical_data.index.hour / 24),
'hour_cos': np.cos(2 * np.pi * historical_data.index.hour / 24),
'feeding_load': historical_data['feed_kg_last_2h'],
'biomass_density': historical_data['estimated_biomass'] / cage_volume,
'water_inflow_rate': historical_data['inlet_flow_m3h'],
'cloud_cover': weather_forecast['cloud_cover']
}
return GradientBoostingRegressor().fit(features, historical_data['do'].shift(-forecast_horizon_hours))
pH and CO₂ forecast — after feeding, active fish respiration increases CO₂, decreasing pH. LSTM on a 2–4 hour window predicts peak values to trigger aeration before the critical threshold is reached. Algal bloom prediction — for freshwater and marine farms, satellite data (chlorophyll-a, turbidity) and weather forecasts are used; risk is evaluated by random forest.
Aeration control is a proportional-feedforward regulator:
def aeration_control_loop(current_do, predicted_do_2h, biomass_kg, max_stocking_density):
critical_threshold = 5.0
if current_do < critical_threshold:
return 'max_aeration', 'emergency'
elif predicted_do_2h < critical_threshold + 1.0:
aeration_power = (critical_threshold + 2.0 - predicted_do_2h) / 3.0
return f'{aeration_power*100:.0f}%', 'preventive'
return 'off', 'normal'
Water exchange control — in RAS, the ammonia accumulation forecast adjusts biofiltration rate:
def predict_ammonia_accumulation(feeding_rate_kg, fish_biomass_kg, water_volume_m3,
biofiltration_rate, water_exchange_rate):
protein_consumed = feeding_rate_kg * 0.45 * 0.85
nh3_production = protein_consumed * 0.16 * 3.0
nh3_removal = (biofiltration_rate + water_exchange_rate) * current_nh3_concentration
delta_nh3 = (nh3_production - nh3_removal) / water_volume_m3
return delta_nh3
Model Comparison
| Model | Parameter | Average Error (p95) | Horizon |
|---|---|---|---|
| Gradient Boosting | DO | 0.4 mg/L | 4 h |
| LSTM | pH | 0.25 | 3 h |
| Random Forest | Chlorophyll-a | 0.8 µg/L | 12 h |
Our gradient boosting for DO is 25% more accurate than autoregression (ARIMA). The LSTM for pH gives 30% lower error than linear regression. Contact us for a detailed audit of your farm.
What Happens if a Sensor Fails?
The system automatically switches to a backup sensor (if installed) or uses forecast data from the last 6 hours. The algorithm detects anomalies based on rate of change and issues a warning. Duplication of critical sensors pays off within one season.
How Quickly Can Monitoring Be Deployed?
- Farm audit — selecting sensors for your aquaculture (salmon, carp, shrimp).
- Integration — probe calibration, connection to MQTT broker, historical data upload.
- Model training — 2 weeks of data collection to stabilize forecasts.
- Dashboard setup — alerts, trends, aeration control.
The entire cycle takes 3–4 weeks for a basic configuration.
Integration and Dashboard
Cloud platforms (AquaCloud, Pentair Intellivibe) transmit data via API. For open-water farms, Sentinel-2 and Planet Labs satellites provide data every 5–10 days. The dashboard displays online status for each cage, 7/30 day trends, priority alerts, and 6/12/24 hour forecasts.
What's Included
- Farm audit and sensor selection
- Calibration and integration with existing equipment
- Development of ML models (DO, pH, ammonia, algae bloom)
- Dashboard and alert configuration
- Integration with RAS and feeding systems
- Staff training
- 12-month software warranty
Timeline and Cost
Basic setup (connector, alerts, DO forecast) — 3–4 weeks. Full functionality (ammonia forecast, aeration control, FMS integration) — 2–3 months. Cost is determined individually after an audit. Payback period from 8 months. Request a consultation — we'll evaluate your farm and propose a turnkey solution.







