Scott Hanselman

Bridging Dexcom Share CGM Receivers and Nightscout

March 14, '15 Comments [20] Posted in Diabetes | Hardware | Open Source
Sponsored By

Dexcom Share

I've long lamented the sad state of Diabetes technology. For the last 20 years I've been told that it'll be cured in the next few years. (Spoiler: That hasn't happened.)

Fortunately some technological breakthroughs have happened, like the CGM (Continuous Glucose Meter). This device has a transmitted embedded in my belly that transmits to a small receiver. However, my wife couldn't see my blood sugar remotely, so the Nightscout open source project pretends to be computer connected to the receiver, then uploads it to your own website. Then you can see your blood sugar on your watch, or family and friends can log in also. This project has been moving along nicely for a year or so now.

Just last month Dexcom, the CGM maker, released an update to their receiver that includes Bluetooth, called the Dexcom Share. Now my transmitter goes to my Dexcom device which then bounces via Bluetooth LE to my phone, which is then uploaded to the Dexcom site. The Dexcom iPhone app will support the Apple Watch in the future as well, they say.

However, I'd like more control over my data. Dexcom's solution (as of the time of this writing) is iPhone/iPad only. Not everyone can afford an iWatch and iDevices. I'd like to use my Pebble Watch, for example, which is supported in Nightscout today.

I got the Dexcom Share at 3:30pm today in the mail. By 4:40pm it was paired to my iPhone and working nicely. So what I really need is a simple bridge that takes my Dexcom Share data and copies it to Nightscout. From there I can analyze it, send it to my Pebble, or do whatever.

Watching iPhone Traffic from a Windows Machine

First, I need to understand the Dexcom Api. Let's watch the iPhone talk to Dexcom. I'll install Fiddler on my Windows machine and configure Fiddler as a proxy server. I'll need to trust the Fiddler SSL cert (only for dev purposes) on both the iPhone and the Windows machine. My machine is called Hexpower7 and the proxy is on port 8888. I'll visit http://hexpower7:8888 on my iPhone and install the cert there also, which will allow me to watch the traffic and learn about the API.

I learned a few things by watching the traffic.

Watching Traffic

Calling Dexcom with CURL

First, when you login to the Dexcom API you get a Session ID, which is common and to be expected. With that Session ID you can get your sugar values. After the login I retrieved my latest sugar number:

curl -k -X POST "https://share1.dexcom.com/ShareWebServices/Services/Publisher/ReadPublisherLatestGlucoseValues?sessionID=GUID&minutes=1440&maxCount=1" -H "Accept: application/json" -H "Content-Length: 0"

resulting in:

[{"DT":"\/Date(1426290216000-0700)\/","ST":"\/Date(1426293817000)\/","Trend":4,"Value":113,"WT":"\/Date(1426290240000)\/"}]

Here's a screenshot:

Talking to Dexcom Share from CURL

Cool. So I pair-programmed with Benjamin West from the Nightscout project and we spent an hour writing a script to get my Dexcom Share data and bridge/POST it to Nightscout.

I put the script in an Azure WebJob and it's pulling my Share data and putting it into Nightscout every few minutes. I won't post the code here, rather the Nightscout team will take our prototype from here, but the result is lovely.

I don't have to carry an extra Android device anymore, I just use my Dexcom Share and its supported iPhone uploader application. Very cool.

Now it's 7:30pm, just a few hours after I got my Dexcom Share and I've got the best of both worlds. The API was easy to use and we didn't spend more than two hours on it. Most of the time was waiting for the transmitter to complete its warmup cycle.

My Blood Sugar in the Cloud

I'll do a formal Dexcom review soon, but I can already tell you it's a winner. Everyone who can get a CGM should get a Dexcom Share. It's a thrilling device. I would like the iPhone app to support iPhone 6 and 6+ screen-sizes better, and a nicer UI, but all in all, it's a great device.

Don't forget, visit http://marchisformakers.com, tell your friends and tweet us at #MarchIsForMakers!


Sponsor: Big thanks to Aspose for sponsoring the blog feed this week! Are you working with Files?Aspose.Total for .NET has all the APIs you need to create, manipulate and convert Microsoft Office documents and many other formats in your applications. Start a free trial today.

RELATED READING

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Saturday, 14 March 2015 08:06:45 UTC
Nice work Scott (and Ben), very impressive lack of time required to discover all that.

Seems a shame the new receiver won't be released in the UK though, hopefully that will change.

Impressive graph too :)
Saturday, 14 March 2015 14:58:52 UTC
Hi Scott, cool stuff. But besides the usual things you may try the paleo diet. It can drastically improve your health. You have nothing to lose.
Sorry for this non-techie comment
Tom
Saturday, 14 March 2015 21:17:59 UTC
Tom, you do realize that prior to the 1920s people just died if they had type I diabetes. You can't create insulin by changing your diet. I'd defer to the endocrinologists on this one.
Laurie
Saturday, 14 March 2015 22:02:06 UTC
Laurie, it's a complementary stuff, not miracle
Tom
Sunday, 15 March 2015 03:25:36 UTC
Hi there! Any idea how long before this will be available to all of us IPhone users who would love to use the Nightscout thing and the Pebble watch?
Katie
Sunday, 15 March 2015 04:11:26 UTC
Katie - Now! Ben finished it up and it's at https://github.com/bewest/share2nightscout-bridge as a beta.
Scott Hanselman
Sunday, 15 March 2015 04:18:23 UTC
Hi Scott,

I'm also a Dexcom user and learned about the "Share" model from your post - thank you! This new model started shipping in March. I called Dexcom and was pleasantly surprised to learn this:

