Wednesday, 29 July 2015

Gaming my glucose levels with FreeStyle Libre and Dexcom G4

FreeStyle Libre vs Dexcom G4

The day I started using my Dexcom G4 system, I still had about 3 days left on my last FreeStyle Libre sensor. That gave me the opportunity to take images such as this one seen on the right (Dexcom reader at the top, Libre reader at the bottom). Having experience with both, I'll list some random thoughts on each.

Freestyle Libre

  • Sensor insertion process was very easy, I like the round flat shape of the sensor. They use awesome glue that easily stay stuck for 14 days.
  • I don't like the fact that you HAVE TO remove it after 14 days, it stops working after 14 days.
  • Having a blood glucose meter inside the reader is very useful.
  • It is nice having access to reports quickly directly on the reader such as : Average glucose, time in target, graphs of previous days.
  • You can't zoom into the graph, it's difficult to look at exact measurements, you can't really see them on the device. Exporting the data only gives you a value every 15 minutes, no raw 1 minute data available.
  • No alarms. Many times I scanned my glucose and I only then realised that I was going high while I could have prevented the high if I was notified by an alarm a few minutes earlier.
  • You don't need to carry the reader with you all the time, the sensor will keep on storing data (only the most recent 8 hours worth of data).
Dexcom G4
  • Sensor insertion process a bit more complex, but not too bad.
  • You can restart the sensor after 7 days. You can wear the sensor until it becomes inaccurate or falls off. I'm currently on day 12 of my first sensor and the FreeStyle Libre's glue is much stronger. I have applied tegaderm to keep the sensor in position.
  • It asks you for calibration values every 12 hours, so you are forced to verify the accuracy of the CGM. Note that you should only calibrate within the normal ranges and when your levels are stable. Don't calibrate under extreme conditions, the maths will get confused and you will mess things up.
  • I can get the sensors locally and because you can go longer than 7 days, it is much cheaper than the Libre.
  • It does have alarms, you can customize it somewhat. It woke me up a couple of nights and a couple of times during the same night. You can not disable the emergency super low glucose alarm, I guess it makes sense that you should not ignore that alarm.
  • The Dexcom receiver does not show any reports or statistics... although the Dexcom studio windows application do.
  • The Dexcom receiver have a latency of 10+ minutes... clearly you can see that they are filtering things a lot... don't worry, all is not lost, xDrip to the rescue..
  • My Dexcom receiver is not using the 505 software update, the update is only available in the US and is suppose to fix the latency issues.
  • Now for the awesome DIY stuff:
    • I've build the xDrip bridge device and I'm running xDrip on my cellphone. It means that: The xDrip bridge collects data from the Dexcom G4 Transmitter and transmits it to my cellphone via BLE (Low energy Bluetooth). These are "raw" values, prior to any calibration and filtering done on the Dexcom receiver. I don't even need the Dexcom receiver any more. 
    • The xDrip application is open source. I can modify it as I like.
    • The xDrip application contains features such as: reports, statistics, customizable alarms, zoom-able graphs, rate of change information, time till next reading, etc..
    • xDrip can also upload your data to a database in the cloud. The Nightscout project allows you then to monitor the glucose values remotely from any device that can open a website.
The Libre sensor and Dexcom G4 transmitter seen below:

Gaming my glucose

Managing my T1D turned into a game. The more I use a CGM, the more obsessed I become to manage my values as well as possible. My score consists of the following measurements:
  • How close can I get my average to 5.0 ?
  • How small can I get my standard deviation ?
  • How long can I keep the levels stable between 4.0 and 8.0 ?
  • Ultimately, the blood A1C will tell me somewhat how well I did in the past 3 months.
Insulin works pretty slowly, even the rapid acting insulin. I had to try and improve somehow on getting my level back to normal when going high. Giving a correction bolus usually takes 1-2 hours to bring back my levels to normal range. I tried some light exercise, and it is working very nicely. Whenever I see my levels going up and beyond 8.0, I try to find stairs. Climbing stairs for about 5-10 minutes dramatically improves the rate at which the levels go down. It takes about 10-20 minutes for the levels to drop instead of 60 minutes (when taking a shot). Taking a correction bolus can also cause a low if the amount of insulin was too much. Having a low can cause a high if you eat too much in order to correct the low... can you see the oscillating cycle ?? Doing something else rather than taking a correction bolus definitely have some benefits. On the right you can see the xDrip android application with a staircase scenario. I only started climbing stairs at the 4th orange dot, note the rapid decline after just a little exercise. You can also see the oscillating effect on the 24 hour graph at the bottom of the image which happened because of my breakfast bolus being too much. Just note that a T1D still needs insulin, exercise and diet alone can not control it.

