TechnicalApr 24, 202610 min read

Building FuelShield: An IoT System From Concept to Production

Deep dive into the architecture, detection logic, and hardware-software integration of our flagship fuel monitoring system for commercial fleets.

YG
Yash Ghodele·Founder, Ugam Digital Studio

In India, fuel theft from commercial vehicles costs the industry ₹5,000+ crores annually. Fleet operators have almost no visibility into their tanks between stops. Existing solutions were either expensive enterprise systems (₹2L+ per vehicle) or unreliable aftermarket setups that drivers learned to game in weeks.

The Architecture

FuelShield uses an HC-SR04 ultrasonic sensor mounted inside the tank, connected to an ESP32 microcontroller. The ESP32 processes readings locally — no cloud round-trip for critical decisions — and publishes to an MQTT broker only when anomalies are detected or during periodic health checks.

// FuelShield Architecture

HC-SR04ESP32→ (local detection) →MQTTFirebaseNext.js Dashboard

Detection runs on-chip. Only alerts reach the cloud. Offline buffer: 50 readings.

The Detection Logic

We couldn't just track fuel level drops — legitimate usage causes those too. Instead, we built a rate-of-change detector. A normal 200L diesel engine burns roughly 0.8-1.2L per hour at highway speeds. A siphon drain happens at 10-15L per minute. The delta is unmistakable.

The result: sub-1-second siphon detection, 99.2% accuracy across 200+ vehicle deployments, and a system cost of ₹3,800 per vehicle — 98% cheaper than enterprise alternatives.

What Production Taught Us

Lab environments lie. Tanks vibrate on rough roads. Power fluctuates. SIM cards lose signal in rural corridors. We built offline-first buffering (50 readings queued locally) and adaptive sampling (higher frequency when anomalies detected). Every edge case was a field trip.