Our take on how to DIY closed loop, safely

You will often see similar growth and evolution cycles across any type of online community, and the closed loop community is following this growth cycle as expected. Much like how Nightscout went from one very hard way to setup to get your CGM data in the cloud, to ultimately having dozens of DIY options and now more recently, multiple commercial options, closed looping is following similar trends. OpenAPS was the first open source option for people who wanted to DIY loop, and now there are a growing number of ways to build or run closed loops! And next year, there should be at least one commercial option publicly available in the U.S. followed by several more options in 2018 on the commercial market. Awesome! This is exactly the progress we were hoping to see, and facilitate happening more quickly, by making our work & encouraging others to make their work open source.

We’ve learned a lot (from building our own closed loop and watching others do so through OpenAPS) that we think is relevant to anyone who pursues DIY closed looping, regardless of the technology option they choose. This thought process and approach will likely also be relevant to those who switch to a closed loop commercial option in the future, so we wanted to document some of the thought process that may be involved.

Approaching closed looping safely

Before considering closed looping, people should know:

  • A (hybrid or even full) closed loop is not a cure. There will be a learning curve, much like switching to a pump for the first time.
  • Even after you get comfortable with a closed loop, there will still sometimes be high or low BGs, because we are still dealing with insulin that peaks in 60-90 minutes; we’ll still get kinked pump sites or pooled insulin; and we’ll still have hormones that drive our BGs up and down very rapidly in ways we can’t predict, but must react to. Closed looping helps a lot, but there’s still a lot that goes into managing diabetes.

Before using a DIY closed loop, people should consider:

  • Identifying or creating the method to visualize their data in a way they are comfortable with, both for real-time monitoring of loop activity and retrospective monitoring. This is a key component of DIY looping.
  • Running in “open loop” mode, where the system provides recommendations and you spend days or weeks analyzing and comparing those recommendations to how you would calculate and choose to take action manually.
  • Based on watching the “open loop” suggestions, decide your safety limits: you should set max basal and bolus rates, as well as max net IOB limits where relevant. Start conservative, knowing you can change them over time as you watch and validate how a particular DIY loop works with your body and your lifestyle.

Getting started with a DIY closed loop, people should think about the following:

  • Understand how it works, so you know how to fix it. Remember, by pursuing a DIY closed loop, you are responsible for it and the operation of it. No one is forcing you to do this; it’s one of many choices you can and will make with regards to how you personally choose to manage your diabetes.
  • But even more importantly, you need to understand how it works so you can choose if you need to step in and take manual action. You should understand how it works so you can validate “this is what it should be doing” and “I am getting the output and outcomes that I would expect if I were doing this decision making manually”.
  • Often, people will get frustrated by diabetes and take actions that the loop then has to compensate for. Or they’ll get lax on when they meal bolus, or not enter carbs into the system, etc. You will get much better results by putting better data into the system, and also by having a better understanding of insulin timing in your body, especially at meal times. Using techniques like “eating soon mode” will dramatically help anyone, with or without a closed loop, reduce and limit severity of meal spikes. Ditto goes for having good CGM “calibration hygiene” (h/t to Pete for this phrase) and ensuring you have thought about the ramifications of automating insulin dosing based on CGM data, and how you may or may not want to loop if you doubt your CGM data. (Like “eating soon”, ‘soaking’ a CGM sensor may yield you better first day results.)
  • Start with higher targets for the loop than you might correct to manually.
  • Move first from an “open loop” mode to a “low glucose suspend” type mode first, where max net IOB is 0 and/or max basal is set at or just above your max daily scheduled basal, so it low temps to prevent and limit lows, but does not high temp above bringing net IOB back to 0.
  • Gradually increase max net IOB above 0 (and/or increase max basal) every few days after several days without low BGs; similarly, adjust targets down 10 points for every few days gone without experiencing low BGs.
  • Test basic algorithms and adjust targets and various max rates before moving on to testing advanced features. (It will be a lot easier to troubleshoot, and learn how a new feature works, if you’re not also adjusting to closed looping in its entirety).
