Closing the Loop on an Artificial Pancreas

Life as a parent is never easy, but when you’ve got a kid with Type 1 diabetes it’s a little harder. Sometimes it feels like a full-time job in itself; there’s never a break. With carb counts and insulin ratios that change throughout the day, every meal is a medical procedure. A romp in the snow or a long bike ride can send her blood glucose plummeting. The overnights are the worst, though, because you never know if you overestimated the number of carbs at dinner and gave her too much insulin. Low blood glucose is easily treated with a few sips of juice, but if it goes unnoticed in the middle of the night, it could be fatal. That’s why parents of diabetics are always a little glassy eyed — we rarely sleep.

Why is all this necessary? It’s because Type 1 diabetes (T1D) is an autoimmune disease that attacks the insulin-producing beta cells in the pancreas. Once those cells are dead, insulin is no longer produced, and without insulin the rest of the cells in the body can’t take in the glucose that they need to live. Diabetics have to inject just the right amount of insulin at just the right time to coincide with the blood glucose spike that occurs after meals. Knowing how much to give and when is why we say we have to “learn to think like a pancreas.”

Animas Ping insulin pump, partial teardown. The cylinder on the bottom is the battery, the motor and syringe compartment are on top. Source: Animas

Things are better than they used to be, for sure. Insulin pumps have been a game changer for T1Ds. An insulin pump is just a tiny syringe pump. A small motor moves the plunger on a disposable syringe filled with a few days worth of insulin. The hormone is delivered through a small catheter placed under the skin every few days — painful, but better than a needle stick with every meal and snack. A computer keeps track of everything and provides safety against overdosing on insulin, so it’s terribly convenient, but we still need to “think like a pancreas” and calculate the amount to deliver.

Even with its shortcomings, my daughter’s pump has been a blessing, and I’ll do whatever it takes to keep her in the latest gear. Pumps generally cost about $5000 or so, and need to be replaced every three years. While I’m not looking forward to paying the bill when her current pump gives up the ghost, I am certainly keen to do a teardown on the old one. I suspect it’s dead simple in there — a tiny gear motor, some kind of limit switches, and a main board. It’ll be painful to see how little my money buys, but it’ll be cool to play around with it.

Dexcom CGM sensor assembly. The little wire is the sensor that goes under the skin, and the gray blob is the transmitter. Source: Animas

Also a tremendous boon has been her continuous glucose monitor (CGM), which has a small electrochemical glucose sensor that gets inserted into her skin and sends data back to a display unit. We get a real-time graph of her approximate blood glucose level, updated every five minutes. It’s only approximate because the sensor doesn’t reach into the blood stream – it just samples the glucose in the interstitial fluid and infers a blood glucose using its twice-daily calibrations. Even still, it usually picks up hypoglycemic events and warns us so we can treat her. But it’s not perfect, so I still sleep lightly, waiting for the alarm that may never come.

So with insulin pumps and CGM, you’d think all the parts are in place to build an artificial pancreas. All it would take is to close the loop between sensing the blood glucose and calculating the correct dose of insulin And given that both pumps and CGMs all know how to talk wirelessly, it seems like a no-brainer to close the loop. There are even pumps with CGM receivers built right into them, so you know it’s just a software change to get the two devices talking to each other. And yet, at least here in the USA, we still have to close the loop manually, so the artificial pancreas remains elusive.

The painful part of this is that closed-loop CGM-integrated pumps are available elsewhere in the world. So the blocker isn’t a technical hurdle at all, but a regulatory one. The US FDA refuses to allow manufacturers to offer closed-loop pumps here, and in a way I can see their point – a pump that’s on autopilot without someone in the loop to sign off on the dosing can potentially push too much insulin and send the patient spiraling into unconsciousness, seizures, and eventually death if left untreated.

So the FDA is being careful and making the manufacturers prove the pumps are safe, and I appreciate that. But we’ve been told for years that the artificial pancreas is just around the corner, but it never seems to get here. Some people are sick of waiting, though, and have taken matters into their own hands with an artificial pancreas Android app. The project looks impressively well designed and executed, and the code is open and available for inspection. There’s no way the device would ever come close to passing regulatory muster, of course, but the fact that hackers have built a working artificial pancreas only serves to demonstrate that all the technology is here and ready to go.

For our part, we’re going to wait for a device that’s gone through testing and approval and not try to hack a stop-gap solution. At this point, I can only hope that a closed-loop system is available by the time she needs a new pump, and plan on continuing to sleep with one ear open.

Post navigation

