DIY looping and CGM – a critical cog in the machine

When you are using a DIY closed loop, one of the most critical parts of the set up is the CGM data. But what we know about CGM data is changing, and we need to be aware of this and factor it into how we use our systems.

Over the past 12 months, we’ve seen some significant changes to the CGM landscape, with new entrants, potential new entrants and changes to existing players. Possibly the single biggest change has been the introduction of “calibration free” sensors from Dexcom. 

But these changes bring adjustments to how we use the CGM we have in our DIY closed loops, and some of these have safety implications. 

Firstly, lets look at:

General CGM hygiene

Whichever CGM system you are using, if you are going to use blood based calibration, then there are some very clear rules you should apply, whether or not you are using DIY CGM software or the official apps. 

  1. Make sure hands and kit are clean.
  2. Try to calibrate when you have a series of dots with a flat arrow (15-30 minutes is usually enough)
  3. Avoid calibrating when glucose levels are moving up or down. 
  4. Do “enough” calibrations – on official apps, you will be prompted for once or twice per day checks. On DIY systems you may not be, and should be careful about continuing without calibrations.
  5. If it all possible, calibrate with some of your readings in a lower range (4-5mmol/l or 72-90mg/dl) and some at a slightly higher level (7-9mmol/l or 126-160mg/dl) as this provides a better range for the point/slope calibration.

In addition, if you have chosen to adapt the Libre using either a MiaoMiao or Bluecon NightRider, you should pay close attention to the performance of the system and make use of sense checking blood tests to ensure the output of the system is aligned with blood. You should also reset your calibrations (by stopping the sensor in xDrip or Glimp) every time you change sensor. I personally don’t recommend using Libre1 for DIY looping.

These are all basics of using CGM, but they take on extra importance when using a DIY closed loop, as DIY systems have limited ability to determine whether the interstitial data being received from the sensor aligns with what the CGM output is, something which commercial options using licensed CGM does have available.

Historically users have also pre-soaked sensors to get over the trauma of insertion. The DIY tools then allow for this period as you are able to specify when the sensor was applied, and the calibration adjusted accordingly. While people have seen better results with using the same trick on the Dexcom receiver and app, the sensor calibration within this setup will be tuned for the variation after insertion, so it’s worth being aware of the temporal risks of pre-soaking. 

Factory Calibrated sensors

Abbott Freestyle Libre

As we know, the Abbott Libre system doesn’t provide a feed of data, so the WeAreNotWaiting community has come up with a way of capturing the data off the sensor, which is currently used in a number of forms. What we also know about the Libre data is that, while it is factory calibrated, the data packet contains more “raw” information than just the glucose value.

There are currently two ways of using this. The OOP algorithm with xDrip, which is a reverse engineered version of the algo in the Librelink app, and the xDrip “Libre” algorithm, which doesn’t use all the data in the packet.

As this article covers, user experience with each of those varies, and without paying due care to the performance of what your specific instance is doing, you could find yourself having issues with dosing insulin from it.

Dexcom G6

More recently, the Dexcom G6 has come to market. This is, of course, another sensor with factory calibration. Alongside this, Dexcom (in Europe at least) introduced new subscription pricing plans that allow for 365/24 cover on the system. That doesn’t stop it being expensive, so users were aghast when, complying with the FDA requirements for iCGM, Dexcom supposedly removed the ability to restart a sensor. 

Since then there has been a lot of DIY work done to work around this limitation, culminating in this series of instructions. As a result, these mechanisms have been incorporated into the DIY systems to allow “preemptive restarts”, where the app will restart the sensor for you ahead of the expiry time, and allow continuation of service. 

As a result, people have noticed that when the sensors are restarted, the values received are jumping, as in the picture below.

Further investigation of this phenomenon shows that it is occurring on G6 sensors using the transmitter native data where the factory calibration code has been used, whether that sensor has been calibrated during its life or otherwise. 

What’s happening in this context is that the G6 transmitter believes it is dealing with a new sensor and is therefore returning to a day 1 state, with factory calibration in place to deal with the insertion trauma, which on a nine day old sensor, simply isn’t there. 

