🌿 Sprinkify — AI-Optimized Irrigation That Waters What Matters

🧠 Inspiration / Problem

Conventional campus and city sprinklers waste massive amounts of water:

  • 🚿 Overspray: sprinklers water sidewalks, buildings, and pedestrians.
  • 💧 Overlap waste: multiple sprinklers redundantly cover the same spots.
  • 🕒 Rigid schedules: timers don’t adapt to lawn shapes or weather.

This leads to water waste, poor efficiency, and negative user experience — a serious issue in cities and campuses trying to conserve water.


💡 What It Does

Sprinkify is an AI-powered irrigation assistant that:

  • Accepts text descriptions (via Gemini LLM) or images / aerial footage (via ML + OpenCV) to generate GeoJSON lawn layouts with sprinkler positions.
  • Runs an optimizer (CP-SAT solver + PPO reinforcement learning agent) to generate efficient sprinkler rotation + flow patterns.
  • Produces simulation heatmaps, MATLAB-powered visualizations, and drives real hardware (servo motors + pumps) to execute the plan.
  • Offers a React + Tailwind dashboard with chatbot interface, multilingual support, and analytics.
  • Uses Spring Boot for secure orchestration and Flask for ML/image processing.

👉 The result: maximum coverage, minimum waste, and real-time synchronized sprinkler control.


🏗️ System Architecture

🖥️ Frontend (React + Tailwind + Konva)

  • Chatbot UI (Gemini agents: Designer, Personal Advisor, Eco-Optimizer)
  • Image & drone footage uploader
  • Lawn editor + simulation viewer

☁️ Backend Layer 1 — Spring Boot (Java)

  • API gateway
  • Hosts chatbot orchestration
  • Uses Gemini API for text → GeoJSON parsing & explanations

🧠 Backend Layer 2 — Flask (Python)

  • Image processing (OpenCV + Shapely):
    • HSV green segmentation → lawn polygons
    • Contour extraction → Shapely polygons (scaled to real units)
    • HoughCircles → sprinkler positions
  • Optimizer:
    • OR-Tools CP-SAT solver (deterministic)
    • PPO RL agent (learning-based)
  • Simulation Renderer:
    • Generates coverage heatmaps & MP4 animations

🗄️ Database — MongoDB Atlas

  • Stores users, lawns, sprinklers, GeoJSON, optimization plans, simulation runs, device telemetry

🧩 Feature Breakdown

🌿 Feature A — Text → Lawn (Gemini LLM, NLP)

  • User enters natural language (e.g., “5m wide, 7m long lawn with rounded edges…”)
  • Gemini extracts shape, size, sprinkler placements
  • Regex + spaCy validation layer ensures units and geometry are consistent
  • Stored as GeoJSON in MongoDB

🖼️ Feature B — Image/Drone → Lawn (CV)

  • HSV threshold green → lawn
  • OpenCV contours → polygons (Shapely)
  • Threshold blue + HoughCircles → sprinklers
  • Scale to real units → GeoJSON
  • Great for both uploaded photos and drone footage (DJI Mini 3 4K) to map irregular lawns automatically.

🧮 Feature C — GeoJSON → Optimized Plan

  1. Solver Path (OR-Tools):

    • Rasterize lawn, precompute spray kernels
    • Solve scheduling with CP-SAT → minimize overspray + water use
  2. Learning Path (PPO):

    • RL agent learns rotation/flow control over simulated lawns
    • Adaptable to new shapes without retraining
  3. Hybrid Mode:

    • Seed solver with RL output for optimal + feasible schedules.

Output: JSON rotation & flow instructions per sprinkler.


🌐 Feature F — Database & Data Management

  • All structured data stored in MongoDB: users, GeoJSON, optimization results, telemetry, MATLAB outputs.

🚁 Drone → GeoJSON Feature

We use DJI Mini 3 (4K) drone to capture aerial footage.
Flask runs an OpenCV segmentation + contour pipeline to extract real-world polygons and generate GeoJSON, even for complex or snake-shaped lawns.
👉 This makes Sprinkify scalable for campus-sized mapping.