43 thoughts on “Closing the Loop on an Artificial Pancreas”

“Dead simple” isn’t what I see when I read this tear down.
It’s probably not exactly what you have, but I think it’s similar.
This one looks extremely well designed (Well, unsecured CC1100 for RF? Maybe could use improving) and it looks like it took many millions in NRE to get the first one designed, built and certified.

Out-of-pocket for the medicines in question would have been $1500-2000+

People bitch about healthcare reform, and want repealing it as the solution. The solution is to stop pharmaceutical companies from price-gouging US citizens. The outright out-of-pocket costs of many medicines in other countries is approximately what a typical insurance copay is in the USA. For example, my copay for Humalog is $75/month for two bottles. A single bottle with no insurance whatsoever in Canada? $50 USD.

Same for anytthing else other than Regular and NPH, despite both Humalog and Lantus now being off-patent.

I was able to get someone onto this system recently, and they have said that it’s the single most important thing they have had happen to them in their life. T1 since childhood and in their 30’s now. I have a T1 daughter and am running Nightscout for monitoring her BG’s, but her pump is not capable of the hybrid closed loop systems… Nightscout in and of itself though has been a life changer.

Encapsulation is at least 10 years away – where do the Beta cells come from? How do you keep alive millions of Beta cells without a vascular system? How do you prevent immune sensitization from cell fragments which leak out of any porous membrane big enough to get glucose through?

“a pump that’s on autopilot without someone in the loop to sign off on the dosing can potentially push too much insulin and send the patient spiraling into unconsciousness, seizures, and eventually death if left untreated.”
The First Rule of Robotics is “When in doubt, alert humans, then switch into manual mode”.

i am one of the few users of that android app. using it since one year. we have a lot of security features implemented. you can not switch on such a system and do not look what it does. in the past we had to monitor our diabetes. now we have to monitor the devices which manage our diabetes.
another thing is you have to tell the loop what you are doing (sports or eating) its not a full autopilot yet. but a big help to manage our daily lifes.
btw the main project is openaps.org you find it on github too and on various gitter.im channels.

Yes, it’s certainly possible. But we haven’t found that data useful enough to incorporate into our algorithms so far, for a couple reasons. Firstly, different types of activity have very different effects on blood sugar. In an extreme example, vigorous running around a soccer field might send someone’s blood glucose (BG) low during practice, but the exact same activity will cause their BG to rise during a game (due to the effects of adrenaline). And secondly, by the time your accelerometer detects activity, it’s “too late” to correct that using insulin, because insulin activity peaks 60-90 minutes after dosing. So what we do instead is give users the options to set an “activity mode” when they decide they’re going to work out, walk home from dinner, or whatever. That extra warning gives the system time to start dosing more conservatively, which helps prevent any BG crash due to the activity.

Wireless IoT like device that can literally kill you with the wrong commands being sent to it. Sounds like a great idea to close the loop. Better still, let’s put it on the internet! Why stop there? Pacemakers too!

insulin does not kill you. you have a small cannula. the amount of insulin is limited. you have a backflow. a part from that insulin pumps have a safety function that you can only apply x amount of insulin per hour or day.
if you think it is a “great idea” join out projects and help to make them more safety.

This is an assessment of poison center calls, further delineated by substance taken. The outcome for 2.7% of callers who overdosed on insulin had cerebral defects and another 2.7% of the patients died. That’s over 5% of people who were calling into a poison center with questions about having taken too much insulin.

“For overdoses with insulin, relatively high rates of serious symptoms and deaths were observed.”

I would agree that too much insulin isn’t as bad as the opposite but the idea of a wireless device that is capable of dosing you with no mechanical limitations in a life safety application is an issue and too much insulin is absolutely a potentially life threatening issue. FDA approved medical device manufacturers are free to do their own thing but they are opening themselves up to a litany of litigation if they choose to favor “IoT” for every medical device because they feel that it is trendy or desired.

This is why all of the closed-loop systems out there so far (including the DIY ones) only operate on temp basals.

Part of the reasoning being – if you send a “change delivery rate to 5 units/hour for the next 30 minutes” multiple times – the effect is still the same. It’s also much harder to wind up with so much IOB that no one can correct for it.

If you repeat “bolus 5 units” multiple times when only 5 units were needed – bad news.

Disadvantage being you can’t go closed-loop for meals – but honestly that will never be possible with externally administered insulin. If you administer when bloodsugar starts rising from a meal – that’s too late.

