My son, Evan, was diagnosed with type 1 diabetes in August 2012. Type 1 diabetes is an autoimmune disease that attacks the pancreas and prevents insulin production. The body needs insulin to transport glucose from the blood to the cells. Synthetic insulin is used to manage type 1 diabetes, but it doesn’t work as quickly as human insulin. Determining the right dose of insulin for a given meal’s carbohydrate content becomes an all-consuming balancing act. Too little insulin and blood sugar skyrockets, causing potentially life-threatening complications. Too much insulin and blood sugar plunges to dangerous levels.
The shock of the diagnosis continued to set in over the next few months, as my wife, Laura, and I attempted to figure out how to keep a 4-year-old alive and happy. Eight to 12 finger-prick checks to measure blood glucose and 4 to 8 shots of insulin a day—these became the course of our days and nights. It was the most painful and dark period in my life, and we needed to find a better solution. So began a technological journey that allowed us to improve Evan’s quality of life—and ultimately the lives of many others.
We purchased a Dexcom G4 CGM in February 2013 and immediately loved it. (The receiver costs US $400, and it’s another $400 for each transmitter. Sensor wires cost $99.) We were no longer flying blind between finger checks. We could merge the data from the G4 with reams of nutrition data we had been collecting and thus fine-tune Evan’s insulin dosing.
But dropping Evan off at day care triggered a wave of panic: We were once again in the dark. I wanted us—Laura, the school nurse, and me—to be able to see his glucose level at any moment and get alerts when it was headed out of range.
At the time, Dexcom didn’t provide remote access, but I knew that the Dexcom G4 receiver could furnish glucose data via its USB port. Dexcom’s own Windows software was pulling data in this way, and fortunately, Dexcom supplied an API (application programming interface) library as part of its software installation. It took about 3 hours to code a C# program that polled the receiver and uploaded the data to a Google spreadsheet. We sent Evan to day care with a small laptop equipped with the receiver. While he was in his classroom, we could see his blood glucose via either a simple website or an iOS app I threw together. It was life changing, as it allowed Evan some freedom from the typical type 1 diabetes regimen at day care. Still, when Evan went out for recess or long walks, putting him out of range of the laptop’s receiver, we were blind again. Thus began my work on a truly ambulatory solution, based on a smartphone rather than a laptop.
My family primarily uses iOS devices, but power limitations and closed frameworks made hooking up the receiver to an iPhone far more difficult than to an Android phone. I got a Motorola Droid Razr M phone, and once I had the basic USB enumeration down—so my phone could “see” the receiver when it was plugged in—I started decoding the G4’s communication protocol. Using the same C# program as before, I ran commands and captured the USB traffic as it flowed between my computer and the receiver. With this data, I wrote an Android app to extract glucose data and upload it to our Google spreadsheet via the cellular network. In my excitement, I tweeted my discovery. What happened next was incredible.
Another “diabetes dad,” Lane Desborough, contacted me. He wanted to build a similar system for his son. I shared my C# program with him and continued to refine the Android app over the summer, in preparation for Evan’s return to school. Lane created Nightscout, a Web app with predictive alerts. These alerts are based on glucose levels uploaded to a database built using the open-source MongoDB platform. Lane transformed my system into a tool that anyone could use.
While Dexcom has subsequently released Share, a proprietary remote-monitoring system, it works only with iOS devices. By having reverse engineered the G4’s communication protocol and created an open online database system, we can access the data on a wider range of equipment. For example, I picked up a Pebble smart watch the first day they were available at retailers, and within a few hours, I had written software that lets me see Evan’s glucose level at a glance.
Lane and I (along with Ross Naylor) continued to collaborate, and in early 2014, we made the C# uploader, Android app, Pebble watch, and Nightscout code open source. Subsequently, better software engineers than I have improved the code and made it easier to use; a Facebook group for Nightscout, set up by Jason Adams, now has nearly 12,000 members, and our code made the semifinal round for the 2014 Hackaday Prize.
While remote monitoring may seem invasive, it is in fact liberating. Evan can play more, learn more, and simply do more, because his life is far less disrupted by the demands of diabetes. We can mitigate most hyper- and hypoglycemic events without interrupting his day. I am proud to have taken back some of what we lost that day in August 2012 and blessed to know that my little boy’s diabetes has helped so many others.
This article originally appeared in print as “DIY Diabetes Remote Monitoring.”