A recent paper published by the University of Colorado, that looks at the risks associated with extension of factory calibrated sensors provides insight into this phenomenon, and provides a useful measurement of the variation they found in two volunteers. There are a couple of caveats about this:

  • While the study itself was grant funded, a number of the researchers who have undertaken the study have been involved with Dexcom
  • The study sample is very small
  • We don’t know how many sensors are involved

While this isn’t a large sample, the issue is that sensor reuse is not FDA approved and there are therefore ethical problems with undertaking a prospective study. It also provides a useful insight into how calibration on the G4, G5 and G6 work. 

The image above shows that the distribution of values in days 1 & 2 and 11 & 12 vary noticeably. The report allows you to infer that this data is collected from multiple sensors and restarts. As the sample is statistically small, you can’t draw too many strong conclusions from it, but I think it provides a view of the behaviour of a factory calibrated sensor under restart, and the distributions shown are noticeably different on the first two days with and without a new sensor.

Reviewing the AGP data also appears to show that (in volunteer 2 at least), the mean on days 11-12 is higher than that on days 1-2. 

This final table shows the statistical breakdown of this data, and highlights (in case 1 at least) there was a significant difference between days 1-2 and 11-12, on average, whereas case 2 saw a lot less difference.

This paper doesn’t take into account, or track, the variance in food intake, stress, sleep, or exercise, all of which can have an impact glucose levels, but provides a view of what is believed to be happening. 

What does this all mean for DIY loop users 

The first thing to note is that this is most important for those who are preemptively restarting their sensors in Spike or xDrip. If you are doing this, and it is happening at a time when you can’t be aware of it, you run the risk of a sudden jump in reported glucose level and then a period where it reports as higher than the real blood level. This could result in an overdose of insulin. 

Secondly, as detailed in the paper, the factory calibration is a timed function that adjusts drift over a period. If you pre-soak a sensor, whether using DIY CGM software with factory-calibrated native transmitter data or Dexcom software, the time decay of calibration means that it expects variance in the output and seeks to fix it. 

The longer the presoak, the less the insertion trauma when you start the sensor, so if you insert 24 hours before starting, the factory calibration will run with the expectation of trauma effects for a period where those will be substantially reduced. 

Both these phenomenon should be considered when using the G6 in a DIY looping system.

How should a user deal with these factors?

What’s clear is that using the G6 is perhaps a little more complex than it as first suggests. To use it safely, there are a few points to be aware of: 

  • If you are using the native data with the calibration code in xDrip or Spike, the safest thing to do is not allow preemptive restarts of the sensor.
  • If you must use preemptive restarts, then make sure you insert at a time of day where you can observe the change and calibrate if necessary. 
  • If you are restarting sensors, either do it without the factory calibration for safest results on days 11 and 12, or ensure you are ready to calibrate and keep an eye on variation.
  • Pre-soaking of the G6 with factory calibration is likely to give variation in results. If you do pre-soak, then to get best results, you will probably need to calibrate the sensor.
  • If you aren’t being observant about the changes that may be taking place, it may be better to revert to non-factory-calibrated mode and use the system like a G5.

Final thoughts

Regardless of how you collect CGM data for use in a DIY closed loop, it’s worth being aware of the idiosyncrasies inherent with all of them and the way that they are used. That’s the best way to ensure that you are not subject to unexpected CGM data.

Creators of commercial systems have licensed the CGM products for use with their systems, and in doing so have access to more data than the DIY systems, which rely on intermediary software to provide that. While the developers of DIY systems incorporate features to handle variation in CGM data, there are some obvious areas where they simply don’t have as much information. As a result, users need to be aware that they have to take care of their CGM and not ignore the key aspects of hygiene. 

There are 100s of 1,000s of loop hours from users of DIY CGM software, which demonstrates that this can be done safely. The key is to respect the systems and the data, and be aware of what could go wrong. As always, rule no.1…. Engage brain!


  1. This is an incredibly useful piece of knowledge to have about the G6 and how it works. Thanks very much for sharing with the DIY Closed Loop Community!

Leave a Reply

Your email address will not be published.