Condolances for your lack of sleep Dan. Long time T2 here, I’d prefer they advanced islet implant tech and other researched bioscience solutions than fixed the loop with artificial implanted electronics, but then don’t we all I guess. For now I’d like to see the manufacturers putting serious eyes and emphasis of security of whats there before they should be even remotely allowed to operate closed loop. The pump and cgm are wireless but why is this needed even for a couple of metres? its just a big attack vector and Ive seen worrying rumbles from within the hacking community about lack of security already so you are extremely wise to avoid being boots on the ground on such a new tech in my opinion. Fit the things with a jack, or something that requires the comms to be done actually touching the device. Then the signals could carry intra device with shielded wires without risk of something swamping the wifi spectrum and blocking the comms with potential bad unintended effects.
I had a brief stint on insulin this year when I was in a auto accident and steam burnt when the radiator popped and steam burnt me over 44% of my body, insulin is used to grow new skin so the body consumes extra insulin when burnt and recovering and they were pumping masses into me not having any baseline as I was tablet/diet controlled previously, along with a high carb/fat diet and my bg was swinging all over the place with a couple of full blood tests a day and regular night time hypo’s at the 3am minimum point. Horrible experience but happily I’m now back off insulin a few months later and I’ve reduced my tablets also, it took shedding 20kg and a low carb diet to get to that stage this quick but every day I’m not having to futz with needles or worry about dropping too low is a bonus. I only wish everyone’s pancreas could be fixed so they had the same. One day soon hopefully…

I have a T1D girlfriend, and ever since she switched to wireless (proprietary OMNIPOD system, controlled by a dedicated PDA) pumps it’s been a lot less straining on her. The game-changing fact was the omnipod’s don’t have an tubes or wires, because any tube or wire to the injection site can get caught or accidently pulled and cause scarring, pockets of improperly injected insulin, infection, pain, and a fucktonne of hassle.

Wirelessly controlled pumps (pods in omnipod vernacular) are a phenominal idea. Just keep it encrypted, even proprietary, as long as it’s secure. Someone should REALLY get around to making a wireless protocol / standard specifically for medical equipment. Something that is distinct from other existing protocols (maybe even allot a specific frequency range for them not typically used by other electronics)

So make it communicate over a extremely limited distance. Put a comms link sensor onto the surface of the casting of the pump or cgm or even something as simple as a switch or button on the device that it will only enable the radio and enter into comms when its selected. Or is lifting your clothing to touch the device into programming mode in place such a massive price to pay?
The sensors and cannula go under the skin but not the whole device.
Call me paranoid, but I watched someone once turn a “secure” msan into a warez fileserver by reflashing it with bespoke firmware through a remote exploit during a blind pentest. Anything done in firmware can be broken. Anything that can be broken without physical interaction isn’t for me.

Most normal people do not prioritize system design for relatively rare socio-paths. Irrational anxiety usually stems from an individuals own lack of integrity, and is unfortunately a common behavioural cycle for “security-researchers” who make money from hype.https://en.wikipedia.org/wiki/Hanlon%27s_razor

Are you a Doctor qualified to give an opinion, or another crank with delusions of grandeur?
Anything you stick under the skin for more than a few days increases the occurrence of dangerous blood clots, and that is why medications are usually adjusted by a Doctor during care.

Common ailments are being given priority, and this is good news for those 10% of diabetics (Type 1) not suffering the effects of obesity/medication-complications. In theory, there should be a one-time treatment for Type 1, and those with possible permanent pancreatic failure from obesity related inflammation will have to go on a walk everyday to determine if treatment is possible. As a side note, people should be highly sceptical of those papers claiming Gluten intake isn’t a Simpson paradox.

We are still focusing the most capital onto the DNA treatment solution for obvious reasons, and the trials for this technology were started in late 2016.

There is also a lot of evidence linking severe obesity to diminished mental capacity.
How are two detractors going to prove that diet and exercise do not play a primary roll in health?

Those who consistently take care of their health stand a better chance of the new treatment/cures working.
However, those that gave up will suffer the consequences of their sedentary lifestyles…

If it takes pissing 90% of you off to get people on a healthy run, than troll fitness trainer it will be….
Stop being a victim, we both know I can currently out-run you fatty… :p
Empower yourself, get off what used to be your ass before you lose what little life you have left.

Even a real cure won’t work for people who eat fast-food 7 days a week with tears in their eyes.

