Sie sind auf Seite 1von 29

Quick Guide on closing the loop with AndroidAPS

· Something like preface


· What is Closed loop and why do I need it
· What do I need to get things workng.
· Insulin Pump
· Mobile phone
· Which phones are not suitable for Libre
· Sensor for continuous monitoring of blood glucose (CGM)
· Dexcom G4
· Abbot Freestyle Libre
· Nightscout account with necessary plug-ins
· NSclient
· AndroidAPS
· Glimp or LibreAlarm (Freestyle Libre only)
· xDrip
· Other gadgets
· Well I have all this- but now what?
Something like preface
Hello,
Once you are here, you probably already know that people around the world widely use
APS (Artificial Pancreas System) which is a system built on mathematical algorithm
called OpenAPS. It is used to give automatic or manual commands to the insulin pump to
change the basal levels of insulin depending on the constant incoming data of blood
glucose from a sensor.
The creation starts from Dana Lewis and later include programmers from around the
world, led by the idea to help their children and relatives with T1D diabetes. They do this
completely noncommercial and submit their work freely as open source on the Internet.
Anyone can freely use it and interpret with different hardware and equipment and thus
reach for the cherished goal of every diabetic - artificial pancreas.
The purpose of this article is to show you how you can also.
We have, however, warn that using such a system requires a lot of attention and
knowledge of your condition.
In any case this is not a panacea and will not solve your problems like a magic wand or
goldfish, but will give a more complete understanding of how and what is happening in
your body. Also, use of this system in no way cancels scheduled visits to endocrinologist
and advices given by him. OpenAPS not officially endorsed by any government or
medical authority, so its use is entirely your responsibility and you can not blame anyone
else for damages of any kind that are caused by the use of the system. So if you do not
agree with the assumption of risk better stop reading now.
If you are still here - good! So you have courage and willingness to try to improve control
of your T1 diabetes.

What is a closed loop and why do I need?


In the most general case OpenAPS systems are divided into two steps:
- Open loop - in this version a BG sensor (blood glucose) sends signals to a piece of
software that makes calculations and based on parameters you set gives proposal - what
should you do to keep the level of BG in limits. Example - You've set you that you want
BG to be between 6 and 8 mmol / l, but the sensor data showed that it is currently 10.
Then the software will give you a proposal to make temporary increase in basal values by
20-30% for 1 hour ( just an example ). This change you should enter and confirm your
insulin pump by yourself.
Second example - the sensor sends data that the level of BG is 4 mmol / l, which is below
the limit, and the software will give you a proposal to run a temporary basal 0% for 30
minutes, also you will need to decide whether it is right and manually enter it on pump
and keep track of the outcome.
- Closed loop - With this one things get a little easier - the proposals of the software
correction in the basal levels do not need your approval and manually entering the pump
and run automatically. So if we take the first example from above and 20 minutes after
the software has started 20-30% higher basal insulin BG fell down to 6.5 mmol / L then it
(the software) will send automatically signal to the pump to stop the temporal basal
before expiration of 60 minutes duration in order to prevent BG from going too low. Or if
we take the second example it if after 10 minutes of stopping insulin (0% really means
that the pump does not input any insulin) BG has risen to 6 mmol / l then the software
will return the value of basal insulin to 100% avoid excessive leap and re-intervention.
These are very simple examples, but it should give you some idea of what will actually
happen.
Now on the second part of the question - do I need such a thing? - My personal opinion is
- YES YOU DO - because no one can convince me that has perfect control over their
blood sugar at any time of the day. Even artificial pancreas is not absolute salvation, it
greatly helps in resolving problematic situations.

There are many different interpretations of the OpenAPS algorithm. Initially it used old
models of pumps Medtronic with minicomputers like Raspberry Pi. This method allows
use of the full potential of OpenAPS with all of its functions, but it is relatively difficult
to implement. It requires special hardware, special pump (Medtronic with software
version 2.6 below) and some knowledge in programming and soldering.
Alternatives are:
Loop - version of the iPhone and Rileylink, again required pump is Medtronik with
software version prior to 2.6.
AndroidAPS - which require only Android phone, Dana pump and some type of CGM. At
present this is the only program that can be used with new pumps without requiring any
additional hardware to them because real functions of mini computers, which is actually
your mobile phone.

