National Hackathon • 1st Prize Winner

How We Won Smart India Hackathon: The Inside Story

36 hours. 6 engineers. 1 catastrophic 3:00 AM GSM failure. How an emergency Architecture Decision Record (ADR) moving compute from cloud to edge won us 1st Prize nationally at Smart India Hackathon.

Shubham Kulkarni
Shubham Kulkarni Team Lead • Embedded Systems Architect
Published February 2026 • Updated Sep 2026
Engineers collaborating intensely over hardware in a hackathon

It was 3:15 AM inside the echoing basketball auditorium that served as the Smart India Hackathon grand finale venue. Fluorescent lights buzzed overhead, energy drink cans littered every desk, and our team was staring into the abyss: our cloud-tethered GSM communication bridge had completely collapsed. The indoor hall was an RF dead zone with an attenuation of -98 dBm. In fewer than five hours, a judging panel of senior scientists from the Ministry of Agriculture and ISRO would arrive at our booth. If we attempted to demonstrate our automated irrigation system using a cloud API, our demonstration would fail in under ten seconds.

What followed over the next three hours was the single most pivotal architectural decision of my engineering career. We stopped fighting the network, drafted a formal Architecture Decision Record (ADR) on a napkin, ripped out the cloud dependency entirely, and converted the entire system into an autonomous offline-first edge mesh. Here is the unvarnished engineering story of how Team AgroTechies took 1st Prize Nationally (AIR 1) at Smart India Hackathon.

36h Continuous Sprint
AIR 1 National Rank (Hardware)
₹100k Cash Prize Awarded
<80ms Local Edge Decision Loop

1. The Problem Statement: PS-1289 Smart Irrigation

The prompt issued by the Ministry of Agriculture was deceptive in its apparent simplicity: "Build an intelligent, low-cost precision irrigation system that conserves water by automatically activating field pumps based on soil moisture gradients."

Most competitor teams fell into the classic engineering trap: they tried to build everything. They demonstrated speculative drone imagery, blockchain crop certificate marketplaces, and mobile apps with 20 input forms. But they overlooked the harsh operational reality of rural Indian farms:

  • Zero Connectivity: Fields in rural Maharashtra, Rajasthan, or Bihar do not have reliable 4G cellular coverage or Wi-Fi.
  • Severe Power Fluctuations: Agricultural single-phase and three-phase power lines experience frequent brownouts and voltage surges.
  • Corrosive Soil Chemistry: Resistive copper moisture prongs corrode via electrolysis within 48 hours, outputting false readings that drown crops.
The Core Differentiator

While other teams pitched cloud dashboards to farmers who have no internet, we engineered a ruggedized, corrosion-resistant capacitive LoRa node that executes soil-to-pump closed-loop control entirely offline.

2. The 36-Hour Sprint Timeline

Chronology of the 36-Hour National Sprint

  • H 00–06 Topology Design Selected LoRa 433MHz star topology over Wi-Fi
  • H 06–16 Hardware Assembly Embedded C firmware on PIC microcontroller & relays
  • H 16–22 Cloud Integration Attempted GSM MQTT uplink to AWS Lambda
  • H 22–26 The Crisis & ADR GSM link collapsed; drafted offline edge ADR
  • H 26–32 Edge Rewrite Local SQLite WAL queue & edge threshold engine
  • H 32–36 Rehearsal & Pitch Rehearsed the physical "cable pull" demo 5 times

3. The Hour 25 Emergency Pivot: ADR-001

When the GSM module dropped 94% of packets inside the auditorium at 3:00 AM, we realized that our cloud-centric architecture was our single point of failure. We formally recorded our decision as an Architecture Decision Record (ADR):

docs/adr/ADR-001-Edge-Autonomy.md Architecture Decision Record
# ADR-001: Transition from Cloud Lambda to Edge Gateway Autonomy
Date: 2023-12-20 (Hour 25 of SIH Finale)
Status: ACCEPTED

## Context
1. The hackathon venue exhibits severe RF attenuation (-98 dBm on GSM/GPRS bands).
2. Live jury demonstration in 5 hours requires 100% reliable pump actuation.
3. Rural farmland mirrors this exact connectivity constraint.

## Decision
1. Decouple pump actuation from AWS Lambda completely.
2. Deploy the irrigation decision matrix locally on the Raspberry Pi edge gateway.
3. Use local SQLite with Write-Ahead Logging (WAL) as the primary transaction ledger.
4. Convert cloud sync into an asynchronous, best-effort background daemon with exponential backoff.

## Consequences
+ System is completely immune to network dropouts during live jury evaluation.
+ Pump decision latency drops from ~1,400ms (cloud roundtrip) to <80ms (local edge).
+ Cloud dashboard operates via eventually consistent sync when connectivity resumes.
- Requires local RTC clock or NTP fallback for time-of-day irrigation scheduling.

Architecture Comparison Matrix

Evaluation Parameter Cloud-Centric (Initial) Offline-First Edge (Pivot)
Demo Vulnerability Fatal (fails if cell signal drops) Zero (completely air-gapped)
Actuation Latency 1,200ms – 4,500ms <80ms direct GPIO relay trigger
Farmer Usability Requires active data subscription Runs forever on solar power + LoRa
Data Integrity Packets lost on disconnect Buffered locally in SQLite WAL store

4. Edge Hardware Architecture & LoRa Protocol