Being a Type 1 Diabetic – I can tell you first hand that taking 10 -20 units of Bolus ( Apidra ) Insulin can and most probably will kill you if not countered with appropriate amounts of carbohydrate . I took the wrong insulin one evening ( I should have injected Basal Insulin ) instead I shot 15 units of Apidra …. that cost me 3 hrs in the emergency room under observation until I stabilized and I was still seeing wild glucose level swings for several more hours after that. Left untreated a hefty dose of insulin will lead to unconsciousness and eventually death – the key word here is untreated. Spike a capillary and you will see a rapid drop in blood glucose level as well, that if left untreated will result in unconsciousness and eventually death
Trust me your mileage won’t vary

+1 to this. When most people say “xx units of insulin untreated will kill you” it is meaningless without also saying WHAT KIND of insulin you are on. Slow-acting insulin, you might be fine. Fast-acting, and you’re dead.

This is a reason why all closed-loop designs available so far (both Medtronic 670G and the OpenAPS approach) rely on temp basals only. This limits how much they can correct for – but also prevents you from having uncorrectable accumulations of IOB.

What shocks me is many pump manufacturers (including recent Medtronics) allow remote bolus but NOT remote basal adjustment – but bolus mistakes are FAR more dangerous than a temp basal mistake.

For those of you concerned about insulin pump security, please keep in mind that insulin overdoses resulting in hypoglycemia (and occasionally hospitalization or even death) occur regularly with current “dumb” pumps. Because there is such a high background risk, it is actually fairly easy for a closed loop system to dramatically reduce the overall risk of harm from insulin overdose, simply by suspending insulin delivery when blood glucose is too low or falling too rapidly. It is also quite straightforward to implement limits on how much additional insulin a pump can deliver, so that any additional insulin it can administer automatically cannot be enough to cause severe hypoglycemia, and can easily be counteracted by carbohydrates if needed.

For more information on how systems like this are designed with safety as the first and foremost consideration, and how the algorithms ensure that using the system can only be safer than not using it, check out the https://openaps.org/reference-design/. All open-source closed loop systems (OpenAPS, AndroidAPS, and Loop for iOS) follow similar design principles, and as a result, almost 200 individuals with Type 1 diabetes are using such systems successfully, with far fewer instances of hypoglycemia and hyperglycemia.

It’s also worth noting that, while it took a long time to complete their clinical trials and submit it to the FDA for approval, Medtronic has now gotten FDA approval for the first commercial hybrid closed loop pump, the 670G. For anyone concerned that building a DIY closed loop APS system may not be for them, the 670G should be available this spring.

Recent research found this not to be true. In fact, type 1 diabetes turns out to be a neurological disease. Diabetic nerve issues aren’t a symptom, they are the cause and the trigger for the immune response. Up until now everyone assumed diabetes caused the nerve problems, not vice versa. Knowing that, they’ve been able to cure mice in laboratory settings in a completely chemical fashion.

Knowing a bit about technology and computers makes me much LESS likely to want to trust someone’s life to it. If I had a kid who relied on software to live, I wouldn’t sleep for fear of that. Keeping a human in the loop is a good idea. I dunno how old your daughter is, but once she’s old enough to be properly responsible, it won’t take much effort for her to press the button herself, manage her own insulin levels.

Indeed it’s a good thing that she does, it trains her to take responsibility for it, and understand how the whole thing works. Gives her control over her health. Rather than a black box that you ignore, but trust, and don’t necessarily have a clue about.

She’s almost 11 and very good at managing her dosing – usually. But in a hypoglycemic crisis, the first thing that goes is the ability to think rationally. The brain is starved for fuel, and that can cause a hard crash, to the point where even if you could think straight, there’s no way she’d have the coordination needed to operate the pump.

I agree that depending on software to live is scary, but T1Ds need a safety net under them that only software can provide, at least for now. That means super-rigorous QA procedures, which I hope is what the FDA provides and why it’s taking so long to close the loop.

As far is it being a black box for her to ignore, that’s exactly the goal. After all, that’s exactly what a normal pancreas is – it controls blood glucose without us ever having to think about it or even know what it is. Why wouldn’t I want her to have the same freedom to eat and play and work and have a reasonable expectation of waking up in the morning like the rest of us? It may be unrealistic, but a guy can hope.

Chronic diseases are relentless – every waking hour of every day you need to think about T1D to keep good control. Having a life and doing this is tough – T1D Exchange data show it is not until about age 25 when the frontal lobes mature that glucose control becomes good enough to avoid long term complications.

Anything we can do to reduce this burden is a plus – of course PWD still need to know how to use fallbacks like shots, and it takes time for people to trust any new technology #wearenotwaiting