When I first started working on GuardianShot, I thought the hardest part would be the hardware. I was wrong. The real challenge was building an ML model that could run on a microcontroller with 256KB of RAM while still being accurate enough to save vaccines.
The Problem with Traditional Monitoring
Traditional cold chain monitoring is reactive. A sensor reads the temperature, and if it's out of range, an alarm sounds. By then, it's often too late—the vaccines have been compromised, and the damage is done.
What we needed was a predictive system. Something that could see a temperature anomaly coming 30 minutes before it happened, giving healthcare workers time to intervene.
Why TinyML?
The obvious solution would be to stream sensor data to the cloud and run predictions there. But in remote clinics with unreliable internet? That's a non-starter. We needed edge inference.
TinyML—machine learning optimized for microcontrollers—was the answer. But it came with serious constraints: limited memory, no floating-point unit, and power consumption that had to be measured in microwatts.
Training the Model
We started with an LSTM architecture, which is great for time-series prediction. The challenge was compressing it from a 2MB model to something that could fit in 200KB while maintaining accuracy.
The process involved: quantization (converting 32-bit floats to 8-bit integers), pruning (removing unnecessary connections), and knowledge distillation (training a smaller model to mimic a larger one).
After weeks of iteration, we achieved 94% accuracy on anomaly prediction with a 30-minute lead time. The model runs in under 50ms on an ESP32.
Lessons Learned
1. **Start with data**: We spent two months collecting temperature data from real cold chain scenarios before writing a single line of model code.
2. **Optimize last**: Build a working model first, then optimize. Premature optimization wasted us weeks.
3. **Test on hardware early**: Simulation doesn't catch everything. We discovered memory issues only when we deployed to actual devices.
The GuardianShot system is now deployed in three pilot clinics, and the results have exceeded our expectations. But more importantly, I learned that the most impactful ML isn't always the most complex—sometimes it's the most constrained.