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.
Loop:
The Loop algorithm is implemented only on Apple devices (iPhone/iPod).
- The released version (as of 14 January 2023) is commonly referred to as Loop-main or Loop 3, and supports both Omnipod DASH and Eros, as well as some older Medtronic Pumps. A radio-link device is required for all pumps except for the Omnipod DASH.
- There are a variety of branches and forks for Loop available, which are compared below on this page.
OpenAPS:
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.
Note:
- FreeAPS is a fork of Loop
- FreeAPS X is an implementation of OpenAPS algorithm on an iPhone
- Both of these projects have an active translation crowdin site
Which Loop Version to Choose?
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.
- The original Loop was and is provided at the LoopKit repository. Release Notes for LoopKit/Loop.
- The FreeAPS fork of Loop was created by Ivan Valkou and is maintained at the loopnlearn repository. Release Notes for loopnlearn FreeAPS.
This page covers the use of the script from LoopDocs to download and build Loop 3 or FreeAPS.
- Both Loop and FreeAPS support Omnipod DASH and Eros pods, certain older Medtronic pumps as well as Nightscout as a CGM source
- Note that FreeAPS is based on Loop 2.2.x and does not include the feature enhancements or safety improvements in Loop 3
- FreeAPS includes some Libre CGM support without need for customization
Here are a few reasons for using Loop 3. (These features are not available and not planned for FreeAPS). You can build Loop 3 using either a Browser Build or a Mac Build (which uses the Build Select Script).
- 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.
To learn more about FreeAPS or to build FreeAPS using the FreeAPS Build Script, click here.
The calculations for how much extra insulin (aka “Recommended Bolus”) is 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
- Loop with Patches = Automatic Bolus dosing strategy (% is set by user)
Required minimum iOS version for Loop 3 is15.1
Loop-main
Loop-main is a “short-hand” notation for the current released version. When this page was updated, that version was v3.0.
As of January 2023, the Loop-main branch (v3.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 Main 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
Warning – FreeAPS sunset is approaching
- There will be limited support for FreeAPS in the future
- There is the chance that the next iOS or Xcode update could “break” FreeAPS and you would need to migrate to another Loop branch or fork.
- Please build Loop 3
How much more insulin is delivered?
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.
- Meals:
- 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-main with the Dosing Strategy set to Temp Basals Only, and AB is Loop Main 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), 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).
A Warning about Multiple Apps
There are a lot of DIY apps out there that use a shared appGroup and store their data in Apple Health. This enables code to share information – but this also enables code to share information.
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 (main and master)
- FreeAPS (fork of Loop)
- FreeAPS X (OpenAPS implementation for iOS)
- xDrip4iOS
- libre-direct (aka Glucose-direct)
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.