A four-tier IoT platform for real-time water-quality monitoring of aquaponics systems. Captures pH, temperature, EC, and turbidity from physical sensors on a Raspberry Pi, streams to an AWS-hosted FastAPI backend, and presents live insights via a Next.js dashboard with an AI-powered diagnostic assistant (Google Gemini).
🌐 Live: https://smart-aquaponics.vercel.app
Warning
Currently paused (as of 2026-07-11). AWS backend (EC2 + RDS) has been
torn down per docs/PAUSE.md (Scenario B: snapshot + terminate) to cut
costs from ~₹3,200/mo to ~₹190/mo while the platform isn't actively being
developed. The frontend above will show "Failed to load" errors until
resumed. All data is preserved in a manual RDS snapshot
(aquaponics-db-pause-20260711) and an EC2 AMI
(aquaponics-api-pause-20260711). To bring it back up, follow
docs/RESUME.md (~30-45 min).
arduino/ # Sensor firmware (Arduino Uno, C++)
pi/ # Raspberry Pi edge gateway (Python, Flask, SQLite)
server/ # FastAPI cloud backend (Python, SQLAlchemy, PostgreSQL)
web/ # Next.js frontend (React 19, Tailwind 4, recharts)
infra/ # nginx config, systemd units
docs/ # Architecture, cost analysis, pause/resume runbooks
- Arduino reads pH, EC, water temperature, and turbidity every 5 seconds.
- Raspberry Pi captures the serial stream, buffers to SQLite (7-day retention), and uploads batches to the cloud every 30 seconds.
- AWS runs the FastAPI backend on EC2 (gunicorn + nginx + systemd) with PostgreSQL on RDS. CloudFront sits in front for global accessibility on restrictive networks.
- Next.js frontend on Vercel renders a live dashboard, historical trend charts (1h–30d), an API key manager, and a Gemini-powered chat assistant with live sensor context.
Full architecture in docs/ARCHITECTURE.md.
- ✅ Real-time monitoring — 5-second sample rate, 1-minute database rollups
- ✅ AI diagnostics — Gemini chat with live sensor context for actionable recommendations
- ✅ Trend charts — 5 parameter charts with configurable time ranges and ideal-range overlays
- ✅ Water Quality Index — aquaponics-specific 0-100 scoring with status banner
- ✅ Offline resilience — Pi buffers up to 7 days of data locally, syncs when network returns
- ✅ Secure — JWT auth, SHA-256 hashed API keys, HTTPS everywhere
- ✅ Cloud-resilient — CloudFront in front of EC2 bypasses restrictive campus/hostel networks
| Layer | Tech |
|---|---|
| Sensors | Arduino Uno, Atlas Scientific EZO-EC, DS18B20, analog pH/turbidity |
| Edge | Raspberry Pi 4, Python 3, Flask, pyserial, SQLite |
| API | FastAPI, SQLAlchemy, gunicorn, uvicorn, nginx |
| DB | PostgreSQL 16 (RDS) + pg_cron rollups |
| Frontend | Next.js 16, React 19, Tailwind 4, recharts, shadcn/ui |
| AI | Google Gemini 2.5 Flash |
| Auth | JWT (HS256), bcrypt passwords, SHA-256 API keys |
| Deploy | Vercel (frontend), AWS EC2/RDS (backend) |
| Region | ap-south-1 (Mumbai) |
cd server/ingest_api
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # fill in real secrets
# Apply migrations against your DB...
uvicorn app.main:app --reload --port 5001cd web
pnpm install # (or npm install)
cp .env.example .env.local # set NEXT_PUBLIC_API_URL=http://localhost:5001
pnpm devOpen http://localhost:3000.
cd pi
pip install -r requirements.txt --break-system-packages
cp .env.example .env # fill in INGEST_URL, INGEST_TOKEN, DEVICE_ID
sudo cp systemd/*.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start aquaponics-app aquaponics-uploader| File | What it covers |
|---|---|
docs/ARCHITECTURE.md |
System diagram, components, data flow, repo layout |
docs/COST.md |
Monthly cost breakdown, pause/resume cost scenarios |
docs/PAUSE.md |
Snapshot + terminate runbook (~$2/month cold storage) |
docs/RESUME.md |
Restore from snapshots runbook (~30-45 min) |
docs/SECRETS.md |
Where every credential lives + rotation guide |
docs/HARDWARE.md |
Wiring diagrams, BOM, calibration procedures, sensor maintenance |
- Arduino Uno (1x)
- Raspberry Pi 4 with 16+ GB SD card (1x)
- Atlas Scientific EZO-EC + K1.0 conductivity probe (1x)
- DS18B20 waterproof temperature probe (1x)
- pH probe + signal conditioning circuit (1x)
- Analog turbidity sensor with TSW-30 module (1x)
- Roadmap: Atlas Scientific EZO-DO + dissolved oxygen probe
- Dissolved oxygen sensor (hardware procurement pending)
- LSTM-based 24-hour parameter forecasting (data collection in progress)
- Email/SMS alerts on threshold violations
- Multi-tank support with device grouping
- Mobile-responsive PWA improvements
This is an active research project at IIT Kharagpur. Not yet production-grade for commercial deployment. Issues and contributions welcome.
- Frontend foundation adapted with permission from a peer's BTP project
- Architecture guidance from Prof. Gourav Dhar Bhowmick
MIT (see LICENSE)