
How We Built StubbleWatch: A Serverless AWS & GenAI Early Warning System for World's Smog Crisis
Combining NASA satellite telemetry, meteorological wind physics, and Amazon Bedrock on a serverless AWS stack to give 30 million citizens and city authorities a 6-to-12-hour advance warning before crop-fire smoke hits Delhi NCR.
The Problem: Why Traditional Air Quality Monitoring is Too Late
Every October and November, over 30 million residents in Delhi NCR wake up to a familiar, choking reality: the winter smog season. Burning of paddy crop residue (parali) in Punjab and Haryana releases millions of tons of particulate matter (PM2.5) and toxic aerosols into the atmosphere.
Today, citizens and regulatory bodies rely on ground-based monitoring networks (CPCB, SAFAR, AQI towers). But these systems have a fundamental architectural flaw:
Ground sensors are strictly reactive. They only sound the alarm after toxic smoke has already entered city airspace and settled into people's lungs. By the time an AQI monitor crosses 400 ("Severe"), emergency measures—like halting construction or closing schools—are already too late to prevent mass exposure.
We asked a simple engineering question:
What if cities could track smoke plumes from orbit and forecast exactly when they will hit, hours before ground sensors register a single microgram?
Enter StubbleWatch.
The Solution: Predictive Environmental Intelligence
StubbleWatch is an autonomous, serverless early-warning platform. Instead of measuring static ground pollution, it models the drift vectors of active fires hundreds of kilometers away to compute real-time smoke arrival times (ETA), risk levels, and actionable AI advisories.
- Live Web Dashboard: https://main.d2rshd6w3xwz8n.amplifyapp.com
- GitHub Repository: https://github.com/damnRITIJ/TrioBuilds
How It Works: The Orbit-to-Ground Physics Engine
Rather than building a heavyweight, computationally expensive 3D atmospheric dispersion simulation, we designed a lightweight, sub-second mathematical physics engine in Python:
- Thermal Anomaly Ingestion: We pull live satellite fire detections from the NASA FIRMS (VIIRS 375m) constellation. VIIRS provides ultra-high thermal sensitivity, capturing small-scale farm fires and their Fire Radiative Power (FRP, measured in Megawatts).
- Spatial Grid Clustering: Thousands of discrete farm fires are aggregated into ~10 km spatial grid cells. This eliminates satellite noise and collapses weather API queries from thousands into just a dozen batched requests.
- Dynamic Wind Cone Convergence: Traditional bearing checks use a fixed ±30° cone, which creates an unrealistic 150 km lateral slack cone at 300 km distance. We formulated a dynamic convergence function:
θ_tolerance = max(10°, 45° - Distance / 15)This tightens the detection cone as distance increases, ensuring only smoke strictly heading for Delhi NCR is classified as upwind.
- Inverse-Distance Decay & Stagnation Modeling: Faraway fires disperse smoke over distance, while fires near Delhi have a severe immediate impact. We apply an inverse-distance decay weight capped at 3.0× for fires closer than 100 km. Furthermore, when wind speeds drop below 5 km/h near Delhi, a 1.5× stagnation penalty is triggered to model toxic particulate accumulation.
- Arrival Time (ETA Engine): Using vector decomposition of wind speed and geometric distance, we estimate when the smoke front will enter Delhi airspace (
ETA = Distance / WindSpeed). Any cluster with an ETA > 48 hours is automatically dropped, recognizing that weather forecast confidence rapidly degrades beyond two days.
Cloud Architecture: 100% Serverless on AWS
To ensure sub-second response times, zero maintenance overhead, and $0 idle operating costs, StubbleWatch is engineered entirely with AWS serverless primitives:
- AWS Lambda (Python 3.12 via AWS SAM): Orchestrates satellite ingestion, atmospheric vector processing, scoring, and alerting in under 400 milliseconds.
- Amazon EventBridge: Executes scheduled recurring ingestion every 2 hours without human intervention.
- Amazon API Gateway: Serves on-demand REST
/scorequeries with full CORS support, allowing users to click anywhere on the map to recalculate local risk on the fly.
- Amazon Bedrock (amazon.nova-micro-v1:0): Synthesizes telemetry into tailored, bilingual (English + Hindi) advisories for two distinct personas:
- For Citizens: Clear indoor health safety advisories.
- For Authorities: Tactical enforcement actions (deploying anti-smog mist cannons, regulating heavy vehicles, pausing dust-heavy construction).
- Deterministic Fallback: If LLM rate limits spike, the backend catches the exception and generates rule-based advisories so the UI never crashes.
- Amazon S3: Persists temporal telemetry snapshots (
snapshot.json) for historical analysis and sub-millisecond client caching.
- Amazon SNS: Provides real-time event broadcasting to subscribers via email when risk crosses severe thresholds, as well as on-demand simulation tests.
- AWS Amplify: Delivers global, continuous CDN hosting for our React 19 + TypeScript + Vite + Tailwind CSS + Leaflet map interface.
The Interactive Alert Demo: Closing the Loop
In emergency management, intelligence is useless without dissemination.
On the live StubbleWatch dashboard, users can click "Alerts", enter their email address, and instantly subscribe via Amazon SNS.
To demonstrate the full lifecycle during presentations and hackathon judging, clicking the "Test" button simulates a peak stubble-burning event:
- The telemetry map flashes into High Risk with active upwind red plumes.
- The button updates to a green checkmark saying "Alert Sent!".
- Amazon SNS immediately publishes a high-priority alert email to subscriber inboxes in real-time.
Real-World Impact
For regulatory agencies like the Commission for Air Quality Management (CAQM) and the Central Pollution Control Board (CPCB), StubbleWatch changes the game:
Instead of reacting to hazardous AQI days after smoke has settled, authorities gain a 6-to-12-hour operational head start. This window is long enough to:
- Deploy mobile anti-smog water mist cannons along upwind entry corridors.
- Stagger office timings and ban non-essential commercial diesel trucks before congestion traps smoke at ground level.
- Alert schools and hospitals to prepare indoor air filtration protocols.
Key Takeaways & What's Next
Building StubbleWatch for the AWS Hackathon demonstrated the power of serverless cloud orchestration:
- Cost Efficiency: Because the pipeline only runs when scheduled or invoked on-demand, total infrastructure cost during an entire 60-day stubble season is under $5.
- Fault Tolerance: Designing a mission-critical emergency system taught us that LLMs must always be paired with deterministic fallbacks.
- Next Steps: Expanding coverage across the Indo-Gangetic Plains, adding multi-language WhatsApp alerts, and incorporating Sentinel-5P satellite tropospheric NO2/CO data.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article