FUDiabetes

Loop: Getting Started

wiki
diy
closed-loop

#1

Loop is a do-it-yourself closed-loop insulin delivery system, which consists of 4 components:

  1. Open-source Loop app running on an iPhone
  2. CGM (Dexcom G5, or Dexcom G4+share, or Medronic Enlite)
  3. A compatible insulin pump
  4. RileyLink, an open-source hardware device, which serves as a bridge between iPhone’s Bluetooth Low Energy (BLE) radio and pump’s radio

image

Assuming all required components are available, assembling the system is pretty simple: download the Loop source code and install the app on the iPhone using Xcode (Apple developer tool) on a Mac computer. Detailed, easy-to-follow directions are available in the Loop documentation. No programming or any other special technical skills are required.

User Experience

During normal operation, there is no need to touch the pump at all. Everything is done through the Loop app on the iPhone or, optionally, through a companion Apple Watch app. In short, the user manually enters meals, and accepts or overrides bolus recommendations, while corrections are performed automatically by the Loop closed-loop algorithm.

The main Loop screen shows graphs of recent CGM data and predicted BG, active insulin (“insulin on board” or IOB), insulin delivery, and active carbs (“carbs on board” or COB). Tapping on the plate icon in the lower left corner brings up a carb entry menu, which allows the user to enter meal time (which could in the future, or in the past), and food type with expected absorption time. The user should be aware of the fact that “carbs” entered should reflect everything one needs to bolus for (including protein and fat effects). Large mixed carb/protein/fat meals often take multiple hours to digest. After a meal is entered, Loop suggests a bolus, which the user may accept or override at will.

image

Every 5 minutes, Loop updates its BG prediction, calculates a correction dose, and delivers the correction in the form of a temporary basal rate, with the goal of steering the eventual BG towards the user specified correction range, while avoiding lows.

Is Loop Effective?

No formal studies have been done to evaluate performance of Loop or any other DIY closed-loop system. It is estimated that several hundred people, including adults and kids, have been using Loop for extended periods of time now. Informal feedback and reports have generally been very positive, reflecting improved A1c or other bg control metrics with less effort, improved sleep, and improved quality of life.

Is Loop Safe?

Taking insulin in any form is risky, and it is impossible to guarantee that any approach or system is absolutely safe. Loop has been designed and implemented by people who have T1D or who have kids with T1D, and who very well understand the importance of delivering insulin safely. Loop safety features include the following:

  • In case of failures, the system defaults back to normal, manual pump operation
  • Bolusing requires fingerprint identification
  • There are limits for maximum allowed bolus, and maximum allowed basal rate
  • Loop interface is designed to be transparent to the user, and easy to use
  • Open-source code benefits from review and feedback by many users

Is Loop for Me?

  • Loop is an experimental DIY system not approved for therapy. If you are looking for a perfect system backed up by clinical trials, regulatory approvals, and 24/7 technical support, Loop is not for you.
  • Currently compatible pumps are older-generation out-of-warranty Medronic pumps, which can be difficult to find. Work is under way to enable Omnipod users to use DIY closed-loop systems.
  • Beyond basic familiarity with computers, no special skills are required. Nevertheless, people may find DIY concepts and language difficult or intimidating. However, technical support offered by the community is outstanding. As is usually the case, motivation is far more important than any technical skills or aptitude.

Algorithm

Every 5 minutes, Loop updates its prediction of future BG values over a time period equal to the duration of insulin action. Based on the predicted BG, insulin doses (both boluses and temp basals) are calculated to drive eventual BG into the user specified correction range, while not allowing BG to fall below a user-specified minimum BG level (called Suspend Threshold) at any point in time. BG predictions are based on insulin entries, carb entries and two correction factors (Glucose Momentum and Retrospective Correction), which are attempting to mitigate various unmodeled effects.

Insulin absorption model

In IOB calculations, Loop algorithms take into account boluses and temp basals, as well as nonlinear absorption curves based on published data. Several choices are available to the user, including legacy curves (based on Walsh’s Pumping Insulin book), as well as scalable exponential curves that are found to better fit actual absorption:

image

Dynamic carb absorption model

The meal entry includes an expected absorption time, which Loop uses only as an initial guess. Based on insulin activity, and observed CGM data, Loop calculates and displays to the user the predicted and the observed carb absorption. Below is an example of a relatively large 90g carbs+protein+fat meal that takes about 5 hours to digest. Based on the observed data, predicted carb absorption is dynamically updated, leading to improved BG predictions and dosing.

image

Loop playground: contributions to the BG prediction

All factors contributing to BG predictions are clearly visible to the user on a Loop playground screen. One may turn any of the effects on and off and observe changes in predictions. In addition to the impact of insulin and carbs, the Loop algorithm includes two corrective factors. Glucose Momentum blends in the average slope in BG over past 15 minutes into prediction over next 30 minutes, while Retrospective Correction blends in the observed prediction error over past 30 minutes into the prediction over the next 60 minutes. These corrective features are attempting to mitigate unmodeled effects such as carb entry errors, unmodeled carb absorption, effects of exercise, increased or reduced sensitivity, etc.

image

Loop is well integrated with the Apple Health app, including storage and retrieval of BG, carb, and insulin data between Loop and Health. As of version 1.5, Loop relies on the user entered parameters such as default basal rates, carb ratios, and insulin sensitivities. Future versions may include auto-tuning of these parameters, automating carb absorption time entries based on meal composition (which could be based on other iOS apps), etc.