The deployed field station consisted of three decoupled hardware units:

  • Sensor End-Nodes Capacitive soil moisture sensor (v1.2, corrosion-proof) + DHT22 temperature/humidity sensor interfaced via ADC to a low-power microcontroller.
  • Radio Uplink (LoRa SX1278) Operating at 433 MHz with +20 dBm transmission power, achieving 3.5 km line-of-sight range across heavy agricultural foliage.
  • Edge Gateway & Optoisolated Actuator Industrial Raspberry Pi gateway driving an optoisolated 10A 250V AC relay with snubber circuit protection against pump inductive kickback.

5. Local Offline Gateway Implementation

Below is the production Python state machine we wrote between 3:30 AM and 5:00 AM. It listens on the LoRa serial UART, calculates evapotranspiration thresholds, trips the relay, and commits the transaction to local SQLite:

gateway/edge_controller.py Python 3.11 / SQLite WAL / Serial UART
import time
import serial
import sqlite3
import json

class EdgeIrrigationController:
    def __init__(self, port="/dev/ttyUSB0", baud=9600, db_path="local_telemetry.db"):
        self.ser = serial.Serial(port, baud, timeout=2.0)
        self.db = sqlite3.connect(db_path, check_same_thread=False)
        self.init_db()

    def init_db(self):
        with self.db:
            # Enable WAL mode for high-concurrency non-blocking local commits
            self.db.execute("PRAGMA journal_mode=WAL;")
            self.db.execute("""
                CREATE TABLE IF NOT EXISTS sensor_logs (
                    id INTEGER PRIMARY KEY AUTOINCREMENT,
                    node_id TEXT,
                    moisture_vwc REAL,
                    temp_c REAL,
                    pump_status INTEGER,
                    timestamp REAL,
                    synced_to_cloud INTEGER DEFAULT 0
                )
            """)

    def evaluate_irrigation(self, moisture_vwc: float, temp_c: float) -> bool:
        """
        Determines irrigation actuation locally without any cloud connection.
        Volumetric Water Content (VWC) < 32% triggers pump unless extreme heat
        suggests mid-day evaporative loss (postpones to evening cycle).
        """
        if moisture_vwc < 30.0 and temp_c < 38.0:
            return True  # Activate pump
        return False

    def process_packet(self):
        raw = self.ser.readline().decode('utf-8', errors='ignore').strip()
        if not raw.startswith("{") or not raw.endswith("}"):
            return
        
        try:
            data = json.loads(raw)
            node_id = data["node"]
            vwc = float(data["vwc"])
            temp = float(data["temp"])
            
            should_pump = self.evaluate_irrigation(vwc, temp)
            pump_int = 1 if should_pump else 0
            
            # Direct physical relay actuation over local GPIO
            # gpio.output(RELAY_PIN, gpio.HIGH if should_pump else gpio.LOW)
            
            with self.db:
                self.db.execute(
                    "INSERT INTO sensor_logs (node_id, moisture_vwc, temp_c, pump_status, timestamp) "
                    "VALUES (?, ?, ?, ?, ?)",
                    (node_id, vwc, temp, pump_int, time.time())
                )
            print(f"[EDGE ACTUATED] Node: {node_id} | VWC: {vwc}% | Pump: {'ON' if should_pump else 'OFF'}")
        except Exception as e:
            print(f"Packet parse error: {e}")

6. The "Pull the Cable" Judging Moment

At 9:30 AM, our judging panel arrived. Two of the judges had inspected twelve consecutive booths, watching student after student apologize for failed cloud API calls and Wi-Fi disconnects.

When our turn came, we did not start with PowerPoint slides. I reached behind our edge gateway, visibly yanked the Ethernet cable out, and placed the severed cable on the table:

The 60-Second Demonstration

"Judges, our internet cable is unplugged. There is no Wi-Fi. Watch this." My teammate dipped the capacitive sensor into dry silica sand. In under 80 milliseconds, the LoRa packet bridged the hall, the edge gateway processed the threshold, and the 220V industrial water pump violently roared to life, shooting water through our miniature drip irrigation manifold.

The lead judge smiled, turned to his colleagues, and said: "Finally. An engineering team that understands real Indian agriculture."

7. Engineering Lessons from Hackathon Battlegrounds

LESSON 01

Architecture Decision Records (ADRs) Under Fire

Writing down the explicit consequences of technical pivots prevented intra-team arguments at 3:00 AM. A concise written trade-off matrix aligns team execution instantly when panic is highest.

LESSON 02

Demo the Failure Mode, Not Just the Happy Path

Juries are deeply cynical of smooth demos because they look pre-recorded. Proactively breaking your own system (pulling cables, cutting power, simulating noisy sensors) proves real engineering resilience.

LESSON 03

Optoisolate Your Microcontrollers

During initial bench testing, pump motor shutoffs induced back-EMF inductive voltage spikes that reset our microcontroller. Adding optocouplers and flyback diodes saved our physical hardware from burning out.

LESSON 04

Narrow Scope, Infinite Polish

We won by doing exactly one thing with flawless fidelity: the sub-100ms closed-loop feedback between soil water content and pump activation. Depth beats superficial breadth every single time.

8. Post-Hackathon Takeaways

Winning Smart India Hackathon taught our team that world-class engineering is not about using the newest buzzword framework; it is about building software and hardware that solves real physical constraints under adverse conditions.

Award
1st Prize Winner • Smart India Hackathon 2023 Hardware Edition (Govt. of India)
Tech Stack
Embedded C, PIC16F877A, LoRa SX1278, Raspberry Pi, Python 3.11, SQLite WAL
Repository
github.com/kulkarnishub377/SIH-AgroTechies
Official competition entry by Team AgroTechies. Awarded by the Ministry of Education's Innovation Cell, Government of India.