Skip to content
Back

Closed-Loop Diabetes System

Health TechData AnalysisAutomation

The Problem

When my daughter was diagnosed with Type 1 diabetes in May 2024, we were suddenly immersed in a world of 24/7 care, critical decisions, and little margin for error. While still in the hospital, I began researching how to best support her and started by doing what I know best - created a spreadsheet. Every meal, every correction, every basal adjustment — calculated, cross-referenced against shifting sensitivity patterns, and logged obsessively.

Type 1 diabetes management is a 24/7 data problem. Blood glucose levels respond to insulin, food, activity, stress, sleep, and a dozen other variables — many of which interact unpredictably. Commercial insulin pumps automate delivery, but the algorithms in approved systems are conservative by design. They react slowly, correct cautiously, and leave significant manual burden on the caregiver.

I immersed myself in books, forums, YouTube videos, and podcasts, recognizing that managing Type 1 diabetes requires deep understanding to make sound therapy decisions. A turning point was discovering Dana M. Lewis's book Automated Insulin Delivery and her work on the OpenAPS project — it gave me confidence that this was a robust, evidence-based system grounded in both engineering excellence and lived experience, not just unverified internet advice.

The open-source diabetes community — under the banner #WeAreNotWaiting — has spent years building alternatives. These DIY systems use the same pump hardware but run community-developed algorithms that are more responsive, more configurable, and in many cases deliver better outcomes than their commercial counterparts.

I decided to build one.

The Approach

The system I implemented is called Trio — a fork of the open-source artificial pancreas project originally developed by Dana M. Lewis and the OpenAPS community. It runs on an iPhone, communicates with an insulin pump via Bluetooth, and reads continuous glucose monitor (CGM) data in real time.

System Components

  • Trio app — built from source via GitHub, deployed through Apple TestFlight. Handles the core algorithm: predicts glucose trajectory, calculates insulin needs, and sends commands to the pump.
  • Nightscout Pro — a cloud-based data platform for centralized visualization and remote monitoring. Stores all glucose readings, insulin deliveries, carb entries, and algorithm decisions.
  • Loop Follow — a companion app configured on my device for real-time glucose tracking and alerts.

Configuration and Tuning

The real work isn't the installation — it's the ongoing calibration. The system needs personalized therapy settings:

  • ISF (Insulin Sensitivity Factor) — how much one unit of insulin drops blood glucose, which varies by time of day
  • I:C Ratios (Insulin-to-Carbohydrate) — how many grams of carbs one unit of insulin covers
  • Basal profiles — background insulin delivery rates across a 24-hour cycle
  • UAM (Unannounced Meal Detection) — how aggressively the algorithm responds to unexpected glucose rises
  • SMB (Super Micro Bolus) — small, frequent insulin pulses that allow faster corrections than traditional bolusing

Each parameter requires careful observation, testing, and adjustment. The system generates enormous amounts of data — glucose readings every 5 minutes, insulin delivery logs, algorithm decision traces — and tuning means reading that data, spotting patterns, and translating them into configuration changes.

Key Decisions

DecisionWhy
Trio over commercial systemMore aggressive algorithm options (SMBs, UAM), better suited to a child's unpredictable eating patterns. Community actively developing.
Nightscout Pro over self-hostedReliability matters more than cost savings when monitoring a child's health remotely. Managed hosting eliminates server maintenance.
Build from sourceRequired by the open-source license and Apple's deployment model.
Conservative initial settingsStarted with minimal automation and increased aggressiveness over weeks as we gathered data and built confidence in the system's behavior.

Results

  • Automated the majority of insulin dosing decisions — from dozens of manual calculations per day to meal announcements and occasional corrections
  • Enabled 24/7 remote monitoring with real-time alerts, giving our family confidence and sleep
  • Improved time-in-range (the key diabetes management metric) significantly compared to manual management
  • Data-driven therapy adjustments replaced guesswork — every change backed by trend analysis

What I Learned

The hardest part is trusting the algorithm. When your child's health depends on software you compiled from GitHub, the temptation to override is constant. Learning when to trust the system and when to intervene is itself a skill that takes weeks to develop.

Open-source communities can outpace regulated industries. The #WeAreNotWaiting community has built tools that research confirms deliver better outcomes than commercial alternatives. The regulatory framework hasn't caught up, which means parents like me are making consequential technology decisions with incomplete institutional support.

This is the same skill set as my day job. Configuring an insulin algorithm isn't that different from tuning DAX measures or calibrating a financial model. You observe data, form hypotheses, adjust parameters, and measure results. The domain is different; the analytical discipline is identical.

Community Gratitude

Managing Type 1 diabetes means making dozens of therapy decisions daily — with no breaks, no holidays, and low tolerance for error when health and quality of life are at stake. It demands constant vigilance and emotional resilience from both patients and caregivers.

I'm profoundly grateful to the open-source diabetes community (#WeAreNotWaiting) — developers, researchers, testers, and fellow T1D parents and patients — who share their knowledge freely and build systems like Trio, Nightscout, and Loop Follow. Their dedication and generosity make safer, more confident care decisions possible for families like ours.

Resources


Built with Trio (open-source artificial pancreas), Nightscout Pro, Loop Follow, and an unhealthy amount of 3am glucose data.