Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌾 Krishi Vaani

The Voice of the Farm

AI-powered voice & SMS agricultural intelligence for India's small and marginal farmers in their own language, on the phone they already own.

Built for Build with AI: Code for Communities a Google Cloud hackathon where every problem statement was written by an MP's office, and the best solutions get piloted in a real constituency.

Status Stack AI Hardware License


Why this exists

86.1% of India's ~146 million landholdings are small and marginal (Agriculture Census, 2015–16). Most of these farmers choose what to plant based on habit and hearsay β€” not on what the soil, the groundwater, or the sky are actually saying. When the guess is wrong, the loss is total: no insurance cushion, no smartphone to check an app, and one extension officer covering dozens of villages.

AgriVaani doesn't ask farmers to change how they live. It meets them on a phone call.

What it does

AgriVaani is three connected AI systems, reachable entirely by voice IVR and SMS β€” no app, no smartphone, no literacy requirement:

Pillar What it does
πŸ›°οΈ Smart Crop Recommendation Fuses satellite NDVI/NDMI, soil pH, groundwater depth, and rainfall history into a ranked, plain-language crop recommendation per plot, per season.
⚑ Real-Time Advisory & Dry-Spell Alerts Fuses weather forecasts with real field sensor data (Arduino Mega 2560 + GSM + pH sensor) to push proactive irrigation/fertigation alerts by voice and SMS β€” before the damage happens, not after. Can optionally auto-actuate an irrigation pump via a 4-channel relay, gated by hard safety limits.
πŸ”¬ Crop Health Logging A farmer sends a photo or voice note of a sick plant. Gemini's multimodal model gives an instant diagnosis and confidence score. Low-confidence or high-severity cases are automatically escalated to a human expert at the nearest Rythu Seva Kendra.

System Architecture

                        FARMER TOUCHPOINTS
        πŸ“ž Toll-free voice call (IVR)      πŸ’¬ SMS (inbound/outbound)
                     β”‚                              β”‚
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β”‚  Telephony Gateway │◄────────    SMS Gateway     β”‚
           β”‚  (Twilio / Exotel) β”‚        β”‚  (Twilio / Exotel) β”‚
           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                     β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚    Orchestration API      β”‚  Node.js / TypeScript
                       β”‚  session state Β· routing  β”‚
                       β”‚  IVR state machine        β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
           β–Ό              β–Ό           β–Ό               β–Ό              β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Recommend    β”‚ β”‚ Advisory  β”‚ β”‚ Crop      β”‚ β”‚ Language   β”‚ β”‚ RSK Officer β”‚
   β”‚ Service      β”‚ β”‚ Alert     β”‚ β”‚ Health    β”‚ β”‚ Provider   β”‚ β”‚ Dashboard   β”‚
   β”‚ FastAPI +    β”‚ β”‚ Engine    β”‚ β”‚ Diagnosis β”‚ β”‚ Bhashini / β”‚ β”‚ Next.js 14  β”‚
   β”‚ XGBoost      β”‚ β”‚ Node cron β”‚ β”‚ Gemini    β”‚ β”‚ Google STT β”‚ β”‚             β”‚
   β”‚              β”‚ β”‚ + rules   β”‚ β”‚ Vision    β”‚ β”‚ /TTS       β”‚ β”‚             β”‚
   β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
          β”‚               β”‚             β”‚                             β”‚
          β–Ό               β–Ό             β–Ό                             β”‚
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”‚
   β”‚                    Data Layer                    β”‚               β”‚
   β”‚  Earth Engine Β· Soil Health Card Β· CGWB          β”‚               β”‚
   β”‚  IMD / weather Β· Field hardware (GSM/GPRS + SMS) β”‚               β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜               β”‚
                            β–Ό                                         β”‚
                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                        β”‚
                β”‚ PostgreSQL Β· Firestore Β·   β”‚β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                β”‚ BigQuery                   β”‚
                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

On the ground

   🌱 Field                                    πŸ“‘ GSM / GPRS
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Arduino Mega 2560   β”‚ ── pH readings ──► β”‚ Orchestration API     β”‚
β”‚  + SIM800L GSM      β”‚                    β”‚ /v1/sensors/:id/...   β”‚
β”‚  + pH sensor        β”‚ ◄── commands ────  β”‚                       β”‚
β”‚  + 4-ch relay       β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚    β”œβ”€ irrigation pump                                β”‚
β”‚    β”œβ”€ fertigation valve A                            β–Ό
β”‚    β”œβ”€ fertigation valve B                  Alert Engine (cron)
β”‚    └─ spare                                fuses forecast + soil signal
β”‚  safety: 30-min max runtime,               β†’ voice + SMS alert
β”‚  local manual override always wins         β†’ optional auto-actuation
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         (opt-in, critical-only)

Tech Stack

