Better diabetes monitoring with a CGM.

You probably don't want this page. It's really only relevant for those with:

That being said, if you have those things, or are just interested, then great, let me explain what this is.

As a type 1 diabetic, learning about the Freestyle Libre was, quite literally, a gamechanger for my diabetes control. I first wore one over Christmas, and walking along the sea front I was able to get my blood sugar reading without stopping walking, or even taking off my coat. If you're diabetic and don't have one, quite simply go get it now.

After several years I thought about going further with the readings. Could the data be captured in some other way to improve my monitoring, and therefore control, even more. I found the Miaomiao reader, a third party product which ships from China, and which is (from a technical point of view) a NFC to bluetooth bridge. It allows an Android app called XDrip+ to poll the Libre sensor at five minute intervals.

Once your phone has the data, then it can pass it on to a smartwatch, and upload it to a server, and that's where this app comes in. DripTray provides a Windows Service which XDrip+ can communicate with to upload readings, and also a Win32 application which can download that data and graph it in (practically) real time.

This all means that by wearing the Libre sensor and Miaomiao, and keeping my phone within bluetooth range, I am getting my blood sugar monitored, displayed on my smart watch, the history stored, and display on the desktop of any Internet connected Windows desktop, meaning I can keep track both at home and work. As an additional benefit, XDrip+ can be configured to alert me overnight when I'm asleep if I'm going high or low, so I can fix the problem. It's another step onwards in diabetes monitoring I'd describe as "game changing"

Getting DripTray to work

Walking through the components you'll need to get DripTray running

Freestyle Libre sensor

You'll need the sensor fitted and running, buy them from the Abbott web site.

Miaomiao reader

The reader needs to sit physically alongside the sensor, so that it can make the NFC connection to it. You can choose to stick the reader to your skin, but I prefer to use an armband. I bought mine from DiaStuff and it works well.

An Android phone

You may well be able to do all this with an iPhone and Spike, but I've not tried it so can't help with that.


XDrip+ isn't on the Play store, instead you need to download the APK and install it manually. The app updates itself periodically. There are many settings you'll like to configure in XDrip+, but set your Hardware Data Source to be Libre Bluetooth, and ensure that Bluetooth is enabled. I found this step to be confusing - I didn't find a clear guide online on how to get it working, probably because there are so many variables and options.

An Internet-accessible Windows machine

There's no reason why this has to be in Azure, if you already have access to a server which is in the cloud on which you can run a Windows service, then use that. You might like to publish a machine at home (and use DynDNS) or if you don't need your readings to be available from home/work/holiday then you can run the service on a computer at home, and not share it to the rest of the Internet.

Install .NET 3.5 on the server, and add a firewall permit rule for port 443, along with 3389 if you're RDP'ing to the server for admin. Download the DripTray Service below, and copy the files it contains into c:\program files\driptray. Install the service using these commands:

C:\Program Files\DripTray> sc create DripTray start=auto binpath="c:\program files\driptray\driptrayservice.exe" DisplayName="DripTray" C:\Program Files\DripTray> sc description DripTray "Use with XDrip+"

If you need to reverse this and uninstall the service, use this:

C:\Program Files\DripTray> sc delete driptray

Download and run the DripTray Control app below to configure it, and then start the service. The write password will be supplied to XDrip+ to be able to upload results to DripTray, and the read password (which only has read access to the data) will be used by DripTray Graph. I strongly suggest you use SSL so that your information is encrypted over the Internet, but doing so does mean a fair amount of additional configuration - see below.

The database file is in the SQLITE format, and I suggest setting a sensible prune limit to ensure it doesn't grow too large - I have this set to 30 days of data, and the database file is 15Mb.

Configure XDrip+ to upload

