An intelligent autonomous robotic boat designed for real-time water quality monitoring, plastic pollution detection, and algae bloom identification using advanced AI/ML models and hyperspectral sensing technology.
- What This Project Does
- Problem Statement & Solution
- Key Features
- System Architecture
- Technologies Used
- Installation & Setup
- Environment Variables
- Usage Guide
- Screenshots
- Team
- Documentation
This autonomous boat system:
- Navigates autonomously through water bodies using GPS waypoints
- Monitors water quality in real-time using an 18-channel hyperspectral sensor
- Detects plastic pollution using computer vision (YOLOv8)
- Identifies algae blooms and predicts chlorophyll-A levels using machine learning
- Operates offline-first with automatic cloud synchronization when internet is available
- Provides real-time dashboard for monitoring and remote control
- Collects samples at specified locations using an automated pump system
Water pollution is a critical environmental challenge affecting lakes, rivers, and oceans globally:
- Plastic Pollution: 8+ million tons of plastic enter oceans annually, harming marine life
- Algae Blooms: Harmful algal blooms (HABs) contaminate drinking water and kill aquatic life
- Manual Monitoring: Traditional water quality testing is time-consuming, expensive, and covers limited areas
- Limited Data: Lack of continuous, real-time water quality data for effective decision-making
An autonomous robotic boat that combines:
β
AI-Powered Detection: Dual AI system for plastic detection (YOLOv8) and chlorophyll prediction (CatBoost)
β
Hyperspectral Sensing: 18-channel spectral sensor (410-940nm) for detailed water analysis
β
Offline-First Architecture: Works without internet, syncs data when connected
β
Cost-Effective: Uses affordable hardware (Raspberry Pi + ESP32) compared to commercial solutions
β
Scalable: Can deploy multiple boats to cover large water bodies
β
Real-Time Monitoring: Live dashboard with GPS tracking and data visualization
- Early detection of harmful algal blooms
- Mapping plastic pollution hotspots
- Continuous water quality monitoring for environmental agencies
- Data-driven decision making for water resource management
- GPS-based waypoint navigation
- IMU and magnetometer for orientation
- Obstacle avoidance capabilities
- Return-to-home functionality
- Mission planning with custom routes
- AS7265x Spectral Sensor: 18 channels from 410nm to 940nm
- Pi Camera NoIR: Visual documentation and plastic detection
- GPS NEO-6M: Position tracking with 2.5m accuracy
- MPU6050 IMU: Pitch/roll compensation
- HMC5883L Magnetometer: Heading calculation
- TDS Sensor: Total dissolved solids measurement
- YOLOv8n model trained on 5000+ images
- Detects plastic bottles, bags, and algae blooms
- Real-time inference on camera feed
- 70+ training epochs for high accuracy
- CatBoost regression model
- Predicts chlorophyll-A concentration from spectral data
- SHAP explainability for model interpretability
- Trained on calibrated spectral measurements
- MQTT protocol for real-time updates
- Offline SQLite database with cloud sync
- WebSocket for live dashboard updates
- RESTful API for data access
- MongoDB cloud storage
- Real-time boat tracking on interactive map
- Live sensor data visualization
- Mission management interface
- Historical data analysis with charts
- Remote control capabilities
- Alert system for anomalies
- Battery voltage monitoring
- Low-power modes
- Automatic shutdown on critical battery
- Solar charging support (optional)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLOUD BACKEND β
β Express.js + MongoDB + MQTT Broker + WebSocket β
β β’ Mission management β
β β’ Data storage & analytics β
β β’ Real-time updates β
βββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ
β MQTT/HTTPS
β (when online)
βββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββ
β RASPBERRY PI 4 (Master Controller) β
β Python + SQLite + MQTT Client β
β β’ Navigation & Mission Control β
β β’ Sensor Data Acquisition β
β β’ AI Inference (Chlorophyll + Plastic) β
β β’ Local Database & Sync Service β
β β
β Sensors: β
β β’ AS7265x (IΒ²C) - 18-channel spectral β
β β’ Pi Camera NoIR - Image capture β
β β’ NEO-6M GPS - Position β
β β’ MPU6050 - IMU β
β β’ HMC5883L - Magnetometer β
βββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ
β USB Serial
β (115200 baud)
βββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββ
β ESP32 (Motor Controller) β
β Arduino C++ Firmware β
β β’ Controls 2Γ DC motors (L298N) β
β β’ Controls 1Γ peristaltic pump β
β β’ Battery voltage monitoring β
β β’ Receives commands from RPi β
βββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ
β
βββββββββ΄βββββββββ
β β
βββββββΌββββββ ββββββΌββββββ
β L298N #1 β β L298N #2 β
β Left + β β Pump β
β Right β β Motor β
β Motors β β β
βββββββββββββ ββββββββββββ
- Raspberry Pi 4 (4GB RAM) - Main controller
- ESP32 DevKit - Motor controller
- AS7265x - 18-channel spectral sensor (Triad Spectroscopy)
- Pi Camera NoIR - Near-infrared camera
- NEO-6M GPS - Global positioning
- MPU6050 - 6-axis IMU
- HMC5883L - 3-axis magnetometer
- 2Γ L298N - Dual H-bridge motor drivers
- TDS Sensor - Water conductivity
- 12V DC Motors - Propulsion
- Peristaltic Pump - Water sampling
- Python 3.9+ - Raspberry Pi controller
- Node.js + Express - Backend API server
- MongoDB - Cloud database
- SQLite - Local offline database
- MQTT (Mosquitto) - Real-time communication
- FastAPI - AI model inference API
- Next.js 14 - React framework
- TypeScript - Type-safe development
- Tailwind CSS - Styling
- Leaflet - Interactive maps
- Chart.js - Data visualization
- Socket.io - Real-time updates
- YOLOv8n (Ultralytics) - Object detection
- CatBoost - Gradient boosting for regression
- LightGBM - Alternative ML model
- SHAP - Model explainability
- scikit-learn - Preprocessing & metrics
- OpenCV - Image processing
- Arduino IDE - ESP32 firmware
- VS Code - Development environment
- Git - Version control
- Docker (optional) - Containerization
- MQTT - Pub/Sub messaging
- WebSocket - Real-time web updates
- IΒ²C - Sensor communication
- UART/Serial - RPi β ESP32 communication
- REST API - HTTP endpoints
- Raspberry Pi 4 (4GB+ RAM) with Raspberry Pi OS
- ESP32 development board
- Node.js 18+ (for backend server)
- Python 3.9+ (for Raspberry Pi)
- Arduino IDE (for ESP32 firmware)
- MongoDB database (local or cloud)
- MQTT broker (Mosquitto or cloud service)
Refer to detailed wiring guides:
# SSH into your Raspberry Pi
ssh pi@raspberrypi.local
# Update system
sudo apt update && sudo apt upgrade -y
# Enable I2C, Serial, and Camera
sudo raspi-config
# Interface Options β Enable I2C, Serial, Camera
# Reboot after changes
# Clone repository
git clone https://github.com/AhqafCoder/GANDHARVAS_SIH25204.git
cd GANDHARVAS_SIH25204/raspberry-pi
# Install Python dependencies
pip3 install -r requirements.txt
# Configure settings
cp config.yaml.example config.yaml
nano config.yaml # Edit with your settings# On your development PC (Windows/Mac/Linux)
# 1. Install Arduino IDE from https://www.arduino.cc/
# 2. Add ESP32 board support:
# File β Preferences β Additional Board Manager URLs:
# https://dl.espressif.com/dl/package_esp32_index.json
# 3. Install ESP32 boards:
# Tools β Board β Boards Manager β Search "ESP32" β Install
# 4. Open firmware
# File β Open β firmware/esp32_motor_controller/esp32_motor_controller.ino
# 5. Configure
# Tools β Board β ESP32 Dev Module
# Tools β Port β (Select your COM port)
# 6. Upload
# Click Upload button (β)# On server machine or cloud instance
# Clone repository
git clone https://github.com/AhqafCoder/GANDHARVAS_SIH25204.git
cd GANDHARVAS_SIH25204/server
# Install dependencies
npm install
# Setup environment variables (see below)
cp .env.example .env
nano .env # Configure your settings
# Start server
npm start
# Or with PM2 for production
npm install -g pm2
pm2 start index.js --name boat-server# On your development machine
cd GANDHARVAS_SIH25204/client
# Install dependencies
npm install
# Configure API endpoint
# Edit .env.local
echo "NEXT_PUBLIC_API_URL=http://your-server:3000" > .env.local
echo "NEXT_PUBLIC_WS_URL=ws://your-server:3000" >> .env.local
# Development mode
npm run dev
# Production build
npm run build
npm start# Setup Macro AI (YOLOv8)
cd GANDHARVAS_SIH25204/ai\ macro/dataset-pipeline
# Install dependencies
pip install -r requirements.txt
# Download/train model
python train_70epochs.py
# Setup Micro AI (CatBoost)
cd ../../ai\ micro
# Install dependencies
pip install -r requirements.txt
# Train models
python train_improved.py
# Start inference API
cd api
uvicorn main:app --host 0.0.0.0 --port 8000# Server Configuration
PORT=3000
NODE_ENV=production
# MongoDB
MONGODB_URI=mongodb://localhost:27017/boat_monitoring
# Or MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/boat_monitoring
# MQTT Broker
MQTT_BROKER_URL=mqtt://localhost:1883
# Or cloud broker:
# MQTT_BROKER_URL=mqtts://broker.hivemq.com:8883
MQTT_USERNAME=boat_user
MQTT_PASSWORD=your_secure_password
MQTT_CLIENT_ID=backend_server
# JWT Authentication (Optional)
JWT_SECRET=your_jwt_secret_key_here
# File Upload
UPLOAD_DIR=./uploads
MAX_FILE_SIZE=10485760 # 10MB
# API Keys (if using external services)
WEATHER_API_KEY=your_weather_api_key
MAPS_API_KEY=your_maps_api_key# Boat Configuration
boat_id: "BOAT_001"
# Server Connection
mqtt:
broker: "mqtt://your-server.com:1883"
username: "boat_user"
password: "your_password"
topics:
status: "boat/BOAT_001/status"
data: "boat/BOAT_001/data"
commands: "boat/BOAT_001/commands"
# Hardware Settings
hardware:
esp32_port: "/dev/ttyUSB0"
esp32_baud: 115200
gps_port: "/dev/serial0"
gps_baud: 9600
camera_resolution: [1920, 1080]
# Sampling Configuration
sampling:
interval_meters: 10 # Sample every 10 meters
spectral_integration_time: 50 # ms
pump_duration: 5 # seconds
# AI Models
ai:
yolo_model: "models/yolov8n_plastic_algae.pt"
chlorophyll_model: "http://your-server:8000/predict/chlorophyll"
confidence_threshold: 0.6
# Database
database:
local_path: "data/boat_data.db"
sync_interval: 300 # seconds (5 minutes)NEXT_PUBLIC_API_URL=http://localhost:3000
NEXT_PUBLIC_WS_URL=ws://localhost:3000
NEXT_PUBLIC_MQTT_BROKER=ws://localhost:9001
NEXT_PUBLIC_MAP_TILE_URL=https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png-
Start Backend Server
cd server npm start -
Start Raspberry Pi Controller
cd raspberry-pi python3 boat_controller.py -
Start Frontend Dashboard
cd client npm run dev -
Access Dashboard
- Open browser:
http://localhost:3000
- Open browser:
- Navigate to Mission Planner tab
- Click on map to add waypoints
- Set mission parameters:
- Start coordinates
- Destination coordinates
- Sampling interval (meters)
- Waypoint sequence
- Click Save Mission
- Deploy boat and click Start Mission
- Map View: See boat position, track history, waypoints
- Dashboard: Live sensor readings, water quality metrics
- Charts: Time-series graphs of chlorophyll, TDS, etc.
- Alerts: Notifications for anomalies (high chlorophyll, plastic detected)
Use the Command Panel to:
FORWARD- Move forwardBACKWARD- Move backwardLEFT- Turn leftRIGHT- Turn rightSTOP- Stop all motorsPUMP_ON- Start water samplingPUMP_OFF- Stop pumpRTH- Return to home
- Navigate to Data Explorer
- Filter by date range, location, or parameters
- Export data as CSV/JSON
- View AI predictions and confidence scores
- Download captured images
Note: Replace placeholder images with actual screenshots from your deployed system.
Team Gandharvas - Smart India Hackathon 2025
Institute: Invertis University
| Name | Role |
|---|---|
| Sarthak Maurya | R&D Lead & Hardware Lead |
| Aadya Saraswat | R&D and Designing Lead |
| Ahqaf Ali | Hardware & Backend Lead |
| Vivek Vishwakarma | AI/ML Lead |
| Lal Shivam Singh | UI/UX Lead |
| Trisha Bhardwaj | Documentation Lead |
For detailed documentation, refer to:
- Comprehensive Guide - Full technical documentation
- Quick Start Guide - Fast setup instructions
- Deployment Guide - Production deployment steps
- Integration Guide - Hardware integration details
- ESP32 Wiring - Motor controller wiring
- API Documentation - Backend API reference
- Manual Control Guide - Remote control instructions
- Check internet connectivity
- Verify MQTT broker URL and credentials
- Check firewall settings on server
- Verify I2C connections:
i2cdetect -y 1 - Check power supply to sensors
- Ensure proper pull-up resistors on I2C lines
- Test ESP32 serial communication:
screen /dev/ttyUSB0 115200 - Check motor driver connections
- Verify battery voltage (should be 11-12.6V)
- Move to open area (away from buildings)
- Wait 2-3 minutes for satellite lock
- Check GPS antenna connection
- Ensure model files are in correct paths
- Check FastAPI server is running
- Verify network connectivity to inference API
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is developed for Smart India Hackathon 2025.
- Smart India Hackathon for the opportunity
- Invertis University for support and resources
- Ultralytics for YOLOv8 framework
- CatBoost team for ML library
- OpenStreetMap for map tiles
For questions or support:
- GitHub: AhqafCoder/GANDHARVAS_SIH25204
- Email: team.gandharvas@example.com
Made with β€οΈ by Team Gandharvas
β Star this repository if you find it helpful!