* The Share receiver started to ship to new patients in early March 2015.
* All patients who purchased a Share cradle will receive a free upgrade to the Share receiver.
* All purchasers of a G4 Platinum receiver from January 1, 2015, until the Share receiver is shipped, will receive a free upgrade to the Share receiver.
* There will be a low cost cash upgrade to the Share receiver for those patients who are still under warranty with their existing receiver.
* The Share receiver will be compatible with future generation Dexcom sensor systems.

(source http://www.dexcom.com/news/fda-approves-dexcom-g4-platinum-continuous-glucose-monitoring-system-share)

By the way, did you see the FDA's "De Novo Classification Process" described there?

Thanks for the post!
Arsen
Arsen
Sunday, 15 March 2015 09:42:17 UTC
Great post, shows how we should be looking to use tech to help with healthcare. Raises the question of how else we could link up montoring devices for real time distribution of the data. sharing with healthcare providers, and maybe firing alerts to the patient, care giver and supporting people when required. I could envisage an alert for a blood sugar crash with a gps location could be a life saver.
Monday, 16 March 2015 05:03:46 UTC
Thanks for the great post Scott. I understand diabetes much better now. You're a great presenter.
Tom
Monday, 16 March 2015 05:48:11 UTC
This is a great example of obtaining functionality that we all want, but isn't being delivered.
Imagine if the sensor just sent its raw readings via Bluetooth.

What we want: Sensor -> Iphone -> Watch (24 inch round trip)
- vs -
What we get: Sensor -> Dexcom -> Iphone -> Cloud -> iPhone - > Watch (10 thousand mile round trip!)

I suspects we won't see this for a while due to the approvals required for the sensor processing to occur on the phone rather than Dexcom, but it's annoying to wait as the technology is already here. Bring on the BLE enabled sensor!!!
BenM
Monday, 16 March 2015 14:59:57 UTC
maybe firing alerts to the patient, care giver and supporting people when required. I could envisage an alert for a blood sugar
Wednesday, 18 March 2015 01:11:02 UTC
This sounds like great progress, hopefully more health/medical devices will head this way. We probably could do with a standard data format though from devices so the data can be aggregated into an app of your choice.

P.S. "Not everyone can afford an iWatch and iDevices" or wants one :)
Pete
Thursday, 19 March 2015 00:28:12 UTC
Scott, compliments for the crafty legwork showing how to retrieve the data from Dexcom's website.
I find it odd that they don't offer access to the data on a secure website, allowing to check it occasionally from any web browser. I don't have an iPhone, but would like to check in on my daughter's GCM every now and then.
Are you aware of any plans by Dexcom to provide simple browser-based access?
Hans Mollet
Thursday, 19 March 2015 03:12:20 UTC
Thanks for your post! My son is 8 and has type 1. He was diagnosed a year ago and we have had many questions about the pump and CGM. Your video was about the best I have seen. Thank you!
B Ragan
Wednesday, 25 March 2015 17:17:35 UTC
My dad and I used to joke about the cure being 5 years away. He lived with Type 1 Diabetes for 61 years. Now it's up to me to live to see the cure. I'm at 28 years with Type 1.

I used the Dexcom 7 a few years back but found that it wasn't that accurate when I needed it to be. Not timely enough with the high and low drops. I've heard that the new model, with the updated software, is much more accurate. However, it still requires fingerstick tests for calibration. How has your experience with it been?

I'm most interested in the FreeStyle Libre (a cure would also be nice). No fingerstick calibration required. Approved now in Europe but of course they expect another 15+ months before our FDA approves it here.
Ned Robinson
Friday, 10 April 2015 22:16:33 UTC
Oh great. Up to now I could ignore the Share receiver since night scout / xDrip work so well that I wouldn't want to go back a step and use the Dexcom website. Now you have it uploading directly via an iPhone to Nightscout. That is so neat!!! But probably expensive now for me!!! It would sure be nice to stop carrying that Android phone though!! (since 'my' phone is an iPhone).
Pam Palmer
Monday, 13 April 2015 16:19:56 UTC
Hi Scott!

Thanks for this. I've got the Dexcom Share -And I'm assuming I don't need to still install the Android app. etc.? I'm going through the steps to set up the Pebble watch/Nightscout. I've got the Dexcom share apps installed and all working.

Thanks for any help anyone can give!
Andrew
Monday, 04 May 2015 15:26:22 UTC
Any plans to make it transfer treatment data too? If not, I may take a stab at that if you don't mind.
Pontus
Thursday, 07 May 2015 00:38:26 UTC
hey my name is briggs rowley and i have the dexcom G4 i love it it to the moon and back i do realize that you have a dexcom share but do you need a dexcom share to pair it up with the pebble smart watch i don't have one yet but i am hoping that my parents will get one for themselves and for me. please respond to me thank you so much for this it really makes me cry to see people help out in this community os wonderful people help us diabetics survive and not only survive but fight this with what we have and you have created a wonderful thing i hope you respond but this is probably a wast of your time anyways so thai you for all that you have done for this diabetes community. LOVE THIS IDEA AND IM SURE MILLIONS OF OTHER AMERICANS AND PEOPLE AROUND THE WORLD WHIT TYPE ONE DIABETES WILL LOVE IT TOOOOOOOO!!!!!!!!!!!!!!!!!!
briggs rowley
Thursday, 28 May 2015 15:34:31 UTC
Hi Scott! My daughter just got her CGM put in. This is all so new and exciting for us! My husband and I both have iPhones, and I have an apple computer and my husband has a PC. We have the share program, and we're going to get my daughter an iPhone. My question is: Can we go to: https://github.com/bewest/share2nightscout-bridge in order for us to use the Pebble watch so we can keep track of her BG readings? And, how exactly would we do that? Thank you so much for being so technical savvy!!!!!!
Peggy Jo
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.