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. 

Tuesday, 21 July 2015

Updated T1D survival kit

My latest T1D survival kit can be seen in the image. See the list below with links to the websites where applicable:
  • A: Freestyle Optium blood glucose monitor.
  • B: Finger pricking tool
  • C: Needles for finger pricking tool
  • D: Blood glucose test strips, you need a strip for every blood glucose finger prick test. 
  • E: Ketone test strips, in case of high glucose levels, you need to test for ketones. If detected, emergency measures need to be taken or you could die. 
  • F: Apidra insulin, rapid acting insulin, required to inject before I eat. 
  • G: Lantus insulin, slow acting insulin, I take two injections daily. 
  • H: BD micro fine needles, attach them to inject the Apidra and Lantus. 
  • I: Glucagen emergency hypo kit. If I become unconscious because of low glucose, give this to me. 
  • J: Dischem glucose sweets and my favourite chomp chocolate, needed to counter hypo's.
  • K: Alcohol wipes to clean the skin before inserting a CGM sensor.
  • L: FreeStyle Libre Reader. The reader also have a blood glucose monitor and you can use FreeStyle optium test strips.
  • M: FreeStyle Libre sensors. These are used and don't work any more.
  • N: Dexcom G4 Sensor. 
  • O: Dexcom G4 Transmitter. This attach to the sensor. You can buy the Dexcom products from the local distributor Ethitech.
  • P: Dexcom G4 Receiver, this receive the signals from the transmitter and displays it on the screen. The device also alerts you when going low or high.
  • Q: My xDrip bridge device. DIY project. The bridge receives the signals from the transmitter and re-transmit them via bluetooth to my cellphone. The xDrip android app then uploads the data to a database and can be viewed remotely from anywhere. If you created a xDrip device, you no longer need the Dexcom receiver. The xDrip method seems to be much better, you get the raw values which is less fudged than the values displayed on the receiver.
  • R: Nightscout, used for displaying and alerting remotely on any device that can open a website. You need N, O and Q for this to work. 

Wednesday, 15 July 2015

xDrip progress

I have started putting my xDrip components together over the weekend. It took me less than 10 minutes to solder and assemble all the parts, and I'm really not into soldering, anyone can do it. However, next time I will use shorter wires, remove the pins from the BLE module and use a smaller charger module. I'm going to use this configuration for now until the size of it gets annoying. The wixel code was also super easy to compile and upload. How does it work ? In short, the wixel reads the signals coming from the Dexcom transmitter and sends that to the BLE module. You pair your cellphone with the BLE module and the android app then receive the data from the BLE module. The android app displays the glucose values and can then upload the data to a database. The data can then be viewed remotely by multiple people simultaneously all over the world. I already received my Dexcom kit from Ethitech and eagerly wait for my last Freestyle Libre sensor to expire. Less than 4 days away and I will be part of CGM in the cloud and the NigthScout project. #WeAreNotWaiting !!

Monday, 6 July 2015

Sensor 5 inserted and getting ready for xDrip

My stock of Libre sensors are depleted, I just inserted my 5th and final sensor. My 4th sensor lasted the 14 days without any problems. Here you can see my epic 5th sensor, sucking into my arm.

For the people still wondering how the device looks that inserts these sensors: The left image shows the device with the sensor still intact before insertion. You simply press the spring loaded device against your skin which will then release the spring. The needle that you can see in the centre will penetrate the skin, leaving the thin measurement wire inside. The right image shows the device after insertion.

What will I do after sensor 5 ?? I discovered that Ethitech is a distributor of Dexcom products in South-Africa. I can buy a Dexcom G4 sensor for about R1100 from them. Officially the Dexcom sensor is only approved to be used for 7 days, but many many people have shown that they still work after a few weeks. Now, if the Freestyle Libre was available easily in South-Africa, it would have been more difficult to decide how to continue. The only way I could buy a Libre sensor was through ebay, ... they are selling a sensor for more than double the retail price... I'm not willing to pay R2000+ for one sensor and take the risk of loosing it via the postal service any more.

Getting ready for my xDrip!! The xDrip is a cool DIY device that reads the signals transmitted by the Dexcom transmitter. The signals are then packed and send over Bluetooth v4 (BLE). A cellphone can then read the bluetooth packets. After that, many cool things are possible. Data can be uploaded with the cellphone onto the internet and viewed remotely by someone else. Prediction algorithms can be written, alarms can go off when glucose are going low or high, my custom algorithms might improve the MARD accuracy, location information can be used to inform relatives where the patient is when going low, .. and many more. I received all the parts needed to assemble my first xDrip today. I've got 2 weeks to get it working which should be more than enough time, I only have something like 6 wires to solder and software to upload to the wixel.