Components of a diabetes devices laid out on a table

How to design, prototype, and build an artificial pancreas.

Every 5 minutes, a medical device analyzes real-time physiological data about me, reviews historical data and time-dependent settings, calculates an appropriate response, and then injects a precise amount of medicine into my abdomen. This medical device isn’t a polished consumer product like you might see from GE or Philips; it’s a DIY assortment of existing medical devices, a $25 Linux computer, an old cell phone, and a battery pack all crammed into a rock-climbing chalk bag slung over my shoulder. “PiPan” (short for “RaspberryPi-Pancreas”), as I affectionately call it, is my homemade artificial pancreas.

I’m a member of a small (but rapidly growing) community of people with Type I diabetes using open-source software and off-the-shelf hardware to enable closed-source medical devices to communicate with each other. The system looks hacked together, takes a lot of time to build and test, and isn’t incredibly user-friendly…but the ~80 people using it around the world are helping to greatly improve their or their children’s quality of life, lessening fear caused by the disease, and helping to disrupt ideas of what health care might mean in the digital age.

Type 1 Diabetes 101.

If you’re familiar with Type 1 diabetes, save yourself a minute and skip over this section. If not (and that’s okay!), here’s a quick synopsis.

Everyone’s body needs insulin to convert glucose from the foods we eat into energy that our body’s cells can utilize. Insulin is a hormone produced by the pancreas, an organ in the body, shown above.

You can think of insulin as a key that unlocks the doors of cells so that glucose is able to enter the cell. Your blood glucose level is a measure of the amount of glucose still contained in your bloodstream, yet to be transferred into the cells. Keeping blood glucose levels within a narrow range is necessary to feel healthy, be able to use your muscles and brain adequately, and ultimately, to stay alive.

If you have Type 1 diabetes, your body’s immune system decided to destroy the cells in the pancreas that release insulin (thanks a lot, immune system!). Now it is up to you to inject synthetic insulin on a daily basis using syringes, an insulin pen, or an insulin pump.

Syringe, insulin pen, and insulin pump
Syringe, insulin pen, insulin pump

It’s likely that you know someone with Type 2 diabetes, as 90-95% of the approximately 30 million people in the U.S. with diabetes have Type 2. In Type 2, the body either produces less insulin than required and/or the cells can’t utilize the insulin as efficiently as they should. A key difference between Type 1 and Type 2 is that not every Type 2 requires insulin, but every Type 1 does. People with Type 2 may be able to use dietary changes, increased exercise, and/or oral medications to manage the disease.

Path to an artificial pancreas.

Consumer insulin pumps, released about 30 years ago, enabled precise delivery of insulin nearly continuously, as normal pancreases do. They were a huge step-up from 2-3 times/day injections with syringes; the human still had to gather data with a drop of blood from their finger and make a decision, but the pump allowed for much better diabetes control. An insulin pump is the “output” portion of an artificial pancreas; it acts on the decision being made. The process looks a bit like this:

Insulin pump decision tree map

Continuous Glucose Monitors (CGMs) entered the market about 10 years ago. They use a small sensor embedded under the skin that relays the current blood glucose level to a receiver every few minutes. CGMs represent the “input” portion of an artificial pancreas; they provide near-continuous data that the human can use to make better decisions with.

Insulin pump decision tree map

Until about 3 years ago, getting real-time access to the CGM data off of the device wasn’t possible. That’s when a group of parents of children with Type 1 created the open-source Nightscout project, a means to pull data off the CGM, push it to the cloud, and make it available to any internet-connected device, all in real-time. At this point, the sensor data was liberated from the CGM, able to be utilized by other devices.

Iot connected insulin pump decision tree map

The next logical step would be to take the human out of the loop and automate it. If the CGM data could be fed to a computer that could also control an insulin pump without human intervention, it would effectively be an artificial pancreas.

But, as stated above, only 3 years ago were users able to hack the CGM to communicate with them. And insulin pumps are still “walled-off”; there isn’t a means to read from and control them via a computer in real-time. Amazingly, while all of the individual pieces have been available for almost a decade, there still isn’t a commercial device that can modify insulin dosing based on a predicted high or low blood glucose…and there won’t be for at least another 1.5 years (in the U.S., at least).

So…is it safe?

Safety is hands-down the single greatest concern of everyone working on this project. Everyone working on the project either has Type 1 diabetes themselves or is building the system for a close friend or family member; the responsibility of what they’re undertaking is not light.

The OpenAPS community has not released a stand-alone software package installer or even publicized every step necessary to implement the system. Instead, they’ve chosen to create a detailed user guide, a web forum where people can ask questions, and all of the tools necessary to build, install, and operate the system. All of the pieces are there, but pulling them together into a functioning system falls onto the user. This ensures that the user fully understands the system and takes responsibility for it. A user who doesn’t understand their system would at best be confused, and at worst, potentially hurt if something were to go wrong. Another reason not to release a turn-key system is to prevent prosecution by the FDA for illegally distributing a Class III medical device.


a: The Minimed 530G, available in the U.S. since 2013, has the ability to suspend insulin dosing when a low blood glucose threshold has been crossed. It does not predict future lows. The Medtronic 640G, due out in the U.S. sometime in 2016, will suspend insulin dosing based on a predicted low blood glucose, thereby preventing the low from happening. The Medtronic 670G, expected to launch in the U.S. in April 2017, in addition to suspending insulin dosing based on a predicted low, will also give insulin to reduce high blood glucose values.

b: Key contributors in the beginning include Ben West, Oscar Pearson, Dana Lewis, Scott Leibrand, Jason Calabrese, and undoubtedly more that I’m forgetting to mention.