HydroPulse: Pinpointing Underground Water Leaks with AWS Graviton2 & DynamoDB
A deep dive into how HydroPulse uses wet-tap hydrophone telemetry, fluid-structure wave physics, and AWS Graviton2 to triangulate underground municipal pipe ruptures with sub-meter precision in real time, auto-throttling valves in under 50 ms to prevent catastrophic water hammer blowouts.
1. The Problem: The Invisible Loss Underneath Our Cities
Every day across Indian cities like Delhi and Bengaluru, municipal utilities treat and pump millions of liters of clean drinking water. Yet, between 35% and 50% of that potable water never reaches a household tap.
It disappears underground through Non-Revenue Water (NRW)—silent pipe ruptures, joint fractures, and destructive pressure shockwaves known as water hammer.
When a utility suspects a subterranean burst today, field crews walk paved streets with acoustic ground microphones (geophones). Because compacted urban soil and concrete pavement introduce over 60 dB of acoustic attenuation, detecting a leak is like trying to hear a whisper through a soundproof wall. It takes weeks of speculative, disruptive road excavations costing crores of rupees.
For the WeMakeDevs Bharat Builds Environmental Hacks (Track 02: Heat & Water), I set out to solve this by building HydroPulse: an autonomous cyber-physical acoustic triangulation and automated surge mitigation SCADA system powered by the AWS Free Tier.
2. The Cyber-Physical Architecture
Rather than listening on road asphalt, HydroPulse bypasses soil attenuation by tapping directly into the water column with $48 USD piezoelectric hydrophones attached to municipal hot-tap saddles.
When a water hammer rupture strikes, acoustic pressure waves travel through the pipe fluid. The acoustic transient is digitized at 10 kHz with microsecond GPS Pulse-Per-Second (PPS) UTC synchronization and processed through an event-driven edge-to-cloud closed loop:
- Pressurized Water Main (Acoustic Shockwave): The subterranean burst generates high-frequency acoustic shockwaves propagating bidirectionally through the fluid column.
- Wet-Tap PZT Hydrophone Node ($48 BOM): Direct-contact piezoelectric sensors bypass over 60 dB of soil attenuation, conditioned through a precision TI OPA145 differential charge amplifier and 50 Hz active notch filter.
- ESP32-S3 Edge Microcontroller: Employs continuous 10 kHz ADC Direct Memory Access (DMA) ring buffering, triggered by an STA/LTA energy transient detector with microsecond-grade GPS PPS timestamping.
- Amazon API Gateway HTTP API v2: Ingests the 10 kHz acoustic burst payload with sub-10 ms latency and native CORS support.
- AWS Graviton2 Lambda (Triangulation & Mitigation Engine): Executes the Korteweg fluid-structure wave velocity solver, 4th-order zero-phase bandpass filtering, and band-limited GCC-PHAT cross-correlation in under 12 ms of compute time.
- Parallel Multi-Service Mitigation (< 50 ms SLA):
- Amazon DynamoDB: Persists immutable incident audit trails (GPS coordinates, confidence score, wave speed, delay time) with sub-8 ms write latency at $0.00 idle cost.
- Autonomous Actuation: Commands upstream Pressure Reducing Valves (PRVs) to throttle to 50% flow in 35.8 ms, neutralizing destructive pressure surges.
- Amazon SNS: Dispatches real-time SMS alerts with direct Google Maps navigation links to on-duty municipal repair squads.
- Next.js SCADA Mission Control: Renders live dual-channel CRT oscilloscopes, 2D STFT spectrograms isolating the 850 Hz cavitation resonance band, and interactive Leaflet Delhi GIS map tracking.
3. Why These Specific AWS Tools?
- AWS SAM CLI (Local-First IaC): Modeled our entire serverless cloud (
template.yaml) declaratively, allowing 100% offline testing against LocalStack in Docker without spending a single paisa during development.
- AWS Lambda on ARM64 Graviton2: Hosted our digital signal processing (DSP) math. Fast Fourier Transforms (FFT) and phase transform operations execute in under 12 ms with cold starts under 180 ms on Node.js 20.
- Amazon API Gateway HTTP API v2: Ultra-lean ingestion gateway providing sub-10 ms latency and native CORS for our Next.js SCADA console.
- Amazon DynamoDB (PAY_PER_REQUEST): Single-table architecture storing immutable incident audit trails. Because water hammer ruptures are sporadic, on-demand billing meant $0.00 idle cost while delivering single-digit millisecond write latencies (p99 < 8 ms).
- Amazon SNS: Real-time emergency work-order dispatch topic firing SMS alerts with Google Maps deep-links directly to repair crews.
4. What Fought Back: The 4 Hardest Engineering Hurdles
Building a cyber-physical system is rarely smooth sailing. Here is what pushed back during development and how I engineered around it:
Fight 1: Spurious False Peaks at 6 dB SNR Noise
In urban India, municipal water mains run directly under heavy highway traffic (like Delhi's Outer Ring Road). At severe noise levels down to 6 dB SNR, vibrations from overloaded trucks created acoustic false peaks in standard cross-correlation, causing triangulation on our 1,200 m Wazirabad pipeline to fail.
How I Fought Back:
I implemented physical Korteweg travel-time boundary enforcement. Since an acoustic wave cannot travel faster than the physical speed of sound in that specific pipe material (approx 1,092 m/s in steel), any mathematical correlation delay exceeding
|Δt| > L / vs was rejected as physically impossible. Pairing this boundary gating with a 4th-order zero-phase Butterworth bandpass filter lifted our severe noise pass rate from failing to over 90% accuracy.Fight 2: The 100 μs Discrete Sampling Wall
At a 10 kHz ADC sampling rate, each digital sample represents a 100 μs time step. In water where sound travels at approx 1,258 m/s, a single-sample error causes a 12.5 cm spatial deviation. Discrete cross-correlation alone could not provide reliable sub-decimeter pinpointing.
How I Fought Back:
I implemented 3-point parabolic sub-sample peak interpolation around the discrete correlation peak:
δ = (R[k-1] - R[k+1]) / (2 * (R[k-1] - 2*R[k] + R[k+1])) Δt = (k_peak + δ) / fs This extracted fractional time delays down to microsecond resolution, achieving ±0.11 m (±11 cm) sub-meter pinpointing precision.
Fight 3: The 50 ms Closed-Loop Actuation Deadline
Water hammer pressure spikes travel at supersonic speeds through water. If our cloud pipeline took 200 ms to analyze data and command the valve, the shockwave would have already blown the pipe joint apart.
How I Fought Back:
We profiled the full edge-to-cloud roundtrip. Initial tests on x86 Lambda had compute execution times hovering around 35 ms. Moving to ARM64 Graviton2 dropped pure compute time to 10.5 ms. Combined with HTTP API v2 (8 ms) and DynamoDB on-demand writes (6 ms), our total closed-loop response clocked in at 35.8 ms—well under the 50 ms mission-critical constraint!
Fight 4: The DTU Bawana Road Ground Reality
When simulating real pipeline geolocations, I mapped Delhi Jal Board's actual infrastructure along Main Bawana Road right outside Delhi Technological University (DTU)—the exact venue where the hackathon build day took place!
Testing the pipeline geometry against real-world pipe materials (Ductile Iron Class K9, 400 mm bore, 500 m span) proved that physical Korteweg sound speed deviates from unconfined water (1,258 m/s vs 1,482 m/s) due to pipe wall hoop elasticity absorbing pressure energy. Accounting for this elasticity was the difference between finding the rupture or digging 80 meters in the wrong direction.
5. The Results: 80-Run Automated Benchmark
To verify algorithmic reliability, I authored an automated 80-run benchmarking test matrix (
core-dsp/tests/benchmark.test.ts ) evaluating 4 real municipal pipelines across 4 noise tiers (24 dB down to 6 dB SNR):Pipeline Sector | Material | Span | Wave Speed | Noise SNR | Mean Error | Pass Rate (≤ 1.5 m) |
|---|---|---|---|---|---|---|
Main Bawana Road Trunk (DTU) | Ductile Iron | 500 m | 1258 m/s | 18 dB | 0.048 m | 100% |
Main Bawana Road Trunk (DTU) | Ductile Iron | 500 m | 1258 m/s | 6 dB | 0.804 m | 80% |
Rohini Sector 16 Feeder | Cast Iron | 620 m | 1276 m/s | 18 dB | 0.032 m | 100% |
Wazirabad Transmission Main | Mild Steel | 1200 m | 1092 m/s | 18 dB | 0.018 m | 100% |
Okhla Phase III Distribution | HDPE | 350 m | 1184 m/s | 6 dB | 0.204 m | 100% |
OVERALL MATRIX (80 Scenarios) | All Materials | 350–1200 m | — | 6–24 dB | Sub-Meter | 88.8% |
In the live SCADA console, when a rupture transient fires, the operator sees:
- Live CRT oscilloscope waveforms with 250 ms phosphor persistence decay.
- An STFT spectrogram highlighting the distinctive 850 Hz cavitation resonance peak.
- A red pulsing marker snapping to DTU on the Leaflet Delhi GIS map.
- An automated 50% valve throttle commanding the PRV to suppress the pressure surge in 35.8 ms.
6. Key Takeaways for Fellow AWS Builders
- Graviton2 (ARM64) is a Superpower for Math: If your Lambda functions execute math, signal processing, or data transformations, specify
Architectures: [arm64]in SAM. It's faster, cheaper, and requires zero code changes.
- LocalStack Saves Your Free Tier: Testing against LocalStack in Docker allowed me to iterate hundreds of times on Lambda and DynamoDB offline without touching cloud credits.
- HTTP API v2 > REST API: For serverless microservices where every millisecond counts, HTTP API v2 delivers lower latency and effortless CORS setup.
7. Links & Open Source Code
- GitHub Repository: https://github.com/yashvirsingh09/HydroPulse
- Live 3-Minute Video Demo: https://youtu.be/1PqwuHI0gMA
Building HydroPulse proved that AWS serverless infrastructure isn't just for SaaS dashboards—it's an ideal, sub-50 ms foundation for real-world cyber-physical infrastructure solving India's greatest environmental challenges.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article