Which DIY Algorithm to Choose
There are several do-it-yourself (DIY) closed loop algorithms. The best known are Loop and OpenAPS, with several implementations for each. Both algorithms require careful attention to settings and there is a learning curve for each. Some prefer Loop (iPhone only); some prefer OpenAPS (rig, Android or iPhone); most believe that any closed loop algorithm is better than manual control, which is why #WeAreNotWaiting.
Most of the information on this website concentrates on using Loop.
The Loop algorithm is implemented only on Apple devices (iPhone/iPod).
- The released version (as of Nov 2022) supports Omnipod Eros and some older Medtronic Pumps and requires a RileyLink compatible device to allow the phone to communicate with those pumps. This version is commonly referred to as Loop Master or Loop 2.2.x.
- The development version (“soon” to be released as Loop 3), supports the same pumps but adds Omnipod DASH support; DASH Pods do not require a RileyLink
- There are a variety of branches and forks for Loop available, which are compared below on this page.
Follow this link to find out more about the OpenAPS Reference Design Zero and One (oref0 and oref1).
- Implemented with older Medtronic pumps using a battery operated single-board computer to run the algorithm.
- The “rig” has a radio to talk to the pump.
- The user enters data via the pump and Nightscout; and edits preference files to modify configurations.
- Implemented on Android phones with a variety of pump and CGM choices: AndroidAPS.
- Uses a RileyLink compatible device for older Medtronic and Omnipod Eros pumps
- Direct (Bluetooth) communication for a few other pumps, including Omnipod DASH
- User interface contained locally on the Android phone.
- Must complete objectives while learning the system to progress through levels of complexity.
- Plan to spend weeks progressing from open loop to full access of the oref1 features.
- Additional automation is available when all objectives are completed.
- In-process implementation on iPhone, FreeAPS X runs oref0 and oref1.
- The FreeAPS X ecosystem now supports DASH as well as the Omnipod Eros system and the older Medtronic pump.
- There are a lot of forks and options that are beyond the scope of the Loop and Learn community to document.
- The main discussion forum is found on this Discord channel.
- Some early documentation is found here, but please review the OpenAPS documents and follow the Discord channel.
If you have decided to use the Loop system, you need to decide which version should you start with.
A word about open-source: The software is provided for the public to use and modify as desired. The repositories (LoopKit for Loop and loopnlearn for FreeAPS) are controlled by individuals who contribute to the community by providing code they believe works properly. When a new release is provided by those sites, users choose when to build that release and are asked to report back if they discover any problems. If problems are found, they are updated quickly. There are release notes at each site that should be read prior to updating your version.
Although the development versions of Loop and FreeAPS are not “released”, specific versions that have been lightly tested can be downloaded and built using the script found in LoopDocs at this link: Build Loop dev. Only use the script on LoopDocs to download and build Loop-dev. Do not download Loop-dev directly from GitHub, as you’ll download a newer version that has not been tested as long. The version of dev with this script is from Sep 26, 2022. This is NOT a release. The developers may need to make changes, so pay attention to your app, report bugs and read the instructions in LoopDocs about joining zulipchat.
- The script simplifies building a lightly-tested development version for Loop or FreeAPS
- Both Loop and FreeAPS development versions add support for Omnipod DASH pods in addition to Eros and older Medtronic pumps
- Loop development version adds support of Nightscout as a CGM source (available for all FreeAPS versions)
- Note that the development branch of FreeAPS is based on Loop 2.2.x.
- It does not have the updated features found in Loop-dev
- It adds some Libre CGM support without need for customization
Even though the development version of Loop can be built with a script now, it is still under development. And by using it, you should:
- Follow zulipchat
- Be aware that there may be a breaking change that requires deleting the app and starting fresh
- Watch your system closely
- Report bugs – ideally on zulipchat
- Be aware that the script will not be updated at the same pace as the development branch
Here are a few reasons for using Loop-dev. (These features are not available and not planned for FreeAPS). Be sure to use the BuildLoopFixedDev script from LoopDocs and don’t download Loop-dev directly from GitHub.
- Onboarding protocol with guardrails ensures all settings are entered
- Streamlined main screen display and settings screens provide improved user experience
- Better alerts and notifications assist the user
- Added Features are available:
- Fingerstick blood glucose prompts when data is stale
- Non-pump insulin entry within the app
- Manual Temp Basal feature that automatically restores to closed loop at end of selected duration
- Remote Carb/Bolus capability
New Loopers should start in Open Loop (with the Closed Loop switch in the disabled position). When transitioning to Closed Loop, begin with the Dosing Strategy at the default value of Temp Basal. Once you’ve refined your settings, if you want to try the automatic bolus dosing strategy (Loop) or microboluses (FreeAPS), there are switches in the app settings to enable the more advanced features.
If you decide to start with the FreeAPS version of Loop because you want to use one of the CGM that is natively supported by FreeAPS and not by Loop, then begin with FreeAPS default settings and gradually enable extra features. Any CGM that you can add to Nightscout can be used with Loop-dev, but requires internet access to operate.
The calculations for how much extra insulin (aka “Recommended Bolus”) is necessary are the same for Loop and FreeAPS. The amount of insulin needed is recalculated at 5-minute intervals (Loop Interval). The maximum allowed basal rate and bolus are respected. The Dosing Strategy selection determines how that extra insulin is delivered. The level of control available (in order) is:
- Loop = Temp Basal Only dosing strategy or Automatic Bolus dosing strategy (40%)
- The 40% can be modified by customizing the code and building again
- FreeAPS = Temp Basal and/or Microbolus (up to 100%)
- The use of Temp Basal and fractional percent for Microbolus is adjustable inside the app (no rebuild required to modify)
Features in FreeAPS – not in Loop
- Some Libre choices for CGM
- Ability to modify some insulin dosing selections by switches instead of customizing code and rebuilding
- Ability to save settings and reload later (profile changes)
Features in FreeAPS but not in released version of Loop (v2.2.9). Loop-dev adds a Manual Temp Basal with a better interface including automatic restoration of closed loop at the end of manual temp basal duration.
- Ability to set a user-defined Manual Temp Basal rate
True for FreeAPS and Loop-dev
- Requires a minimum iOS of 14 to build
Loop Master is a “short-hand” notation for the current released version. When this page was updated, that version was v2.2.9.
As of September 2021, the Loop Master branch (v2.2.x) gives the user the flexibility to select either Temp Basal Only or Automatic Bolus as the dosing strategy. As a default, the dosing strategy in Loop Master is set to the Temp Basal Only and uses temp basals to manage insulin dosing.
Temp Basal Only uses a combination of automated temporary basals and manual meal-time and correction boluses to manage blood glucose.
- When your blood glucose (BG) is at or above target, Loop determines the amount of Recommended Bolus based upon your settings. Subject to your Delivery Limits, Loop will deliver the Recommended Bolus over 30 minutes by dispensing equal amounts of insulin every Loop cycle (approximately every 5 minutes) via positive temp basals (i.e., increase in your scheduled basal rate) to increase your IOB. This decision is re-evaluated during every Loop interval.
- When your blood glucose (BG) is below target, negative temp basals (i.e., reduction of your scheduled basal rate) are used to reduce your IOB. This decision is also re-evaluated during every Loop interval.
- When you record a Meal, Temp Basal Only will recommend a bolus that you can accept or modify and then press Deliver.
- You can manually bolus at any time by pressing the Bolus icon in the center of Loop’s Main Screen.
Automatic Bolus uses automatic bolusing to deliver correction insulin.
To enable automatic boluses with Loop, click on Settings – Dosing Strategy – Automatic Bolus (Experimental):
- When your blood glucose (BG) is at or above target, you receive 40% of the Recommended Bolus at every Loop interval while the scheduled basal rate is unchanged.
- When your blood glucose (BG) is below target, negative temp basals (i.e., reduction of your scheduled basal rate) are used to reduce your IOB. This decision is re-evaluated during every Loop interval.
- When you record a Meal, you can accept the suggested bolus, or let the Automatic Bolus dosing strategy provide a bolus equal to 40% of the Recommended Bolus at every Loop interval.
- You can manually bolus at any time by pressing the Bolus icon in the center of Loop’s Main Screen (same as when using Temp Basal Dosing Strategy). Any bolus recommendation that you see when you press the Bolus icon will be 100% of the Recommended Bolus.
FreeAPS has user-defined Settings that are slightly different from options found in Loop. You determine the combination of temp basals and bolus % that are right for you. As a default, FreeAPS is set to use temp basals to manage blood glucose – in the same manner as Loop Master branch. For greater detail on using FreeAPS, please visit the FreeAPS page.
When you first install FreeAPS, please leave Microboluses disabled in FreeAPS settings AND disable Adaptive Nonlinear Carb Model in iPhone settings. (Note – as of FreeAPS v2.2 (201) and later, the default for Adaptive Nonlinear Carb Model is disabled, so no user action is required.) This set-up will give you a branch very similar to the Master branch plus the additional CGM options.
If You Have Never Used Automatic Bolus as a Dosing Strategy
You should ease your way into FreeAPS microbolusing, click on Settings – Microboluses- Enable Without Carbs, and then set your Partial Bolus Application (PBA) to 20% and your Basal Rate Multiplier (BRM) to a number consistent with your Maximum Basal Rate. This will give you a chance to double-check your settings before fully deploying Microboluses.
With these settings, you’ll record meals just as you ordinarily would using Temp Basal dosing strategy and you’ll manually bolus. Over time, you can Enable With Carbs, increase your PBA and decrease your BRM.
If You are an Experienced AB Looper
Click on Settings – Microboluses – Enable With Carbs and Enable Without Carbs and set your PBA to 40% and your BRM to 1x. This set-up will give you a branch very similar to the current Loop Master with Automatic Bolus Dosing Strategy enabled.
Over time, you can increase your PBA and adjust your BRM.
The BRM determines the extent to which you receive extra insulin via temp basals versus microboluses. If the BRM is 1, then only microboluses are used.
If the BRM is set to Max basal limit (scroll down to the bottom of the BRM screen), then any Recommended Bolus will be delivered via temp basals up to the amount of your Maximum Basal Rate. Of course, if you want to receive only temp basals, its very easy to click on Settings – Microboluses – and click Enable With Carbs and Enable Without Carbs so that their checkboxes are no longer green.
I’m sure that by now, you’re asking yourself how much more insulin is delivered using Dosing Strategy of Temp Basals Only compared to Automatic Bolus (40% with Loop) or FreeAPS using one of the Microbolus options. Well that’s a trick question. As long as you aren’t bumping up against limits, the answer is that effectively the same amount of insulin is delivered over time.
There are times when automatic bolusing makes a big difference in blood glucose (BG) management:
- Corrections: Insulin for corrections gets into your system faster.
- Long absorbing meals
- Meals that you forgot to bolus.
Pro-Tip: All Loop versions achieve the best results when you include protein and fat in your meal bolus. The automatic bolusing versions are better at correcting for those times when you forget.
It is very important to know how Loop operates and be careful to set safe Delivery Limits for Maximum Basal Rate and Maximum Bolus. Here’s a quick reference guide to help you set safe Delivery Limits as you start Looping.
In the tables below, Master is Loop with the Dosing Strategy set to Temp Basals Only, and AB is Loop Master with the Dosing Strategy set to Automatic Bolus.
In the example below, you can see how quickly your extra insulin is delivered using Master, AB and FreeAPS.
With the Temp Basal Only dosing strategy selected, either Loop or FreeAPS (referred to as Master in the diagrams on this page) will deliver up to 17% of your Recommended Bolus every Loop interval. With the Automatic Bolus dosing strategy selected (referred to as AB in the diagrams on this page), the Loop will deliver up to 40% of your Recommended Bolus every Loop interval, but with FreeAPS, the % of Recommended Bolus that you receive is based upon your Partial Bolus Application (PBA). You can set your PBA to any % that you’d like from 10% to 100%. In the example above, FreeAPS is set at 60% and 80% for comparison purposes.
Warning: Unless you’re a very experienced Looper with excellent settings and your current sensor readings are verified to be stable and accurate, do not use a PBA above 80%.
In this example, with scheduled basal set at 1u/hour and Maximum Basal set at 3u/hour, Temp Basal Only delivers the least amount of insulin because it is bumping up against the Maximum Basal Rate. The most basal that can be delivered in 30 minutes is 1.5u (0.5u as regularly scheduled basal + 1u as temp basal). With a scheduled basal of 1u/hour and a Recommended Bolus of 2.1, you’d need to have a Maximum Basal Rate of 5.2u/hour (1u/hour as scheduled basal + 4.2u/hour for 30 minutes as temp basal) in order to receive the entire Recommended Bolus amount as temp basals over a 30-minute period.
You’ll notice that all these dosing strategies deliver almost the same amount of insulin within a 30 minute period (6 Loop intervals), unless the max Temp Basal rate is limiting it (first column). However, the difference in how fast the insulin is delivered is significant. With AB (40%), after 5 minutes, you have received 40%, but after 15 minutes, you have received almost 79% ((0.85u+0.50u+0.3u)/2.1u). Whereas after 15 minutes with FreeAPS, you have received almost 93% ((1.25u+0.50u+0.20u)/2.1u) at a 60% PBA or 100% ((1.7u+0.30u+0.10u)/2.1u) at a 80% PBA.
Because of the speed at which automatic bolusing delivers insulin without any manual intervention on your part, it is important to have solid settings before you decide to enact either autoboluses or microboluses. It is also worth mentioning how much more insulin you get with the Temp Basal Only dosing strategy (referred to as Master below) at a Maximum Basal Rate of 5.2 in comparison to 3u/hour. As you start your Looping journey, please set safe Delivery Limits (see Beginning Settings chart above).
What does that mean? If you have one DIY app reading and storing CGM information, that CGM information might be shared with another DIY app.
This can be a good thing, but it might have unintended consequences. Once you decide which DIY app to try, limit the installed versions on your phone to that selection.
And if you decide to have more than one app on your phone that can control a pump – be absolutely certain that only one is actually controlling your pump.
What are app names that might share app groups and write to Apple Health?
- Loop (master and dev)
- FreeAPS (fork of Loop)
- FreeAPS X (OpenAPS implementation for iOS)
- libre-direct (aka Glucose-direct)
For example, at one point, users of Loop-dev needed to completely delete their app from their phone to switch to a new scheme for alerts. They could not do this as long as any shared app group app was still present. This is not a common scenario, but be aware.
Another example, one person was using xDrip4iOS for himself and following his daughter with Glucose-direct. He found both CGM values were imported into his FreeAPS X app. That problem has been corrected for FreeAPS X and in the freeaps_dev branch for FreeAPS, which adds Glucose-Direct support.