📊 MATLAB Integrations

8️⃣ Coverage Heatmap Generation

  • MATLAB simulates water coverage over 2D grid (GeoJSON + sprinklers)
  • Produces coverage matrices + heatmap PNGs for the dashboard.

9️⃣ Optimizer Benchmarking

  • Run MATLAB Optimization Toolbox (fmincon, ga)
  • Compare solutions from OR-Tools, PPO RL, and MATLAB solver.

🔟 Geometric Preprocessing & Shape Analysis

  • Convex hull, perimeter, area, polygon decomposition
  • Used for heuristic sprinkler placement and lawn grid preparation.

1️⃣1️⃣ Simulation Playback Generation

  • MATLAB animates sprinklers over time (angles, flows)
  • Generates MP4 with VideoWriter → displayed in React dashboard.

🤖 Hardware Build

A mini irrigation controller built on Arduino-class hardware:

Component Function
Elegoo Uno R3 Microcontroller
16×2 LCD Status display
28BYJ-48 stepper + ULN2003 Sprinkler rotation
L293D H-bridge + DC pump Variable flow control
IR tripwire sensor Stops watering if beam is broken
Analog soil moisture sensor Monitors soil hydration
Buzzer Alerts
5 V buck converter Power regulation

👉 Receives rotation/flow instructions from backend → executes real synchronized patterns.
👉 Displays status on LCD, stops on sensor break, logs moisture — all while rotating like a real sprinkler.


🧠 Gemini Integrations Throughout

  • Text → GeoJSON parsing
  • Three advisor modes: Lawn Designer 🧠, Personal Advisor 👤, Eco-Optimizer 🌍
  • Explanations of optimizer results (e.g., “Sprinkler S1 rotates 40°–120° to minimize overlap…”)
  • Sustainability narratives (“This schedule saves 12,000L/year ≈ 3 swimming pools”)
  • Multilingual support for global users

🧪 Tech Stack Summary

  • Frontend: React + Tailwind + Konva
  • Auth: Auth0 (MFA, JWT)
  • LLM: Gemini API (text→GeoJSON, explanations, narratives)
  • CV: OpenCV + Shapely
  • Optimizer: OR-Tools CP-SAT + PPO RL
  • Analytics: MATLAB (heatmaps, optimization, geometry, MP4)
  • Backend: Spring Boot (gateway), Flask (ML/CV/optimizer)
  • DB: MongoDB Atlas
  • Hardware: Arduino-class controller + DJI drone integration

🚧 Challenges

  • Synchronizing multiple sprinklers with rotation limits and real-time flow.
  • Handling informal text input (solved via Gemini + validation).
  • Cleaning drone footage for reliable polygon extraction.
  • Making solver + RL outputs feasible and explainable.

🏆 Accomplishments

  • Full pipeline: text/image/drone → GeoJSON → optimized plan → MATLAB analysis → hardware execution.
  • Real working controller with sensors, rotation, and flow control.
  • MATLAB integration for heatmaps, optimizer benchmarking, and animations.
  • Gemini used for both authoring and explanation, making the AI feel like an advisor.

📚 What We Learned

  • Combining optimization and learning yields superior plans.
  • MATLAB accelerates numerical analysis dramatically.
  • Explainability (Gemini) improves user trust and makes demos shine.
  • A well-designed multi-agent chatbot UX adds massive perceived intelligence.

🚀 What’s Next

  • Weather-aware & predictive watering (LSTM/XGBoost)
  • Edge ML on microcontrollers for pedestrian detection
  • Multi-node coordination across large campuses
  • AR visualization of sprinkler coverage
  • Voice mode (Gemini + ElevenLabs)

🛠️ Built With

React · Tailwind · Konva · Spring Boot · Flask · OpenCV · Shapely · Gemini API · OR-Tools · PPO RL · MATLAB · MongoDB · Auth0 · Arduino · DJI Mini 3 Drone

Share this project:

Updates