“Should I build an artificial pancreas?” (It’s a personal question)

Given that many (7 almost 8!) of us have closed the loop with OpenAPS, and sometimes show pictures of great overnights like the below, and given the fact that diabetes is a complicated, annoying, unfair disease, there is a lot of interest in closing the loop. Scott and I definitely get that, which is why we started the #OpenAPS movement.

I have been asked more and more lately, “Are you going to make this available to less tech-savvy people?” and “Should I build one?”.

Less insulin needed and OpenAPS reduced accordingly

The answer to the first question is emotionally hard, because a DIY build of a medical device that auto-adjusts insulin will always involve some technical knowledge – or at the very least, a growth mindset and willing to learn many new things to build a technical knowledge in order to proceed through the murky process of building a not-100%-documented artificial pancreas. You don’t have to be a programmer or an engineer; but you do have to have time and energy to spend learning as well as doing. I say this every day: the DIY part is important.

(And, I know people always want to hear “yes! It’ll be out on X date, and just as easy as installing Nightscout.” But it’s not as easy as installing something like Nightscout and never will be.)

That leads into the second question as an explanation of why it’s not as easy as we would wish:

Even if you have a very technical background, you’ll still spend time learning new languages, new pieces of software, and building pieces of your own. Things will break, things will need to be improved, and you need to have the knowledge of what’s going on and understand the logic of what you’re trying to achieve at each stage in order to be able to troubleshoot both the code part of things and the diabetes part of things.

It is hard. And it is a lot of work.

What you don’t see when someone says they’ve (DIY) closed the loop:

For every “I had such a great night” picture someone posts, that probably represents at least (10?+) hours of working on building or troubleshooting their system. Scott and I have each spent hundreds of hours working with my system, from trouble shooting, to building in new features, to reaffirming that things are all working as planned, etc. That figure should be a bit lower for new people as a result of our efforts, but it will never be as easy as just plugging something in, giving it your weight, and letting it take over. The system only does what you program it to do.

I often say this is “not a set-and-forget” system. And this is also true in the wearability of it. Right now, I use a Raspberry Pi and Carelink USB stick to communicate with my pump. They’re great, but the separate power source I also have to keep charged, plus keeping the USB in range of my pump, plus making sure it’s all working, can be a headache sometimes. (Which is why I’m so glad we made an offline mode, to reduce one of the biggest headaches of using the system.) When I’m on the go during the day, sometimes I don’t take it with me, or I choose to stop and un-power it and resume it when I get home. At this point, I wouldn’t be surprised if most people use it for nighttime use only (at least for the most part). But even with nighttime use only, there’s still constant changing of the code (in some cases daily), tweaking, altering, fixing, breaking, and un-breaking various parts.

Did I mention it was a lot of work?

And does a closed loop prevent all lows and highs? No.

It’s important to realize this is not a cure. I work really hard to do eating soon mode before meals to prevent spikes from the amount of carbs I choose to eat. I still have to test my blood sugar and calibrate my CGMs multiple times a day. I still have to change out my pump site every 2-3 days, and deal with the normal hassles of wonky pump sites, etc. I still have some highs – although the loop helps me handle them and I spend less time above range. And I still have some lows – although usually they’re from human error related to bolusing, the loop helps prevent them from always being a true low and/or blunting the drop so I don’t require as much correction. But diabetes is still a good amount of work, even with a closed loop.

Is it worth it to self-build an artificial pancreas?

This is a personal question. It’s a lot of work, with risk involved.

For me, I have decided and continue to decide that it’s worth it.

But only you can decide if the work and the risk are worth the potential rewards for you.

Does the FDA care more about safety than people with diabetes do?

Today my inbox was suddenly flooded with links to a video with some commentary about artificial pancreas technology at a conference by a representative of the U.S. FDA. The implication many people are getting after watching the video clip is that this FDA representative is implying that people are being unsafe by building their own artificial pancreas. He mentions it is consumer prerogative to build an artificial pancreas – which is correct. The implication of his analogy is that changing your car and killing yourself is similar to a DIY artificial pancreas effort.

