Skip to main content

The diabetes patients who hacked a pancreas

Our medical devices didn't work together. So we cracked the code ourselves.

By Paul Heltzel

One day in spring 2019, pictures of children started to appear on an online support group for diabetics. Some of the kids were dancing. Some were on the playground. All were proudly showing off a medical device: an insulin pump decorated with a circle, scrawled in green magic marker.  

The symbol represented a life-changing development for diabetics and their families — and the culmination of a sprawling, self-directed hacking project. Dozens of people had spent hundreds of hours creating a device that could control a modern, widely-available insulin pump: a do-it-yourself artificial pancreas.

Multiple university studies showed an artificial pancreas could be a game-changer for keeping blood sugars in check and helping lessen the dangers of diabetes. Yet the wheels of the marketplace — and FDA approval — grind slowly. So while diabetics anxiously awaited the release of commercial systems, tech-savvy diabetics and their loved ones worked on do-it-yourself systems.   

Most of the people involved had wondered if the job was impossible: How could a bunch of hackers, working in their free time, create something medical manufacturing companies had yet to put on the market? Still, the community kept inventing, coding, and testing.

I was by far the least tech-savvy person involved in the project. But I’m a diabetic, and I was determined to help — even if it meant learning to read long strings of code and zapping myself on a dog’s invisible fence. Trust me: it was worth it.

I’ve lived with type 1 diabetes since I was diagnosed at age 10. From that moment, I started taking insulin shots and pricking my fingers for a drop of blood as many as 10 times a day, to test my blood sugar levels and plan how much insulin to take.

Over that time, I’ve seen plenty of medical advances for diabetics: synthetic human insulin; pumps that delivered precise dosages; continuous glucose monitors, or CGMs, which report a user’s blood sugar every five minutes, thanks to a small needle inserted under the skin. By about 2014, a tech-savvy diabetic could trade multiple daily injections and finger pricks for an insulin pump and a CGM.

But there was a basic flaw in all the new diabetic technology: The pump didn’t talk to the CGM. That meant that none of these devices worked together to do what a pancreas does: help keep blood sugar in check by automatically dosing insulin as needed. And a mistake in dosing could be fatal.

In 2015, Dana Lewis, a Seattle resident with diabetes, realized that she was sleeping through her CGM’s alarms. Left untreated, low blood sugar could send someone into diabetic shock.

Dana’s then-boyfriend, Scott Leibrand, was a software developer, and he set about to modify her CGM. They got help from other hackers, including Ben West, who figured out how to control the pump, and who would end up writing much of the code they needed. By 2016, the group had figured out how to intercept the blood sugar readings from the CGM, coordinate that with data from the insulin pump, and issue small dosing instructions. They essentially turned a tiny computer that could fit into a Tic-Tac box into an artificial pancreas.

“We got engaged and announced that we were going to ‘close the loop,’ with the goal to do it by the time we got married and moved in together,” Lewis says. “Scott wouldn’t have to deal with the alarm, which was highly motivating. And we did it two weeks later.”

They called their system OpenAPS. At diabetic conferences and on their website, they began to share how they made the CGM and the pump work together.

When you use a DIY artificial pancreas, you’re an experimental study of one. The device isn’t approved by the FDA, so it can’t be gifted or sold. Each user has to build a system from scratch.

OpenAPS was one of several simultaneous projects created by people who were trying to solve the challenge themselves. Some hackers had succeeded in controlling old-model insulin pumps through a smartphone. Other software engineers were focused on translating readings from CGMs onto a website, a project called Nightscout, so parents could monitor their kids’ blood sugar remotely.

They were all great developments, but they weren’t available to a sizable portion of diabetics, who use a wireless, tubeless pump called the Omnipod. The device was small, disposable, waterproof, and covered by insurance — but didn’t work with these new hacks.

When I stumbled on Dana and Scott’s story in 2015, I wondered if the Omnipod I used could be hacked too. But unlike Scott, I lacked the engineering background to get the project off the ground. What could I bring to the table? An idea? Maybe an impossible idea? It wasn’t much. All I was sure of was how much I didn’t know.

I emailed the DIY inventors and introduced myself.

Dana and Scott wrote me back: The idea of hacking the Omnipod intrigued them, and they offered to help. We talked on the phone, and decided to start a group in Slack to try to decode the radio transmissions to and from the pod. Dana sent out invites to developers who might want to contribute.

The conversations took off quickly. But the decoding went in fits and starts, as hackers took steps to understand how the Omnipod worked. A number of difficult problems ground the work to a halt. The channel went almost dormant for weeks. 

The solution was to bring in outside help. James Wedding, the father of a type 1 diabetic daughter and president of the Nightscout Foundation, wanted to help the effort but, like me, lacked programming chops. He gave the project a boost by creating a bounty program, inviting hackers to tackle the problem for a reward. Drawing pledges from diabetics and their families, the bounty would grow to about $30,000, and attract some talented programmers. By the project’s end, our Slack group would grow to 2,000 people.

And when a programmer named Pete Schwamb signed onto the channel, I knew our chances of success had increased dramatically.

Schwamb had already developed an ingenious device called the RileyLink — named after his daughter, who was diagnosed with type 1 diabetes. The device, a tiny battery-powered circuit board with an antenna, acts as a wireless bridge between a CGM and insulin pumps created by the company Medtronic. It’s an integral part of an artificial pancreas system called Loop.

