Why the DIY part of OpenAPS is important

I had the chance to talk about DIYPS and OpenAPS during a demo session in DC last week. (Thank you to Gary from Quantified Self and Marty from the National Academy of Sciences for making this possible!)

I walked away with several insights:

  1. Many people don’t know about diabetes; fewer have a realization of current diabetes tech. In several cases as I was describing the closed loop artificial pancreas, people stopped me and were wowed – but not by the closed loop. They were impressed by the CGM.
  2. Others think that this type of technology is already out on the market.

So, I believe we have a long way to go in communicating and advocating for this type of technology. We know it’s behind where it should be – and we want it to catch up. That’s a big part of the OpenAPS goals to help the FDA, device companies, and everyone involved move a little faster than they might otherwise, because #WeAreNotWaiting.

But here’s the other question I was often asked: “How many people have you given this to?”

I frequently embarked on an explanation of how we can’t “give” away #DIYPS or the OpenAPS implementation – in fact, we can’t and won’t give away the code, either. Some of that is because the FDA says no – and some of it is common sense and principles that both Scott and I hold.

Here’s why I think it is so important to keep the DIY in DIYPS and each OpenAPS implementation that is in progress:

  • You need to have a deep understanding of the system before even considering using it on yourself. You need to know what it’s trying to do in all situations, including the fringe cases (the “this is unlikely to happen but if it does…”), so that you know when it’s working – and when it’s not – whether it’s 3pm in the afternoon at work, or 3am and you wake up and find something is not right and the system is not working.
  • You need to go step by step and test and ensure at each stage that it is working as expected – both in a “this is what it should be doing” and “it is giving out the correct amount of insulin”. Remember, insulin is a lethal drug. It’s also a lifesaving drug. It’s important to remember both of these things and balance the risks accordingly.

From the conversations I’ve had with people interested in learning more or getting a DIYPS-type system for themselves, they fall into two categories:

  1. “How can I buy it from you?”
  2. “What do I need to do to make one?”

Given my above reasoning, the second question is my favorite. The first one scares me, if someone does not then switch to the #2 question. Many people do go from #1 to #2, which is great.

DIYPS, for me, and OpenAPS implementations, for others, are works in progress. They’re not perfect. They’re better than what’s out there (like sleeping through alarms when you’re low at night), but they also have big risks. And it’s important to know, and respect these risks, and understand the limitations of the system, before being able to take advantage of this type of system – and to build the system with appropriate safeguards. (This is one of the reason we have OpenAPS, for example, designed to accept multiple failure points – like walking out of range, loss of connectivity, etc.)

The ability to buy a “black box” type system where you don’t know exactly how it works, but you trust that it works? That will be coming from the major device manufacturers in several years – hopefully sooner rather than later, and that’s something that OpenAPS will hopefully help make happen more quickly.

So to answer the #2 question, what do you need to make a DIYPS or OpenAPS of your own?

I’ll answer the technical aspects of this question in another post, but the first thing I always say is: “The willingness to build and test and test and test some more before ever considering using it on yourself.”

How to do “eating soon” mode – #DIYPS lessons learned

“Do you prebolus for meals with #DIYPS?”

The answer to this question is complicated for me. I don’t “prebolus” like most people do (meaning “take some or all of your meal insulin about 15 minutes before you eat”).

I do take insulin before a meal. In fact, I do it up to an hour before the meal starts, by setting my correction target BG from it’s usual range (usually 100-120) to 80. This usually means I’m usually doing anywhere from .5-1u or more of insulin prior to a meal. But the amount of insulin has no direct relationship with the total amount of carbs I’ll end up eating during the meal.

Does it work? Yes. Do I go low? No, because it is unlikely that I would get anywhere near 80 by the time my carbs kick in for a meal (15 minutes after I eat), and therefore the initial carbs are handled by that initial amount of insulin from the eating soon-bolus. (Last year, I wrote a post about “eating soon mode” under the guise of lessons learned about meal time with #DIYPS – if you want to read the reason behind WHY eating soon mode is key in more detail, you can definitely read the longer version of the post. It also links another key concept I’ve learned about called carbohydrate absorption rate.)

So, how can you manually do “eating soon” mode?

1. If you know you’re going to eat anywhere in the next hour, manually calculate a correction bolus with a target BG of 80. (Example – if your correction ratio is 1:40, and you are currently 120, that means you would give yourself 1u of insulin.) An hour, 45 minutes, 30 minutes – whatever you make work is better than not doing it!

2. Eat your meal and bolus normally, but use your IOB as part of your meal calculation so you don’t forget about that insulin you already have going. (Helpful if your pump tracks IOB and you use a bolus calculator feature, but if you take injections, keep in mind about the insulin you’ve already given for the meal – just subtract that amount (1u in above example) from what you’d otherwise inject for the meal.

Note: if you use eating soon mode, you might want to delay the last unit or two of your meal insulin until after you see BGs rise, since sometimes you need less total insulin for the meal if you get insulin active early. (Often, we PWDs may overcompensate with more insulin than we need because it’s not timed correctly compared to the carb absorption rate.)


  • 5pm – You’re planning to eat around 5:30 or 6pm. Your BG is 120 and your correction ratio is 1:40. Setting your correction target to 80, that means you take 1u of insulin.
  • 6pm – You sit down to eat. Looking at your meal, you see 45 carbs and decide, with a carb ratio of 1:10, that you would take 4.5 units for the meal. Keeping in mind your earlier bolus of 1u, you end up taking 3.5 units for the meal. (4.5 total – 1u prebolus = 3.5 more units needed to cover the meal, see above note about considering delaying a unit or two of that bolus until you see your BGs impacted by carbs).

Result? You should have less of a spike from your carbs kicking in 15 minutes after you eat. It won’t always completely eliminate a spike, but it will provide a flattening effect. This is part of how I’m able to eat large (like 120g of gluten free pizza) meals and have flat or mostly flat BGs, and this is also one of the reasons I think using #DIYPS has dramatically improved my eAG and a1cs.

(See another post, with illustrations, about doing eating soon mode here.)