The scary takeaway from the video, in my opinion, as well as other public comments in the past, is the implication that the FDA cares more about the potential harms of taking action than the almost certain harms of inaction. And it’s increasingly frustrating that the FDA appears to imply publicly that those of us in the #wearenotwaiting community are doing things unsafely as a result of taking action.

Safety is what drives the #wearenotwaiting movement. In my case, I refuse to sleep another night with the fear that I won’t wake up in the morning because there’s not an FDA-approved system on the market that will wake me up if my life is in danger, let alone a system that can take action and change the situation to be more safe. So I built my own (#DIYPS), because the current FDA-approved CGM devices were not (and still are not) loud enough to wake me up at night, putting me at risk of dying in my sleep. And yes, it ultimately turned into an artificial pancreas – with the same goal of ensuring I wake up every morning, safely (alive). That is my prerogative for sure.

But I fail to see why the FDA, which collectively has no particular knowledge of these systems (especially as they have no jurisdiction, acknowledged on all fronts, over what I do myself – it’s my prerogative), is making public statements implying that these types of systems are categorically unsafe.

As a matter of fact, every DIY system I’ve seen is safer than the FDA-approved standard of care available for people with diabetes. The thousands of people using Nightscout, which is currently a DIY remote view-only monitoring system? Provides more safety and security for people with diabetes, not to mention it is helping achieve better outcomes for people with diabetes than they were able to achieve before with the standard of diabetes care as it exists today. (This was originally for the most part because of restricted access to data, although while that has improved there’s still interoperability issues getting access to real-time data in the same place from the 3+ average devices a person with diabetes uses…unless they have Nightscout or another DIY tool running.) The dozens of people working on their DIY version of an artificial pancreas system (many of whom are collaborating and sharing data in the #OpenAPS community)? These systems are safer than the standard of care, which is to let an insulin pump continue to overdose you if you are dangerously low while you sleep.

(You can see some of my personal data from #DIYPS, before we closed the loop, here and more about outcomes after we closed the loop and had #OpenAPS here. My closed loop artificial pancreas system continues to work excellently nine plus months in, and you can continue to watch my outcomes as I post them to Twitter regularly using the #DIYPS and #OpenAPS hashtags. I’ve also shared the other powerful lessons that DIY tech has helped me learn about diabetes care that helps all people with diabetes, regardless of technology.)

Are there risks to DIY efforts? Yes. But there’s risks to living with diabetes regardless. And as a person with diabetes, I am well aware of the risks that I choose to take. Diabetes is a disease in which you carry around large amounts of a lethal drug in your pocket that you are supposed to inject daily in order to save your life. As a person with diabetes, we are nothing but aware of the multitude of risks of living with this chronic disease 24/7/365.

In fact, even without a DIY artificial pancreas system, I am at risk every day simply from using my FDA-approved insulin pump that does not accurately track how much insulin I am given. (Read more here about how most insulin pumps on the market calculate IOB only from boluses, and often do not provide a record let alone incorporate any temporary adjustments to your basal rates and do not in any case track the impact of suspending your pump completely.)

And as someone who has founded the #OpenAPS movement, with the goal of an open and transparent effort to make safe and effective basic Artificial Pancreas System (APS) technology widely available to more quickly improve and save as many lives as possible and reduce the burden of type 1 diabetes…..we approach it with safety first in mind, and is a big part of why the DIY part is critical and is a part of our number one priority of safety.

Not everyone will choose to go the DIY route. In fact, most people do not and I am told all the time “Oh, I would never do that.” And that’s fine! Everyone can choose what they want for themselves.

But technology has made it increasingly feasible for those of us who want to improve our own safety to do so, because the industry and the FDA are not moving quickly enough to meet our needs.

That, indeed, is our prerogative – to increase our own safety.

#DIYPS and the wedding

“Diabetes wasn’t in the picture during the wedding, and that was exactly how it should be.”

Dana Lewis and Scott Leibrand said "I do!"

 

If you’re not familiar with Scott & me (Dana), and how we ended up building #DIYPS and later #OpenAPS, you might be interested to read this great article in Business Insider. (And I’ve been told it’s guaranteed to make you go “awww” even if you already sort-of know us!)

I love that it also highlights how #DIYPS played into our wedding, which was exactly how I wanted it: I hardly thought about diabetes at all. I didn’t have to cut into the lining of my wedding dress to carry d-supplies. In fact, up until the last minute, I wasn’t sure if I was going to carry the closed loop during the wedding itself, because I had decided not to put pockets in my dress and I wasn’t sure Scott’s suit had big enough pockets to hold everything.

But just like all things in this #DIYPS and #OpenAPS journey, a couple of serendipitous events gave us our solution.

First, we were in Alabama for the week before the wedding, and I was working a few days remotely there. But I like to move while I work, and so I’d move around the house (and go outside) with my laptop while I was on calls. This led to Scott getting no data alerts and no-loop-running alerts, and randomly chasing me down to re-plunk the loop down into range. Finally, he asked if I would consider a fanny pack. I laughed, and told him no way, and that HE should wear a fanny pack. Then I remembered hearing about flip belts and thinking about getting one at one point to try for running. So, we made a quick Amazon purchase (where all great artificial pancreas parts come from ;)).

Scott probably thought he’d get me to wear the flip belt around the house (it is purple, after all), and maybe at the wedding, but when it arrived two days before the wedding and I was busy working, he actually put it on, placed all the loop parts inside, and then decided to try putting his tux coat on over it.

It didn’t show.

And this is how *Scott* ended up wearing the belt and the AP parts during the wedding (he’s wearing it above and you can’t see it!). I obviously was stilling wearing my pump and my CGM sensor under my dress where it wasn’t showing. We also gave my second CGM receiver to Tim ( Scott’s brother and best-man-extraordinaire), who also wore Scott’s watch for much of the day and helped give me updates on my BGs when Scott & the loop were out of range prior to our “first look”.

As a result of having #DIYPS/#OpenAPS, my BGs had been picture perfect the night before the wedding, and were within range all afternoon leading up to the wedding. (They were fine during and after the wedding, too, so much so that it never occurred to me to take more pictures of my graph, which shows how perfect it was to have diabetes not on my mind!)

This may have been (one of) the first wedding(s) with an artificial pancreas in it, but we bet it won’t be the last – one of our friends in the Seattle area who is now up and running on #OpenAPS is also getting married next month, and he may wear his loop during his wedding, too!

We like this trend.

What we’ve been up to – mostly offline #OpenAPS

It’s probably time for an update around here – especially since we’re nearing the “deadline” we set for closing the loop – August 1, 2015!

August 1 is our wedding date, which is part of the reason it’s been quiet around here as we are off busy preparing for that.

The other reason it’s been quiet (unless you follow me on Twitter and see some of the #DIYPS examples there) is because we closed the loop back in December (read more about it here), and we haven’t made any significant updates to the #DIYPS system.

It’s all working well.

Showing a relatively flat CGM graph despite a 75 gram carbohydrate meal, thanks to OpenAPS.

What we’ve been focusing on most of the year is supporting the #OpenAPS community. In particular, we’re trying to help more people learn what they need to understand so that they can build their own loops. There’s a handful who have made or are making excellent progress, and hopefully we’ll have some OpenAPS data to share soon.

Most recently, spotty hotel internet in Portugal helped prompt us to finish the offline version of #OpenAPS, which I’ve been testing. (And will use the honeymoon, wherever that ends up being, as an opportunity for more testing!) #DIYPS has always required internet connectivity to get the recommendations from the cloud (which is where it stores the data I give it about boluses and carbs). The reliance on connectivity is always something to troubleshoot if the system appears to not be working, and also makes it burdensome to carry around all the time and make sure it has connectivity.

Getting offline looping of CGM data to OpenAPS.

Offline OpenAPS will likely solve a big part of the frustrations I experience with daytime use of the system. I already saw a big improvement in being able to use offline OpenAPS in Portugal – both at the conference and in the hotel, as well as walking the streets of London during a layover. It’s nice to drop the system (the same Raspberry Pi, battery, and carelink stick from DIYPS) in my bag and not have to constantly check to make sure the wifi hotspot is connected. The only difference in the setup is that one of my CGMs is plugged directly into the Raspberry Pi.

Showing my OpenAPS rig against the plane window to illustrate offline steam of BGs to OpenAPS is working

We still need to do more testing on our offline implementation of OpenAPS, but it’s going well and I’m excited that what we’ve learned from this progress will help us with better tools to enable the broader OpenAPS community since #WeAreNotWaiting!

“Making” and “DIY”ing – continued

I had a conversation this week with someone in the CGM in the Cloud Facebook group, after they indicated they wouldn’t be (or maybe weren’t interested in) joining the “dev” group for #OpenAPS – and it’s a conversation I find myself having often. Here’s what I usually end up saying, when someone says they’re not a “dev” or “not an engineer” or something similar:

“I’m not a formally trained developer/coder/engineer, either… but I keep telling people, many people in this project aren’t- it’s a passion project where we learn what we need to learn to do the things we want to do. It’s fine if someone chooses not to do something, but I encourage everyone to not let labels or perceptions of traditional roles stop them from jumping in and giving it a try to see what they can learn and thus do! Especially with this awesome supportive community of people willing to help you as you go.”

This also came up when we were discussing what it takes to be a “maker” on TEDMED’s #GreatChallenges live panel today. One of my excellent fellow panelists (Cole) pointed out that pretty much everyone is a maker – whether you tweak a recipe, work with wood, or find any kind of workaround of any sort to make things work. (Which in my mind makes every single person with diabetes a “maker” and probably anyone with any disease or health care condition that they live with.)

I previously wrote about what it takes to DIY from a DIYPS and #OpenAPS perspective (and why that’s important), but I think it holds true across any aspect of diabetes or any other disease state – and definitely beyond healthcare:

Passion, persistence, and willpower needed.

So please, don’t let labels stop you from DOING. You can learn whatever tech skills you set your mind to. You can find numerous ways to solve a problem, whether it’s on your own or by partnering with someone else – and there’s plenty of people with the skills who are willing to help you learn, too.Remember, we started building #DIYPS to make louder CGM alarms. Scott and I have both learned numerous new things and new programming languages and skills along the way as we went from alarms to an alert and recommendation system to a closed loop artificial pancreas (and now people who own 4 Raspberry Pis). We didn’t come to the table with knowledge of everything we needed to know to do what we first wanted to do – and we’re definitely still learning a dozen or more things (programming languages, new software, etc.) along the way as we continue with #OpenAPS. We also didn’t know anything previously about working directly with the FDA – and now we are, on a number of projects, in order to help scale from n=1 of a DIY artificial pancreas to many n=1s around the world.

You can do this. Bring your passion, and go do great things!

#WeAreNotWaiting, are you?

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.)

Example:

  • 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.)

