G.U.A.R.D
General Unit for Aquatic Risk Detection
Enterprise-grade aquaculture monitoring for commercial ornamental fish shops and multi-tank hatcheries — replacing slow manual water testing with continuous sensor telemetry and instant alerts.
- Real-time water quality telemetry via ESP32 nodes over MQTT to HiveMQ Cloud
- Multi-channel alerting — WebSocket toast, SMTP email & Telegram Bot simultaneously
- Glassmorphic React dashboard with RBAC, species knowledge base & guided onboarding
Aquarium Tank Telemetry Deck
Each ESP32 node publishes a JSON payload to HiveMQ Cloud MQTT every 30 seconds. The backend authenticates with bcrypt, stores state in MongoDB, and writes time-series data to InfluxDB simultaneously.
Display Tank 01
ONLINE- ▸ Temperature:
DS18B20 waterproof digital sensor (OneWire) - ▸ pH Level:
Gravity pH-4502C Probe (6.5–8.5 safe range) - ▸ Water Level:
JSN-SR04T ultrasonic sensor (non-contact) - ▸ Turbidity:
Optical TSS light-scattering sensor (50 NTU max) - ▸ TDS:
Analog probe with temperature-compensated firmware - ▸ Automated Fish Feeder:
PWM Micro Servo Motor (Precision timed feed dispense) - ▸ Water Inflow & Outflow Pumps:
4-Channel 5V Relay Module (AUTO / ON / OFF modes)
{
"device_id": "GUARD-D01",
"ph": 7.2,
"temperature": 28.4,
"tds": 430,
"turbidity": 12,
"water_level": 82
}
Six Reasons G.U.A.R.D Stands Apart
Purpose-built for aquaculture — every feature answers a real-world problem that costs fish health and money.
Simultaneous real-time measurement of Temperature, pH, TDS, Turbidity, and Water Level via SVG arc gauges — zero polling lag with WebSocket push every 30-second telemetry cycle.
Threshold breaches trigger simultaneous SMTP email and Telegram Bot notifications — with in-memory throttling to prevent duplicate alert floods.
Remote & threshold-driven relay pump switching (AUTO / ON / OFF) and PWM micro-servo feeder dispatching over MQTT to maintain optimal tank conditions.
20 research-verified freshwater species with optimal pH, Temp, TDS, and Turbidity ranges. Tank Compatibility Checker cross-validates threshold configs in real time.
First-time users never see an empty dashboard — auto-routed to a /demo sandbox with a driver.js step-by-step tour across 7 (USER) or 11 (ADMIN) highlights.
Three-tier RBAC (SUPER_ADMIN / ADMIN / USER), bcrypt device secrets, JWT-protected REST, duplicate-alert suppression, and offline threshold sync via MQTT retained messages.
Never miss a critical event.
The rule-based alert engine checks every telemetry payload against per-device configurable thresholds. On a breach with no existing unresolved duplicate, an Alert record is persisted and dispatched across all channels simultaneously.
- SMTP email delivery to tank owner on threshold breach
- Instant Telegram Bot message via @GUARD_yp_bot
- Per-account email / Telegram enable toggles
- In-memory throttling prevents alert flood storms
System Architecture & Environment Screenshots
End-to-End IoT Architecture
From ESP32 edge nodes to React dashboard — every layer purpose-built for low-latency aquatic telemetry.
Frontend → :5173 Vite dev server
MongoDB → :27017 Primary state DB
InfluxDB → :8086 Time-series
MQTT → :1883/:8883 HiveMQ Cloud
GPIO 34 → pH-4502C Probe (ADC)
GPIO 35 → TDS Sensor (ADC)
GPIO 36 → Turbidity Sensor (ADC)
GPIO 13/12 → JSN-SR04T Trig / Echo
7-Step Data Journey
From sensor voltage to dashboard update — every stage in the real-time telemetry pipeline explained.
ESP32 reads 5 water quality sensors (DS18B20 Temp, pH, TDS, Turbidity, Ultrasonic Level) every 30s and publishes TLS-encrypted JSON payloads to HiveMQ Cloud while listening on control topics for actuator commands.
Node.js MQTT client ingests incoming telemetry from HiveMQ Cloud, verifies device UID against MongoDB, and authenticates device secret via bcrypt. Unauthorized or corrupt payloads are safely discarded.
Latest tank state & device status are updated in MongoDB via Prisma ORM, while high-frequency telemetry points are simultaneously written to InfluxDB time-series storage for analytics.
Alert engine checks configurable thresholds per species. Breaches trigger alert persistence, duplicate suppression, and automated actuator commands (water pump relay switching & fish feeder servo dispensing).
Alerts are dispatched simultaneously via socket.io to connected frontend clients (toast & badge), SMTP email to tank owners, and instant Telegram Bot messages (@GUARD_yp_bot).
Frontend UI subscribes to real-time WebSocket events. SVG arc gauges re-render live stats, actuator toggle states update instantly, and alert indicators increment — with zero page polling.
JWT-authenticated REST APIs query InfluxDB time-series data to render interactive Recharts trend graphs, allowing users to analyze historical parameter stability against species thresholds.
Tech Stack & Bill of Materials
Default Alert Threshold Configuration
| Alert Type | Condition | Sensor |
|---|---|---|
| TEMP_HIGH | temperature > TEMP_MAX | Temperature |
| TEMP_LOW | temperature < TEMP_MIN | Temperature |
| PH_HIGH | ph > PH_MAX | pH Level |
| PH_LOW | ph < PH_MIN | pH Level |
| TDS_HIGH | tds > TDS_MAX | TDS |
| TURBIDITY_HIGH | turbidity > TURBIDITY_MAX | Turbidity |
| WATER_LEVEL_LOW | water_level < WATER_LEVEL_MIN | Water Level |
Bill of Materials — Per-Tank Hardware Node
| Component | Model / Spec | Interface | Qty | Est. Cost |
|---|---|---|---|---|
| Microcontroller | ESP32 DevKit C | Wi-Fi, GPIO | 1 | LKR 4,000 |
| Temperature Sensor | DS18B20 Waterproof | OneWire GPIO 4 | 1 | LKR 800 |
| pH Sensor Module | pH-4502C / Gravity pH | Analog ADC | 1 | LKR 5,000 |
| ORP Sensor Module | ORP Probe + Conditioner | Analog ADC | 1 | LKR 6,000 |
| TDS Sensor | Analog TDS Module | Analog ADC | 1 | LKR 2,500 |
| Turbidity Sensor | Optical TSS Module | Analog ADC | 1 | — |
| Water Level Sensor | JSN-SR04T Ultrasonic | Digital Trig/Echo | 1 | LKR 600 |
| EC Sensor | EC Module | Analog ADC | 1 | LKR 6,500 |
| Relay Module | 4-Channel 5V Relay | Digital GPIO | 1 | LKR 1,200 |
| Power Supply | 12V DC + LM2596 Buck | VIN / GND | 1 | LKR 3,000 |
| Miscellaneous | PCB, jumpers, casing, fuse | — | — | LKR 2,000 |
| Estimated Total (Per Node) | ~LKR 31,600 | |||
3yp - Team 08 : E21
Third Year Software Engineering Project · Department of Computer Engineering · Faculty of Engineering · University of Peradeniya
University of Peradeniya