This is our (Dana & Scott‘s) take on things to think about before and when pursuing a closed loop option. But there’s about a hundred others running around the world with closed loops, too, so if you have input to share with people that they should consider before looping, leave a comment below! :) And if you’re looking to DIY closed loop before a commercial solution is available, you might also be interested in checking out the OpenAPS Reference Design and some FAQs related to OpenAPS.

OpenAPS poster cited in Nature!

I was thrilled to read a commentary by John Wilbanks and Eric Topol, out in Nature today, titled “Stop the privatization of health data“. (Click here to read a PDF version of the article.)

Tucked on the bottom of the second page of the (PDF version of the) article:

“For instance, in 2014, a woman with type 1 diabetes wired together a tiny processor, an insulin pump and a continuous glucose monitor to automate the regulation of her blood sugar levels. For a small community of patients, the collective use of such ‘home-made’ systems has resulted in improvements that are well ahead of those provided by devices and interventions emerging from conventional markets.1”

(The citation is to the poster that we presented on behalf of the #OpenAPS community at the American Diabetes Association Scientific Sessions meeting last month, with self-reported outcomes from 18 of the first 40 users and builders of DIY artificial pancreas systems)

OpenAPS (n=1)*98 as of July 19, 2016It’s worth noting that there are now (n=1)*98 users of #OpenAPS, so this “small community” is growing fast: doubling approximately every three months.

Wilbanks and Topol highlight some critical truths in their commentary, and call out another (frustrating) diabetes example to illustrate:

“Although patients can monitor their glucose levels at any instant, their aggregate records are not made accessible to them. And there is no mechanism by which patients or researchers outside the company can gain access to Medtronic’s tens of thousands of measurements.”

I’ve written about this specific example before, in fact: new ‘partnerships’ mean my personal health data is likely shared with IBM for Watson’s usage…but I don’t have access to this data or insights, and am in fact missing critical information and data visualization on my FDA-approved medical device that’s been on the market for years.

The call to action for device manufacturers, regulators, and the medical industry is simple: Give me, the patient, my data that I need so I can safely take care of myself and better manage my diabetes.

Wilbanks and Topol emphasize that this won’t happen “…unless each of us takes responsibility for our own health and disease, and for the information that we can generate about ourselves. When it comes to control over our own data, health data must be where we draw the line.”

This needs to happen everywhere, not just in diabetes. Will you join us in drawing the line?

Picture this: How to do “eating soon” mode

How do you prevent or limit meal spikes? It doesn’t take a closed loop artificial pancreas; it takes an understanding of insulin timing and the impact on your body.

I’ve written before about why getting insulin going in your body before meal carbs kick in is so important. You can read that really long post here. And I’ve written a slightly shorter post explaining how to do “eating soon mode” to achieve insulin activity peaking when you eat, without causing lows. But recently, I quickly scratched together an illustration to show the difference in the timing and outcomes between the “eating soon mode” approach compared to a traditional “pre-bolus” approach, and after receiving feedback that these images were helpful, decided to post them here.

(Again, for more context, read this post on how to calculate your eating soon amount; and this post for more of the science behind it and how we discovered this method 2+ (!) years ago. And as always, your diabetes may vary; I’m not a doctor; etc. but this is something that when applied consistently smooths out meal spikes, even when eating high fat or high protein or high carb or any kind of meal.)

What often happens with a pre-bolus of the meal insulin 15 minutes before a meal
What often happens with a pre-bolus of the meal insulin 15 minutes before a meal


The type of meal spike (minimal) you can achieve by getting insulin activity going 1 hour before the meal with "eating soon" mode approach
The type of meal spike (minimal) you can achieve by getting insulin activity going 1 hour before the meal with “eating soon” mode approach.

*Note – the calculation of (TargetBG-80)/ISF is assuming that you have already corrected to your normal target, i.e. 100 or 120.

Let me count the ways that the healthcare system is broken

Alternative title to this blog post:
Choosing our battles.

I am furious: shaking with anger and frustration. Because after 13.5+ years of living with diabetes, the number one frustration continues to be fighting for access to supplies and the tools I need to treat my diabetes.

The latest scenario is this (skip to the end if you don’t want to read the emotional, nitty gritty detail part and want a tl;dr):

I changed jobs last year, and thus I had new insurance. New insurance = new authorization for all the things diabetes wise. For those of you unfamiliar, this is a long list: pump; pump supplies (reservoirs and sites); insulin; CGM receiver; CGM transmitter; CGM sensors, test strips, etc.

The biggest battle this time was for getting approval for my CGM, which I’ve been using for years. But I had to re-prove that the autoimmune disease that I have has not in fact gone away. So I did. But my CGM authorization request was denied, because my blood sugars were “too good”.

Sigh. (So maybe that’s the one “downside” to an artificial pancreas?)

I fought the denial with an appeal. Finally, after many phone calls and hoop jumping, they overturned the decision and granted approval. My CGM receiver, transmitter, and 3 months of sensors were shipped on March 15. Hooray! I figured my problems were solved until I switched insurances again in the future.

But wait, there’s more.

I waited very carefully until the end of June, past the three month mark of when I had got my first batch of sensors, to put in the order for the next 3 months worth of CGM sensors. I placed my order, went on a trip, got back to Seattle, and assumed they were floating their way to me.


I received a phone call today informing me that the supply company was working on the authorization for my CGM sensors..but couldn’t submit it because my doctor’s chart notes were older than 6 months. My response was, “why do you need an authorization? I had one three months ago.”

Turns out, the insurance only authorized me for CGM sensors until April 30. The order shipped as soon as authorization was received was dated March 15, so they knew there was no way I could submit another order for them before June 15.

Anyone else see the problem here? They knew I would have to go through this process AGAIN. It’s not like my non-curable type 1 diabetes was going to go away in the three months, thus my need for CGMs to help me manage said diabetes did not go away, either.

And because my endo appointment is scheduled for July 28, the supply company is unable to put in the order until I go to the appointment and get new chart notes (they have to be <6 months old). So I have to call the endo again and get a soon-as-possible appointment to pay my $15 co-pay to get new chart notes to get a new batch of sensors.

I. Am. So. Frustrated.

The healthcare system is so, so broken. Patients shouldn’t be running in circles, unnecessarily going to the doctor’s office and taking up their time that could be spent helping people who need that face to face time. It’s unnecessary time for the doctor, time I have to take away from work/life, and lots of paperwork and phone calls, and it’s been this way for over a decade.
I am very fortunate, because I’m currently fighting this battle for CGM, not for test strips or insulin. (Although, I’ve done that before, too.) There are people who can’t afford CGM even if they get coverage, and people who are fighting for coverage or are in parts of the world and can’t access insulin. I very much get that and am hyper-aware of my privilege here.

But that’s why I have to choose my battles. My heat of the moment reaction is to want to rattle up the poles of my insurance company and fight to make this not the reality; but the reality is, it’s not just my insurance company. It’s every insurance company. It’s the entire healthcare system right now that’s wrong and in need of balance and fixing. And so Scott and I are trying to choose our battles – and utilize the privilege we have and the resources we have – to make the biggest difference in changing the healthcare system.

So that is what we are doing, with numerous projects related to OpenAPS and the broader #WeAreNotWaiting movement: working with the FDA and other organizations and individuals who want to help make the future of healthcare better.

But in the meantime, I’m also calling my endo to change my appointment and fighting the battle for personally getting my CGM approved and probably paying 100% out of pocket for a box or two of sensors to tide me over.