Bridging Dexcom Share CGM Receivers and Nightscout
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.
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"
Here's a screenshot:
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.
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.
- The Sad State of Diabetes Technology in 2012
- Scott's Diabetes Explanation: The Airplane Analogy
- YOUTUBE: How my diabetes equipment works
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.
Sorry for this non-techie comment
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.
By the way, did you see the FDA's "De Novo Classification Process" described there?
Thanks for the post!
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!!!
P.S. "Not everyone can afford an iWatch and iDevices" or wants one :)
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?
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.
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!
Comments are closed.
Seems a shame the new receiver won't be released in the UK though, hopefully that will change.
Impressive graph too :)