My target range is set to 4.0-8.0 mmol/L. I've been on the Libre for 70 days and my time in target was 59%. I've been on the Dexcom G4 for 11 days and my time in target was 73%. It might be that the Dexcom alarms made the difference, or I'm just learning how to play the game better. Either way, thanks to Abbott and Dexcom, this game is very difficult to play without a CGM. Libre on the left, xDrip with Dexcom G4 on the right.

DIY !!!

The one thing I don't like about the Dexcom G4 is that the reader or xDrip bridge needs to be nearby (a few meters max) all the time otherwise you will miss values. When you try playing this game, you would like to see all of the data and don't loose any values. The xDrip bridge listens for 2.4GHz packets and when it receives one, retransmits it via BLE to the cellphone. After that, the xDrip sleeps for about 4.5 minutes before it starts listening for a message again. If your cellphone is not in range, you will loose the packet. This means that you have to carry the xDrip bridge and cellphone with you everywhere. I want a little more freedom. I made some changes to the wixel c code running on the xDrip and java code running on the xDrip android app. I was using the downloadable xDrip apk on my cellphone, which means that I would loose my data if I had to start using my modified application. I did not want to loose my data, so I had to add some code to fix that.  My branch of the code is at and My list of modifications:
  • Firstly, I did not want to loose my data. The android app already had an export function, but no import function. I've added the import function which I used to import my data after removing the installed xDrip version and installing my version.
  • xDrip wixel stores the raw glucose values and packet id in a circular buffer. There is still plenty of RAM left on the wixel. I can fit 2 days worth of values in there, but I'm storing only 20 minutes worth of data in the buffer for now. The dexcom packet id contains a byte size value that increments with 3-5 every reading. I'm guessing that it's some sort of timer value and I'm using it to determine the time-stamp of previous readings relative to the latest reading.
  • The BLE packet only transports 20 bytes at a time. I had to change the xDrip android code to combine packets in order to receive messages larger than 20 bytes. I've added a starting([) and ending(]) symbol to each packet. The android code then use those symbols to determine when the complete message arrived. 
  • Code that ensure that historical values don't get added more than once to the database.
In the future I would probably add more logging functionality. I like to keep track of when I injected what kind of insulin and how much. I'm not so much a carb counter, but that might also be useful. Currently I'm using nightscout to log the information, but it will be much better if it can be done directly in the xDrip android app. 


  1. Awesome data! I as of late ran over your web journal and have been perusing along. I thought I would leave my first remark. I don't realize what to say aside from that I have. playmotupatlu

  2. I cherish this site!! The blaze up the top is marvelous!!

  3. This was a really great contest and hopefully I can attend the next one. It was alot of fun and I really enjoyed myself.. Gba4iOS

  4. A well fitted pair of diabetic shoes should be comfortable to wear, even for long periods of time, and they should not rub or bite on any part of the foot.

  5. Amazing data on your site, thank you for setting aside an ideal opportunity to impart to us. Stunning understanding you have on this present, it's pleasant to discover a site that subtle elements such a great amount of data about distinctive specialists. speed4game

  6. Pleasant Informative Blog having decent sharing.. forge of empires hack

    1. Your online journal gave us profitable data to work with. Each and every tips of your post are amazing. You rock for sharing. Continue blogging, Dragon Ball Z Dokkan Battle Hack

  7. It’s perfect time to make some plans for the future and it is time to be happy. I’ve read this post and if I could I desire to suggest you few interesting things or advice. Maybe you could write next articles referring to this article. I want to read even more things about it! 오션파라다이스다운

  8. I felt very happy while reading this site. This was really very informative site for me. I really liked it. This was really a cordial post. Thanks a lot!. undertale download mac 2019

  9. It ended up being Very useful to me and I am certain to every one of the reporters here! Free fortnite skins

  10. Hey There. I found your blog using msn. This is a very well written article. I’ll be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I’ll definitely return. how to get free diamonds in mobile legends