Schwamb thought our Omnipod project would be just as easy to complete. “I’m very much an optimist,” he told me recently. “I think I had confidence from decoding the Medtronic pump. But it turned out to be the definition of a not-easy problem.”

And it would take some surprisingly manual steps to solve. A handful of us bought antenna kits that looked like TV rabbit ears, to capture the Omnipod’s radio signals and view them on a computer. The data came across in a hexadecimal number system, which uses symbols: 0 to 9, and then A to F, representing 10 to 15. So a command might look like this:


The message above identifies the pod, tells it how much insulin to deliver, and includes checks that verify that the command is correct. As we did the work, we added the commands to a web page, a sort of wiki-based Rosetta Stone.

The code began to reveal itself within a few weeks. But decoding every possible command took several years. The translation effort, led by engineers Joe Moran and Ken Shirriff, allowed us to capture messages that checked on the pump’s status; told the pod to deliver insulin; and told the pod when to increase or decrease the dose.

One programmer wanted to capture code behind the alarm a pod gives when it comes into contact with static electricity. (In winter, a static charge from sweaters and jackets can make a pod fail.) I volunteered to make the capture because my “invisible fence” for our dog gives a slight static charge when he gets too close to the edge of our property. I zapped the pods over and over (and myself more than once, accidentally) until my antenna picked up the error code.

At one point, an engineer of the original Omnipod came onto the Slack channel and chatted with us. He couldn’t share any proprietary information, but said some of the work brought back memories, and he encouraged the programmers to keep going. We were on the right track. It was an electric moment. 

But about a year into the project, a troublesome problem stopped the programmers. One bit of code included in each insulin delivery command, which programmers called the “nonce,” kept changing. The programmers couldn’t understand the math behind it. They began to doubt whether the Omnipod could be reverse-engineered at all.

The developers realized the only way they could understand how to control the device was to extract and interpret the contents of its microcontroller chip. One of the project’s contributors, Dan Caron, reached out to a computer scientist named Sergei Skorobogatov at the University of Cambridge. Skorobogatov had developed proprietary techniques to view a chip’s firmware, or computer instructions. After multiple attempts, he used a secret method to extract data from the chip.

Next, a handful of developers made a massive effort to decode the rest of the protocol that drove the pump. “It’s basically a bunch of numbers,” Schwamb says. “And turning that into instructions and tracing through what they do is super-hard …. It was crazy how long it took.”

But eventually, Schwamb and others made strides in controlling the Omnipod and writing code to make it work with Loop. It was time to test the system.

Joe Moran, who’d spent countless hours parsing some of the code’s most difficult challenges, was the first to use the closed-loop Omnipod and the experimental software to regulate his insulin. He waited several days to tell Schwamb he was using it, knowing Schwamb would worry. More people became testers, until about 30 were wearing the system 24/7.

When you use a DIY artificial pancreas, as Dana Lewis says, you’re an experimental study of one. The device isn’t approved by the FDA, so it can’t be gifted or sold. That means each user has to build a system from scratch, following documented instructions, spending hours getting familiar with the technology and assembling the hardware and software.

That’s why the final, daunting challenge was creating easy-to-follow documentation for the new software. Two parents of diabetics had created an online tech support community to help Medtronic users running Loop. Now, one of the administrators, Katie DiSimone, spearheaded the work of making Loop accessible to Omnipod users, too.

In April 2019, after about eight months of real-world testing, the code for an experimental version of Loop, using Omnipod, was released on the Loop website.

Within a day of the announcement, parents began posting photos of their children wearing pods, with that green circle, the icon for Loop, drawn on them with a marker. One little girl was standing on the base of a slide beaming, the looped Omnipod on her arm below her shoulder.

I cried at my desk, scrolling through page after page of photos of kids wearing the Loop-connected pods with the symbol. 

There’s a line — “We are not waiting” — that the DIY diabetic movement uses to describe its hacker’s mindset and its impatience to live more simply and safely with diabetes. A hardware engineer and diabetic’s dad, Lane Desborough, coined the phrase at a 2013 diabetes technology meeting at Stanford University. Over time, it’s become a common Twitter hashtag, boosted by the diabetes nonprofit Tidepool, which helps diabetics share the data from their medical devices. Why wait, the phrase demands, to advance the technology diabetics need to live safely?

Tidepool, with the cooperation of insulin pump and CGM manufacturers — including Medtronic and Insulet, the maker of Omnipod — is now building on the DIY community’s work. And there are growing examples of medical device manufacturers and hackers working together to speed up the process of development and approval. In late 2018, months before the Loop code for Omnipod was released, Tidepool announced it would partner with Insulet to create an FDA-approved version of Loop for Apple’s App Store. Soon after, Medtronic made a similar partnership announcement with Tidepool. A clinical study of about 800 diabetics is underway, conducted by The Jaeb Center for Health Research, aiming to gauge the DIY system’s effectiveness.

The day we talked, Schwamb, who now works for Tidepool, had seen a Facebook post from the parents of a young girl with diabetes who had seizures when her blood sugar dropped dangerously. “Now she’s on Loop and they don’t worry about lows,” he said. “This is a crappy disease. And, you know, the fact that I have some skill where I can help with this is amazing.”

Published on

Paul Heltzel is a writer based in Tidewater, Virginia.


Illustration by Gary Neill


Your brain vs. artificial intelligence

To understand how AI works, you have to understand human cognition, and recognize the processes we take for granted.