In Settings, go to Cloud Upload, and then Nightscout Sync (REST-API). Enable the upload, and set the base URL to look this this (where your.server.com is the address of the server running DripTray Service https://writepassword@your.server.com/api/v1/. You should probably also upload treatments as DripTray supports those, but the other options will depend on your setup.

Enabling SSL

Setting the system for HTTP (unencrypted) transfer is notably simpler than enabling HTTPS and turning on SSL, as there are no certificate worries. However, this data should really be transferred using encryption.

Certificate generation

To create the certificate you'll need, I suggest you use OpenSSL. It's great software, but if you're using a Windows machine to do this work, you'll need to dig a little further. Shining Light Productions helpfully provide a pre-compiled version of OpenSSL at this page. Download and install it.

Save this file as driptray.conf:

[req] default_bits = 2048 prompt = no default_md = sha256 x509_extensions = v3_req distinguished_name = dn [dn] C = UK ST = County L = CTY O = MyOrg emailAddress = email@mydomain.com CN = your.server.com [v3_req] subjectAltName = @alt_names subjectKeyIdentifier=hash authorityKeyIdentifier=keyid:always,issuer basicConstraints=CA:TRUE [alt_names] DNS.1 = your.server.com

Replace the parts in orange with values relevant to your setup. The certificate is marked as a Certificate Authority so that Android will import it correctly.

Run this to generate a new self-signed certificate:

C:\openssl\bin> openssl req -new -x509 -newkey rsa:2048 -sha256 -nodes -keyout driptray.key -days 3560 -out driptray.crt -config driptray.conf

Convert the CRT file to a PFX, as that’s the type which Windows imports:

C:\openssl\bin> copy driptray.key+driptray.crt driptray.pem C:\openssl\bin> openssl pkcs12 -export -out driptray.pfx -in driptray.pem -name "DripTray Self Signed"

You’ll be asked to choose a certificate password – make a note of this as you’ll need it later.

Also generate a DER format certificate, as that's the format which Android imports:

C:\openssl\bin> openssl x509 -inform PEM -outform DER -extensions v3_ca -in driptray.pem -out driptray-android.crt

Set DripTray Service to use the certificate

Copy the PFX file to the machine running the service, and import the certificate into the Personal store for the local machine. This process will ask you to enter the password you chose above. Be sure to mark the private key as exportable.

Associate the certificate on Windows with DripTray Service by running this in an elevated command prompt:

C:\> netsh http add sslcert ipport= certhash=30a28b461666669794046715a5a35001f7bbbb2d appid={66bf34b7-1014-4b15-8341-6a55b0e82b63}

The certhash in purple refers to the thumbprint of the certificate OpenSSL generated. You can find it by opening the certificate in MMC, opening the certificate details, and finding Thumbprint on the Details tab. The appid relates to the DripTray Service. You can get help generating this command on the Command Reference tab in DripTray Control - once one has been added to the server Personal store, choose it from the drop list and the command can be copy and pasted from there. This sets the new certificate as the one used to sign SSL communications with the web service which DripTrayService runs. Change the port number in orange to be something else if you decided to alter it.

If you need to clear the association, do so by running:

C:\> netsh http delete sslcert ipport=

Trust the certificate for DripTray Graph to use

Copy the CER file to the machine running DripTray Graph, and import the certificate into the TrustedRootCertAuthorities store for the local machine. This process will not ask you to enter a password.

Add the certificate to Android

Transfer the driptray-android.crt file generated above to the Android device running XDrip+, and touch it to import it. You'll need to authenticate to Android, and then choose "VPN and Apps" for the certificate purpose.

Run DripTray Graph

DripTray Graph makes use of the .NET 3.5 chart control so download that and install it on any machines you'd like to run the graph. Double-click the graph to configure it - the options alter the appearance of the graph as you change them, so move the Options dialog to the side to see what they look like. "Working hours only" means that the graph stops updating in the evening and at weekends - to save just a little bandwidth on a work machine left running 24/7.

Getting help

I appreciate that these instructions are a little sparse - there are few screenshots and no easy list of steps to follow. This is because I doubt anyone will ever actually use this system. However, I've uploaded it as I know it makes a huge diffference to my diabetes control, and I know how long the work to put it together took! If this is used by just one other person, once, then I'd be really happy that I could help another diabetic get the benefit that I have. If you're following these instructions and either run into trouble or are successful, please get in touch and let me know, I'd love to hear from you.