How do I loop? How to get started with DIY “Artificial Pancreas” systems

If you’ve found this page, then you are looking to get started with looping. You’ve realised that you want build an unemotional system that can make recommendations and take action to adjust insulin delivery based on numbers and models, and not emotional responses to conditions.

A range of options!

So that’s where we’ll start. There are multiple DIY closed loop systems. The options presented here vary in levels of complexity and difficulty to set up, in addition to differing in feature sets, algorithms, and hardware options. Ultimately you will be making the decision as to where you start. You’ll often see “YDMV”, which means ‘you diabetes may vary’ – and it will. It’s up to you to select a system that works for you. But don’t worry – you can always change systems, pumps, etc. in the future! Many people in the community switch back and forth or run multiple types of closed loop systems depending on their needs.

The details provided here are links to the various documentation and set-up guides along with my take on how easy it is to do. Whichever option you elect to take, there are many people willing to help you get running via the Gitter.im channels for these apps. This references both open loop (where the user has to interact with a pump to action the suggestion) and closed loop (where the algorithm speaks directly with the pump to adjust insulin levels).

If you want to dig more into what I think of the Loop and OpenAPS systems, I have written a comparison of using both systems from an adult T1 user perspective, looking at Form , Function and Interaction.

Open Loop

Before closing the loop, running in “open loop” mode is the easiest way to learn how a system works and how insulin is adjusted to manage glucose levels. That’s why we recommend giving it a go if you get the chance, before you close the loop. All systems support open looping. OpenAPS requires a rig for open looping; but can be done with a non-loopable pump. AndroidAPS can also be run in open loop mode, regardless of which pump you have. Loop requires the hardware for looping in order to also run open loop.

Closing The Loop

There are a few options for closing the loop. They are:

OpenAPS – a system that runs on a small “rig” which consists of a tiny computer and radio; works with legacy Medtronic pumps, and any CGM. It can be set up using any type of computer (PC running Windows or Linux, or a Mac).

Loop – an Apple only framework and algorithm that runs on an iPhone, works with legacy Medtronic Pumps, uses Dexcom Share or G5, or Medtronic CGM for glucose data and requires a RileyLink to communicate between the pump and phone. It requires xCode on a Mac to set up. It also costs $99 for an Apple developer license in order to not have to re-install the app every 7 days.

AndroidAPS – an Android only app that implements the OpenAPS “oref0” algorithm and works with a DANA*RS & Roche Combo – the first closed loop implementation on Android, that needs no additional hardware components, works with multiple CGM systems and requires Android Studio to set up on your computer of choice.

Before closing the loop, it’s worth reading through Dana Lewis’ observations about how you can safely close the loop.

OpenAPS

OpenAPS, built by Ben West, Dana Lewis and Scott Leibrand, supports multiple legacy Medtronic Pumps and can be used with a number of different CGM systems. It now has automated set-up scripts that are as easy as 1, 2, 3, literally. You can cut and paste from the guide in to your computer of choice and it is very easy to set up. The looping hardware consists of a small “rig” , which is a small computer with a radio and battery.

OpenAPS Edison Rig in Tic-Tac box, next to the pump

The home of OpenAPS can be found at: https://openaps.org/ where you can find a vast array of information that relates to the platform. Follow the “Getting started” link to take you into the documentation, or follow this link: https://openaps.readthedocs.io/en/latest/index.html

To set up OpenAPS you’ll need:
  • Any computer

To run OpenAPS you’ll need:

  • Any CGM system (Dexcom G4, G5, xDrip+, Medtronic, Libre with a real-time uploader)
  • A compatible Medtronic pump (see documentation for details)
  • A small computer (Intel Edison, Raspberry Pi0W or Pi 3)
  • A radio (built into the Explorer Board, or a separate radio stick for other rigs)
  • A battery for the rig
  • Optional: any mobile phone can be used to display data and interact with your OpenAPS rig

The current recommended rig combination is the Explorer Board, Edison and 2500mAh Li-Po battery. Edisons can be found on eBay and Explorer Boards are available from Enhanced Radio Devices online. The next generation of hardware will soon be available and will ship in April.

Algorithm and Features:

OpenAPS’s original algorithm is called oref0. It has optional features that enable sensitivity change detection, meal-time assistance and dynamic calculation of carbohydrate absorption. Additional advanced features have been added which allow for “Super Micro Bolus” (SMB), “Unannounced Meals” (UAM) and alerts when additional action may be required by the user.

  • SMB allows the algorithm to provide small boluses when enabled (and can be triggered by Carb entry, bolusing or a temporary target). The benefit of delivering a calculated insulin amount as a bolus is that it takes effect more quickly than using a safe Temporary Basal rate, which delivers over 30 mins.
  • UAM identifies that the changes in glucose levels are outside of expected ranges based on the carb data it has and adjusts insulin delivery accordingly.
  • Pushover alerts are notifications to tell the user that the algorithm thinks it needs more insulin or carbs based on the changes it is observing and the information it has. This proves to be extremely useful when out and about!
  • Autotune is also optimises the previous 24 hours of data and tunes basal rates, ISF and carb ratios.