#DIYPS & #OpenAPS

Since I‘ve been using #DIYPS for over a year and also had the closed loop version running for more than two months with excellent results, I get several questions every week about how/when we’re going to make it available to other people. #DIYPS is an individual implementation that we built, and because of FDA regulations it’s not something we can give to another person to use. (Not to mention it’s not been tested for more than n=1, etc.) But, both Scott and I are passionate about moving diabetes technology forward for all, and so this week we kicked off the OpenAPS project.

#OpenAPS is our initiative to build on the #DIYPS closed loop work and eventually make this type of technology available (and faster than the market and traditional research is otherwise moving) for more people with diabetes. We aim to encourage other independent researchers to build their own closed loop implementations based on the OpenAPS reference design, and share their results and help us improve the design further. We are also working toward clinical trials that will enable more people to test and use the system during the research phase, but without having to code and build their own implementation of a closed loop artificial pancreas system. And all of this will be done in an open, transparent way so people can ask questions, monitor progress, and get involved at various stages.

The Open Artificial Pancreas System (#OpenAPS) is an open and transparent effort to make safe and effective basic Artificial Pancreas System (APS) technology widely available to more quickly improve and save as many lives as possible and reduce the burden of Type 1 diabetes.

We believe that we can make safe and effective APS technology available more quickly, to more people, rather than just waiting for current APS efforts to complete clinical trials and be FDA-approved and commercialized through traditional processes. And in the process, we believe we can engage the untapped potential of dozens or possibly hundreds of patient innovators and independent researchers and also make APS technology available to hundreds or thousands of people willing to participate as subjects in clinical trials.

At the end of the process, we hope to have produced an FDA-approved #OpenAPS reference design and reference implementation that can be used by any medical device manufacturer with minimal regulatory burden. We believe this will in turn allow manufacturers (and the academic research teams they work with) to turn more of their attention to designing and testing more advanced APS systems, and thereby accelerate the pace of innovation toward new and improved Type 1 diabetes treatments, and eventually a cure.

In the mean time, it will make basic overnight closed loop APS technology widely available to anyone with compatible medical devices, thereby reducing the burden of Type 1 diabetes on everyone who lives with the disease.

I’ll continue to post here often with data and updates from my experience & work with #DIYPS, which I’m continuing to use. But I also encourage you to bookmark OpenAPS.org if you’re interested in watching that work move forward, too – and as always, we’ll be on Twitter with #DIYPS and #OpenAPS as @DanaMLewis and @ScottLeibrand (and you can email us for #DIYPS or #OpenAPS info at Dana@OpenAPS.org and Scott@OpenAPS.org).

#DIYPS Closed Loop – One month of data & it still works great

My name is Dana Lewis and I have a closed loop artificial pancreas (that I built) that I use every night. Also see: woot!

Tweet that says "I love you #DIYPS closed loop"

We closed the loop in December (click here for more details about the first week of data & basics on how the closed loop works; or here to learn more about the basic non-closed loop #DIYPS and how far we’ve come in a single year), and I’ve been using it almost nonstop since.

When to loop – or not

I’ve only been limited in using the closed loop for overnight when I inadvertently fried the SD card in the Raspberry Pi (a known issue that’s related to the number of times you plug/unplug it from power source). We promptly ordered a second Pi as a backup, and by the time it arrived, Scott managed to revive the first one, so I now have two ready to run at any time. (Because of course you need emergency backups of your essential organs!)

When I first started looping in December, I originally intended to only use it at night, but it was hard to not loop during the day, too. The idea that I could sit at my desk and work for 3-4 hours straight, and not worry about my BGs, is so appealing!

However, it’s not really practical for me to want to use 24/7 every day…yet. This is where the versions of APS that will come to market in 3+ years will be great, because it will be all-in-one (or at least limited in excess pieces you have to carry). To wear it 24/7, I have to have enough batteries to power the raspberry pi and keep it in range, which means constantly picking it up and moving it around, carrying it in my bag from meeting to meeting, etc. I’ve decided it’s not worth it for every day, but it is awesome to have the choice when sitting through an important interview to have it running and have more security and peace of mind.

Back to using the closed loop for overnights

When we first showed our closed loop efforts off, we had about a week’s worth of data that already showed improved overnight blood glucose (eAG) and time in range, plus reduced number of #DIYPS alarms.

After a month, the results of using a DIY closed loop artificial pancreas system overnight continue to look promising:


We also recently added another screen to #DIYPS so I could access and review “what happened last night”, or what was the output of the closed loop. I usually look at the net impact per hour (how much above or below my normal basal rates I ended up getting), but also at the individual numbers of how much above and how much below I ended up getting every hour. Here’s a visualization:

Tweet illustrating how DIYPS closed loop works overnight with micro corrections to keep blood glucose in range

Using closed loop activity to spot trends and change basal rates

We also built a 7 day and 30 day view of this closed loop activity history so I can look at trends by hour overnight (versus manually compiling and visualizing them, like I did in our first closed loop data post here).

When we first looked at the data for overnight closed loop net insulin activity, I could spot a trend easily – the loop temped low from midnight to 2am, leveled out, then increased with higher temps after 5am. I can easily see why it often ends up temping low after I go to sleep, because I often do a half unit or so if I’m riding “high” (130 – ha!), and feel safe doing so with the loop to catch any more drop than I desire. (This pattern was consistent at 7, 14, and 30 days, although the average net insulin amount varied slightly.)

However, when I first started looping overnight in December, I had rises around 2am that the loop had to handle by providing higher temporary basal rates than my scheduled basals. I upped my midnight basal rate as a result, but it looks like I upped it too far since the closed loop often temps low now during that time frame. My next step is to probably change my midnight basal to be lower by 0.1u, and see if that reduces the amount of low temps needed from 12-2am, without causing spikes. My theory is that this alone may also reduce the number of higher temps from 2-4am, because those may be a result of the lower temps earlier on. Thus, I am starting overnight basal tweaking with this one change and seeing how much of a ripple effect it has for the rest of the night as well.

In pursuit of…what? Or: what are we optimizing for?

My BG averages overnight (and during the day) are excellent (well within the “normal” range <120) and time in range is continuing to grow (85% & counting) with using the closed loop #DIYPS. So, beyond minute basal tweaking, what’s next?

At this point, I think the next goal is encouraging other independent researchers to get up and running on their own closed loop overnight APS.  Do we really need to wait another 3+ years for APS technology to come to market?  What exactly would #WeAreNotWaiting look like if we applied it to closed loop Artificial Pancreas technology research? What do you think?

How does a closed loop artificial pancreas work when you DIY? Or: #DIYPS closed loop is working!

We closed the loop with #DIYPS and now have a DIY closed loop artificial pancreas running right now (for me, aka n=1.)

Here’s what a closed loop #DIYPS artificial pancreas looks like:


(A raspberry pi powered with a battery (shown) or via an outlet; a Carelink USB plugged into the Pi and in close proximity to the pump; a Medtronic insulin pump (an older version, thanks to a family from CGM in the Cloud for sharing it!); and of course my CGM and Android uploader phone that’s sending my data into the cloud/#DIYPS)

Here’s how a closed loop artificial pancreas or “#DIYPS closed loop” works:

Over the past year, we’ve been using #DIYPS to process BG, insulin on board and carbohydrate decay in real time. This yields real-time predictive alerts of three kinds: more insulin needed (X.X units of bolus insulin); less insulin needed (temp basal to zero insulin for X minutes); or carbs needed. Using this algorithm and my data entered (insulin taken or reduced; carbs ingested); we’ve seen significant results not only for the first 100 days, but also sustained over an entire year for improved average glucose, improved a1c, and improved time in range.

Closing the loop with #DIYPS

Three weeks ago, we mentioned at D-Data Exchange 2014 that we were planning to close the loop with #DIYPS…by August 1 (our wedding date :)).

The FDA was even in the room.

Two weeks later…we closed the loop.

It was this simple:

  • Thanks to Ben West’s awesome work, we plugged the Carelink USB into the Raspberry Pi. Thanks to a generous family from the CGM in the Cloud Facebook group, we acquired an old 522 insulin pump that could talk to the Carelink USB. (My current pump is too modern to work with this setup.)
  • Once we established that the Pi/USB setup could read from the pump, we started connecting #DIYPS to the system to close the loop.
  • Normally, #DIYPS provides 3 types of recommendations (see above). We reconfigured it so that while “looping”, it only enables the pump to do temporary basal rates instead of boluses. If #DIYPS says I need more insulin, it tells the pump to begin a temporary basal rate for 30 minutes above my normal basal rate. If #DIYPS says I need less insulin, it tells the pump to begin a temporary basal rate lower than my normal basal rate for 30 minutes, effectively reducing my net insulin.
  • When something changes and I need to do more or less insulin, #DIYPS tells the pump to increase or decrease the temporary basal rate, or resume my normal basal rate.
  • Note: there is a maximum basal rate that the pump can provide. This is a safety check so that #DIYPS cannot recommend a seriously dangerous basal rate. In fact, if I need more insulin than #DIYPS closed loop can safely provide using a 30 minute temp basal, the system will alarm and alert me to that state (although I usually already know about it). Same for if I was dropping fast and needed carbs in addition to reducing insulin; it would alarm and recommend carbs above and beyond reducing insulin.

I’ve been ‘looping’ (using #DIYPS closed loop) for a little over a week. Here are some of my overnight results:

As you can see, the outcomes are awesome. In fact, they are better than I expected!

#DIYPS closed loop results are significant

Here’s a break down that shows on an example night (Sunday night, 12/14 through Monday morning, 12/15) of how #DIYPS performed:

You can see that around 10:30 (not pictured, but in the graph), I was running low and needed some temp basals to zero, then later some higher temp basals to accommodate the resulting rise in BG. Later, my normal basal rates sufficed until another point overnight when I needed less insulin to prevent a low.

While this is 1/9 or so example nights, this is pretty much how it works every night. BGs drift up? Temp basal higher (usually 1.6 or 1.8, which is <=.5u above my normal). BGs drifting low? Temp basal lower or in extreme cases to zero to prevent a low.

What happens if the closed loop artificial pancreas fails/stops working?

If the loop stops working*, #DIYPS continues to work normally (processing all data and pushing recommendations), and my pump goes back to my normal basal profiles after any existing temp basal rates expire (which would be a max of 30 minutes). No big deal and no more dangerous than I would be walking around with my pump acting normally.

*I’ve found numerous ways to make the system stop working: no battery power; being too far away from the USB stick so the pump can’t communicate; no cell signal to provide wifi as a hotspot to the Raspberry Pi; if the pump battery goes low, RF gets turned off and the USB can’t talk to the pump; if there’s no cell signal or wifi at all, I can’t upload CGM data to #DIYPS anyway; if the SD card gets corrupted inside the Raspberry Pi; etc.

So, there’s many points of failure. But it doesn’t matter. #DIYPS closed loop is safer for me (disclaimer: just me! I’m the only one doing this as a personal experiment to my own body) than if I just had a pump and a CGM, because it can reduce insulin and prevent lows. And it can increase insulin slightly and prevent rebounds.

After about a week’s worth of data, here’s the results of #DIYPS (what I’ve been using for the past year) versus the week of closed loop #DIYPS:


The target BG is especially awesome, because we have the closed loop targeting a BG of 115!

It’s also worth noting the reduction in alarms. Remember, I sleep through CGM alarms, so we built #DIYPS. #DIYPS makes a lot of alarms – sometimes upwards of 40 a night (those are really bad nights!). With the closed loop nights, there are very few alarms..and they’re usually alerts about things #DIYPS closed loop is taking care of on it’s own (see all of those no-hitters above!).


What’s next with #DIYPS closed loop

We’re going to continue and iterate on the closed loop and keep making it better. I’m definitely going to keep using it overnight – it’s like having a working pancreas, the kind where you can go to sleep without fear.

We’re also adding this to the ‘things we’ve learned while working on #DIYPS’ list:

  • Calculating the carbohydrate absorption rate for an individual – how many carbohydrates your body absorbs in an hour
  • Tracking “carbs on board” or “carb decay” – how many carbohydrates are still being digested in your body and impact BG levels
  • “Net” IOB – tracking net IOB by incorporating “negative” boluses from temporary basal rates to zero
  • Preventing post-meal BG spikes/drops with early meal boluses and better understanding of insulin activity
  • and you can control overnight BGs solely using simple adjustments of insulin rates.

Thanks to everyone who made it through a really long post, and for the MANY people who have contributed in various ways to helping us close the loop with #DIYPS! Also, let us know what questions come to mind that we haven’t managed to answer above about how the system works, results, etc.