AI / MLVertex AI Β· Gemini 2.x (multimodal) Β· XGBoost recommender + rules-based fallback
GeospatialGoogle Earth Engine (Sentinel-2 NDVI/NDMI) Β· ISRO Bhuvan Β· CGWB / India-WRIS groundwater
WeatherIMD API Β· NASA POWER / OpenWeatherMap fallback
Voice & SMSTwilio Programmable Voice + SMS (Exotel-ready via provider interface)
LanguageBhashini (primary) Β· Google Cloud Speech-to-Text & Text-to-Speech (fallback, live)
BackendNode.js + TypeScript (orchestration) Β· Python + FastAPI (recommendation engine)
DatabasePostgreSQL (Cloud SQL / Neon / Supabase) Β· Firestore Β· BigQuery
DashboardNext.js 14 + TypeScript + Tailwind CSS
Field HardwareArduino Mega 2560 Β· SIM800L GSM module Β· analog pH sensor Β· 4-channel relay module

Repository Structure

agrivaani/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ orchestration-api/        # Node.js/TypeScript β€” telephony, sessions, IVR, alerts
β”‚   β”œβ”€β”€ recommendation-service/   # Python FastAPI β€” crop scoring + Gemini rationale
β”‚   └── officer-dashboard/        # Next.js 14 β€” RSK escalation queue
β”œβ”€β”€ firmware/
β”‚   └── sensor_node/sensor_node.ino   # Arduino Mega 2560 + GSM + pH + relay
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ seed_demo_data.ts
β”‚   β”œβ”€β”€ telemetry_replay.py
β”‚   └── fake_call.ts
β”œβ”€β”€ db/
β”‚   └── migrations/001_initial_schema.sql
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ DEMO_SCRIPT.md
β”‚   └── KNOWN_GAPS.md
└── .env.example

Getting Started (native β€” no Docker required)

This project runs natively on your machine. No virtualization needed.

1. Database β€” free cloud Postgres

Create a free instance at neon.tech or supabase.com, then:

psql <your_connection_string> -f db/migrations/001_initial_schema.sql

2. Environment

cp .env.example .env
# fill in DATABASE_URL at minimum β€” everything else falls back to
# deterministic mocks if a key is missing (see KNOWN_GAPS.md)

3. Seed demo data

cd scripts && ts-node seed_demo_data.ts

4. Run the services

# Terminal 1 β€” orchestration API
cd apps/orchestration-api && npm install && npm run dev

# Terminal 2 β€” recommendation engine
cd apps/recommendation-service && python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload --port 8000

# Terminal 3 β€” officer dashboard
cd apps/officer-dashboard && npm install && npm run dev

5. (Optional) Go live with real voice calls

ngrok http 3000
# point your Twilio number's webhook at <ngrok-url>/v1/voice/inbound

Full walkthrough: docs/DEMO_SCRIPT.md


What's real vs. what's mocked

AgriVaani is built so that every mocked component sits behind the same interface a real one would use β€” swap a credential, not the architecture. Full detail in docs/KNOWN_GAPS.md.

Component Status
Crop scoring (rules-based) βœ… Live, unit-tested
Gemini rationale generation βœ… Live (falls back to static strings without a key)
Google Cloud Speech-to-Text / Text-to-Speech βœ… Live
Arduino Mega 2560 firmware (pH + relay + safety cutoffs) βœ… Written, hardware-ready
Alert engine (deterministic dry-spell + pH thresholds) βœ… Live
Gemini Vision crop diagnosis βœ… Live (falls back to a mock diagnosis without a key)
RSK officer dashboard βœ… Live
Twilio voice/SMS βœ… Live with a trial account + ngrok
Earth Engine satellite sync 🟑 Mocked (realistic randomized NDVI/NDMI)
XGBoost trained model 🟑 Rules-based fallback in its place
Bhashini Indic language APIs 🟑 Mocked (enterprise account required)
Officer authentication 🟑 Stubbed (pilot-blocker, not a hackathon-blocker)

Safety by design

  • Auto-actuation is opt-in per plot, critical-alerts-only β€” advisory (voice/SMS) is always the default response. The system never silently starts controlling a farmer's irrigation pump.
  • Hardware-level guardrails: a 30-minute max relay runtime regardless of the source of the command, and a local manual override switch that always wins over a remote signal.
  • Alert fatigue control: no duplicate alert for the same unresolved condition within 24 hours.
  • Explicit escalation rule, not implicit LLM judgment: needs_expert = confidence < 0.6 OR severity == "high" lives in code, not inside a prompt.

Roadmap

  • Crop recommendation engine with rules-based fallback
  • Real-time alert engine with hardware sensor fusion
  • Crop health diagnosis with human escalation
  • Voice/SMS orchestration with live Twilio + Google TTS
  • Real Earth Engine satellite integration
  • Trained XGBoost model on labeled yield data
  • Bhashini production integration for full Indic language coverage
  • Pilot deployment with one Rythu Seva Kendra cluster
  • District-scale rollout in partnership with the state agriculture department

Team

SSY – Solve. Scale. Yield. β€” Indore

Built for Build with AI: Code for Communities (Google Cloud Hackathon)


Krishi Buddhimatta, Har Kisan Tak Agricultural intelligence, to every farmer.

Releases

Packages

Contributors

Languages