What do I need to get things workng.

Insulin pump - Which must have already been installed and configured by a specialist
insulin pump. For specific software we are focused on here you need the pump to be
Sooil Dana Diabecare R, if you want to be in Closed loop mode. In open loop and you
can try every brand/model available. Opportunities to include other models are being
developed, but at the time AndroidAPS does not support other brands and models.
Mobile Phone - is imperative ( you'll need someone to do the calculations) with these
technical specifications
- Android OS 5 or higher
- Bluetooth - to be able somehow to communicate with other devices
- NFC chip - (only for Freestyle Libre) to be able to read data from the sensor
- Mobile data / WiFi - network connectivity in order to upload data of BG readings and
conducted treatments in NightScout
Which phones are not suitable for Freestyle Libre? - According to some Internet
communities there are problems with certain models of mobile phones that overheated
BG sensor (Freestyle Libre) and render it useless, for that reason it is not recommended
to use them. These are:
· Huawei Nexus 6P
· Samsung Galaxy Young 2
· Samsung Galaxy Core Prime
· Samsung Galaxy Grand Prime
· Samsung Galaxy J5

BG sensor
The options are two:
Abbott Freestyle Libre - That 's sensor which is placed on the arm, developed by the
British company Abbott, but it gives information about current BG only when scanned
with NFC device (remember that we've already wrote about NFC chip phone) so that this
is not a CGM (Continuous Glucose Monitoring), but FGM (Flash Glucose Monitoring)
and with no additional gadget it cannot be used in a closed loop. For information about
closing the loop see Section - Other gadgets.
The sensor retains in its internal memory the data of the measured blood glucose for the
last 8 hours (measured at an interval of 15 min), and the last 15 minutes (at an interval of
1 min).
Dexcom G4- This is actually an American company that has focused on sensors that
constantly measure blood glucose (CGM). Unlike Freestyle Libre this sensor measures
and transmits blood sugar every 5 min., Even has alarms for high and low sugar. The
continuous stream of data makes it ideal for artificial pancreas systems. Newest model is
currently G5, that officially works with mobile phone iPhone and miniature transmitter
placed on the patient's body. More common is the older model G4, which uses a special
reader instead of a mobile phone. Both models use unofficial program running for now
only in android called xDrip, which receives data directly from the transmitter in model
G5 or receiver in G4 and transmit them locally to the phone where AndroidAPS is
running. It is important to clarify that the official applications of Dexcom don't work with
AndroidAPS, and generally they have very limited options as time of use and the ability
to monitor the data. Currently, the most common option is G4 with receiver "share",
which unfortunately is sold only in the US but has the necessary Bluetooth connection to
android phone.
Nightscout account with necessary plug-ins - - Here is not the place to explain how to
install your Nightscout (NS) website, there're a lot of explanations/guides online.
http://www.nightscout.info/wiki/welcome
http://www.nightscout.info/wiki/welcome/website-features/cgm-remote-monitor-care-
portal- this is a MUST HAVE one

If you've already installed Nightscout:

 Go to https://portal.azure.com/ and login to your Azure profile

 Click your App Service name.

 Click "Application settings"

 Add or edit the parameters as follows:

o ENABLE = careportal boluscalc food bwp cage sage iage iob cob basal ar2 rawbg
pushover bgi pump openaps
o DEVICESTATUS_ADVANCED = true
o PUMP_FIELDS = reservoir battery clock
 Click "Save" at the top of the panel.

This is the basic setup of your Nightscout/Azure site needed for AndroidAPS use.

xDrip - program running under Android which main purpose is receiving BG data and
sending it to Nighscout. It is widely used mainly by parents remotely monitoring BG
levels of their children. In our case it will accept the data from the BG sensor and will
send it to AndroidAPS and to your NighScout website. Here the basic settings required
are Hardware Data Source as well as API upload - Enabled - BaseURL format https: //
your_API_secret@your_site.azurewebsites.net and checked option Broadcast locally.
NSClient - A small program with the main task to upload the data of BG levels and any
treatments in your NS site.
Download the latest version from - https://github.com/nightscout/NSClient-
Android/releases
Install and configure the phone with the data from your NS website.
Once installed NSClient must be configured to connect to your NS website. This is done
by choosing Prefences (three points at the top right corner of the program).
Click on Nightscout URL and enter the address of NS your site (for example
https://ivanivanov.azurewebsites.net/) and confirm by pressing OK.

Then select Nightscout API Secret and in the window that appears, enter the password for
your site, (no my API secret is not *********** :)) and confirm with OK.

If you'll be using the Glimp software and Freestyle Libre it's recommended to turn on
xdrip emulation.

AndroidAPS - The program was created by Czech developer Milos Kozak. He started
getting involved with this project at the end of 2015 while trying to make a program for
his daughter, who was then 6 years old. By mid-2016 he had a complete and sufficiently
secure management pump program through OpenAPS. Due to the unpopularity of Dana
pumps in the US, he developed his program almost alone. Gradually promote the
program and if at the end of July 2016 and the use is limited to his daughter and another
two enthusiasts, the currently active users of the program are 27, and this number is
constantly increasing. Milos Kozak continues to try to help every individual completely
free of charge, guided by purely moral motives, which he deserved infinite respect of his
followers. Thanks to one of us has even translated into Bulgarian.

The problem is that the program cannot be found as "ready to install" (no .apk file for
download) as request of the author. This means that you will need to download the source
code from:
https://github.com/MilosKozak/AndroidAPS

Extract it somewhere on the hard drive of your computer and go to the next step.
Install AndroidStudio(on your PC):
Download Android Studio from:
https://developer.android.com/studio/index.html
Install it after downloading
After the installation has finished you need to start Android Studio and open the folder
where you've unpacked the source code of AndroidAPS
Choose AndroidAPS-master and confirm with OK
AndroidStudio automatically begins to perform its tasks and if after some time (several
minutes) in the lower left corner window will show something like

Which means - There are no errors and you can proceed to the next step.

Which is:
From the bottom left corner select Build Variants, and from the window that appears
(under the Build Variants) choose fullWearDebug.
To go to the next step you need to enable USB Debugging on your phone.
Here are some steps to enable the USB Debugging If you have difficulties with that:
Make sure you have ADB drivers for your phone installed on your computer and that you
have enabled USB Debugging on the phone you will use. Connect it with micro USB
cable to your computer and select Run App in Android Studio

A new window will open.


A message appears on the phone, where you choose this way:
In Android Studio you select your phone, and confirm by pressing OK. Then the
installation will start.

Wait a few minutes and after you see AndroidAPS running on your phone disconnet it
(the phone) from your USB cable.

Glimp or Libre Alarm?


These two are are used only if you have Freestyle Libre sensor.
Glimp is an Android program written by Italians and gives a fairly complete information
on BG levels measured by the sensor and many other statistics. Nice feature of this one is
that it does not require calibration (ie measurement of BG with meter and entering the
data into the program with every new sensor), and like the reader from the starter pack of
Freestyle Libre it has a built-in calibration algorithm. Since version 4.0 supports
uploading of all scanned data to Nightscout, and 4.3 supports CGM function - ie hang the
phone with NFC chip to the sensor (fix it with wire or sticky tape to sit tight) and the
program measures continuously BG levels and uploads them to NS, which plays a major
part of any OpenAPS system.
Glimp you can download for free from Google Play Store
To configure uploading BG values in NS click on the three points at the top right corner
of the program and select Options and then click Remote glucose monitoring.
Enter the address of your NS website and API Secret (password). Press "Test connection"
and if everything is OK it should show a positive message. If not - check that you have
entered the correct values.
If everything is OK whenever you scan your Freestyle Libre sensor with Glimp running -
sensor data will be automatically uploaded to the NS site,
(If your phone has a network connectivity (4G / WiFi) of course.
Since version 4.5 Glimp have a version for Android Wear (in other words Smart watches
with Android) and if they have an NFC chip will not even need to take out your phone to
scan the sensor. Only touch your sensor with the watch and see the result of it and even
use the watch for full CGM functionality. From our tests, however, the use of "Glimp +
watch CGM" leads to very rapid drain of the battery of the watch (in less than two
hours ), which is impractical and made us look for another solution.
Libre Alarm and xDrip+
Libre Alarm is a piece of software for Android Wear (watches), which is extremely young
(and every young person makes many mistakes), but its combination with xDrip+ leads to
a very acceptable version of CGM with Freestyle Libre.

How to install NFC support in Sony Smartwatch 3


https://github.com/pimpimmi/LibreAlarm/wiki/How-to-install-NFC-on-Sony-
Smartwatch-3

Then simply pair your phone with watch, download and install Libre Alarm application
from Google Play and xDrip + from
https://xdrip-plus-updates.appspot.com/stable/xdrip-plus-latest.apk

Upload it to your phone after downloading and install it - connect your phone with an
USB cable to the computer on which you have downloaded xDrip+ .apk file, copy the
file to a temporary directory on phone. Disconnect the cable, open the folder and install
(open the .apk file).
Next you need to set-up xDrip+ program:
After running Xdrip + click in the upper-left corner (three bars) and from the menu select
Settings
From the window that appears is important to change Glucose units of mmol / l (if you
use it) and Hardware Data Source of Libre Alarm, and Run Collector in foreground.
Then scroll down in Settings and tap on API Upload (REST)

Enabled must be ON and in the field "Base URL" enter "https: //" +yourAPISecret+
@NightscoutURL + "/api/v1/"
Overall input should look like this:
https://myAPIsecret@mysite.azurewebsites.net/api/v1/
Then go back again to Settings and check if the field "Broadcast locally" is "On" ( it
must be ).
The only thing that remains here is to start the sensor - click on the three bars and select
"Start sensor". You will be asked for 2 calibrations. I usually scan with the Libre reader
(one gadget that looks like a meter) and enter the values (two identical values).

Then you are ready to scan sensor with the phone as the phone is close to the sensor with
NFC ON. It is also good to check whether the scanned values appear in Nightscout your
site and AndroidAPS, if not then go back through the steps of setting up xDrip+ and
verify that all values are entered correctly.

Other gadgets
To convert Freestyle Libre from FGM to a fully operational CGM you'll needed 2 more
gadgets
- Smart watch Powered by Android Wear and NFC chip - currently on the market that's
just Sony Smartwatch 3
- Some kind of a case or a way to attach the watch on the Freestyle Libre sensor.

Sony Smartwatch 3 is the only Powered by Android Wear with NFC chip(for now), but
this chip is disabled in the operating system and is necessary to make some software
changes to use it.
Brief description of how to do this can be found at:
https://github.com/pimpimmi/LibreAlarm/wiki/How-to-install-NFC-on-Sony-
Smartwatch-3

After you've done everything in the description (without problems) - in programs the
watch you should find "Settings NFC", where you can activate the chip.
If this pass you can proceed to the installation of Andoid Wear and Libre Alarm on the
phone. Once you have done and Libre Alarm shows your BG data you are ready to attach
the watch to the sensor and have a working CGM.
The case - the most convenient way to attach the watch is by 3D printing
Download the file from the link below:
http://www.deebee.it/download/vH45_GlimBee_DeeBee.stl
Send it to someone performing services for 3D printing or friend with a 3D printer and
when you have that plastic case remove the watch from the strap, separate the two parts
of the case, insert the clock in between with the display facing to the circular opening and
close the case. Find yourself a long enough elastic band and spend two ends of the strip
into the side openings of the case. Put your hand in and place the case over the sensor
(circular hole is exactly the size of Freestyle Libre sensor, so that it fits and can not
move). Tighten the elastic band to secure the case ( not to move freely ), but not so tight
to create discomfort and voila - you're ready.

By this point you should have everything you need to start AndroidAPS in a closed loop
mode and it can make the necessary adjustments of insulin dosage when your BG is out
of bounds.

OK - I have all of this- but now what's next?

About setting up and useing AndroidAPS - wait for the second part of this manual.

We wish everyone good luck!

Written by:
Radoslav Radev
Rumen Georgiev
SeungYeop Kang

Das könnte Ihnen auch gefallen