Depending on your CGM and phone preference, there are multiple options for configuring OpenAPS to loop “offline” (without internet connection). Allowing your rig to connect to your phone is useful for remote monitoring (and troubleshooting and data analysis). Using Nightscout is recommended for this purpose.

The Gitter Channel, where you can ask questions about getting started and set-up, is at: https://gitter.im/nightscout/intend-to-bolus

Loop

Loop is an implementation of Loopkit, a framework created by Nate Racklyeft, that runs on an iPhone. It was built with the aim of reducing the amount to carry for APS implementations and thanks to Nate and Pete Schwamb’s ingenuity, built as a framework for others to implement their own algorithms. It uses the RileyLink hardware to communicate between BLE from the iPhone to the RF frequencies the Medtronic pumps use.

Rileylinks may be obtained from www.getrileylink.org. Loop provides hybrid closed loop capabilities and includes the ability to determine and deliver a bolus from the phone.

Loop + RileyLink
Loop + RileyLink
To set up Loop, you will need:
  • A Mac computer with xCode
  • Recommended: an Apple Developer license ($99 USD/year) so you don’t have to re-install the app every 7 days
To run Loop, you’ll need:
  • RileyLink
  • iPhone
  • A CGM (Dexcom G5 (or G4 with Share) although G5 recommended)
  • A Medtronic pump (as per OpenAPS)
  • Optional: Apple watch

As Loop writes all data to HealthKit and runs everything locally, it is an offline system and doesn’t require an Internet connection to function. Uploading to Nightscout for remote monitoring is fully integrated.

Loop can be found at: https://github.com/LoopKit/Loop

Algorithm and features:

Loop operates uses a different algorithm than OpenAPS. It adjusts insulin based on future predicted glucose levels. It includes a feature called “Retrospective Correction” that offers a mechanism for taking into account and adapting to unexpected short term variation. Loop’s carbohydrate absorption model has recently been updated. It uses estimates of carbohydrate absorption times (for which a default can be used) to determine required insulin action. The update includes a feature known as “Dynamic Carb Absorption” (similar to OpenAPS) and the graphical interface can show this data.

Loop has a companion app on the Apple watch that allows carb entries and bolusing direct from the watch and can incorporate current blood glucose and time since last run in a complication.

The Gitter channel is at: https://gitter.im/Loopkit/Loop

AndroidAPS

AndroidAPS is an implementation of the (OpenAPS) oref0 algorithm in a modular platform on Android. It can be found at https://androidaps.readthedocs.io/en/latest/EN/index.html.

To set up AndroidAPS, you’ll need:
  • Any computer (Mac, Windows or Linux) running Android Studio
To run AndroidAPS, you’ll need:
  • Android Phone
  • any CGM that can be uploaded to nightscout (Dexcom G4, G5, Libre, Eversense, Medtronic
    Guardian or Elite). The preferred uploader app is xdrip+ with G4, G5 or Libre but others can
    be used, see nightscout.info for details
  • Dana-R, Dana-RS or Roche Combo pumps
Algorithm and features:

AndroidAPS utilizes the OpenAPS algorithm.

When getting started, there are a number of objectives or “steps” to help learn about using the closed loop system. It starts with an open loop mode which and progresses through a number of stages to help you understand how the system works, including adjusting settings and preferences.

AndroidAPS Screens

Similar to Loop, you can calculate and administer boluses from within AndroidAPS.

Additional pumps may be usable with AndroidAPS in the future, such as the Roche Insight pump. There is also the possibility a Rileylink driver will be written, allowing Medtronic pumps to then be used (by communicating over the Rileylink) with AndroidAPS.

The Gitter channel is at: https://gitter.im/MilosKozak/AndroidAPS

Post Commentary

If you’re struggling to decide which of these might suit you best,there’s a basic comparison of the systems at a physical level and an in depth comparison of the OpenAPS and Loop algorithms, based on my experiences of the two. It may help you whittle down your choice.

If you’re a parent trying to decide which to use with your T1 kid, you may want to take a look at Katie Disimone’s blog, where she has compared Loop and OpenAPS from that perspective.

So pick the one you like the look of and has the best fit to your needs and happy looping!