User blogs, posts and reports

Resources

  • Loop documentation, to get started read introduction and requirements
  • Loop code: download complete code as a zip file from the Loop github site, and install using Apple Xcode app on a Mac following the instructions. You may also take a look at the 16min video How to build the Loop app by Katie DiSimone.
  • Community technical support and forums: Looped group on Facebook (need to request to enter), and Loop gitter channel (open to view, need to sign up to post)
  • History of Loop by the original creator and developer, Nate Racklyeft
  • Building Amazing Diabetes Apps talk by Nate Racklyeft
  • Other DIY closed loop systems: OpenAPS, AndroidAPS
  • OpenOmni: efforts to enable Omnipod to be used in DYI closed-loop systems are under way. Technical progress can be viewed on the openomni github site.
  • Nightscout, one of the first #WeAreNotWaiting projects, an open-source system that allows real time access to CGM data via personal website, smartwatch viewers, or apps and widgets available for smartphones. Loop communicates to Nightscout, which integrates all user data: CGM, carbs, Loop actions, etc. allowing real-time web based visualization, sharing and remote monitoring, and a wide range of analysis reports.



End of wiki ---------- comments start here


Animas going out of business looking into medtronic
Being Unlimited while sleep deprived
Welcome, introduce yourself here!
Welcome, introduce yourself here!
My story with diabetes - a spouse point of view
14 hours without insulin... what could you expect to happen?
Tips, Tech & Gear wiki Table of Contents
#2

Here is my attempt at a Loop wiki. I know it’s too long, sorry I am not good at this :slight_smile:


#3

It looks like a good summary. I would not say it is too long. It was probably quite difficult trying to decide how to boil it down as I am sure you could have easily written pages more.


#4

This is OUTSTANDING!

Would an existing RileyLink be the appropriate hardware to work with an Omnipod when the pod comm is fully cracked, or will the Pod’s RF require different hardware?

Would it be possible to have a section that discusses how to start looping? Or possibly just including the build (https://loopkit.github.io/loopdocs/build/overview/) and use (https://loopkit.github.io/loopdocs/use/close-loop/)? I have read the two Build and Use tabs several times, but I still don’t get the feeling that I am quite sure how to attack it :frowning: It may well be me though!

A couple of links I have kept track of that you may, or may not, decide to include:

I am so pleased you wrote this! This is really WONDERFUL!


#5

916 MHz (Medtronic) vs 433 MHz (Omnipod)
(I think?)


#6

Awesome write-up! Thanks for taking the time to put this together!


#7

Awesome!! :clap:t2:


#8

Pete Schwamb has successfully sent commands to a Pod using the existing RileyLink hardware. The sub-GHz chip on RileyLink is capable of operating in both 433 MHz and 916 MHz bands. For improved reception, it might be good to modify the RF matching network some, but it looks like the same hardware could conveniently work for all pumps.


#9

I have a short statement in the top part on how to get going, and I’ve also included a bit more in the resources. It really is not difficult at all. It’s like trying to describe how to learn to drive a car - no amount of words or books can help - you just need to sit down and give it a try.


#10

Any further comments, questions, suggestions? If not, @Michel, feel free to convert it into a published wiki post if you wish, or let me know how to do that.


#11

Dragan, thank you so much!

I’ll give it a day or two for comments and convert it. Give me the green light whenever you feel it is good to go! I will also write down what I do for that for documentation.


#12

@dm61, is this lovely post ready to convert?


#13

Sure. Any further edits or corrections could be made live.


#14

Done! Thanks so much, this is a GREAT wiki!


#15

@dm61, I have been scouring the Loop wiki. What I understand from it and its links (I am sure all obvious to you!):

  • we need to run Loop on an iPhone
  • to integrate all the data needed by Loop, we need to run Nightscout in the background, in the cloud.
  • we need to use the Dexcom apps to interface to the G4/G5 CGMs
  • we need an Apple computer to compile the app
  • and, naturally, we do not have the option to run xDrip/xDrip+ within Loop.

#16

Correct. There is no Android version of Loop.

No, Loop does not require Nightscout at all, and it does not pull any data from Nightscout. In fact, Loop operates just fine offline - does not require internet access for normal operation. Loop is capable of sending its data to Nightscout, which is very convenient for parents who follow kids using Nightscout. But, Nightscout is optional for Loop, not required.

Correct (but see more detailed answer below to your last question)

Correct.

Not entirely correct. It is possible to use iosxdripreader with Loop, but that option requires internet access (there is some talk about potentially integrating iosxdripreader features within Loop, but I’d not wait for that). Also, iosxdripreader is in earlier work-in-progress stages compared to Xdrip+ for Android. People who are using iosxdripreader with Loop are those who are trying to extend G5 transmitter life beyond Dex imposed exp date, or those who are using G5 transmitters with DIY-replaced batteries. In such situations, some people are even using two phones, Android with Xdrip+, and iPhone with Loop.


#17

That is great info, clarifies a lot.


#18

Would it make sense to have a paragraph on Loop vs xdrip? Very high level. One paragraph only. Include this in both the loop and the xdrip wiki. The paragraph in the loop wiki has a pointer to the xdrip wiki and vice versa.

??


#19

this is just amazing! I just got my Riley Link yesterday and am buuilding as I read, thank you for making it easier for all of us :smiley: