Harnessing DIY IoT to Manage Type 1 Diabetes

To better manage Type 1 Diabetes for his child, this developer dad built a custom IoT enabled solution that works wonders for his family's peace of mind and allows for real-time monitoring of his child's blood sugar levels.

467
Pattern on top of sugar packets
Illustration: © IoT For All

Early last year, my family was thrust quite suddenly into the world of type 1 diabetes (T1D). We spent almost a week in the hospital stabilizing my daughter and learning a ton about managing the life-threatening disease that would be with her for the rest of her life. We’re in the early stages of a long, tough journey, but it’s safe to say that we’re appreciative of all the powerful, innovative T1D management advances, both medically and technologically.

Diabetes Type 1 and Managing the Life-Threatening Disease

Let’s talk about the pancreas (and the rest of your body) for a moment. Its job is to constantly tweak its biochemistry to keep blood sugars in a normal, healthy range. Say you ate a burrito for breakfast, lunch and dinner – your pancreas is handling that like a champ, determining how much of its carb-processing power – insulin – it needs to dispense to convert those burritos into energy your body can use. Charting blood sugar over time, even for the craziest of meals, is like looking at a perfect bell curve, with a relatively small peak.

It’s not like that for a person with type 1 diabetes. Not even close. Since their pancreas cannot produce insulin, the sugars from their meals continue to pile up in the bloodstream. This creates a short-term emergency risk as well as long term health deterioration.

As you can imagine, managing T1D revolves around the real-time daily monitoring of my daughter’s disease, keeping track of food intake and blood sugar levels and determining whether action needs to be taken or not.

What I Set Out to Solve

It’s against this chaos and uncertainty that my wife and I fight each and every minute of the day. However, life for diabetics has changed substantially for the better. With the creation of technological advancements like the insulin pump and continuous glucose monitor (CGM), life has gotten easier for both diabetics, and in our case, the parents of diabetics. We can see our daughter’s blood sugar levels at any moment, no matter where we’re located. Every 5 minutes, the CGM transmitter sends the current blood sugar level to a phone nearby, which then sends that data to the cloud. IoT at its finest!

But, there’s a limitation. That data isn’t arriving as fast as we expect it to and doesn’t go exactly where we want and need it to be. We want it in realtime, and we want it on as many connected devices as we require.

For example, on the delivery side, I can’t be picking up my phone constantly. Or staring at a web page somewhere. Or casually glancing at my smartwatch. I need that singular value, my daughter’s most recent blood glucose level, accessible via many channels, from phone to smartwatch to iPad to computer to whatever other devices I want to connect.

Dexcom, the makers of our CGM, has done a substantial job with their product, and it improves with each release. But, despite the progress, and despite their tracking and reporting functionality, they haven’t invested enough into the instantaneous, real-time streaming of blood glucose level readings to any number of various types of devices and interfaces. So, I set out to deal with this limitation.

Luckily, T1D has a forward-thinking and collaborative do-it-yourself community. From decoding Bluetooth transmissions to create new management apps, to reverse engineering communication protocols for insulin pumps, to building the first usable artificial pancreas, to powerful real-time visualization apps, developers are finding new ways to manage the disease, and have shared it with the community.

Working with a real-time app platform (at my day job) let me think differently about architecting something like this, and allowed me to focus on the “business” problem I was trying to solve. Where was data being sent from? To whom should it go and by which method? Should I augment the data with, in this case, additional statistical aggregations? Should I store it as well in a database, for longer historical views? I spent way less time thinking about servers, API frameworks, logging and monitoring, and more time answering the questions that inevitably made the day-to-day management of my daughter’s Type 1 Diabetes that much easier.

Building My Own T1D Management Solution

I set forth, harnessing the power of the open source community, with one objective in mind: to have the fastest, most secure, scalable, resilient and flexible solution for me to see my daughter’s ever-changing blood glucose levels.

My goal was to create a technology stack to stream updates from my daughter’s CGM to an ever-growing list of end-user applications, including but not limited to, MS, push notifications, Slack, IoT lightbulbs and any interface I and others interact with throughout the day.

Why so many end-user apps? I have a life to live myself. I have to go to work. My wife and I both need to consume this data and updates, and it needs to be the exact same data. I can’t be looking at my phone all the time. I need to know the moment there’s a potential problem. Most importantly, I need to know that I have the most up-to-date data available.

Everything starts with the Dexcom CGM firmly planted on my daughter’s belly and has a fine filament inserted into her tissue. The CGM communicates directly to her phone via Bluetooth, and, every 5 minutes, an updated reading of her blood glucose level is sent to her phone.

With my DIY solution, I’m able to trigger an SMS/text message through a third-party service. This is how I’m able to send every new reading to Slack. And, it’s how I’m able to change the color of an LIFX light bulb depending on the number. When I’m in my bedroom and my daughter is asleep, and I’m reading a book or watching TV, looking at my phone with each update takes me out of my concentration. Relaxation at the end of a long day is hard to achieve!

I added the LIFX Internet-connected lightbulb to the solution, which changes color and brightness based on my daughter’s blood sugar levels. Red means high, green means in-range, blue means trending low, and incredibly bright blue means low and action required. It’s had a huge impact on my wife and my nightly routine. And it only took 15 minutes to implement, start to finish.

The emotional benefit has been incredible for my wife and me. The whole notion of me being able to see the data the moment it comes off my daughter’s CGM is huge as a parent. From there, I can easily distribute that number to an ever-growing number of applications I interact with, continuing to improve how I consume it in a more efficient, less disruptive way in my everyday life. That data is wherever I need it, whenever I need it. I look forward to continuing adding new end-user applications, enhancing my solution and improving how my wife and I manage my daughter’s T1D. And I’ll continue to share and watch with excitement as the DIY, open-source T1D community grows.

Jeremy Pollock, Director of Product Management at PubNub.