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.
The Loop and Learn website was created to assist people wanting to succeed with Loop. With the advent of FreeAPS X, documentation was added to this site on that implementation of the OpenAPS algorithm.
When deciding which DIY algorithm you should choose, consider the options.
- The Loop algorithm is implemented only on Apple devices (iPhone/iPod) and uses a RileyLink compatible device to allow the phone to communicate with older Medtronic and Eros Omnipod pumps.
- There are a variety of branches and forks for Loop available.
- The Loop Master branch and one fork of Loop, referred to as FreeAPS, are compared below on this page.
- The OpenAPS Reference Design Zero and One (oref0 and oref1):
- Implemented with older Medtronic pump 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, AndroidAPS uses a RileyLink compatible device for older Medtronic and Eros Omnipod pumps, direct communication for a few other pumps. (Omnipod Dash with AndroidAPS is in beta test now and should be added “soon” to a new release.) 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 available when all objectives are completed.
- In-process implementation on iPhone, FreeAPS X runs oref0 and oref1. As of FreeAPS X version 0.2.1 (note – version numbers change frequently – use most recent release), it offers direct Dexcom support as well as the ability to use any CGM that sends values to Nightscout. If you believe you might want to try this algorithm and are a dedicated Apple user but a novice with DIY closed loop; our current recommendation is to build Loop or FreeAPS (Loop) now. Later if you want to try FreeAPS X, it will be much easier given your Loop experience. FreeAPS X uses the same pumps and RileyLink compatible devices as Loop. It is not for novices in its current state.
If you have decided to use the Loop system, you next 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.
New Loopers should start 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 like some of the features mentioned or you need 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. Consider joining the Telegram Channel for Loop. Help and discussion (English) and FreeAPS News. Click here for even more details about the many features of FreeAPS.
The calculations for how much extra insulin (aka “Recommended Bolus”) is necessary is the same for Loop Master 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 difference is in how that extra insulin is delivered. The level of control available (in order) is:
- Master = 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
- More choices for CGM
- Ability to go Open Loop and set a user-defined Temp Basal rate
- Ability to modify some insulin dosing selections by switches instead of customizing code and rebuilding
- Ability to save settings and reload later (profile changes)
- Active translation project (you can contribute for your language)
- Requires a minimum iOS of 14 to build
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.
Now that Xcode 13 has been released, Loop v2.2.x must be built with a Workspace build. The Build Script for Workspace builds is actually easier than the older zip file method (no longer available). This can be built on an iPhone using iOS 13 or later, including iOS 15.
What makes FreeAPS unique is that it has many user-defined Settings. 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. Important Notice for those using Omnipod: If you ignored the pre-build warnings to make sure that your Looping phone and Pod are using the same time zone, please do not take any of the steps below until you access your Loop settings and click on Change Time Zone in order to avoid the Time Zone bug.
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.
FreeAPS must be built using Loop Workspace. FreeAPS only works on iPhones using iOS 13 or later.
How much more insulin is delivered?
I’m sure that by now, you’re asking yourself how much more insulin is delivered using Loop Master with Temp Basals Only as your dosing strategy vs Loop Master with Automatic Bolus as your dosing strategy vs FreeAPS. 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 (Loop Master with the Automatic Bolus dosing strategy or FreeAPS) really 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 Master 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 (Experimental) dosing strategy selected (referred to as AB in the diagrams on this page), the Master Branch will deliver up to 40% 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 please 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 certainly 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.