diff --git a/README.md b/README.md index 4d84813db..872693483 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,26 @@ # Introduction -* Easily navigable version of the [latest production docs are here.](https://openaps.readthedocs.org/en/latest/index.html) -* Easily navigable version of the [in-development or "dev" docs can be found here.](https://openaps.readthedocs.org/en/dev/index.html) - -## Welcome - Welcome to the [openaps](https://github.com/openaps/) documentation! -This documentation support a self-driven Do-It-Yourself (DIY) implementation of an artificial pancreas based on the [OpenAPS reference design](http://openaps.org/open-artificial-pancreas-system-openaps-reference-design/). By proceeding to use these tools or any piece within, you agree to the copyright (see LICENSE.txt for more information) and release any contributors from liability, and assume full responsibility for all of your actions and outcomes related to usage of these tools or ideas. +This documentation supports implementing a self driven, Do It Yourself (DIY) artificial pancreas, based on the [OpenAPS Reference Design](https://openaps.org/reference-design/). By proceeding to use these tools or any [openaps](https://github.com/openaps/) repositories, you agree to abide by the copyright agreement and release any contributors from any liability. You assume full responsibility for all actions and outcomes related to use of these tools or ideas. [Please read the copyright agreement before proceeding](https://github.com/openaps/docs/blob/master/license.txt). + +* [The easiest option for reading the documentation is by using this version](https://openaps.readthedocs.org/en/latest/index.html). (You may want to bookmark this link.) ---------- -### A Note on DIY and the "Open" Part of OpenAPS -This is a set of development tools to support a self-driven DIY implementation. -Any person choosing to use these tools is solely responsible for testing and -implementing these tools independently or together as a system. - -The [DIY part of OpenAPS is important](http://bit.ly/1NBbZtO). While formal training -or experience as an engineer or a developer is not a prerequisite, a growth -mindset is required to learn to work with the "building blocks" that will help -you develop your OpenAPS instance. Remember as you consider this project that -this is not a "set and forget" system; an OpenAPS implementation requires -diligent and consistent testing and monitoring to ensure each piece of the -system is monitoring, predicting, and controlling as desired. The performance -and quality of your system lies solely with you. - -This community of contributors believes in "paying it forward," and individuals -who are implementing these tools are asked to contribute by asking questions, -[helping improve documentation](docs/docs/Resources/my-first-pr.md), and -contributing in other ways. +## A Note on DIY and the Open Part of OpenAPS + +This is a set of development tools to support a self driven DIY implementation of an open source artificial pancreas, OpenAPS. Any individual choosing to use these tools is solely responsible for testing, verifying, and implementing each of these tools independently or together as a system. + +The [DIY part of OpenAPS is important](http://bit.ly/1NBbZtO). A growth and learning mindset is required to work with the "building blocks" that will help develop your OpenAPS system. **This is not a set and forget system**; an OpenAPS system requires persistent attention. Users must do blood glucose tests frequently and watch continuous glucose monitors vigilantly, in order to ensure each piece of the system is monitoring, predicting, and controlling blood glucose safely, given user defined constraints. The performance and quality of your OpenAPS system relies solely on you. + +This community of contributors believes in paying it forward, and individuals who are implementing these tools are asked to contribute by asking questions, [helping improve this documentation](docs/docs/Resources/my-first-pr.md), and contributing in other ways. ---------- -### OpenAPS System Development Phases +## OpenAPS System Development Phases + +This documentation is organized into a series of phases that progressively build upon the openaps development tools towards a working OpenAPS system. -This documentation is organized into a series of phases that progressively -build upon the openaps development tools towards a working OpenAPS system. The phases are as follows: * **Phase 0: General Setup**
@@ -43,17 +29,22 @@ Get the equipment you need; record baseline data, configure your hardware, insta * **Phase 1: Monitoring and Visualization Setup**
Prepare Nightscout or other visualization tools that are key for monitoring a closed loop. -* **Phase 2: Creating a a PLGM or open loop**
+* **Phase 2: Creating a PLGM or open loop**
Use the setup script to build a basic loop; you can choose to run the loop manually ("open loop" mode), or automate your loop. At this stage, you should review and refine algorithms, test different scenarios for safety, etc. * **Phase 3: Understanding Your Loop and Tweaking Settings**
Analyze the basal recommendations that are outputted from your system; run in a test environment for multiple days to configure safety settings that are right for you before moving forward. * **Phase 4: Iterate and Improve the Closed Loop**
-At the end of the previous stages and after 3 consecutive nights with no hardware failures and at least 1 night without low alarms, you can move into advanced features like meal-assist and auto-sensitivity tuning. Also improve the functionality of the system with additional software or hardware development +At the end of the previous stages and after 3 consecutive nights with no hardware failures and at least 1 night without low alarms, you can move into advanced features like advanced meal assist (AMA) and auto-sensitivity tuning ("autosens" and "autotune"), and improve the functionality of the system with additional software or hardware development. ---------- -You may be looking for: -* How to [get help with your implementation](http://openaps.readthedocs.io/en/latest/docs/introduction/communication-support-channels.html) (hint: [go to Gitter here](https://gitter.im/nightscout/intend-to-bolus)) -* The ["old" directions](http://openaps.readthedocs.io/en/latest/docs/walkthrough/manual/index.html) -* The [OpenAPS Reference Design](https://openaps.org/reference-design/) +**You may be looking for:** + +* [Live help with your implementation](http://openaps.readthedocs.io/en/latest/docs/introduction/communication-support-channels.html) (Hint: [Check out this Gitter channel](https://gitter.im/nightscout/intend-to-bolus)) + +* ["Old" setup directions](http://openaps.readthedocs.io/en/latest/docs/walkthrough/manual/index.html) + +* [OpenAPS Reference Design](https://openaps.org/reference-design/) + + diff --git a/docs/conf.py b/docs/conf.py index 65bcb49b1..a21419c34 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -27,6 +27,9 @@ # -- General configuration ------------------------------------------------ +# RTD +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' @@ -61,8 +64,8 @@ # General information about the project. project = u'OpenAPS' -copyright = u'2016, Ben West, Dana Lewis, and openaps contributors' -author = u'Ben West, Dana Lewis, Scott Leibrand, openaps community' +copyright = u'2017, the #OpenAPS community' +author = u'the #OpenAPS community' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -122,7 +125,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'alabaster' +#html_theme = 'default` extra_nav_links = { @@ -148,7 +151,7 @@ } """ -html_theme = 'sphinx_rtd_theme' +html_theme = 'default' html_theme_options = { 'display_github': True, 'github_user': 'openaps', diff --git a/docs/docs/Images/BT_pairing.png b/docs/docs/Images/BT_pairing.png new file mode 100644 index 000000000..9c46b3f6e Binary files /dev/null and b/docs/docs/Images/BT_pairing.png differ diff --git a/docs/docs/Images/BT_papertrail.PNG b/docs/docs/Images/BT_papertrail.PNG new file mode 100644 index 000000000..eaaccc8bb Binary files /dev/null and b/docs/docs/Images/BT_papertrail.PNG differ diff --git a/docs/docs/Images/BT_sudos.png b/docs/docs/Images/BT_sudos.png new file mode 100644 index 000000000..4909b6fa4 Binary files /dev/null and b/docs/docs/Images/BT_sudos.png differ diff --git a/docs/docs/Images/Computer_rig_different_wifi.png b/docs/docs/Images/Computer_rig_different_wifi.png new file mode 100644 index 000000000..566133703 Binary files /dev/null and b/docs/docs/Images/Computer_rig_different_wifi.png differ diff --git a/docs/docs/Images/Computer_rig_same_wifi.png b/docs/docs/Images/Computer_rig_same_wifi.png new file mode 100644 index 000000000..661c6e030 Binary files /dev/null and b/docs/docs/Images/Computer_rig_same_wifi.png differ diff --git a/docs/docs/Images/Edison/64_bit.png b/docs/docs/Images/Edison/64_bit.png new file mode 100644 index 000000000..8c8a8d602 Binary files /dev/null and b/docs/docs/Images/Edison/64_bit.png differ diff --git a/docs/docs/Images/Edison/After_Homebrew.png b/docs/docs/Images/Edison/After_Homebrew.png new file mode 100644 index 000000000..3c5125e2f Binary files /dev/null and b/docs/docs/Images/Edison/After_Homebrew.png differ diff --git a/docs/docs/Images/Edison/After_install_other_stuff.png b/docs/docs/Images/Edison/After_install_other_stuff.png new file mode 100644 index 000000000..40a6e5d24 Binary files /dev/null and b/docs/docs/Images/Edison/After_install_other_stuff.png differ diff --git a/docs/docs/Images/Edison/Edison_Explorer_Board.png b/docs/docs/Images/Edison/Edison_Explorer_Board.png new file mode 100644 index 000000000..2b3a85a0f Binary files /dev/null and b/docs/docs/Images/Edison/Edison_Explorer_Board.png differ diff --git a/docs/docs/Images/Edison/Edison_in_Finder_folder.png b/docs/docs/Images/Edison/Edison_in_Finder_folder.png new file mode 100644 index 000000000..beef2523d Binary files /dev/null and b/docs/docs/Images/Edison/Edison_in_Finder_folder.png differ diff --git a/docs/docs/Images/Edison/Enter_return.png b/docs/docs/Images/Edison/Enter_return.png new file mode 100644 index 000000000..9d7949f8e Binary files /dev/null and b/docs/docs/Images/Edison/Enter_return.png differ diff --git a/docs/docs/Images/Edison/ExplorerBoard_two_charging_cables.png b/docs/docs/Images/Edison/ExplorerBoard_two_charging_cables.png new file mode 100644 index 000000000..90b390bba Binary files /dev/null and b/docs/docs/Images/Edison/ExplorerBoard_two_charging_cables.png differ diff --git a/docs/docs/Images/Edison/Inside_terminal.png b/docs/docs/Images/Edison/Inside_terminal.png new file mode 100644 index 000000000..312422e39 Binary files /dev/null and b/docs/docs/Images/Edison/Inside_terminal.png differ diff --git a/docs/docs/Images/Edison/Phone_hotspot_wifi.png b/docs/docs/Images/Edison/Phone_hotspot_wifi.png new file mode 100644 index 000000000..979c6159a Binary files /dev/null and b/docs/docs/Images/Edison/Phone_hotspot_wifi.png differ diff --git a/docs/docs/Images/Edison/Rig_login_time.png b/docs/docs/Images/Edison/Rig_login_time.png new file mode 100644 index 000000000..df17c7f28 Binary files /dev/null and b/docs/docs/Images/Edison/Rig_login_time.png differ diff --git a/docs/docs/Images/Edison/Terminal_example.png b/docs/docs/Images/Edison/Terminal_example.png new file mode 100644 index 000000000..54e172a02 Binary files /dev/null and b/docs/docs/Images/Edison/Terminal_example.png differ diff --git a/docs/docs/Images/Edison/Time_zone.png b/docs/docs/Images/Edison/Time_zone.png new file mode 100644 index 000000000..886d76888 Binary files /dev/null and b/docs/docs/Images/Edison/Time_zone.png differ diff --git a/docs/docs/Images/Edison/Wifi_add.png b/docs/docs/Images/Edison/Wifi_add.png new file mode 100644 index 000000000..9a6fe60f3 Binary files /dev/null and b/docs/docs/Images/Edison/Wifi_add.png differ diff --git a/docs/docs/Images/Edison/Wifi_edit_screen.png b/docs/docs/Images/Edison/Wifi_edit_screen.png new file mode 100644 index 000000000..234ea991f Binary files /dev/null and b/docs/docs/Images/Edison/Wifi_edit_screen.png differ diff --git a/docs/docs/Images/Edison/after_install_lsusb.png b/docs/docs/Images/Edison/after_install_lsusb.png new file mode 100644 index 000000000..b8417f8c4 Binary files /dev/null and b/docs/docs/Images/Edison/after_install_lsusb.png differ diff --git a/docs/docs/Images/Edison/apt-get.png b/docs/docs/Images/Edison/apt-get.png new file mode 100644 index 000000000..4c67f90db Binary files /dev/null and b/docs/docs/Images/Edison/apt-get.png differ diff --git a/docs/docs/Images/Edison/cd_jubilinux.png b/docs/docs/Images/Edison/cd_jubilinux.png new file mode 100644 index 000000000..f68e2966f Binary files /dev/null and b/docs/docs/Images/Edison/cd_jubilinux.png differ diff --git a/docs/docs/Images/Edison/change_me_out_for_jubilinux.png b/docs/docs/Images/Edison/change_me_out_for_jubilinux.png new file mode 100644 index 000000000..6506ad7f1 Binary files /dev/null and b/docs/docs/Images/Edison/change_me_out_for_jubilinux.png differ diff --git a/docs/docs/Images/Edison/changing_edison_password.png b/docs/docs/Images/Edison/changing_edison_password.png new file mode 100644 index 000000000..975e52788 Binary files /dev/null and b/docs/docs/Images/Edison/changing_edison_password.png differ diff --git a/docs/docs/Images/Edison/control_d.png b/docs/docs/Images/Edison/control_d.png new file mode 100644 index 000000000..4e9a079ee Binary files /dev/null and b/docs/docs/Images/Edison/control_d.png differ diff --git a/docs/docs/Images/Edison/dfu_files.png b/docs/docs/Images/Edison/dfu_files.png new file mode 100644 index 000000000..0347e0daa Binary files /dev/null and b/docs/docs/Images/Edison/dfu_files.png differ diff --git a/docs/docs/Images/Edison/dfu_inside.png b/docs/docs/Images/Edison/dfu_inside.png new file mode 100644 index 000000000..d42dcda97 Binary files /dev/null and b/docs/docs/Images/Edison/dfu_inside.png differ diff --git a/docs/docs/Images/Edison/dfu_unzip.png b/docs/docs/Images/Edison/dfu_unzip.png new file mode 100644 index 000000000..c031a11c1 Binary files /dev/null and b/docs/docs/Images/Edison/dfu_unzip.png differ diff --git a/docs/docs/Images/Edison/dfu_util.png b/docs/docs/Images/Edison/dfu_util.png new file mode 100644 index 000000000..3b6954a6b Binary files /dev/null and b/docs/docs/Images/Edison/dfu_util.png differ diff --git a/docs/docs/Images/Edison/directory.md b/docs/docs/Images/Edison/directory.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/docs/docs/Images/Edison/directory.md @@ -0,0 +1 @@ + diff --git a/docs/docs/Images/Edison/dont_worry_during_reboot.png b/docs/docs/Images/Edison/dont_worry_during_reboot.png new file mode 100644 index 000000000..e08158388 Binary files /dev/null and b/docs/docs/Images/Edison/dont_worry_during_reboot.png differ diff --git a/docs/docs/Images/Edison/edison_driver.png b/docs/docs/Images/Edison/edison_driver.png new file mode 100644 index 000000000..c980cd8e1 Binary files /dev/null and b/docs/docs/Images/Edison/edison_driver.png differ diff --git a/docs/docs/Images/Edison/edison_driver2.png b/docs/docs/Images/Edison/edison_driver2.png new file mode 100644 index 000000000..59c14a1a8 Binary files /dev/null and b/docs/docs/Images/Edison/edison_driver2.png differ diff --git a/docs/docs/Images/Edison/edison_hostname_password.png b/docs/docs/Images/Edison/edison_hostname_password.png new file mode 100644 index 000000000..085252307 Binary files /dev/null and b/docs/docs/Images/Edison/edison_hostname_password.png differ diff --git a/docs/docs/Images/Edison/edison_popup.png b/docs/docs/Images/Edison/edison_popup.png new file mode 100644 index 000000000..eeacb71e1 Binary files /dev/null and b/docs/docs/Images/Edison/edison_popup.png differ diff --git a/docs/docs/Images/Edison/flash.png b/docs/docs/Images/Edison/flash.png new file mode 100644 index 000000000..1d533050d Binary files /dev/null and b/docs/docs/Images/Edison/flash.png differ diff --git a/docs/docs/Images/Edison/ifup_wlan0.png b/docs/docs/Images/Edison/ifup_wlan0.png new file mode 100644 index 000000000..ccbb26f46 Binary files /dev/null and b/docs/docs/Images/Edison/ifup_wlan0.png differ diff --git a/docs/docs/Images/Edison/ip_address.png b/docs/docs/Images/Edison/ip_address.png new file mode 100644 index 000000000..605d0a2cc Binary files /dev/null and b/docs/docs/Images/Edison/ip_address.png differ diff --git a/docs/docs/Images/Edison/jubilinux_unzip.png b/docs/docs/Images/Edison/jubilinux_unzip.png new file mode 100644 index 000000000..370d130cf Binary files /dev/null and b/docs/docs/Images/Edison/jubilinux_unzip.png differ diff --git a/docs/docs/Images/Edison/log_rotation.png b/docs/docs/Images/Edison/log_rotation.png new file mode 100644 index 000000000..6940ca62f Binary files /dev/null and b/docs/docs/Images/Edison/log_rotation.png differ diff --git a/docs/docs/Images/Edison/login_after_successful_reboot.png b/docs/docs/Images/Edison/login_after_successful_reboot.png new file mode 100644 index 000000000..4fadb7014 Binary files /dev/null and b/docs/docs/Images/Edison/login_after_successful_reboot.png differ diff --git a/docs/docs/Images/Edison/logrotate.png b/docs/docs/Images/Edison/logrotate.png new file mode 100644 index 000000000..af2d0ec68 Binary files /dev/null and b/docs/docs/Images/Edison/logrotate.png differ diff --git a/docs/docs/Images/Edison/mid_flash.png b/docs/docs/Images/Edison/mid_flash.png new file mode 100644 index 000000000..87dc1efd4 Binary files /dev/null and b/docs/docs/Images/Edison/mid_flash.png differ diff --git a/docs/docs/Images/Edison/name.png b/docs/docs/Images/Edison/name.png new file mode 100644 index 000000000..3dd544273 Binary files /dev/null and b/docs/docs/Images/Edison/name.png differ diff --git a/docs/docs/Images/Edison/nodejs.png b/docs/docs/Images/Edison/nodejs.png new file mode 100644 index 000000000..66ac3ebfb Binary files /dev/null and b/docs/docs/Images/Edison/nodejs.png differ diff --git a/docs/docs/Images/Edison/ping_success.png b/docs/docs/Images/Edison/ping_success.png new file mode 100644 index 000000000..9cc9e87e5 Binary files /dev/null and b/docs/docs/Images/Edison/ping_success.png differ diff --git a/docs/docs/Images/Edison/ping_unsuccessful.png b/docs/docs/Images/Edison/ping_unsuccessful.png new file mode 100644 index 000000000..cb039651f Binary files /dev/null and b/docs/docs/Images/Edison/ping_unsuccessful.png differ diff --git a/docs/docs/Images/Edison/port.png b/docs/docs/Images/Edison/port.png new file mode 100644 index 000000000..81b98ca10 Binary files /dev/null and b/docs/docs/Images/Edison/port.png differ diff --git a/docs/docs/Images/Edison/putty.png b/docs/docs/Images/Edison/putty.png new file mode 100644 index 000000000..d6b324070 Binary files /dev/null and b/docs/docs/Images/Edison/putty.png differ diff --git a/docs/docs/Images/Edison/putty2.png b/docs/docs/Images/Edison/putty2.png new file mode 100644 index 000000000..a3b2c3dee Binary files /dev/null and b/docs/docs/Images/Edison/putty2.png differ diff --git a/docs/docs/Images/Edison/putty3.png b/docs/docs/Images/Edison/putty3.png new file mode 100644 index 000000000..c462a248b Binary files /dev/null and b/docs/docs/Images/Edison/putty3.png differ diff --git a/docs/docs/Images/Edison/putty_port.png b/docs/docs/Images/Edison/putty_port.png new file mode 100644 index 000000000..8db30c53b Binary files /dev/null and b/docs/docs/Images/Edison/putty_port.png differ diff --git a/docs/docs/Images/Edison/python.png b/docs/docs/Images/Edison/python.png new file mode 100644 index 000000000..3b4be0db2 Binary files /dev/null and b/docs/docs/Images/Edison/python.png differ diff --git a/docs/docs/Images/Edison/ram.png b/docs/docs/Images/Edison/ram.png new file mode 100644 index 000000000..2d94993c3 Binary files /dev/null and b/docs/docs/Images/Edison/ram.png differ diff --git a/docs/docs/Images/Edison/ready.png b/docs/docs/Images/Edison/ready.png new file mode 100644 index 000000000..4d9173f38 Binary files /dev/null and b/docs/docs/Images/Edison/ready.png differ diff --git a/docs/docs/Images/Edison/ready_to_flash.png b/docs/docs/Images/Edison/ready_to_flash.png new file mode 100644 index 000000000..f6330a886 Binary files /dev/null and b/docs/docs/Images/Edison/ready_to_flash.png differ diff --git a/docs/docs/Images/Edison/reboot.png b/docs/docs/Images/Edison/reboot.png new file mode 100644 index 000000000..87029c018 Binary files /dev/null and b/docs/docs/Images/Edison/reboot.png differ diff --git a/docs/docs/Images/Edison/root.png b/docs/docs/Images/Edison/root.png new file mode 100644 index 000000000..e66be7c2c Binary files /dev/null and b/docs/docs/Images/Edison/root.png differ diff --git a/docs/docs/Images/Edison/successful.png b/docs/docs/Images/Edison/successful.png new file mode 100644 index 000000000..6cf5ea36b Binary files /dev/null and b/docs/docs/Images/Edison/successful.png differ diff --git a/docs/docs/Images/Edison/wifi_interfaces.png b/docs/docs/Images/Edison/wifi_interfaces.png new file mode 100644 index 000000000..60c49a99c Binary files /dev/null and b/docs/docs/Images/Edison/wifi_interfaces.png differ diff --git a/docs/docs/Images/Edison/winzip.png b/docs/docs/Images/Edison/winzip.png new file mode 100644 index 000000000..597cbb6ae Binary files /dev/null and b/docs/docs/Images/Edison/winzip.png differ diff --git a/docs/docs/Images/Example_batch_images_upload.png b/docs/docs/Images/Example_batch_images_upload.png new file mode 100644 index 000000000..29feb2768 Binary files /dev/null and b/docs/docs/Images/Example_batch_images_upload.png differ diff --git a/docs/docs/Images/Example_iphone_apps.png b/docs/docs/Images/Example_iphone_apps.png new file mode 100644 index 000000000..6970b7130 Binary files /dev/null and b/docs/docs/Images/Example_iphone_apps.png differ diff --git a/docs/docs/Images/Example_screen_from_NightscoutDataTransfer_app_while_data_upload_in_progress.png b/docs/docs/Images/Example_screen_from_NightscoutDataTransfer_app_while_data_upload_in_progress.png new file mode 100644 index 000000000..52bd5c958 Binary files /dev/null and b/docs/docs/Images/Example_screen_from_NightscoutDataTransfer_app_while_data_upload_in_progress.png differ diff --git a/docs/docs/Images/Explorer_Board_rig.png b/docs/docs/Images/Explorer_Board_rig.png new file mode 100644 index 000000000..5dd9defff Binary files /dev/null and b/docs/docs/Images/Explorer_Board_rig.png differ diff --git a/docs/docs/Images/High_level_components_OpenAPS_setup_process.png b/docs/docs/Images/High_level_components_OpenAPS_setup_process.png new file mode 100644 index 000000000..b73bf40c8 Binary files /dev/null and b/docs/docs/Images/High_level_components_OpenAPS_setup_process.png differ diff --git a/docs/docs/Images/How_data_looks_in_NightscoutDataTransferApp_OpenHumans.png b/docs/docs/Images/How_data_looks_in_NightscoutDataTransferApp_OpenHumans.png new file mode 100644 index 000000000..1e4f66467 Binary files /dev/null and b/docs/docs/Images/How_data_looks_in_NightscoutDataTransferApp_OpenHumans.png differ diff --git a/docs/docs/Images/IFTTT_NSkey.png b/docs/docs/Images/IFTTT_NSkey.png new file mode 100644 index 000000000..8322a2cfb Binary files /dev/null and b/docs/docs/Images/IFTTT_NSkey.png differ diff --git a/docs/docs/Images/IFTTT_actionfields.png b/docs/docs/Images/IFTTT_actionfields.png new file mode 100644 index 000000000..0ecf420a6 Binary files /dev/null and b/docs/docs/Images/IFTTT_actionfields.png differ diff --git a/docs/docs/Images/IFTTT_applets.png b/docs/docs/Images/IFTTT_applets.png new file mode 100644 index 000000000..4055c3ee5 Binary files /dev/null and b/docs/docs/Images/IFTTT_applets.png differ diff --git a/docs/docs/Images/IFTTT_button.png b/docs/docs/Images/IFTTT_button.png new file mode 100644 index 000000000..ee3a7f384 Binary files /dev/null and b/docs/docs/Images/IFTTT_button.png differ diff --git a/docs/docs/Images/IFTTT_buttonpress.png b/docs/docs/Images/IFTTT_buttonpress.png new file mode 100644 index 000000000..3c23c1d25 Binary files /dev/null and b/docs/docs/Images/IFTTT_buttonpress.png differ diff --git a/docs/docs/Images/IFTTT_connect1.png b/docs/docs/Images/IFTTT_connect1.png new file mode 100644 index 000000000..071ce6af0 Binary files /dev/null and b/docs/docs/Images/IFTTT_connect1.png differ diff --git a/docs/docs/Images/IFTTT_connect2.png b/docs/docs/Images/IFTTT_connect2.png new file mode 100644 index 000000000..3406b1439 Binary files /dev/null and b/docs/docs/Images/IFTTT_connect2.png differ diff --git a/docs/docs/Images/IFTTT_enable.png b/docs/docs/Images/IFTTT_enable.png new file mode 100644 index 000000000..a3963c40f Binary files /dev/null and b/docs/docs/Images/IFTTT_enable.png differ diff --git a/docs/docs/Images/IFTTT_finish.png b/docs/docs/Images/IFTTT_finish.png new file mode 100644 index 000000000..17db4919b Binary files /dev/null and b/docs/docs/Images/IFTTT_finish.png differ diff --git a/docs/docs/Images/IFTTT_homescreen.png b/docs/docs/Images/IFTTT_homescreen.png new file mode 100644 index 000000000..f5908bd53 Binary files /dev/null and b/docs/docs/Images/IFTTT_homescreen.png differ diff --git a/docs/docs/Images/IFTTT_maker.png b/docs/docs/Images/IFTTT_maker.png new file mode 100644 index 000000000..5e6b331cd Binary files /dev/null and b/docs/docs/Images/IFTTT_maker.png differ diff --git a/docs/docs/Images/IFTTT_makerkey.png b/docs/docs/Images/IFTTT_makerkey.png new file mode 100644 index 000000000..eadd37db1 Binary files /dev/null and b/docs/docs/Images/IFTTT_makerkey.png differ diff --git a/docs/docs/Images/IFTTT_newapplet.png b/docs/docs/Images/IFTTT_newapplet.png new file mode 100644 index 000000000..178e3ff87 Binary files /dev/null and b/docs/docs/Images/IFTTT_newapplet.png differ diff --git a/docs/docs/Images/IFTTT_pebble.jpeg b/docs/docs/Images/IFTTT_pebble.jpeg new file mode 100644 index 000000000..cd34c17ff Binary files /dev/null and b/docs/docs/Images/IFTTT_pebble.jpeg differ diff --git a/docs/docs/Images/IFTTT_reorder.png b/docs/docs/Images/IFTTT_reorder.png new file mode 100644 index 000000000..740888a93 Binary files /dev/null and b/docs/docs/Images/IFTTT_reorder.png differ diff --git a/docs/docs/Images/IFTTT_services.png b/docs/docs/Images/IFTTT_services.png new file mode 100644 index 000000000..23e03d116 Binary files /dev/null and b/docs/docs/Images/IFTTT_services.png differ diff --git a/docs/docs/Images/IFTTT_services2.png b/docs/docs/Images/IFTTT_services2.png new file mode 100644 index 000000000..58cfcb36b Binary files /dev/null and b/docs/docs/Images/IFTTT_services2.png differ diff --git a/docs/docs/Images/IFTTT_signup.png b/docs/docs/Images/IFTTT_signup.png new file mode 100644 index 000000000..fbac68913 Binary files /dev/null and b/docs/docs/Images/IFTTT_signup.png differ diff --git a/docs/docs/Images/IFTTT_that.png b/docs/docs/Images/IFTTT_that.png new file mode 100644 index 000000000..cfc89b796 Binary files /dev/null and b/docs/docs/Images/IFTTT_that.png differ diff --git a/docs/docs/Images/IFTTT_this.png b/docs/docs/Images/IFTTT_this.png new file mode 100644 index 000000000..8a96d9907 Binary files /dev/null and b/docs/docs/Images/IFTTT_this.png differ diff --git a/docs/docs/Images/IFTTT_today.png b/docs/docs/Images/IFTTT_today.png new file mode 100644 index 000000000..a418381b7 Binary files /dev/null and b/docs/docs/Images/IFTTT_today.png differ diff --git a/docs/docs/Images/IFTTT_webrequest.png b/docs/docs/Images/IFTTT_webrequest.png new file mode 100644 index 000000000..a2e9ceb1a Binary files /dev/null and b/docs/docs/Images/IFTTT_webrequest.png differ diff --git a/docs/docs/Images/Iphone_rig_same_wifi.png b/docs/docs/Images/Iphone_rig_same_wifi.png new file mode 100644 index 000000000..9ea541f32 Binary files /dev/null and b/docs/docs/Images/Iphone_rig_same_wifi.png differ diff --git a/docs/docs/Images/OpenAPS_Data_Commons.png b/docs/docs/Images/OpenAPS_Data_Commons.png new file mode 100644 index 000000000..f780be33d Binary files /dev/null and b/docs/docs/Images/OpenAPS_Data_Commons.png differ diff --git a/docs/docs/Images/PR0.png b/docs/docs/Images/PR0.png new file mode 100644 index 000000000..9d521866c Binary files /dev/null and b/docs/docs/Images/PR0.png differ diff --git a/docs/docs/Images/PR1.png b/docs/docs/Images/PR1.png new file mode 100644 index 000000000..fde1f7cae Binary files /dev/null and b/docs/docs/Images/PR1.png differ diff --git a/docs/docs/Images/PR2.png b/docs/docs/Images/PR2.png new file mode 100644 index 000000000..43b7ec97e Binary files /dev/null and b/docs/docs/Images/PR2.png differ diff --git a/docs/docs/Images/PR3.png b/docs/docs/Images/PR3.png new file mode 100644 index 000000000..cc62c4531 Binary files /dev/null and b/docs/docs/Images/PR3.png differ diff --git a/docs/docs/Images/PR4.png b/docs/docs/Images/PR4.png new file mode 100644 index 000000000..33343f006 Binary files /dev/null and b/docs/docs/Images/PR4.png differ diff --git a/docs/docs/Images/PR5.png b/docs/docs/Images/PR5.png new file mode 100644 index 000000000..724929599 Binary files /dev/null and b/docs/docs/Images/PR5.png differ diff --git a/docs/docs/Images/PR6.png b/docs/docs/Images/PR6.png new file mode 100644 index 000000000..58b79f927 Binary files /dev/null and b/docs/docs/Images/PR6.png differ diff --git a/docs/docs/Images/PR7.png b/docs/docs/Images/PR7.png new file mode 100644 index 000000000..d3bedae8b Binary files /dev/null and b/docs/docs/Images/PR7.png differ diff --git a/docs/docs/Images/Pushover_carbs needed.PNG b/docs/docs/Images/Pushover_carbs needed.PNG new file mode 100644 index 000000000..dec454118 Binary files /dev/null and b/docs/docs/Images/Pushover_carbs needed.PNG differ diff --git a/docs/docs/Images/Pushover_carbs_needed.PNG b/docs/docs/Images/Pushover_carbs_needed.PNG new file mode 100644 index 000000000..dec454118 Binary files /dev/null and b/docs/docs/Images/Pushover_carbs_needed.PNG differ diff --git a/docs/docs/Images/Pushover_insulinReq_SMB.PNG b/docs/docs/Images/Pushover_insulinReq_SMB.PNG new file mode 100644 index 000000000..a150f9b2e Binary files /dev/null and b/docs/docs/Images/Pushover_insulinReq_SMB.PNG differ diff --git a/docs/docs/Images/Remove_future_treatments.png b/docs/docs/Images/Remove_future_treatments.png new file mode 100644 index 000000000..e20153d49 Binary files /dev/null and b/docs/docs/Images/Remove_future_treatments.png differ diff --git a/docs/docs/Images/Rig_login_time.png b/docs/docs/Images/Rig_login_time.png new file mode 100644 index 000000000..8eaa9c92a Binary files /dev/null and b/docs/docs/Images/Rig_login_time.png differ diff --git a/docs/docs/Images/Successful_data_transfer_complete_screen_in_OpenHumans.png b/docs/docs/Images/Successful_data_transfer_complete_screen_in_OpenHumans.png new file mode 100644 index 000000000..88659452d Binary files /dev/null and b/docs/docs/Images/Successful_data_transfer_complete_screen_in_OpenHumans.png differ diff --git a/docs/docs/Images/Terminus_add_new_host.png b/docs/docs/Images/Terminus_add_new_host.png new file mode 100644 index 000000000..ff9a8e175 Binary files /dev/null and b/docs/docs/Images/Terminus_add_new_host.png differ diff --git a/docs/docs/Images/Terminus_with_hosts.png b/docs/docs/Images/Terminus_with_hosts.png new file mode 100644 index 000000000..8d2e565aa Binary files /dev/null and b/docs/docs/Images/Terminus_with_hosts.png differ diff --git a/docs/docs/Images/access_1.png b/docs/docs/Images/access_1.png new file mode 100644 index 000000000..acf2f5243 Binary files /dev/null and b/docs/docs/Images/access_1.png differ diff --git a/docs/docs/Images/access_2.png b/docs/docs/Images/access_2.png new file mode 100644 index 000000000..24ce6f5eb Binary files /dev/null and b/docs/docs/Images/access_2.png differ diff --git a/docs/docs/Images/access_3.png b/docs/docs/Images/access_3.png new file mode 100644 index 000000000..5d79802b2 Binary files /dev/null and b/docs/docs/Images/access_3.png differ diff --git a/docs/docs/Images/access_4.png b/docs/docs/Images/access_4.png new file mode 100644 index 000000000..defcd5dd6 Binary files /dev/null and b/docs/docs/Images/access_4.png differ diff --git a/docs/docs/Images/access_5.png b/docs/docs/Images/access_5.png new file mode 100644 index 000000000..f5def4663 Binary files /dev/null and b/docs/docs/Images/access_5.png differ diff --git a/docs/docs/Images/access_6.png b/docs/docs/Images/access_6.png new file mode 100644 index 000000000..f193ed7f9 Binary files /dev/null and b/docs/docs/Images/access_6.png differ diff --git a/docs/docs/Images/access_7.png b/docs/docs/Images/access_7.png new file mode 100644 index 000000000..507e5ff64 Binary files /dev/null and b/docs/docs/Images/access_7.png differ diff --git a/docs/docs/Images/access_8.png b/docs/docs/Images/access_8.png new file mode 100644 index 000000000..922a2355a Binary files /dev/null and b/docs/docs/Images/access_8.png differ diff --git a/docs/docs/Images/access_ip.png b/docs/docs/Images/access_ip.png new file mode 100644 index 000000000..f8b88ba35 Binary files /dev/null and b/docs/docs/Images/access_ip.png differ diff --git a/docs/docs/Images/access_mac1.png b/docs/docs/Images/access_mac1.png new file mode 100644 index 000000000..c1282af09 Binary files /dev/null and b/docs/docs/Images/access_mac1.png differ diff --git a/docs/docs/Images/access_mac2.png b/docs/docs/Images/access_mac2.png new file mode 100644 index 000000000..67b09884d Binary files /dev/null and b/docs/docs/Images/access_mac2.png differ diff --git a/docs/docs/Images/access_mac3.png b/docs/docs/Images/access_mac3.png new file mode 100644 index 000000000..25de29597 Binary files /dev/null and b/docs/docs/Images/access_mac3.png differ diff --git a/docs/docs/Images/access_mac_no_exec.png b/docs/docs/Images/access_mac_no_exec.png new file mode 100644 index 000000000..35146b401 Binary files /dev/null and b/docs/docs/Images/access_mac_no_exec.png differ diff --git a/docs/docs/Images/access_mac_password.png b/docs/docs/Images/access_mac_password.png new file mode 100644 index 000000000..06825be59 Binary files /dev/null and b/docs/docs/Images/access_mac_password.png differ diff --git a/docs/docs/Images/access_mac_screen.png b/docs/docs/Images/access_mac_screen.png new file mode 100644 index 000000000..3038e917d Binary files /dev/null and b/docs/docs/Images/access_mac_screen.png differ diff --git a/docs/docs/Images/access_mac_sorry.png b/docs/docs/Images/access_mac_sorry.png new file mode 100644 index 000000000..94c284649 Binary files /dev/null and b/docs/docs/Images/access_mac_sorry.png differ diff --git a/docs/docs/Images/add_new_wifi.png b/docs/docs/Images/add_new_wifi.png new file mode 100644 index 000000000..b7cb124e9 Binary files /dev/null and b/docs/docs/Images/add_new_wifi.png differ diff --git a/docs/docs/Images/aggregating_logs.png b/docs/docs/Images/aggregating_logs.png new file mode 100644 index 000000000..5775cae74 Binary files /dev/null and b/docs/docs/Images/aggregating_logs.png differ diff --git a/docs/docs/Images/avahi-fix.png b/docs/docs/Images/avahi-fix.png new file mode 100644 index 000000000..ec8f8b4fb Binary files /dev/null and b/docs/docs/Images/avahi-fix.png differ diff --git a/docs/docs/Images/avahi-fix2.png b/docs/docs/Images/avahi-fix2.png new file mode 100644 index 000000000..4db58b633 Binary files /dev/null and b/docs/docs/Images/avahi-fix2.png differ diff --git a/docs/docs/Images/avahi.png b/docs/docs/Images/avahi.png new file mode 100644 index 000000000..b95667ad5 Binary files /dev/null and b/docs/docs/Images/avahi.png differ diff --git a/docs/docs/Images/avahi2.png b/docs/docs/Images/avahi2.png new file mode 100644 index 000000000..9dba2bb91 Binary files /dev/null and b/docs/docs/Images/avahi2.png differ diff --git a/docs/docs/Images/clone_oref0.png b/docs/docs/Images/clone_oref0.png new file mode 100644 index 000000000..c364f5865 Binary files /dev/null and b/docs/docs/Images/clone_oref0.png differ diff --git a/docs/docs/Images/cron_reboot.png b/docs/docs/Images/cron_reboot.png new file mode 100644 index 000000000..9e8997be6 Binary files /dev/null and b/docs/docs/Images/cron_reboot.png differ diff --git a/docs/docs/Images/dependencies_success.png b/docs/docs/Images/dependencies_success.png new file mode 100644 index 000000000..07136162f Binary files /dev/null and b/docs/docs/Images/dependencies_success.png differ diff --git a/docs/docs/Images/edit_network_scanner.png b/docs/docs/Images/edit_network_scanner.png new file mode 100644 index 000000000..f330e4839 Binary files /dev/null and b/docs/docs/Images/edit_network_scanner.png differ diff --git a/docs/docs/Images/error-messages.png b/docs/docs/Images/error-messages.png new file mode 100644 index 000000000..716da23b3 Binary files /dev/null and b/docs/docs/Images/error-messages.png differ diff --git a/docs/docs/Images/git-lock.png b/docs/docs/Images/git-lock.png new file mode 100644 index 000000000..e072323c2 Binary files /dev/null and b/docs/docs/Images/git-lock.png differ diff --git a/docs/docs/Images/gitter_marks.jpg b/docs/docs/Images/gitter_marks.jpg new file mode 100644 index 000000000..bba94a98e Binary files /dev/null and b/docs/docs/Images/gitter_marks.jpg differ diff --git a/docs/docs/Images/gitter_pm.jpg b/docs/docs/Images/gitter_pm.jpg new file mode 100644 index 000000000..85c655352 Binary files /dev/null and b/docs/docs/Images/gitter_pm.jpg differ diff --git a/docs/docs/Images/hashed_API.png b/docs/docs/Images/hashed_API.png new file mode 100644 index 000000000..3ea1d2b1f Binary files /dev/null and b/docs/docs/Images/hashed_API.png differ diff --git a/docs/docs/Images/hotspot_running.png b/docs/docs/Images/hotspot_running.png new file mode 100644 index 000000000..0dbc738ab Binary files /dev/null and b/docs/docs/Images/hotspot_running.png differ diff --git a/docs/docs/Images/ifconfig_example.png b/docs/docs/Images/ifconfig_example.png new file mode 100644 index 000000000..ca0979e90 Binary files /dev/null and b/docs/docs/Images/ifconfig_example.png differ diff --git a/docs/docs/Images/localhost.png b/docs/docs/Images/localhost.png new file mode 100644 index 000000000..31850c380 Binary files /dev/null and b/docs/docs/Images/localhost.png differ diff --git a/docs/docs/Images/log_destinations.png b/docs/docs/Images/log_destinations.png new file mode 100644 index 000000000..9daacf07c Binary files /dev/null and b/docs/docs/Images/log_destinations.png differ diff --git a/docs/docs/Images/log_filters.png b/docs/docs/Images/log_filters.png new file mode 100644 index 000000000..003137183 Binary files /dev/null and b/docs/docs/Images/log_filters.png differ diff --git a/docs/docs/Images/looped.jpg b/docs/docs/Images/looped.jpg new file mode 100644 index 000000000..a72968117 Binary files /dev/null and b/docs/docs/Images/looped.jpg differ diff --git a/docs/docs/Images/mmtune.png b/docs/docs/Images/mmtune.png new file mode 100644 index 000000000..c0964bcf8 Binary files /dev/null and b/docs/docs/Images/mmtune.png differ diff --git a/docs/docs/Images/network-filter.png b/docs/docs/Images/network-filter.png new file mode 100644 index 000000000..c4f1a14bf Binary files /dev/null and b/docs/docs/Images/network-filter.png differ diff --git a/docs/docs/Images/network_list_in_rig.png b/docs/docs/Images/network_list_in_rig.png new file mode 100644 index 000000000..b1bfe7838 Binary files /dev/null and b/docs/docs/Images/network_list_in_rig.png differ diff --git a/docs/docs/Images/network_scanner.png b/docs/docs/Images/network_scanner.png new file mode 100644 index 000000000..28191f976 Binary files /dev/null and b/docs/docs/Images/network_scanner.png differ diff --git a/docs/docs/Images/npm_screenshot.png b/docs/docs/Images/npm_screenshot.png new file mode 100644 index 000000000..7f770a919 Binary files /dev/null and b/docs/docs/Images/npm_screenshot.png differ diff --git a/docs/docs/Images/otg.jpg b/docs/docs/Images/otg.jpg new file mode 100644 index 000000000..d723d64dd Binary files /dev/null and b/docs/docs/Images/otg.jpg differ diff --git a/docs/docs/Images/papertrail.png b/docs/docs/Images/papertrail.png new file mode 100644 index 000000000..40885c5a0 Binary files /dev/null and b/docs/docs/Images/papertrail.png differ diff --git a/docs/docs/Images/papertrail_home_buttons.png b/docs/docs/Images/papertrail_home_buttons.png new file mode 100644 index 000000000..0cc984298 Binary files /dev/null and b/docs/docs/Images/papertrail_home_buttons.png differ diff --git a/docs/docs/Images/papertrail_host.png b/docs/docs/Images/papertrail_host.png new file mode 100644 index 000000000..10e709d4d Binary files /dev/null and b/docs/docs/Images/papertrail_host.png differ diff --git a/docs/docs/Images/personal_hotspot.png b/docs/docs/Images/personal_hotspot.png new file mode 100644 index 000000000..fe08fecb0 Binary files /dev/null and b/docs/docs/Images/personal_hotspot.png differ diff --git a/docs/docs/Images/poor_tuning.png b/docs/docs/Images/poor_tuning.png new file mode 100644 index 000000000..3de187509 Binary files /dev/null and b/docs/docs/Images/poor_tuning.png differ diff --git a/docs/docs/Images/save_filter.png b/docs/docs/Images/save_filter.png new file mode 100644 index 000000000..170d6c76f Binary files /dev/null and b/docs/docs/Images/save_filter.png differ diff --git a/docs/docs/Images/scan_settings.png b/docs/docs/Images/scan_settings.png new file mode 100644 index 000000000..8ff35c126 Binary files /dev/null and b/docs/docs/Images/scan_settings.png differ diff --git a/docs/docs/Images/setup_entries.png b/docs/docs/Images/setup_entries.png new file mode 100644 index 000000000..eee7bb497 Binary files /dev/null and b/docs/docs/Images/setup_entries.png differ diff --git a/docs/docs/Images/subg_rfspy.png b/docs/docs/Images/subg_rfspy.png new file mode 100644 index 000000000..a8c199bd4 Binary files /dev/null and b/docs/docs/Images/subg_rfspy.png differ diff --git a/docs/docs/Images/subg_rfspy2.jpg b/docs/docs/Images/subg_rfspy2.jpg new file mode 100644 index 000000000..8728fae32 Binary files /dev/null and b/docs/docs/Images/subg_rfspy2.jpg differ diff --git a/docs/docs/Images/successful_network_scanner.png b/docs/docs/Images/successful_network_scanner.png new file mode 100644 index 000000000..e7a3ea36e Binary files /dev/null and b/docs/docs/Images/successful_network_scanner.png differ diff --git a/docs/docs/Images/terminus.png b/docs/docs/Images/terminus.png new file mode 100644 index 000000000..940b57ded Binary files /dev/null and b/docs/docs/Images/terminus.png differ diff --git a/docs/docs/Images/versions.jpg b/docs/docs/Images/versions.jpg new file mode 100644 index 000000000..bae33d3c3 Binary files /dev/null and b/docs/docs/Images/versions.jpg differ diff --git a/docs/docs/Resources/faq.md b/docs/docs/Resources/faq.md index ea92000ba..6eaf0d020 100644 --- a/docs/docs/Resources/faq.md +++ b/docs/docs/Resources/faq.md @@ -11,13 +11,7 @@ glucose within the desired range through adjusting hormone doses. There are numerous different types of closed loop systems, ranging from simple basal suspend systems designed to mitigate extreme hypoglycemia to dual -hormone, fully automated systems. The JDRF [Artificial Pancreas Project -Plan](http://jdrf.org/research/treat/artificial-pancreas-project/) page -provides an overview of the current commercial and academic generation-based -approach. Several commercial systems are currently in development; see -[Commercial APS Efforts](../Resources/other-projects#commercial-aps-efforts) for more -information. - +hormone, fully automated systems. \#OpenAPS is focused on a single-hormone hybrid closed-loop system. This is a system that uses only insulin (no glucagon) and still requires user input for @@ -27,10 +21,16 @@ page. ## What does an OpenAPS closed loop look like? -While there are numerous variations, this particular setup shows the key components—namely, a continuous glucose monitor, an insulin pump, a method for communicating with the pump (here, a CareLink USB stick), and a controller (here, a Raspberry Pi). Also shown is a Pebble watch, which can be used for monitoring the status of the OpenAPS. Not shown is the power supply (off-screen) and a way to interact with and program the Raspberry Pi, typically a computer or smartphone. +There are numerous variations of OpenAPS setups. + +This particular setup below is an original setup, similar to what was first used to close the loop by DIYers in late 2014/early 2015. The picture below shows the key components—namely, a continuous glucose monitor, an insulin pump, a method for communicating with the pump (here, a CareLink USB stick), and a controller (here, a Raspberry Pi). Also shown is a Pebble watch, which can be used for monitoring the status of the OpenAPS. Not shown is the power supply (off-screen) and a way to interact with and program the Raspberry Pi, typically a computer or smartphone. ![Example OpenAPS Setup](../IMG_1112.jpg) +The most common setup as of late 2015/early 2016 has evolved to be a smaller rig, with similar components. The Edison chip is the mini-computer, and the Explorer Board hosts it along with the radio stick to communicate with the CGM and pump. + +![Example OpenAPS "Explorer Board" rig](../Images/Explorer_Board_rig.png) + For more details on the exact hardware required to build an OpenAPS, see the -[Hardware](../walkthrough/phase-0/hardware.md) section. +[Hardware](../walkthrough/phase-0/hardware/hardware.md) section. diff --git a/docs/docs/Resources/glossary.md b/docs/docs/Resources/glossary.md index 7373ac2b4..2fe099ced 100644 --- a/docs/docs/Resources/glossary.md +++ b/docs/docs/Resources/glossary.md @@ -1,6 +1,13 @@ # Glossary -APS - artificial pancreas system. Sometimes also referred to as "AP" + +## AP and OpenAPS high level terminology + +APS or AP - artificial pancreas system. A term for a closed-loop automated insulin delivery system in which temporary basal adjustments are used to maintain BG levels at a user-specified target range. + +closed-loop - closed-loop systems make automatic adjustments to basal delivery, without needing user-approval, based on an algorithm. + +open-loop - open-loop systems will suggest recommended adjustments to basal delivery, but will require specific user-approval prior to implementing. CGM - continuous glucose monitor, a temporary glucose sensor that is injected into your skin (the needle is removed) for 3-7 days and, with twice a day calibrations, provides BG readings approximately every 5 minutes. @@ -10,6 +17,8 @@ openaps - the core suite of software tools under development by this community for use in an OpenAPS implementation +oref0 - "reference design implementation version 0" of the OpenAPS reference design. Aka, the key algorithm behind OpenAPS. + BG - Blood Glucose BGI (BG Impact) - The degree to which BG "should" be rising or falling. OpenAPS calculates this value to determine the 'Eventual BG'. This value can be used to make other high/low basal decisions in advanced implementations of OpenAPS. @@ -18,22 +27,25 @@ Basal - baseline insulin level that is pre-programmed into your pump and mimics the insulin your pancreas would give throughout the day and night -IOB - Insulin On Board, or insulin active in your body. Note that most commercially available pumps calculate IOB based on bolus activity only. Usually, but not always, Net IOB is what Nightscout displays as 'IOB'. +IOB - Insulin On Board, or insulin active in your body. Note that most commercially available pumps calculate IOB based on bolus activity only. Usually, but not always, Net IOB is what Nightscout displays as 'IOB'. While what's displayed in your NS IOB pill may match what IOB is in your current loop, it's probably a good practive not to rely on this pill alone for knowing how much IOB. -Net IOB - amount of insulin on board, taking into account any adjusted (higher or lower) basal rates as well as bolus activity. +Net IOB - amount of insulin on board, taking into account any adjusted (higher or lower) basal rates (see Basal IOB below) as well as bolus activity. -Basal IOB - difference (positive or negative) between amount of insulin on board delivered via basal rates, and the amount specified by the profile basal rate. +Basal IOB - difference (positive or negative) between amount of insulin on board delivered via basal rates (including any temporary basal rates), and the amount specified by your standard profile basal rate. Treatments IOB - amount of insulin on board delivered via boluses. Reported by some pumps as 'active insulin'. -DIA - duration of insulin action, or how long the insulin is active in your body. (Ranges 3-6 hours typically) +DIA - duration of insulin action, or how long the insulin is active in your body (Ranges 3-6 hours typically). -CR - carb ratio, or carbohydrate ratio - the amount of carbohydrates for one unit of insulin. Example: 1 u of insulin for 10 carbs +CR - carb ratio, or carbohydrate ratio - the amount of carbohydrates that are covered by one unit of insulin. Example: 1 u of insulin for 10 carbs. -ISF - insulin sensitivity factor - the amount of insulin that drops your BG by a certain amount. Example: 1 u of insulin for 40 mg/dL (2.2 mmol/L) +ISF - insulin sensitivity factor - the expected decrease in BG as a result of one unit of insulin. +Example: 1 u of insulin for 40 mg/dL (2.2 mmol/L) NS, or Nightscout - a cloud-based visualization and remote-monitoring tool. +## OpenAPS specific terminology + OpenAPS Nightscout Status Messages appear when the OpenAPS plugin is enabled. * Looping ↻ - Success; Temp basal rate has been suggested. * Enacted ⌁ - Success; Temp basal rate has been set. @@ -49,4 +61,6 @@ Exp. Delta - expected BG delta right now, considering all OpenAPS inputs (IOB, COB, etc). -RileyLink (RL) - A custom designed Bluetooth Smart (BLE) to sub-1GHz module - it can be used to bridge any BLE capable smartphone to the world of sub-1GHz devices. This device is focused on talking to Medtronic insulin pumps and sensors. +snoozeBG - predicted value of blood glucose adjusted for bolussnooze IOB. SnoozeBG will never exceed EventualBG. + +predBGs - predicted blood sugars over next N many minutes based on openAPS logic, in 5 minute increments diff --git a/docs/docs/Resources/history.md b/docs/docs/Resources/history.md index 968df9495..314ade833 100644 --- a/docs/docs/Resources/history.md +++ b/docs/docs/Resources/history.md @@ -10,6 +10,6 @@ In light of the success of #DIYPS closed loop and other simple APS systems built \#OpenAPS is not intended to be a “set and forget” APS system. To maximize safety, a system designed from OpenAPS only doses basal insulin. Users still need to bolus for meals as they do today. However, OpenAPS can identify deviations from predicted blood sugar changes and change basal rates to prevent dangerous drops or rises that deviate from expected behavior. -After launching in early 2015, there are at least 44 known instances of OpenAPS that are live and running (as of March 23, 2016), with several others in development and testing phases. For anecdotal experiences from those running OpenAPS, watch the [#OpenAPS hashtag on Twitter](https://twitter.com/search?f=tweets&vertical=default&q=%23OpenAPS&src=typd) and also check out the [Resources](./index) section for a list of those sharing their experiences publicly. +After OpenAPS was launched in early 2015, there are now more than ~215 known instances of DIY closed loopers using a variety of open source diabetes technologies (as of Feb 1, 2016). For anecdotal experiences from those running OpenAPS, watch the [#OpenAPS hashtag on Twitter](https://twitter.com/search?f=tweets&vertical=default&q=%23OpenAPS&src=typd) and also check out the [Resources](./index) section for a list of those sharing their experiences publicly. In early 2016, progress continues to be made with the iteration of several hardware options, in addition to multiple new software features. diff --git a/docs/docs/Resources/index.rst b/docs/docs/Resources/index.rst index e51631762..b821fdc9a 100644 --- a/docs/docs/Resources/index.rst +++ b/docs/docs/Resources/index.rst @@ -11,8 +11,6 @@ Resources troubleshooting wifi history - other-projects faq glossary - - + switching-between-DIY-systems diff --git a/docs/docs/Resources/my-first-pr.md b/docs/docs/Resources/my-first-pr.md index 1af531bf7..16b48aad6 100644 --- a/docs/docs/Resources/my-first-pr.md +++ b/docs/docs/Resources/my-first-pr.md @@ -1,39 +1,58 @@ ### Making your first PR (pull request) -At some point it will be suggested to you that you make a PR. PR is short for pull request. -It's actually not too hard to do one and it is a great way to contribute. This documentation is here because people like you made PRs. +At some point it will be suggested that you make a PR. PR is short for pull request, and it is a way of adding or editing information stored in GitHub. It's actually not too hard to do one and it is a great way to contribute. This documentation is here because people like you made PRs. Don't worry about making a mistake or somehow editing the wrong documents. There is always a review process before changes are merged into the "formal" OpenAPS documentation repository. You can't mess up the originals through any accidents in the PR process. The general process is: -* The general idea is to make edits and improvements to code or document by making a copy of the repository you'd like to change. -* Double-check that your edits look good to you on your copy. -* Make a few notes for what you did so people can understand why you made the change. -* Then do a pull request, which is to ask the administrators of the repository to pull your changes back into the appropriate branch of the main repository. -* They will do a quick review and merge your changes in, or comment if there are errors that need fixing first, or if it's a large enough change that it needs to go to another branch like dev for further work before being merged to master. +* Make edits and improvements to code or documentation by editing the existing content. +* Double-check that your edits look good to you. +* Make a few notes of what's changed so people may understand the edits. +* Create a pull request, which asks the administrators to use your changes. +* They will do a review and either (1)merge your changes, (2)comment back to you about your changes, or (3)start a new document with your changes. -OK, let's get started. For our example we are going to make an edit to the openaps docs repository. This does NOT need to be done in the linux environment. This can be done on any Windows PC. +OK, let's get started. For our example we are going to make an edit to the openaps docs. This does NOT need to be done in the linux environment on your rig. This can be done on any Windows PC, Mac, etc. (any computer with Internet access). 1. Go to https://github.com/openaps/docs and hit Fork in the upper right to make your own copy of the repository. -2. Github will automatically take you to your copy (notice in the address bar you are now in your own personal github directory) -3. Now we need to find the file we want to edit. Click through the directory structure until you find and are looking at the content of the file you want to change. -4. Next, press the pencil icon in the upper right next to the trash can icon. -5. Make edits to the file as necessary. -6. Next we want to commit our changes. But first we should note what we changed and why. Scroll to the bottom of the page and type your comments in the text field that reads, "Add an optional extended description..." Be sure to include at least one line explaining the reason you made your changes. -7. Click the green "Commit changes" button. -8. Now look and make sure everything you changed looks like you meant it to (no typos, etc). If you see any problems, go back and edit again and save again. - -We now have an improved file that we want to be pulled back into the openaps/docs repository at https://github.com/openaps/docs - -1. Go to https://github.com/[YOUR_GITHUB_USERNAME]/docs - * Or you can go to https://github.com and then click on "docs" in the "Your repositories" section in the lower right. Both methods will get you to the right place. -2. Click the "New pull request" button -3. Under the Comparing Changes heading, click "compare across forks". -4. Set up the the branches you are targeting. The easiest way of thinking about the branch range is this: the base branch is where you think changes should be applied, the head branch is what you would like to be applied. -5. So, choose the base fork as openaps/docs and then the base as master (or whichever branch you edited). The head fork is going to be youraccount/docs and the base as master (unless this is a large change that needs to go to dev first). -![Pull Request](../Images/Pull_Request.png) -6. It should show the list of changes you made. If not, you did something wrong so stop here and ask for help. If the list looks like your changes then put a note in there to what the overarching reason for the changes are (in your case you only made one, but you could have made a bunch). Click the green "Create pull request" button. -7. Type a title for your pull request, and then type a description in the "Write" text field. Click the green "Create pull request" button. - -Your entry will now be in a list of PR's that the team will review and potentially give feedback on before committing to the main documentation for openaps! +![Fork repo](../Images/PR0.png) +2. Go to http://openaps.readthedocs.io/en/latest/docs/introduction/index.html or similar and navigate to the page you want to edit. Click on the black box at bottom left of page with the green word "v: latest" or similar. In the pop up window that appears, click the word "edit" for editing in GitHub. +![edit doc](../Images/PR1.png) +Or you can click on the "Edit in Github" link in the upper right corner, and then click the pencil icon that appears in the top bar of the page contents to be edited. +![RTD io](../Images/PR2.png) +3. Either of the options in Step 2 will create a new branch in YOUR repository where your edits will be saved. Make your edits to the file. +![Edit branch](../Images/PR3.png) +4. You have been working in the "<>Edit file" tab. Select the "Preview changes" tab for a fresh look to make sure everything you changed looks like you meant it to (typpos sic.). If you see a needed improvement, go back to the edit tab to make more improvements. +![preview mode](../Images/PR5.png) +5. When you have finished your edits, scroll to the bottom of the page. In the box at the bottom, provide your comments in the text field that reads, "Add an optional extended description...". The default title has the file name. Try to include a sentence explaining the __reason__ for the change. Relating the reason helps reviewers understand what you are attempting to do with the PR. +![commit comments](../Images/PR4.png) +6. Click the green "Propose file changes" or "Commit changes" button. In the page that appears click "Create Pull Request" and again in the next page click "Create Pull Request". +![create pull request](../Images/PR6.png) +7. That completes the opening of a pull request, PR. GitHub assigns the PR a number, located after the title and a hash mark. Return to this page to check for feedback (or, if you have Github notifications emailed to you, you will get emails notifying you of any activity on the PR). The edit will now be in a list of PR's that the team will review and potentially give feedback on before committing to the main documentation for openaps! If you want to check on the progress of the PR, you can click on the bell logo in the upper right corner of your GitHub account and see all your PRs. +![PR tracking](../Images/PR7.png) Congrats, you made your first contribution! -PS, your fork will still be sitting on your own personal github account. After you get a notification that your PR has been merged, you can delete your branch/fork if you are done with it. In the future, be sure to pull a fresh copy from github.com/openaps/docs before making new edits. +PS, your fork and branch will still be sitting on your own personal GitHub account. After you get a notification that your PR has been merged, you can delete your branch if you are done with it (Step 8's notification area will provide a link to delete the branch once it has been closed or merged). For future edits, if you follow this procedure the edits will always start with an updated version of the openaps repositories. If you choose to use another method to start a PR request (e.g., editing starting from your forked repo's master branch as the starting point), you will need to ensure your repo is up-to-date by performing a "compare" first and merging in any updates that have happened since you last updated your fork. Since people tend to forget to update their repos, we recommend using the PR process outlined above until you get familiar with performing "compares". + +### Advanced tips for adding multiple images to documentation + +If you are planning to make a lot of edits, including adding images to help illustrate parts of the documentation (thank you!), you may want to take the following approach: + +* As you go and save screenshots, rename the screenshots to a descriptive name - but try not to use spaces as that confuses Github. Instead, use underscores. I.e. Example_batch_images_upload.png rather than "Example batch images upload.png". + +* You can upload images in batches easily by: + + 1. Navigate to the images folder (https://github.com/openaps/docs/tree/master/docs/docs/Images - but make sure you are in your fork/copy of the docs Images folder to be able to do this (replace "openaps" in the URL with your github username)). + + 2. Click in the upper right corner where it says "Upload files" + + 3. Drag and drop your images into the screen + + 4. Commit these to your branch + + 5. Now, you can look for the URL/relative path of each file (example, you can see [this individual image has it's own URL and path](https://github.com/openaps/docs/blob/master/docs/docs/Images/Example_batch_images_upload.png) and use that to refer to when adding images into a page in the documentation. + + 6. To see examples of how to add the images, you can look at the "raw" code of a page to see an example from a page that already has the images embedded successfully. The main thing is to have a plain text description, followed by a link with a relative path to the image, like this: `![Example of uploading images in batches](../Images/Example_batch_images_upload.png)` + + (That code is exactly how the image below is embedded to be displayed.) + +![Example of uploading images in batches](../Images/Example_batch_images_upload.png) + + 7. Now, once done adding images/making adjustments, you can submit a PR back to the master copy of the OpenAPS docs. diff --git a/docs/docs/Resources/other-projects.md b/docs/docs/Resources/other-projects.md deleted file mode 100644 index 4a8e4240d..000000000 --- a/docs/docs/Resources/other-projects.md +++ /dev/null @@ -1,50 +0,0 @@ -# Other People, Projects & Tools - -## People - -These people have publicly identified as either supporting or running OpenAPS implementations and are sharing their experiences publicly. See below links. - -Dana Lewis - blogs about personal experience at [DIYPS.org](http://DIYPS.org) and shares on Twitter as [@DanaMLewis](http://twitter.com/danamlewis). - -Scott Leibrand - contributes to Dana's instance of OpenAPS, and is on Twitter as [@ScottLeibrand](http://twitter.com/scottleibrand). (Scott and Dana collectively maintain [OpenAPS.org](http://openaps.org).) - -Ali Mazaheri - shares on Twitter as [@AliMazaheri](http://twitter.com/alimazaheri) - -Chris Hannemann - shares on Twitter as [@hannemannemann](http://twitter.com/hannemannemann) - -Nate Racklyeft - shares on Twitter as [@LoudNate](http://twitter.com/loudnate) - -Ben West - author of decoding-carelink and much of the openaps toolkit - on Twitter as [@bewestisdoing](http://twitter.com/bewestisdoing) - - -The following provide links to other related projects as well as commercial artificial pancreas work underway. - -## APS & Diabetes Data Tools - -* **\#DIYPS** (http://diyps.org/) - the project and personal experience that inspired #OpenAPS - -* **simPancreas** (http://bustavo.com/category/simpancreas/) - another DIY closed loop, although not #OpenAPS related - -* **NightScout** (http://www.nightscout.info/) - a visualization and remote monitoring tool for people with diabetes using CGM - -* **xDrip** (http://stephenblackwasalreadytaken.github.io/xDrip/) - a DIY combination of a device and a software application which receives data sent out by a Dexcom G4 CGM transmitter/sensor and displays the glucose readings on an Android phone - -* **RileyLink** (https://github.com/ps2/rileylink)
-A custom designed Bluetooth Smart (BLE) to 916MHz module. It can be used to bridge any BLE capable smartphone to the world of 916Mhz based devices. This project is focused on talking to Medtronic insulin pumps and sensors. There is also a Gitter channel dedicated to discussion on the RileyLink [here](https://gitter.im/ps2/rileylink). - -* **Tidepool** (http://tidepool.org/ and https://github.com/tidepool-org)
-Notably, work on Boston University iLet UI (https://github.com/tidepool-org/bionicpancreas) and open-source tools for visualization. - -* **Perceptus** (http://perceptus.org) - more data visualization tools - - -# Commercial APS Efforts - -There are currently several commercial closed-loop products in development by old and new companies in the diabetes treatment space. These include: - -* [Medtronic MiniMed 640G](https://www.medtronic-diabetes.com.au/pump-therapy/640g) -* [Medtronic MiniMed 670G](http://diatribe.org/drugdevice-name/medtronic-minimed-670g) -* [TypeZero Technologies](http://www.typezero.com/) -* [Bigfoot Biomedical](http://www.bigfootbiomedical.com/) -* [Boston University's iLet, formerly known as the "Bionic Pancreas"](http://sites.bu.edu/bionicpancreas/) - diff --git a/docs/docs/Resources/switching-between-DIY-systems.md b/docs/docs/Resources/switching-between-DIY-systems.md new file mode 100644 index 000000000..17b921375 --- /dev/null +++ b/docs/docs/Resources/switching-between-DIY-systems.md @@ -0,0 +1,160 @@ +# Tips for switching from another DIY closed loop system to OpenAPS rig (or running both) + +**Note:** This is a high level switchover cheat sheet, and will primarily discuss Loop and OpenAPS comparisons (but may be relevant for helping you understand the differences of OpenAPS from other DIY systems as well). For the purposes of this Loop-to-OpenAPS switchover cheat sheet, we’re going to assume a few things and therefore are not covering all the possible options for setting up an OpenAPS rig. If you want to find out options that exist beyond the assumptions in this page, please refer back to the [main OpenAPS documentation pages](http://openaps.readthedocs.org/en/latest/). In fact, please refer back to the main documentation sections anyway. They really have a lot of information you’ll find helpful. This page is more of a quick cheat sheet to help you get the high levels rather than a thorough setup guide (that’s what the OpenAPS documentation is for). There will be links throughout to the relevant OpenAPS documentation for more details when referenced. + +### Other things you should know before starting: + +* OpenAPS is similar to Loop (they’re both temp basal-based DIY closed loops), but different, even beyond the hardware. The algorithm (looping code) of OpenAPS is referred to as “[oref0](https://github.com/openaps/oref0/)”. You can look at that code (it’s written to be pretty straight forward - [see this example](https://github.com/openaps/oref0/blob/master/lib/determine-basal/determine-basal.js#L346), and the [glossary](http://openaps.readthedocs.io/en/latest/docs/Resources/glossary.html) may be helpful as well), but you can also read this plain language “[reference design](https://openaps.org/reference-design/)” that guides how OpenAPS was built. +* _Paying it forward_: OpenAPS is part of the #WeAreNotWaiting movement...built 100% by volunteers...and that also includes the documentation! If you spot something in the documentation that needs fixing or improving, please flag it and/or submit an edit yourself to fix the documentation then and there! + * This is called “making a pull request” or “making a PR”, which presents your edit for someone to review, approve, and update the overall documentation - which means everyone can use your fix moving forward! We all have a responsibility to keep adding to and improving the documentation. You can find [a guide to creating a pull request/submitting your edit here](http://openaps.readthedocs.io/en/latest/docs/Resources/my-first-pr.html), and if you ask, we’re happy to help answer questions as you do your first pull request. +* **You can do this**. + * One user estimates setting up OpenAPS takes only 20 mouse clicks; 29 copy and paste lines of code; 10 entries of passwords or logins; and probably about 15-20 random small entries at prompts (like your NS site address or your email address or wifi addresses). So if you can copy and paste, you’ll be able to do this! + +--- + +If you’re coming to try OpenAPS from a Loop system, there’s going to be some pretty obvious differences. And it starts with “building” the system. + +### Main Hardware Differences: + + + + + + + + + + + + + + + + + + + + + + + + + +
Built usingBrains sitCommunications reside
LoopxCode on an Apple computeron your iPhoneon the Rileylink
OpenAPSany computeron the “rig” (can be multiple kinds of rigs)on the rig (usually with a built-in radio stick)
+ +**Loop** is built using XCode app on an Apple computer. The brains of the system sit on your iPhone. The communications reside in the RileyLink, acting as a communicator between the iPhone and pump. + +**OpenAPS** is built using “script” commands (can be wide variety of computers that are used). The brains and communications of the system reside on a “rig” which acts as a mini-computer. + +### Assumptions for this Cheat Sheet Guide + +1. Using an explorer board and Edison +2. Using an Apple computer +3. Using a Loop-compatible Medtronic pump (note - OpenAPS can actually use an additional set of pumps, the x12 series, although it requires one extra step not documented here. See this page in OpenAPS docs for all compatible pumps.) + +### High Level Recommended Rig parts list + +See [this short list for what to buy for an Edison/Explorer Board OpenAPS rig.](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/edison-explorer-board-Mac.html#high-level-recommended-rig-parts-list ) + +### Getting started on OpenAPS - the setup links + +#### Building your Rig: +* [Start here for the Mac version]( http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/edison-explorer-board-Mac.html ) (with pictures!) +* ([Reference this page](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/setup-edison.html ) if you’re using any other type of computer to build.) + +#### Flashing your rig: +* [For Mac](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/edison-explorer-board-Mac.html#preparing-flashing-the-edison) (with pictures!) +* ([For other computers.](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/setup-edison.html)) + +#### Nightscout +* We highly recommend Nightscout. Go to [nightscout.info](http://nightscout.info) if you have not yet setup +* If you’re already on Nightscout, you just need to add openaps, like you did Loop, to enable the OpenAPS pill. You will also want to enable the OpenAPS forecast line(s) when you switch to an OpenAPS rig. +* [See this page for more details about Nightscout and OpenAPS]( http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-1/index.html ) + +#### Installing oref0/”installing the loop” +* [Existing instructions for this (Phase 2 of OpenAPS documentation) are here.](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/index.html) + +#### Personalizing your loop: +* [Phase 3 instructions are here.](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/index.html) + +## The big differences between Loop and OpenAPS: + +### Targets and algorithm differences + +* Loop pulled targets from the app. OpenAPS pulls targets from the pump. Here’s [more detail on the data OpenAPS pulls and how it outputs data for you to understand the algorithm in action](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/Understand-determine-basal.html). +* Loop has temporary targets available by using the workout mode in the Loop app. OpenAPS can have [multiple temp targets](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-4/advanced-features.html#eating-soon-and-activity-mode-temporary-targets) (i.e. Eating Soon and Workout, etc., and can be set via the Nightscout Care Portal if the rig is online, and via [IFTTT/Alexa/pebble/scheduled in advance/location based triggers](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-4/ifttt-integration.html). +* OpenAPS has no bolus momentum or safety guard that prevent boluses; but has other key safety settings (see below) + +### “MaxIOB” and other safety settings + +#### MaxIOB +* This is the max cap of how much "extra basal IOB" you want to allow the loop to add, above and beyond any regular basal and bolus IOB. In other words, the amount of high temp basal IOB your loop will be allowed to carry. It is not the same as a max basal rate. The default setting is 0, but if you’re coming from Loop, you’re probably ok starting with something other than 0 for maxIOB. If you've been running successfully on Loop, you can probably put in something like half your max basal, or 1-2x your regularly scheduled basal. So if your normal basal is 0.5U/hr, and your max basal that you let Loop give is 2U/hr, starting with a max IOB of 1U would allow OpenAPS to give the max basal for about 45 minutes before backing off once basal IOB hits 1U. +* After you get comfortable with how OpenAPS operates, you can easily [(here's how)](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html#editing-your-preferences-json) update this number later. + +#### Other safety settings +* In addition to maxIOB, there are other basal-related safety caps built into OpenAPS to help protect you. These are to prevent people from getting into dangerous territory by setting excessively high max temp basals before understanding how the algorithm works. There are default values provided when the OpenAPS loop is first built; most people will never need to adjust these and are instead more likely to need to adjust other settings if they feel like they are “running into” or restricted by these safety caps. If you do want to adjust these default values, they are located in the same preferenes file as linked in the max-iob discussion above. **NOTE:** OpenAPS's loop will use the LOWEST of the following three values to cap your temp basal rate, to make sure you don’t get a disproportionate amount of insulin. + * **“Max Basal”** refers to the max basal set on the pump. (If you change this, it will be read in the next time your rig pulls pump settings.) + * **“Max Daily Safety Multiplier”** limits the temp basal set by OpenAPS loop to be a multiplier of your HIGHEST regularly-scheduled basal rate in the pump. The default setting for this multiplier is 3x...meaning no more than three times your maximum programmed basal rate for the day. If someone tells you your basal is capped by the “3x max daily; 4x current” for safety caps, this is what they'd be referring to. + * **“Max Current Basal Safety Multiplier”:** limits the temp basal set by OpenAPS loop to be a multiplier of your CURRENT regularly-scheduled basal rate in the pump. The default setting for this multiplier is 4x...meaning no more than four times your current programmed basal rate. +* Read about [all of the other optional safety settings here](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html#understanding-your-preferences-json). + +### Parents in particular may want to review the optional settings + +* Parents should [read this blog post by Katie DiSimone for a parent's perspective about various pros/cons](http://seemycgm.com/2017/02/01/loop-vs-openaps/) for parents and kids evaluating DIY closed loop systems. +* **Override the high target with the low** ([see this explanation](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html#override-high-target-with-low) for enabling this feature) + * This makes it easier for secondary caregivers (like school nurses) to do conservative boluses at lunch/snack time, and allow the closed loop to pick up from there. The secondary caregiver can use the bolus wizard, which will correct down to the high end of the target; and setting this value in preferences to “true” allows the closed loop to target the low end of the target. Based on anecdotal reports from those using it, this feature sounds like it’s prevented a lot of (unintentional, diabetes is hard) overreacting by secondary caregivers when the closed loop can more easily deal with BG fluctuations. +* **Carb ratio adjustment ratio** ([see this explanation](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html#carbratio-adjustmentratio) for enabling this feature) + * If parents would prefer for secondary caregivers to bolus with a more conservative carb ratio, this can be set so the closed loop ultimately uses the correct carb amount for any needed additional calculations. + +### Connectivity + +* Loop works offline automatically; but may often need tuning and fixing if you go out of range and come back in range. +* OpenAPS needs some tricks to maximize connectivity (see below), but tends to resume working correctly once you come back into range without having to do anything special. + * [Bluetooth tethering](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-4/bluetooth-tethering-edison.html) is one good option; as soon as you walk out of wifi range, it can automatically bluetooth tether to your phone to get connectivity + * Mifi is one good option, if you travel and are without wifi networks, as it will provide a network without draining your iPhone battery. Mifi systems typically use your cell phone data plan and needs cell data coverage (3g or 4g LTE). + * You can add ([here's how](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/accessing-your-rig.html)) your school or work or as many locations as you have as “known” wifi networks so your rig will automatically connect to the wifi in these places. You may want to contact the school before attempting to connect to their wifi network to see if you need any special accomodations in a 504 plan or IT department involvement to allow the rig to connect. +* OpenAPS will also default to always setting a temp basal (this can be turned off; [see description here](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html#skip-neutral-temps)), which means it’ll be easier to look down at the pump and see if a temp basal is active to know that the loop has been working recently. +* The existing SkyLoop watchface for Pebble watches works seamlessly with OpenAPS looping. No changes are needed if you plan to try OpenAPS or Loop. + +### Carbs +* Loop requires carb and absorption time inputs through the app AND you must bolus from the Loop app or Apple watch. Carbs can be read from the pump if they are entered by pump's bolus wizard, but boluses cannot be read from the pump by Loop app. +* OpenAPS: no absorption time entries required for meals. You bolus directly from the pump (either easy bolus button, or using bolus wizard), and carbs can be entered via the pump or via Nightscout Care Portal (or via Pebble, Alexa, etc. if you set that up). Nightscout's bolus calculator can also serve to calculate a meal bolus as it tracks IOB from temp basals set by OpenAPS (you need to keep your basal profile current for accurate IOB tracking). + +### Boluses and how OpenAPS gets pump history +* Loop users must bolus from Loop app or Apple watch. Loop tracks IOB through reservoir volume changes as the default, and will fallback to the pump's event history in the event reservoir readings aren't continuous. +* OpenAPS users bolus from the pump (either bolus wizard, or easy bolus button). OpenAPS will read the information about the bolus and other insulin activity based on the pump’s event history. + * The pros of this means you won’t have to do anything special for pump rewinds/primes/site changes. OpenAPS will also provide treatment notes on your Nightscout site showing pump events such as suspensions, bolus wizard changes, basal profile edits, and primes. + * The downside of this means you DO need to set a temp basal to 0 unit/hour before suspending, so OpenAPS will know that you didn’t get insulin during the time of suspend (i.e. for shower or taking off the pump to swim, etc.) + +### Multiple rigs +* Loop uses one RileyLink paired via bluetooth. Typically users keep their RileyLink fairly close to the pump (like using a pants pocket) to help maintain communications. +* If using a single OpenAPS Edison/explorer board rig, you should see significant range improvement compared to a RileyLink, and a phone does not need to be nearby (beyond whatever needed for your dexcom system). +* If you have multiple OpenAPS rigs, they're built to be polite to each other - so even if you had 2+ rigs in same room, they won't trip each other up. They “wait for silence” before issuing any commands to the pump. By setting up multiple stationary rigs through a house, kids can move from room-to-room without carrying rigs because the rigs will pass-off comms as the kid moves in and out of the rig's range. Stationary rigs will not need lipo batteries and can be plugged directly into the wall from the explorer board. + +### Troubleshooting +* Loop - depending on environment and t1d's habits, RileyLink may require retuning to get Loop running again (automatically scheduled to retune at 14 minute intervals, but sometimes manual tunes are required). +* OpenAPS - once setup and network connected, there is little required troubleshooting of rig. Most problems should self-resolve in <10 minutes, and if not a power button push usually solves the issue. Also, parents can login to rig remotely to troubleshoot, reboot, etc. (when using the same wifi network as the rig) using an iPhone app. + * Is it looping? (Check on pump to see if temp basal has been set) + * What do the logs say? (Check the OpenAPS logs and/or the OpenAPS pill; it will probably say why it is stuck) + * Reboot the rig (either via logging in, or using the power button on the rig) + * Make sure it’s connected to wifi + * Make sure you’re in range of the rig; CGM data is flowing; etc. + +## Running multiple kinds of DIY systems + +* You can run different DIY systems (like Loop and OpenAPS) side-by-side, if you want to compare algorithms and how they behave. +* For those who like Loop's capabilities for bolusing from the phone, but don't want the requirement to enter carb absorption rates by meal, you can set Loop to "open loop" mode and use it for bolusing, and otherwise allow OpenAPS to be the primary closed loop to take advantage of the [Advanced Meal Assist (AMA)](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-4/advanced-features.html#advanced-meal-assist-or-ama) algorithm, [autosensitivity](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-4/advanced-features.html#auto-sensitivity-mode) to automatically adjust ISF, etc. However, see the following safety warnings below. + * **SAFETY WARNING:** If you choose to keep a Loop rig running alongside OpenAPS, you MUST turn off Loop's ability to write to Nightscout. If you neglect to do this, Nightscout will display double entries of carbs and/or boluses and greatly confuse you in the future. To enter carbs, you can enter directly through Nightscout Care Portal; [use the variety of IFTTT configurations to enter carbs to Nightscout via your Pebble watch, Alexa, Siri, etc.](../walkthrough/phase-4/ifttt-integration.md); or enter using the pump's bolus wizard. Even if you're just using the Loop app in open loop mode, and enter carbs or bolus from the pump bolus wizard for use in OpenAPS, you need to turn off Loop's ability to write to Nightscout. If you don't, Loop will read the boluses and carbs entered via the pump, upload them to Nightscout, and the duplicate entries will result in suboptimal post-meal decisions. You can either turn off Loop's ability to write to Nightscout, or simply close the app, but reopening the app for even a few minutes may still cause it to double enter to Nightscout if uploads are not disabled. If you do not plan to actively use Loop and DO want to bolus from the pump (via bolus wizard or easy bolus button) with OpenAPS, you should either disable Loop's Nightscout uploads, or plan to close the Loop app and not run them side-by-side. + * **Caution**: You may want to disable the Nightscout COB pill, especially if you are using multiple DIY closed loop systems, as it will likely cause confusion. You should look to the (DIY closed loop system you are using)'s pill for information about COB. This means looking in the OpenAPS or Loop pill for information about COB. + + +--- + +#### Ready to get started with OpenAPS? + +Click [here](http://openaps.readthedocs.org/en/latest/) to go to a high-level view of the OpenAPS docs + +#### Where to get help with OpenAPS setup and maintenance: +* See [this page](http://openaps.readthedocs.io/en/latest/docs/introduction/communication-support-channels.html) for various places for OpenAPS support; [the intend-to-bolus Gitter channel](https://gitter.im/nightscout/intend-to-bolus) is the best place for real-time troubleshooting assistance! + * Don't hesitate to ask any question, any time. If it gets missed because there's a lot of activity, feel free to ask again! +* You’ll probably also want to make sure and join [the openaps-dev Google Group](https://groups.google.com/forum/#!forum/openaps-dev), where new features and tools are most commonly announced and shared via email, so you’ll know when there are new things available to try. diff --git a/docs/docs/Resources/troubleshooting.md b/docs/docs/Resources/troubleshooting.md index b0c2f05c8..0559b9f59 100644 --- a/docs/docs/Resources/troubleshooting.md +++ b/docs/docs/Resources/troubleshooting.md @@ -1,6 +1,6 @@ # Troubleshooting -Even those who follow this documentation precisely are bound to end up stuck at some point. This could be due to something unique to your system, a mistyped command, actions performed out of order, or even a typo in this guide. This section provides some tools to help diagnose the issue as well as some common errors that have been experienced and resolved before. If you get stuck, try re-reading the documentation again and after that, share what you've been working on, attempted steps to resolve, and other pertinent details in [#intend-to-bolus in Gitter](https://gitter.im/nightscout/intend-to-bolus) when asking for help troubleshooting. +Even those who follow this documentation precisely are bound to end up stuck at some point. This could be due to something unique to your system, a mistyped command, actions performed out of order, or even a typo in this guide. This section provides some tools to help diagnose the issue as well as some common errors that have been experienced and resolved before. If you get stuck, try re-reading the documentation again and after that, share what you've been working on, attempted steps to resolve, and other pertinent details in [#intend-to-bolus in Gitter](https://gitter.im/nightscout/intend-to-bolus) when asking for help troubleshooting. Here is also a [good blog post to read with tips on how to best seek help online to troubleshoot](https://diyps.org/2017/03/19/tips-for-troubleshooting-diy-diabetes-devices-openaps-or-otherwise/). ## Generally useful linux commands @@ -12,7 +12,9 @@ More comprehensive command line references can be found [here](http://www.comput `pwd` (Show the present working directory (your current location within the filesystem).) -`sudo ` +`sudo ` (Super-user do. Temporarily elevates the current users permission to that of root.) + +`apt-get install ` (Aptitude is a package manager, when a package is missing it will (usually) be there and can be installed by issuing 'apt-get install .) `tail -f /var/log/syslog` @@ -34,13 +36,13 @@ More comprehensive command line references can be found [here](http://www.comput `pip freeze` -`sudo reboot` +`sudo reboot` (Reboot the system) `sudo shutdown -h now` (The correct way to shut down the Raspberry Pi from the command line. Wait for the green light to stop blinking before removing the power supply.) `dmesg` (Displays all the kernel output since boot. It’s pretty difficult to read, but sometimes you see things in there about the wifi getting disconnected and so forth.) -`uptime` +`uptime` (Shows how long the system has been running and the load average of last minute/5 minutes/15 minutes) `crontab -l` (Display cron jobs) @@ -68,6 +70,10 @@ It is recommended to run `oref0-reset-git` in cron so that if the repository get Warning: do not run any openaps commands with sudo in front of it `sudo openaps`. If you do, your .git permissions will get messed up. Sudo should only be used when a command needs root permissions, and openaps does not need that. Such permission problems can be corrected by running `sudo chown -R pi.pi .git` in the openaps directory. If you are using an Intel Edison, run `sudo chown -R edison.users .git`. +## Debugging Disk Space Issues + +If you are having errors related to disk space shortages as determined by `df -h` you can use a very lightweight and fast tool called ncdu (a command-line disk usage analyzer) to determine what folders and files on your system are using the most disk space. You can install ncdu as follows: `sudo apt-get install ncdu`. You can run it by running the following command: `cd / && sudo ncdu` and follow the interactive screen to find your disk hogging folders. + ## Environment variables If you are getting your BG from Nightscout or you want to upload loop status/results to Nightscout, among other things you'll need to set 2 environment variables: `NIGHTSCOUT_HOST` and `API_SECRET`. If you do not set and export these variables you will receive errors while running `openaps report invoke monitor/ns-glucose.json` and while executing `ns-upload.sh` script which is most probably part of your `upload-recent-treatments` alias.Make sure your `API_SECRET` is in hashed format. Please see [this page](https://github.com/openaps/oref0#ns-upload-entries) for details. Additionally, your `NIGHTSCOUT_HOST` should be in a format like `http://yourname.herokuapp.com` (without trailing slash). For the complete visualization guide use [this page](https://github.com/openaps/docs/blob/master/docs/Automate-system/vizualization.md) from the OpenAPS documentation. @@ -97,7 +103,9 @@ A JSON file did not contain entries. ### Unable to upload to http//my-nightscout-website.com -OpenAPS has failed to upload to the configured nightscout website. +OpenAPS has failed to upload to the configured nightscout website. If you're using a Medtronic CGM and no BG readings appear in nightscout, connect to your rig and the directory of your openaps app (default is myopenaps) run + +`openaps first-upload` ### [No JSON object could be decoded](https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#safe=active&q=openaps+%27No+JSON+object+could+be+decoded%27) @@ -140,6 +148,28 @@ Below is correct definition remainder = insulin_sensitivities = settings/insulin_sensitivities.json +### Could not get subg_rfspy state or version. Have you got the right port/device and radio_type? + +Basic steps using an Intel Edison with Explorer Board, checking with `openaps mmtune` to see if it is resolved yet: + * Double check that your port in pump.ini is correct + * Check that your rig is in close range of your pump + * Check that your pump battery is not empty + * Reboot your rig + * Run `oref0-runagain` + * Fully power down and start up your rig + * Remove and re-add your pump device + +If you are using an Intel Edison with Explorer Board, and that does not resolve your issue, or if the two LEDs next to the microUSB ports on your Explorer board stay on even after an mmtune, you may need to re-flash your radio chip: + * Install ccprog tools on your Edison: `cd ~/src; git clone https://github.com/ps2/ccprog.git` + * Build (compile) ccprog so you can run it: `cd ccprog; make ccprog` + * Flash the radio chip: +``` +wget https://github.com/EnhancedRadioDevices/subg_rfspy/releases/download/v0.8-explorer/spi1_alt2_EDISON_EXPLORER_US_STDLOC.hex +./ccprog -p 19,7,36 erase +./ccprog -p 19,7,36 write spi1_alt2_EDISON_EXPLORER_US_STDLOC.hex +``` + * Reboot, and try `openaps mmtune` to make sure it works + ### CareLink RF timeout errors diff --git a/docs/docs/Resources/wifi.md b/docs/docs/Resources/wifi.md index d0fabb5f6..0566a5de5 100644 --- a/docs/docs/Resources/wifi.md +++ b/docs/docs/Resources/wifi.md @@ -7,7 +7,7 @@ There is a script that you can add to your root cron that will test your connect cd ~/src git clone https://github.com/TC2013/edison_wifi cd edison_wifi -chmod 0755 /home/edison/src/edison_wifi/wifi.sh +chmod 0755 wifi.sh ``` Next, add the script to your root cron. Note this is a different cron that what your loops runs on, so when you open it don't expect to see your loop and other items you have added. * Log in as root ```su root``` @@ -21,4 +21,10 @@ You can add a line to your cron that will check to see if is avai * Add the following line ```*/2 * * * * ( (wpa_cli status | grep > /dev/null && echo already on ) || (wpa_cli scan > /dev/null && wpa_cli scan_results | egrep > /dev/null && udo pa_cli select_network $(wpa_clilist_networks | grep jsqrd | cut -f 1) && echo switched to && sleep 15 && (for i in $(wpa_cli list_networks | grep DISABLED | cut -f 1); do wpa_cli enable_network $i > /dev/null; done) && echo and re-enabled other networks) ) 2>&1 | logger -t wifi-select``` ## I am having trouble consistently connecting to my wifi hotspot when I leave the house (iPhone) -When you turn on your hotspot it will only broadcast for 90 seconds and then stop (even if it is flipped on). So, when you leave your house you need to go into the hotspot setting screen (and flip on if needed). Leave this screen open until you see your rig has connected. It make only take a few seconds or a full minute. +When you turn on your hotspot it will only broadcast for 90 seconds and then stop (even if it is flipped on). So, when you leave your house you need to go into the hotspot setting screen (and flip on if needed). Leave this screen open until you see your rig has connected. It may only take a few seconds or a full minute. + +## I am not able to connect to my wireless access point on my iPhone +Consider changing your iPhone's name... In most cases iPhone will set the phone's SSID to something like "James’s iPhone" By default Apple puts a curly apostrophe (’) into the SSID instead of a straight one ('). Your choices from here are either paste in the curly apostrophe in wpa_supplicant.conf, or change the name on the phone. To change the name on the iPhone: + * On your iOS device, go to Settings > General > About. + * Tap the first line, which shows the name of your device. + * Rename your device, then tap Done. diff --git a/docs/docs/introduction/communication-support-channels.md b/docs/docs/introduction/communication-support-channels.md index 278fe35bf..16432eb1f 100644 --- a/docs/docs/introduction/communication-support-channels.md +++ b/docs/docs/introduction/communication-support-channels.md @@ -1,24 +1,62 @@ -# Where to go for help with your implementation +# Where to go for help There are several ways to communicate with other participants and contributors in the #OpenAPS project. See also the [Resources](../Resources/index.rst) section for additional assistance. **Note:** It's best practice not to share your pump's serial number, so make sure not to include it in pictures or pasted text output when seeking help on pump communication. +**Related**: You may want to read [this blog post for tips on how to best seek help when troubleshooting online](https://diyps.org/2017/03/19/tips-for-troubleshooting-diy-diabetes-devices-openaps-or-otherwise/) - there is a lot of information you can provide proactively when seeking help that will aid in getting your issue resolved more quickly. + ### Gitter -[Gitter](https://gitter.im/) is a messaging/chat service similar to IRC. It provides integration with GitHub and several other services. +[Gitter](https://gitter.im/) is a messaging/chat service similar to IRC. It provides integration with GitHub and several other services. It's the best place to get real-time support with anything related to OpenAPS. (Here's [why we often recommend asking questions on Gitter](https://diyps.org/2016/08/17/why-you-should-post-questions-in-gitter/).) * The [nightscout/intend-to-bolus]( https://gitter.im/nightscout/intend-to-bolus) channel is where you will find active #OpenAPS discussions ranging from technical issues with openaps tools to control theory to general information. It is a great place to introduce yourself and get some help from those who are a few steps further down the road. +* For Autotune conversations, use the [openaps/autotune channel](https://gitter.im/openaps/autotune) * For TI stick communication, use the [oskarpearson/mmeowlink channel](https://gitter.im/oskarpearson/mmeowlink) * For RileyLink conversations, use the [ps2/rileylink channel](https://gitter.im/ps2/rileylink) * For LoopKit conversations, use the [LoopKit/Loop channel](https://gitter.im/LoopKit/Loop) -### Google Groups -A private google group focused on #OpenAPS development work can be found [here](https://groups.google.com/d/forum/openaps-dev). Request access to participate and see some of the archived discussions. If you're new, make sure to introduce yourself! +Gitter has a search function to find old information, but since it isn't threaded converations, you may need to spend some time reading the posts after the search result to find the ultimate resolution to the question. So, if you find a particularly useful bit of information that you couldn't find in the docs...please make a PR to the docs so that the information is permanently stored for others to find. + +Tag someone! You can tag particular people if you are responding to them directly by using the `@` symbol and then typing their username. This will help notify the person that you are "speaking to them". If someone asks you for information that shouldn't be shared in the public channel, you can also private message people by hovering over their profile picture and choosing the "chat privately" button. Please do not abuse the tagging or PM features: most questions are best asked untagged in the appropriate channel, so that anyone can respond to them as soon as they read Gitter and see the question. There are people from all over the world online at all hours who can help with most kinds of questions, and the core developers usually read every message in Gitter a few times per day and try to answer any questions that got missed. + +![Gitter PM sample](../Images/gitter_pm.jpg) +************ +**A note about posting photos or screenshots in Gitter** + +Gitter has a mobile app which works great for posting text, but does not allow for posting images directly. If you need to post a photo using the mobile app, you'll have to host your photo file somewhere like Dropbox and post the link to the file location. + +Using the desktop application, you can simply drag and drop the file into the Gitter chat window. The file will upload and then display in the chat thread after a short period of time to upload. +************* + +Posting copy-paste code from your rig is also another valuable activity for troubleshooting. To post a single line of information, you can use the single-backtick-quote that is found on the key to the left of the number 1 key on the keyboard. (hint: it is under the ~ on the same key). You can also long-press the single quote key on your iPhone keypad to bring up the single-backtick-quote that will work in Gitter. If you start and stop a portion of your text with those single quotes, it will `look like this`. + +Posting multiple lines of copy-paste from your rig will also sometimes be needed. You can do that by: + +* start a single line of 3 single quotes (the same one we used in the example above) +* press `control-enter` to get a new line started +* paste the lines of code that you want to post +* press `control-enter` again to get another new line +* enter 3 single quotes to end the section + +The copy-pasted lines should have 3 backticks on the line above and the line below. The example below shows, on the bottom, how the formatted text yielded the black box of text in Gitter. Using this format helps troubleshooters read your information easier than unformatted copy and paste. + +![Gitter tickmarks](../Images/gitter_marks.jpg) + +### Facebook + +There is also a [Looped Group](https://www.facebook.com/groups/TheLoopedGroup/?fref=nf) in Facebook that is currently a discussion place for users on both Loop and OpenAPS systems. You will need to request membership for the group and respond to a message from the group administrators prior to joining. + +The Looped Group has grown considerably in the last 6 months and has many users on both systems. You can search for previous posts on topics that may interest you. Note: If you are asking for troubleshooting help, screenshots and additional information about where you are in your problem will help get the best response. + +![FB group header](../Images/looped.jpg) + +### Google Group - everyone is recommended and welcome to join! +A google group focused on #OpenAPS development work can be found [here](https://groups.google.com/d/forum/openaps-dev). Request access to participate and see some of the archived discussions. If you're new, make sure to introduce yourself! ### Issues on openaps GitHub For reporting issues on the openaps tools formally, the openaps [issues page](https://github.com/openaps/openaps/issues) on GitHub is the proper forum. Feel free to try and get through the issues by working with others on the Gitter channel first if you think it may be something unrelated to the codebase. ### Other online forums -Those in the #OpenAPS community are frequently found in other forums, such as on Twitter (using [the #OpenAPS hashtag](https://twitter.com/search?f=tweets&vertical=default&q=%23OpenAPS&src=typd), as well as [#WeAreNotWaiting](https://twitter.com/search?f=tweets&vertical=default&q=%23WeAreNotWaiting&src=typd)) and on Facebook in the ["CGM In The Cloud"](https://www.facebook.com/groups/cgminthecloud/) group. +Those in the #OpenAPS community are frequently found in other forums, such as on Twitter (using [the #OpenAPS hashtag](https://twitter.com/search?f=tweets&vertical=default&q=%23OpenAPS&src=typd), as well as [#WeAreNotWaiting](https://twitter.com/search?f=tweets&vertical=default&q=%23WeAreNotWaiting&src=typd)) and on Facebook in the ["CGM In The Cloud"](https://www.facebook.com/groups/cgminthecloud/) and ["Looped"](https://www.facebook.com/groups/TheLoopedGroup/)group. There is also a [Slack channel](https://omniapsslack.azurewebsites.net/) to discuss communication around other pumps that are being explored for being used for other DIY closed loops. diff --git a/docs/docs/introduction/contribute.md b/docs/docs/introduction/contribute.md index df8be952c..1d066c548 100644 --- a/docs/docs/introduction/contribute.md +++ b/docs/docs/introduction/contribute.md @@ -13,4 +13,4 @@ If you're not sure where to get started, here are some ways to get involved: * Spread the word about #OpenAPS and get others involved; the more, the merrier. (You can direct them to [OpenAPS.org](http://OpenAPS.org) for more information.) * Consider calling your device manufacturer and ask about communication protocols in order to understand how your device operates. -If you would like to work on the core openaps code, take a look at the openaps [contributing guidelines](https://github.com/openaps/openaps/blob/master/CONTRIBUTING.md) before getting started. +If you would like to work on the core openaps code, take a look at the openaps [contributing guidelines](https://github.com/openaps/openaps/blob/master/CONTRIBUTING.md) before getting started. Thank you for your contributions! diff --git a/docs/docs/introduction/understand-this-guide.md b/docs/docs/introduction/understand-this-guide.md index 4eccb5889..5611764c1 100644 --- a/docs/docs/introduction/understand-this-guide.md +++ b/docs/docs/introduction/understand-this-guide.md @@ -1,29 +1,138 @@ - -# Understanding this guide +# Understanding this guide and how to build your own OpenAPS implementation Some conventions used in this guide: * Wherever you see text that is formatted `like this`, it is a code snippet. You should copy and paste instead of attempting to type this out; this will save you debugging time for finding your typos. * You will see a $ at the beginning of many of the lines of code. This indicates that it is to be entered and executed at the terminal prompt. Do not type in the dollar sign $. -* Wherever there are `` in the the code, these are meant for you to insert your own information. Most of the time, it doesn't matter what you choose **as long as you stay consistent throughout this guide**. That means if you choose `Barney` as your ``, you must use `Barney` every time you see ``. Choose carefully. Do not include the `< >` brackets in your name. +* Wherever there are `` in the the code, these are meant for you to insert your own information. Most of the time, it doesn't matter what you choose **as long as you stay consistent throughout this guide**. That means if you choose `myopenaps` as your ``, you must use `myopenaps` every time you see ``. Choose carefully when naming things. Do not include the `< >` brackets in your name. ### Before you get started -Some familiarity with using the terminal will go a long way, so if you aren't comfortable with what `cd` and `ls` do, take a look at some of the Linux Shell / Terminal commands on the [Troubleshooting](../Resources/troubleshooting.md) page and the reference links on the [Technical Resources](../Resources/technical-resources.md) page. +Some familiarity with using the terminal will go a long way, but is not required for getting started. Terminal (or PuTTY) is basically a portal into your rig, allowing us to use our computer's display and keyboard to communicate with the little [Edison or Pi] computer in your rig. The active terminal line will show your current location, within the computer's file structure, where commands will be executed. The line will end with a $ and then have a prompt for you to enter your command. -One helpful thing to do before starting any software work is to log your terminal session. This will allow you to go back and see what you did at a later date. This will also be immensely helpful if you request help from other OpenAPS contributors as you will be able to provide an entire history of the commands you used. To enable this, just run `script ` at the beginning of your session. It will inform you that `Script started, file is `. When you are done, simply `exit` and it will announce `Script done, file is `. At that point, you can review the file as necessary. +There are many commands that are useful, but some of the commands you'll get comfortable with are: -### What you won't see in this guide +* `cd` means "change directory" - you can `cd ` to change into a directory; and `cd ..` will take you backward one directory and `cd` will take you back to the root directory. If you try to `cd` into a file, your computer will tell you that's not going to happen. + +* `ls` means "list", is also your friend - it will tell you what is inside a directory. If you don't see what you expect, you likely want to `cd ..` to back up a level until you can orient yourself. If you aren't comfortable with what `cd` and `ls` do or how to use them, take a look at some of the Linux Shell / Terminal commands on the [Troubleshooting](../Resources/troubleshooting.md) page and the reference links on the [Technical Resources](../Resources/technical-resources.md) page. + +* `cat` means "concatenation" - it will show you the contents of a file if you `cat `. Very useful when trying to see what you have in preferences or other oref0 files. + +* `vi` and `nano` are both editing command prefixes. Using those will bring you into files for the purposes of editing their contents. It is like `cat` except you will be able to edit. + +One other helpful thing to do before starting any software work is to log your terminal session. This will allow you to go back and see what you did at a later date. This will also be immensely helpful if you request help from other OpenAPS contributors as you will be able to provide an entire history of the commands you used. To enable this, just run `script ` at the beginning of your session. It will inform you that `Script started, file is `. When you are done, simply `exit` and it will announce `Script done, file is `. At that point, you can review the file as necessary. -You won't see a full loop where you can just download the code, press a button, and have a live loop. There are many places where there are examples, and instructions, but you must do the work to understand how to communicate between devices and transfer data between reports and files. This is key for helping you understand what you are building and how it will work. +### What you won't see in this guide -In some cases, the documentation needs to be built out further, with easier to understand language and more examples. You should have full intent and autonomy in building your system for yourself. +You won't see a full loop where you can just download the code, press a button, and have a live loop. There are many places where there are examples, and instructions, but you must do the work to understand what you're doing - and why. This is key for helping you understand what you are building and how it will work. ### But wait - I need the "Dummy" version -Well, actually, you don't. If you can deal with diabetes, invoking shell scripts isn't all that big a deal. But it will probably help to have some idea what is going on here. +Well, actually, you don't. If you can deal with diabetes, this isn't that big a deal. But it will probably help to have some idea what is going on here. It may help to think of the OpenAPS setup as a tiny "diabetes brain" which is focused only on figuring out how much basal insulin you should be getting. It does this by collecting all that background data we usually let our pumps deal with: what is your insulin sensitivity, your target BG, the duration of action for insulin, etc. Then, it collects more immediate data, such as what is the current IOB, and basal rate, as well as checking out the CGM to see what your BG has been up to recently. Then, it decides what should be changed (if anything) and tells your pump to go to a new temp basal rate, either higher or lower, depending on all the other factors. -As you go through the steps to run the loop, the longer-term data is collected in the "settings" directory, with file names indicating what sort of data they contain. The data representing what is going on right now is in the "monitor" directory, and the recommendation for what should change goes in the "enact" directory. To close the loop, you will have added a "cron" script, which just directs the computer to do something at a certain time interval. +For more details about how OpenAPS works, please [review the OpenAPS Reference Design](https://openaps.org/reference-design/). + +### Understanding the basic steps in the Walkthrough + +You'll see us refer to `openaps` (no capitalization) from time to time - this is the building block toolkit that allows us to communicate with various diabetes devices, and ultimately construct an OpenAPS implementation. For most users, you won't have to touch the underlying toolkit (but if you need it, you'll find detailed walkthrough instructions and more content related to the [original openaps toolkit pieces here](http://openaps.readthedocs.io/en/latest/docs/openaps-guide/index.html)). + +The high level process for building a system, as outlined in [the rest of the documentation](http://openaps.readthedocs.org/en/latest/): + +**Phase 0**: HARDWARE PREPARATION +* Buy your [hardware](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/hardware/hardware.html). +* Put the pieces together (pop the Edison on an Explorer Board; or plug Carelink/radio stick into Pi, etc.) +* Install necessary software (also called "flashing" jubilinux to [setup the Edison](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/setup-edison.html) on the Explorer Board rig) and enable wifi. (Pi users will follow [other steps to prepare their Pi](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/rpi.html)). + +**Phase 1**: NIGHTSCOUT +* Get your Nightscout site installed and ready for OpenAPS, so you can more [easily visualize](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-1/index.html) what your closed loop is doing. + +**Phase 2**: LOOP INSTALLATION +* [Install oref0](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/oref0-setup.html#step-0-dependencies) on your rig. This means taking code from Github, and storing it on your rig. +* Run [oref0-setup.sh](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/oref0-setup.html#step-2-run-oref0-setup) to create your closed loop, personalize it, and schedule it to automatically run. This step creates the `` directory and the loop's scheduler called the `cron`. + +**Phase 3**: LOOP PREFERENCES +* At the end of Phase 2, you'll have a working closed loop that by default is a low-threshold suspension loop. After you are comfortable with the loop's performance in preventing lows, you can enable it to perform to include help with correcting high blood sugar as well. For that change, along with many other helpful settings, you'll want to [read this section to understand what it's doing, and how to further personalize your setup](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/index.html). + +**Phase 4**: ADVANCED FEATURES +* [Tell us you've closed the loop](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-4/keeping-up-to-date.html), and enable any [advanced features](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-4/advanced-features.html) that you're ready for! + +**WARNING:** the links above are quick-links to various sections, but there are other steps you will need to do to not miss anything. We recommend [starting at the top of the docs here](http://openaps.readthedocs.io/en/latest/index.html) and making sure you don't miss any pages of instructions. + +### Understanding how all the pieces fit together + +When you get to the end of Phase 2, `ls` in the root directory will show you the following files and directories: + * `src`: The first part of Phase 2 creates a directory called `src` (as in "source code") and installs `oref0` there. This means, to find and look at the underylying oref0 code, you must `cd src`, and then `cd oref0` if you want to see those source code files. They will be a replicate of what is on the openaps/oref0 repository in Github at the time you performed the `git` command. Updating your rig will perform a fresh `git` of the source code and update oref0 on your rig. + * `myopenaps`: The second part of Phase 2, running oref0-setup.sh (also called the "setup script", creates the `` directory. This directory contains your loop's personal information about pump reads, reports, settings, and preferences. The information such as pump serial number and Nighscout URL reside in this directory as well. You can see the contents of that directory by `ls `. + * `crontab.txt`: At the end of oref0-setup.sh, you will be asked if you want to enable the "cron" to schedule and automate your closed loop. If you answer "yes", the script creates a crontab file at the same level as where the `src` and `` directories are located. Once it's running, it will also create various logs that are stored on the Edison/Pi, so you can see what it has done in the past; what it is doing now; and why it is doing or has done anything. + * `kernel.config`: files related to Edison operations. + +![Example - how different phases related to the physic rig](../Images/High_level_components_OpenAPS_setup_process.png) + +`ls ` will show the following files and subdirectories contained within the directory: +* autotune +* cgm +* cgm.ini +* detect-sensitivity.ini +* determine-basal.ini +* enact +* get-profile.ini +* iob.ini +* meal.ini +* mmtune_old.json +* monitor +* ns-glucose.ini +* ns.ini +* openaps.ini +* oref0.ini +* oref0-runagain.sh +* pebble.ini +* preferences.json +* pump.ini +* pump-session.json +* raw-cgm +* settings +* tz.ini +* units.ini +* upload +* xdrip.ini + +`ls settings` will show the contents of the `settings` subdirectory; the files which collect longer-term loop data. +* autosens.json +* autotune.json +* basal_profile.json +* bg_targets.json +* bg_targets_raw.json +* carb_ratios.json +* insulin_sensitivities.json +* insulin_sensitivities_raw.json +* model.json +* profile.json +* pumphistory-24h.json +* pumphistory-24h-zoned.json +* pumpprofile.json +* settings.json +* temptargets.json + +`ls monitor` will show the contents of the `monitor` subdirectory; current data going on right now in your loop. +* battery.json +* carbhistory.json +* clock.json +* clock-zoned.json +* edison-battery.json +* glucose.json +* iob.json +* meal.json +* meal.json.new +* mmtune.json +* pumphistory.json +* pumphistory-zoned.json +* reservoir.json +* status.json +* temp_basal.json + +`ls enact` will show the contents of the `enact` subdirectory; loop's suggested and enacted temp basals and changes. +* enacted.json +* suggested.json diff --git a/docs/docs/walkthrough/manual/phase-4/create-schedule.md b/docs/docs/walkthrough/manual/phase-4/create-schedule.md index d368d85b7..a3118309c 100644 --- a/docs/docs/walkthrough/manual/phase-4/create-schedule.md +++ b/docs/docs/walkthrough/manual/phase-4/create-schedule.md @@ -34,15 +34,3 @@ Another example would be to use cron to automatically resolve git corruption iss It prepares a cron template to change to the current directory and runs whatever was specified, sending all output to syslog. - -**Note**: `cron-5-minute-helper` is currently on the `dev` branch of `oref0`. To -install: -``` -sudo npm install -g git://github.com/openaps/oref0.git#dev -``` -Be aware that switching to the dev version of `oref0` will potentially include -other changes still in active development. You'll want to revert to the latest -release before using other `oref0` features: -``` -sudo npm install -g git://github.com/openaps/oref0.git -``` diff --git a/docs/docs/walkthrough/manual/phase-6/Configure-Automatic-Sensitivity-Mode.md b/docs/docs/walkthrough/manual/phase-6/Configure-Automatic-Sensitivity-Mode.md index 1dc995c36..100a50023 100644 --- a/docs/docs/walkthrough/manual/phase-6/Configure-Automatic-Sensitivity-Mode.md +++ b/docs/docs/walkthrough/manual/phase-6/Configure-Automatic-Sensitivity-Mode.md @@ -2,12 +2,9 @@ For more information review https://github.com/openaps/oref0/issues/58 -1) Install the latest dev branch of `oref0`: -``` -sudo npm install -g git://github.com/openaps/oref0.git'#dev' -``` +1) (Removed) -2) Next in order for the new auto-sensitivity report to run, you need to have at least 24 hours worth of pump history data and enough bg readings (24 hours). +2) In order for the new auto-sensitivity report to run, you need to have at least 24 hours worth of pump history data and enough bg readings (24 hours). In your `openaps.ini` apply the following changes: ``` [report "monitor/glucose.json"] diff --git a/docs/docs/walkthrough/phase-0/baseline-data.md b/docs/docs/walkthrough/phase-0/baseline-data.md index 0a6182505..e89ca7f6e 100644 --- a/docs/docs/walkthrough/phase-0/baseline-data.md +++ b/docs/docs/walkthrough/phase-0/baseline-data.md @@ -4,7 +4,9 @@ There is no requirement to share your data to use the openaps toolset or partici ## CGM Data -Before getting started, we ask that you store at least 30 days of CGM data. For now, the easiest way to do that is to upload your Dexcom receiver to Dexcom Studio or, if you use a Medtronic CGM, upload your CGM data to CareLink. If you use an Animas Vibe, upload your data to Tidepool or Diasend. We suggest you get in the habit of doing this regularly so that you have ongoing data to show trends in your overall estimated average glucose (eAG, a good indicator in trends in A1c) and variations in your "time in range." +Before getting started, we ask that you store at least 30 days of CGM data. For now, the easiest way to do that is to upload your Dexcom G4 receiver to Dexcom Studio or if you use Dexcom G5 the data is in the cloud at Dexcom Clarity, if you use a Medtronic CGM, upload your CGM data to CareLink. If you use an Animas Vibe, upload your data to Tidepool or Diasend. We suggest you get in the habit of doing this regularly so that you have ongoing data to show trends in your overall estimated average glucose (eAG, a good indicator in trends in A1c) and variations in your "time in range." + +(If you alre already a user of Nightscout and have been using it for more than 30 days with a CGM, then you also have CGM data logged in Nightscout that will be useful for looking back and for donating to research in the future if you so choose.) ## Recent A1c @@ -15,4 +17,4 @@ Go ahead and document your most recent A1c and keep it somewhere handy. This wil You should be comfortable making a PR to this documentation. If you haven't ever done this, take a look at [my first pull request guide](../../Resources/my-first-pr.md) -and try it out. \ No newline at end of file +and try it out. diff --git a/docs/docs/walkthrough/phase-0/edison-explorer-board-Mac.md b/docs/docs/walkthrough/phase-0/edison-explorer-board-Mac.md new file mode 100644 index 000000000..077f78e37 --- /dev/null +++ b/docs/docs/walkthrough/phase-0/edison-explorer-board-Mac.md @@ -0,0 +1,363 @@ +# Setting up Edison/Explorer Board on a Mac + +(This is testing a separate workflow for Mac only. Please refer to the [main Edison setup guide](./setup-edison.md) as well for troubleshooting & full instructions for other computer setup processes.) + +## Hardware Assumptions for this page + +1. Using an explorer board and Edison +2. Using an Apple computer +3. Using a Loop-compatible Medtronic pump (note - OpenAPS can actually use an additional set of pumps, the x12 series, although it requires [one small extra step](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/hardware/pump.html#why-do-i-need-a-certain-pump-firmware). See [this page in OpenAPS docs for all compatible pumps](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/hardware/pump.html#information-about-compatible-insulin-pumps).) + +## High Level Recommended Rig parts list + +* [**Explorer Board - link**](https://enhanced-radio-devices.myshopify.com/products/900mhz-explorer-block-pre-order) + +* [**Edison - link**](https://www.sparkfun.com/products/13024) + +* [**Nuts and Bolts - link**](https://www.sparkfun.com/products/13187) + +* **At least one Lithium Battery** (The larger battery will have a little longer battery life; but may be slightly bigger.) + * [**2500mAh battery - link**](https://www.adafruit.com/products/328) + * [**2000mAh battery - link**](https://www.sparkfun.com/products/8483) + +* **Cables** (you may already have workable USB cables; you just need 2 to complete this process. Doesn’t have to be a certain length either, just giving options if you have a preference for shorter or longer cables.) + * [**3 ft long cable, USB-microB - link**](https://www.adafruit.com/products/592) + * [**6 inch long cable, USB-microB - link**](https://www.adafruit.com/products/898) + +## Getting Physical: Build your rig/put the physical pieces together + +The Explorer board is where all the communications are housed for the rig, as well as the battery charger. The Edison is the mini-computer where all the OpenAPS code will be sent and used. In order for this to work, first you have to screw and connect the Edison and Explorer Board together with the nuts and bolts you order. + +The nuts and bolts are tiny, and the spaces are a little tight. I find it really helps to use a set of tweezers and a small Phillips head screwdriver. + +It's easiest to start with the Explorer board and put on 2 nuts and gold screws (nuts on the side with most of the wiring) inside the little outline where the Edison will eventually sit. Gold screws should be placed as shown, with nuts on the backside. Then, lay the Edison board on top, aligning the screw holes. Use a small Phillips head screwdriver to tighten the screws into the gold screws beneath them. The Edison board should not wobble, and should feel secure when you are done. Attach your battery into the explorer board plug. A single red light should appear and stay lit. During the course of your OpenAPS rig use, it's good practice to periodically check that the nuts and screws stay tightened. If they come loose, the Edison can wobble off the connection to the Explorer board and you will either get looping failures (if it's loose) or be unable to connect to the Edison (if it comes completely off). + +![Edison/Explorer Board rig with red light on](../../Images/Edison/Edison_Explorer_Board.png) + +## Software-build your rig + +Building the software into your rig is comprised of three steps: + +1. Preparing the Edison (aka flashing the Edison) +2. Installing the “looping” code (aka setup script for oref0) +3. Customizing your loop + +### 1. Preparing/flashing the Edison + +The Edison comes with an operating system that doesn’t work easily with OpenAPS. The first step is to replace the operating system with a new one. This is called “flashing” the Edison. + +Let’s start by downloading the updated operating system (it’s called Jubilinux) to your computer so that we can install it later onto the Edison. Go to Safari and download [jubilinux.zip](http://www.jubilinux.org/dist/) + +Now we move to the Edison. You’ll see two microB USB ports on your explorer board. One is labeled OTG (that’s for flashing) and one is labeled UART (that’s for logging into the Edison from a computer). We will need to use both to flash. We’re going to plug both of those into our computer’s USB ports using the cables listed in the parts list (Dexcom’s charging cable will work too). + +![Explorer Board rig with two cables and red light on](../../Images/Edison/ExplorerBoard_two_charging_cables.png) + +Once you plug in the cables, you should see your Edison board in your Finder as a connected “device” (similar to what you would see if you plug in a USB thumb drive). If you don’t…try different cables. If your USB port is bad and not recognizing the device, you may need to [reset your SMC first](https://support.apple.com/en-au/HT201295) (it’s not hard to do, takes 2 minutes.) + +![Edison in Finder](../../Images/Edison/Edison_in_Finder_folder.png) + +The OpenAPS uses Terminal, kind of like Loop uses Xcode. It’s our interaction with the code that forms the basis of the loop. You may have never even used the Terminal app. Go to your Applications folder and find the Terminal App in the Utilities folder. Double click to open it. + +![Terminal example](../../Images/Edison/Terminal_example.png) + +Terminal app is an ugly, plain interface…but it does what we need to do, communicate with the Edison. Basically, the Edison is a computer that lacks a keyboard and display. By using a cable connected to the rig, we can login to the Edison and use Terminal as a way of interacting with the Edison. + +When you first launch Terminal, you will probably see something rather plain like below. The important thing to know is that the Terminal helps show you WHERE you are in your computer or Edison. So, in the screenshot below, it’s telling me I am in my “iMac4K” user account. If you are ever a little confused where you are…you can look to the left of the $ prompt and get an idea. + +![A look inside terminal](../../Images/Edison/Inside_terminal.png) + +If you’re like me, you don’t “speak linux” (or python or java or…) nor do you really know what linux is. So, you’ll be comforted to know that most of this setup is copy and paste commands into Terminal. You won’t need to suddenly learn linux…just will need to follow directions and be willing learn some basics. + +**IMPORTANT NOTE**: STEPS 1-10 will be updated periodically, and also will likely be out of date. Since this is just a cheat sheet for Mac users, it may not have all the troubleshooting tips or updated info that the main OpenAPS docs have. If you get stuck and this guide’s set of instructions do not work at the moment, the place to look is the [OpenAPS Walkthrough Phase 0, Setting up your Intel Edison](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/setup-edison.html) for the full information on this part of the OpenAPS setup. + +The next steps will be done in the Terminal app. If you see red colored text/code lines in a box, that’s what you want to copy and paste into Terminal, and then press enter. Don’t try typing it…you’ll likely miss a space or add a typo. So, let’s start… + +#### **1-1. Install homebrew** + +`ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"` + +You will be prompted to enter “RETURN” to continue and then enter your passcode for the user account (your computer password). When you type the password, you will not see any letters appear in the Terminal screen..that is normal. Terminal does not show keystrokes for passwords. + +![Enter return example](../../Images/Edison/Enter_return.png) + +It will take about 1-2 minutes for Homebrew to install. You’ll see a bunch of commands scrolling by in Terminal window. Just wait it out until you see the screen showing Installation successful and you’ll be returned to the $ Terminal prompt. + +![After Homebrew](../../Images/Edison/After_Homebrew.png) + +#### **1-2. Install a bunch of other stuff (dfu-util, coreutils, gnu-getopt)** + +`brew install dfu-util coreutils gnu-getopt` + +![After installing other stuff](../../Images/Edison/After_install_other_stuff.png) + +#### **1-3. Install lsusb** + +`brew update && brew tap jlhonora/lsusb && brew install lsusb` + +![After installing lsusb](../../Images/Edison/after_install_lsusb.png) + +#### **1-4. Start Edison in screen mode** + +`sudo screen /dev/tty.usbserial-* 115200` + +You’ll most likely be asked for your computer password again. Enter it. A blank screen will likely come up, then press enter to wake things up to show an Edison login prompt. Login with username “root” (no quotes) and no password will be needed. Leave this window alone for a bit as we proceed with next steps. + +![Example terminal screen](../../Images/Edison/change_me_out_for_jubilinux.png) + +If you have a problem getting to the Edison login prompt, and possibly get a warning like "can't find a PTY", close that terminal window. Then unplug the usb cables from your computer (not from the Edison...leave those ones as is) and swap the USB ports they were plugged in. Open a new terminal window, use the `sudo screen /dev/tty.usbserial-* 115200` command again. Usually just changing the USB ports for the cables will fix that "can't find a PTY" error. + +#### **1-5. Flash the Edison** + +* Open a new Terminal Window (leave the existing one from that last screenshot open…we need a second window) by selecting command-N or using menu bar Shell>New Window>New Window with Settings-Basic. + +* In the new window, enter `cd ~/Downloads/jubilinux` This will change your directory. + +![Change directories](../../Images/Edison/cd_jubilinux.png) + +* Enter `./flashall.sh` +* You’ll get a prompt that asks you to "plug and reboot" the Edison board. You’re done with this screen for now. Just leave it alone (**don’t close window**) and go to next step. + +![Reboot](../../Images/Edison/reboot.png) + +#### **1-6. Return to the other Terminal Window that we left off of in Step 4.** + +* Enter `reboot` + +#### **1-7. Now we wait and watch.** + +You may see a message notification that the Edison “Disk Not Ejected Properly”. Don’t worry...it is rebooting. You will see some processes going on in the background. + +![Don't worry during Reboot](../../Images/Edison/dont_worry_during_reboot.png) + +You should see: + +``` +Hit any key to stop autoboot: 0 +Target:blank +Partitioning using GPT +Writing GPT: success! +Saving Environment to MMC... +Writing to redundant MMC(0)... done +Flashing already done... +GADGET DRIVER: usb_dnl_dfu +# +DFU complete CRC32: 0x77ccc805 +DOWNLOAD ... OK +Ctrl+C to exit ... +###################################################################################################################### +``` +in the terminal window where you typed `reboot`, and +``` +Using U-Boot target: edison-blankcdc +Now waiting for dfu device 8087:0a99 +Please plug and reboot the board +Flashing IFWI +Download [=========================] 100% 4194304 bytes +Download [=========================] 100% 4194304 bytes +Flashing U-Boot +Download [=========================] 100% 245760 bytes +Flashing U-Boot Environment +Download [=========================] 100% 65536 bytes +Flashing U-Boot Environment Backup +Download [=========================] 100% 65536 bytes +Rebooting to apply partition changes +Now waiting for dfu device 8087:0a99 +Flashing boot partition (kernel) +Download [=========================] 100% 5980160 bytes +Flashing rootfs, (it can take up to 10 minutes... Please be patient) +``` +in the terminal window where you ran `./flashall.sh`. As it says, this should take about 10 minutes. It may appear like nothing is happening for awhile, but wait it out. If it didn’t take long at all...chances are that the flash didn’t really work, in which case you should read through the [full docs] and try again, and/or check out the Troubleshooting section at the bottom. + +**OLDER JUBILINUX VERSIONS**: After flashing is complete, watch the window as you should get asked to type **control-D to continue**. If so, go ahead and press (don’t type that out, just press the keys) control-D to keep going. + +![Control-D prompt for Jubilinux flash](../../Images/Edison/control_d.png) + +**NEWER JUBLINUX VERSIONS (0.1.0 and later)**: You probably won't get asked to Control-D and that is fine. + +After one of the reboots, you'll probably see: + +``` +[** ] A start job is running for /etc/rc.local Compatibili...14s / no limit) +``` +for a few minutes: that's fine. You can also expect to see an ugly red: +``` +[FAILED] Failed to start Hostname Service. +``` +That is also fine, and you can ignore it too. + +Eventually, you should get a ubilinux login prompt (If you see Yocto instead of ubliniux, then you need to go back to Step 1-4 and start the flash process over again). + +![Login after successful Reboot](../../Images/Edison/login_after_successful_reboot.png) + +Use login `root` and password `edison` to login to your newly flashed Edison. After logging in, you will notice that the Terminal prompt says `root@ubilinux:~#`. This is the correct prompt for the jubilinux system. You will not see jubilinux in the prompt. If you bought a pre-flashed Edison, this is how your initial Terminal prompt will look. + +![Terminal Prompt for Jubilinux](../../Images/Edison/name.png) + +CONGRATULATIONS! You just flashed the edison! Wahoo! Now, let's keep going. + +#### **1-8. Wifi for Edison** + +Now that you’ve finished flashing, the Edison is going to need a couple things to finish setting it up; Hostname/passwords and Multiple WiFi networks + +**Hostname and password** + +* From that same screen we just left off , enter these commands to rename your Edison's hostname. + +`myedisonhostname=` <---But replace the <> section with your chosen hostname. I used “edisonhost” as the name, as shown in screenshot below. + +Then run each of these commands with no modifications, just copy and paste: + +`echo $myedisonhostname > /etc/hostname` + +`sed -r -i"" "s/localhost( jubilinux)?$/localhost $myedisonhostname/" /etc/hosts` + +Now your Edison has a new hostname. (note: screenshot below is a little different than you will see on your screen. You will see root@ubilinux) + +![Edison hostname and password screen](../../Images/Edison/edison_hostname_password.png) + +**IMPORTANT** + +* To change the password for your Edison to a more secure password than “edison”, enter `passwd root` + +* Follow the commands to reset the password. Repeat for `passwd edison` + +* SAVE PASSWORDS somewhere, you’ll want them. + +![Changing password screen](../../Images/Edison/changing_edison_password.png) + +#### **1-9. Multiple wifi networks** + +**A-1.** Enter +`vi /etc/network/interfaces` + +**A-2.** A screen similar to the one below will appear. Type “i” to enter INSERT mode for editing on the file. + +![Wifi edit screen](../../Images/Edison/Wifi_edit_screen.png) + +.. note:: + **Helpful Tip for Insert Mode** + + If you are new to INSERT MODE, realize that INSERT MODE inserts characters at the highlighted cursor (it does not overwrite the character showing beneath the cursor). And, the default is that the cursor will be at the top left of the screen to start, so you will need to use the arrow keys to move the cursor to the area where you want to start typing. If you freak out that you’ve made a change that you don’t want to commit...you can simply press the ESC key and then type (no quotes) “:q!” to quit without saving any of your typing/changes. + + +**A-3.** Make the changes so they match the areas highlighted in yellow, above: +* uncomment (remove the #) from the auto wlan0 line +* add ` wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf` right below the iface wlan0 line. +* comment out (add #) to the wpa-ssid and wpa-psk lines as shown + +**A-4.** Press ESC then type “:wq” (no quotes) and enter to write (save) and quit that screen. When you press ESC, you won't initially see much different, but when you type ":wq", you will see the characters appear in the lower left of the screen. + + +**B-1.** Enter `vi /etc/wpa_supplicant/wpa_supplicant.conf` + +**B-2.** Type “i” to enter INSERT mode for editing on the file. + +**B-3.** Add the following for each wifi network you’d like to add. + +``` +network={ + ssid="my network" + psk="my wifi password" +} +``` + +The networks you enter here are the wifi networks that your rig will be able to use to stay connected to internet. Examples shown below. One is my home wifi, the other is my iphone’s personal hotspot. + +![Wifi edit screen](../../Images/Edison/Wifi_add.png) + +![Phone wifi hotspot screen](../../Images/Edison/Phone_hotspot_wifi.png) + +* Note: If you don’t know your personal hotspot’s information, you can find it under your iPhone's Settings, Personal Hotspot as shown in the screenshot. + +* You should add your personal hotspot to the list of wifi networks as a backup if your BT-tethering to hotspot does not work. By toggling your hotspot off-on, it will generate a wifi-tether signal for approximately 90 seconds, so that your rig can find it and connect. Since wifi-tethers are similar to a regular wifi connection, your rig will not automatically hop off this connection when it gets to your home wifi network. You will need to remember to turn off your wifi-tether if you want your rig to connect back to your home wifi network. By contrast, a hotspot connection done by BT-tether does not require any toggling and your rig will connect/disconnect as it leaves/comes to a known wifi network in your wp_supplicant list. + +* If you haven't done it, a good idea is to update the name of your iPhone to remove any apostrophes. Apple's default is to name iPhones with an apostrophe such as "Katie's iPhone". This can cause some problems for wifi connections sometimes. You can rename your iPhone by going into your iPhone's Settings, General, About, and then Name. + +Some wifi networks require you to accept a terms and conditions prior to allowing access. For example, Starbucks coffee shops and many hotels. These networks are termed "captive" networks and connecting your rig to captive networks is currently not an option. + +Other wifi networks may require you to enter a login name and password at an initial screen before allowing access (such as many school wifi networks). Some users have success in using the following wpa network settings for those types of networks: + +``` +network={ + scan_ssid=1 + ssid="network name" + password="wifi password" + identity="wifi username" + key_mgmt=WPA-EAP + pairwise=CCMP TKIP + group=CCMP TKIP WEP104 WEP40 + eap=TTLS PEAP TLS + priority=1 +} +``` + +**B-4.** Press ESC then type “:wq” to write (save) and quit that screen when you have finished adding the wifi networks. You can always come back and add more networks as needed, using the same process. + +**C** Run `ifup wlan0` to make sure you can connect to wifi. A successful connection should look similar (IP address numbers will be different than mine): + +![ifup wlan0 example](../../Images/Edison/ifup_wlan0.png) + +If you don't see a message showing you are successfully connected, go back to the start of Step 1-9 and make sure that you don't have any typos in those two files. + +#### **1-10. Installing packages, SSH keys, and other settings** + +ALRIGHTY...Your Edison is coming along. Now we are going to set aside the Edison “screen” terminal window (in case we can't get in via ssh), reboot, and login using an “ssh” command from a new Terminal window. + +* Type `reboot` +* Wait as many lines of action go by in the Terminal window...eventually you will get to a prompt that has your new edisonhost name login. We aren't going to login right now. Just saving that window in case we need it later. +* Open a new Terminal window by pressing Command-N +* Login to your Edison by entering `ssh root@edisonhost.local` (changing edisonhost to the hostname you selected earlier above). If you see warnings about the authenticity of host can't be established, you can say yes to continue and add the new edison to your known hosts list. This message typically appears when you've set-up multiple edisons on the same computer. +* Enter your password that you set earlier + +![Login to your rig](../../Images/Edison/Rig_login_time.png) + +* Run `ping google.com` to make sure your rig is online. If your rig shows up as online successfully, you can enter control-c to exit the ping. A successful ping should look like the screen below. + +![Ping success](../../Images/Edison/ping_success.png) + +If the rig isn't online, go back and check your /etc/network/interfaces and /etc/wpa_supplicant/wpa_supplicant.conf files above: you probably either missed a step or made a typo. Usually you will see `ping: unknown host google.com` if you are not connected to the internet, as shown below. + +![Ping Unsuccessful](../../Images/Edison/ping_unsuccessful.png) + +* Enter these three lines, one-at-a-time (the first line will run fast, and the second and third lines may take several minutes to complete) + +`dpkg -P nodejs nodejs-dev` + +![Nodejs install](../../Images/Edison/nodejs.png) + +`apt-get update && apt-get -y dist-upgrade && apt-get -y autoremove` + +![Apt-get install](../../Images/Edison/apt-get.png) + +`apt-get install -y sudo strace tcpdump screen acpid vim python-pip locate` + +![python and sudo install](../../Images/Edison/python.png) + +* Enter these three lines, one-at-a-time (the first two will be fast, the last line will take you to a screen for setting up your timezone. Screenshots are just for examples...in this case PST + +`adduser edison sudo` + +`adduser edison dialout` + +`dpkg-reconfigure tzdata # Set local time-zone` + +![Time zone examples](../../Images/Edison/Time_zone.png) + +* Enter `vi /etc/logrotate.conf` then press “i” for INSERT mode, and make the following changes: + + * set the log rotation to daily from weekly + * remove the # from the “#compress” line + +* Press ESC and then type “:wq” to save and quit + +![Log rotation examples](../../Images/Edison/log_rotation.png) + +**Congratulations you have successfully flashed your edison and configured some basic settings. Time to move onto OpenAPS install** + +### 2. Installing the looping script (openaps-setup.sh) + +You'll now want to move on to the [Phase 1 instructions](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-1/index.html) if you haven't already set up Nightscout; and if you've already done that, onward to [Phase 2 to install the closed loop](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/index.html)! + +### 3. Personalising your closed loop + +See the [phase 3 documentation](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/index.html) for personalizing your closed loop. diff --git a/docs/docs/walkthrough/phase-0/hardware/CGM.md b/docs/docs/walkthrough/phase-0/hardware/CGM.md index 2e60a09b3..6f6093517 100644 --- a/docs/docs/walkthrough/phase-0/hardware/CGM.md +++ b/docs/docs/walkthrough/phase-0/hardware/CGM.md @@ -4,54 +4,28 @@ * Dexcom G5 Mobile * Medtronic (MiniMed Paradigm REAL-Time Revel or Enlite) -The openaps tool set currently supports three different CGM systems: the Dexcom -G4 Platinum system (with or without the -[Share](http://www.dexcom.com/dexcom-g4-platinum-share) functionality), the -newer Dexcom G5 Mobile system and the -[Medtronic system](https://www.medtronicdiabetes.com/treatment-and-products/enlite-sensor). - -With Dexcom G4, the Share platform is not required as communication with the -receiver is usually accomplished via USB directly to the Pi. For Dexcom G5 -Mobile you can also use a compatible receiver (software upgraded G4 with Share -receiver or a G5 Mobile Receiver). - -NOTE: You can also pull CGM data from Nightscout as -an alternative (including Dexcom G5 to iOS device + Nightscout Bridge plugin), -or use xDrip (see below). The Medtronic CGM system communicates directly with -the associated pump, so that data can be retrieved using the CareLink USB stick. The Medtronic Minimed 530g Pump's Enlite CGM Sensors CAN be used with the older OpenAPS compatible Medtronic Pumps (Despite that pump originally being offered with SoftSensor CGM Sensors). + +The openaps tool set currently primarily supports three different CGM systems: the Dexcom G4 Platinum system (with or without the [Share](http://www.dexcom.com/dexcom-g4-platinum-share) functionality), the newer Dexcom G5 Mobile system and the [Medtronic system](https://www.medtronicdiabetes.com/treatment-and-products/enlite-sensor). Other CGM or CGM-like devices (Libre) can also be used if the data is uploaded to Nightscout and the OpenAPS rig has Internet connectivity. + +With Dexcom G4, the Share platform is not required; but is valuable for uploading BG data to the cloud (and into Nightscout, which can then send BGs to the rig). However, without Share, a G4 receiver can instead be plugged in directly to the OpenAPS rig. For Dexcom G5 Mobile you can also use a compatible receiver (software upgraded G4 with Share receiver or a G5 Mobile Receiver), or also pull data from the Dexcom Share servers into Nightscout for use with an Internet-connected OpenAPS rig. + +NOTE: You can also pull CGM data from Nightscout as an alternative (including Dexcom G5 to iOS device + Nightscout Bridge plugin), or use xDrip (see below). The Medtronic CGM system communicates directly with the associated pump, so that data can be retrieved using the CareLink USB stick. The Medtronic Minimed 530g Pump's Enlite CGM Sensors CAN be used with the older OpenAPS compatible Medtronic Pumps (Despite that pump originally being offered with SoftSensor CGM Sensors). ### Using the Dexcom receiver CGM -This refers to the Dexcom receiver hardware. Note that your Dexcom should be nearly fully -charged before plugging it in to a Raspberry Pi. If, when you plug in your -receiver, it causes your WiFi dongle to stop blinking, that is a sign that it is -drawing too much power and needs to be charged. Once the receiver is fully -charged, it will stay charged when connected to the Pi. +This refers to the Dexcom receiver hardware. Note that your Dexcom should be nearly fully charged before plugging it in to a Raspberry Pi or Edison-based OpenAPS rigs. If, when you plug in your receiver, it causes your WiFi dongle to stop blinking, that is a sign that it is drawing too much power and needs to be charged. Once the receiver is fully charged, it will stay charged when connected to the rig. ### Pulling CGM data from the cloud -Your OpenAPS implementation can also pull CGM data from a Nightscout site in -addition to pulling from the CGM directly. You can find more documentation about -pulling CGM data from a Nightscout site -[here](https://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-1/nightscout-setup.html). +Your OpenAPS implementation can also pull CGM data from a Nightscout site in addition to pulling from the CGM directly. You can find more documentation about pulling CGM data from a Nightscout site [here](https://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-1/nightscout-setup.html). -* If you have an Android phone, you can use the xDrip app to get your data from - the Dexcom to Nightscout, to then be used in OpenAPS. -* If you have a Share receiver - [follow these directions](http://www.nightscout.info/wiki/welcome/nightscout-with-xdrip-and-dexcom-share-wireless) - to set up your Android uploader and Nightscout website. -* You could also build a DIY receiver. Directions to build the receiver, set up - your uploader and Nightscout can be found - [here](http://www.nightscout.info/wiki/nightscout-with-xdrip-wireless-bridge). -* You can also use part of the DIY receiver set up - the wixel – directly to the - raspberry pi. Learn more about the wixel setup - [here](https://github.com/jamorham/python-usb-wixel-xdrip) and - [here](https://github.com/ochenmiller/wixelpi_uploader). +* If you have an Android phone, you can use the xDrip app to get your data from the Dexcom to Nightscout, to then be used in OpenAPS. +* If you have a Share receiver [follow these directions](http://www.nightscout.info/wiki/welcome/nightscout-with-xdrip-and-dexcom-share-wireless) to set up your Android uploader and Nightscout website. +* You could also build a DIY receiver. Directions to build the receiver, set up your uploader and Nightscout can be found [here](http://www.nightscout.info/wiki/nightscout-with-xdrip-wireless-bridge). +* You can also use part of the DIY receiver set up - the wixel – directly to the raspberry pi. Learn more about the wixel setup [here](https://github.com/jamorham/python-usb-wixel-xdrip) and [here](https://github.com/ochenmiller/wixelpi_uploader). + * If you are using Abbott Freestyle Libre in combination with Sony smartwach 3 and xdrip+ (or possibly other combinations of technology to get Libre data up into the cloud), you can also pull CGM data directly from Nightscout. + ### Using the Medtronic CGM -Because the Medtronic pump collects data directly from the Enlite sensors, -OpenAPS will retrieve CGM data in addition to your regular pump data from your -pump. While you use the same OpenAPS commands to get it, the Medtronic CGM data -need a little special formatting after being retrieved. We'll discuss these -special circumstances as they come up later. +Because the Medtronic pump collects data directly from the Enlite sensors, OpenAPS will retrieve CGM data in addition to your regular pump data from your pump. While you use the same OpenAPS commands to get it, the Medtronic CGM data may need a little special formatting after being retrieved. If so, it will be specified in other areas of the documentation. diff --git a/docs/docs/walkthrough/phase-0/hardware/antenna0.jpg b/docs/docs/walkthrough/phase-0/hardware/antenna0.jpg new file mode 100644 index 000000000..d1f723848 Binary files /dev/null and b/docs/docs/walkthrough/phase-0/hardware/antenna0.jpg differ diff --git a/docs/docs/walkthrough/phase-0/hardware/edison.md b/docs/docs/walkthrough/phase-0/hardware/edison.md index 6d716c472..749bb9c83 100644 --- a/docs/docs/walkthrough/phase-0/hardware/edison.md +++ b/docs/docs/walkthrough/phase-0/hardware/edison.md @@ -1,28 +1,51 @@ # Hardware information for Intel Edison-based setups +Note: The Edison/Explorer Board combination is the rig setup recommended by the community for size, range, and portability reasons. The high level parts list (see below for more details, and links): + +* Explorer Board +* Edison (which you can now order pre-flashed with Jubilinux) +* Nuts and Bolts to hold the Edison on to the Explorer Board +* At least one Lithium battery +* 2 cables + ## Edison -[Intel Edison Compute Module](http://www.intel.com/content/www/us/en/do-it-yourself/edison.html) - Get it from [Amazon](http://www.amazon.com/gp/product/B00PTVSVI8?dpID=51yqQB46DIL&dpSrc=sims&preST=_SL500_SR135%2C135_&refRID=6AE996400627CC0KPY52&ref_=pd_rhf_se_s_cp_2), Adafruit, Sparkfun or your nearest provider. Be aware that there are four versions: 1-EDI2.LPON, 2-EDI2.SPON, 3-EDI2.LPOF, and 4-EDI2.SPOF. Option 1 claims lower power consumption, and if so would be better for a portable rig. Option 2 is the more common version, with theoretically higher consumption because of the more power dedicated to wifi. If you purchase a development kit, this is the version you will get. Versions 3 and 4 require an external antenna. To date no one has done any side-by-side testing of power consumption between the LPON and SPON Edison versions, so it is unclear how much difference (if any) the model number would make to power consumption in real-world conditions with an OpenAPS rig. +[Intel Edison Compute Module](http://www.intel.com/content/www/us/en/do-it-yourself/edison.html) + +* Option A (**RECOMMENDED - this will save you several hours**): [Buy an Edison that is already flashed with Jublinux - see here](https://enhanced-radio-devices.myshopify.com/products/intel-edison-w-jubilinux). You can order it from the same manufacturer that makes the Explorer Boards (see below). You'll be able to skip the flashing steps and [start by logging in as root](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/setup-edison.html#initial-edison-setup) to set up your wifi & otherwise set up OpenAPS from there. + * If it is "out of stock", you can sign up to get notifications for when they're back in stock. Even if they're out of stock at the moment, we recommend waiting a few days to get a pre-flashed Edison. If you get impatient and try to buy an Edison elsewhere and flash it yourself, you'll probably end up frustrated with the process, and may end up wasting more time asking someone to walk you through the process on Gitter than it would've taken to just wait for the next batch of pre-flashed ones. + +* Option B (**NOT RECOMMENDED** unless you've previously flashed jubilinux and are comfortable doing so again): Get it out of the box from [Amazon](http://www.amazon.com/gp/product/B00PTVSVI8?dpID=51yqQB46DIL&dpSrc=sims&preST=_SL500_SR135%2C135_&refRID=6AE996400627CC0KPY52&ref_=pd_rhf_se_s_cp_2), Adafruit, Sparkfun or your nearest provider - and follow the instructions to flash it. Be aware that there are four versions: 1-EDI2.LPON, 2-EDI2.SPON, 3-EDI2.LPOF, and 4-EDI2.SPOF. Option 1 claims lower power consumption, and if so would be better for a portable rig. Option 2 is the more common version, with theoretically higher consumption because of the more power dedicated to wifi. If you purchase a development kit, this is the version you will get. Versions 3 and 4 require an external antenna. To date no one has done any side-by-side testing of power consumption between the LPON and SPON Edison versions, so it is unclear how much difference (if any) the model number would make to power consumption in real-world conditions with an OpenAPS rig. So, get whichever one is cheapest/you decide you want. -Note: There are several different model numbers or variants of the Intel Edison Compute Module. This does not appear to be documented on Intel's website or at many of the online retailers. However, the different variants can be seen in the product listings at [Mouser](http://www.mouser.com/Embedded-Solutions/Computing/_/N-aez39?Keyword=intel+edison) and [Arrow](https://www.arrow.com/en/products/search?q=intel%20edison&filters=Manufacturer_name:Intel;). +The different model numbers or variants of the Intel Edison Compute Module do not appear to be documented on Intel's website or at many of the online retailers. However, the different variants can be seen in the product listings at [Mouser](http://www.mouser.com/Embedded-Solutions/Computing/_/N-aez39?Keyword=intel+edison) and [Arrow](https://www.arrow.com/en/products/search?q=intel%20edison&filters=Manufacturer_name:Intel;). It appears as though the main differences pertain to onboard vs. external antenna and low power vs. high power wireless radio options. The low power radio variant is classified by Intel as "Wearable". According to some discussion on the Intel message boards (see [here](https://communities.intel.com/thread/81519) and [here](https://communities.intel.com/message/251806#251806)) the "Wearable" variant limits the wireless radio power to "keep the thermal properties at a lower level". Some users have noted that their Edison modules get very hot at times. Although the discussions referenced above suggest that using the low power "Wearable" variant may help avoid heat issues, the different Edison models have not been tested side-by-side in an OpenAPS configuration to determine whether or not any one model would use lower power, generate less heat, or have better wireless performance compared to the other models. ## Lipo Battery and/or other battery supply -Use a LiPo battery because the Explorer Board has battery charger circuitry on board for these batteries. The example setup uses a [2000mah LIPO battery](http://www.robotshop.com/en/37v-2000mah-5c-lipo-battery.html). This battery lasts in the region of ~16+ hours. The connector on this battery is a 2mm 2 pin JST to match the Explorer Board power plug. It's best to buy from a reputable supplier, because if the internal two cells are mismatched the explorer board cannot charge them seperately and they are prone to catching fire. Make sure that it *includes a protection circuit* to protect over-discharge. **NEVER** connect the battery to the Edison base board the wrong way round. There is no manufacturing standard so never assume correct polarity. The connector JP1 on the explorer board has two terminals. The left side is positive, the right side is negative. The side with the JP1 lable is the positive side. Typically a battery's red wire is the positive wire. Ideally you want a battery that has a 10k ohm thermistor for temperature protection by the Edison too. +Use a LiPo battery because the Explorer Board has battery charger circuitry on board for these batteries. The example setup uses a [2000mah LIPO battery](http://www.robotshop.com/en/37v-2000mah-5c-lipo-battery.html). This battery lasts in the region of ~16+ hours. The connector on this battery is a 2mm 2 pin JST to match the Explorer Board power plug. It's best to buy from a reputable supplier, because if the internal two cells are mismatched the Explorer board cannot charge them seperately and they are prone to catching fire. Make sure that it *includes a protection circuit* to protect over-discharge. **NEVER** connect the battery to the Edison base board the wrong way round. There is no manufacturing standard so never assume correct polarity. The connector JP1 on the Explorer board has two terminals. The left side is positive, the right side is negative. The side with the JP1 label is the positive side. Typically a battery's red wire is the positive wire. Ideally you want a battery that has a 10k ohm thermistor for temperature protection by the Edison too. You can use any charger with a USB plug, including a wall power charger. The Explorer Board has pass through charging, so this is also how you will charge the LiPo battery. -The following link is to a LiPo battery that is currently most commonly being used with the explorer board rigs. https://www.adafruit.com/products/2011 +The following link is to a LiPo battery that is currently most commonly being used with the Explorer board rigs. https://www.adafruit.com/products/2011. (If it is out of stock on Adafruit, it can be purchased from various sellers on Amazon here: [Adafruit Battery Packs Lithium Ion Battery 3.7v 2000mAh](https://www.amazon.com/Battery-Packs-Lithium-3-7v-2000mAh/dp/B0137ITW46) + +Alternative, but common, higher capacity batteries include the Adafruit Lithium Ion Polymer Battery - 3.7v 2500mAh (PRODUCT ID: 328) and the Adafruit Lithium Ion Cylindrical Battery - 3.7v 2200mAh (PRODUCT ID: 1781). They can be viewed here: https://www.adafruit.com/category/574 and comparables can be easilly located with an internet search. ## Explorer Board or another base board -You can use just about any base board, including the Intel base board or the Sparkfun base board, both of which are commonly sold with the Edison as a kit. Or, purchase the [Explorer Board](https://enhanced-radio-devices.myshopify.com/products/900mhz-explorer-block-pre-order), which was co-designed by this community. It is going to be the main board supported by the docs moving forward. It also has the benefits of a built-in radio stick. +You can use just about any base board, including the Intel base board or the Sparkfun base board, both of which are commonly sold with the Edison as a kit. However, the recommended board to use is the [Explorer Board](https://enhanced-radio-devices.myshopify.com/products/900mhz-explorer-block-pre-order), which was co-designed by this community. It is going to be the main board supported by the docs moving forward. It also has the benefits of a built-in radio. Use the link above to find/purchase an Explorer board. + +### Explorer Board antenna tuning (optional) + +The antenna on the Explorer board is a strip of copper underneath the green outer coating. The antenna is labeled A1. It will have its maximum power at 868 MHz. The antenna has a line across it at one point with a label that says "915". The antenna defaults to the 868 MHz range, which is what WW pumps use. If you have a US pump, mmtune will run and tune to something near 916MHz. Even with the 868 MHz antenna, you should get half a dozen feet or more of range on average. If you (optionally) want to boost the range of your antenna by a couple more feet, then you cut through the outer coating and the copper on that line with an exacto knife. A single clean cut is sufficient, but if the cut doesn't look clean you could make two cuts and then dig out the circumscribed piece and then reseal the copper with nail polish. With that cut, the antenna will have maximum power near 915 MHz. + +If you're unsure whether you need to cut your Explorer Board's antenna, you probably don't. And if you decide you need slightly more range after using the Edison+Explorer rig for a few weeks, you can always come back later and do so then. -## Radio stick / antenna +![Image of Antenna](antenna0.jpg) -We recommend the Explorer Board with a built-in radio stick. The antenna on board is a strip of copper underneath the green outer coating. The antenna is labeled A1. It will have its maximum power at 868 MHz. The antenna has a line across it at one point with a label that says "915". The antenna defaults to the 868 MHz range, which is what WW pumps use. If you have a US pump, mmtune will run and tune to something near 916MHz. Even with the 868 MHz antenna, you should get half a dozen feet or more of range on average. If you want to boost the range of your antenna (optional), then you cut through the outer coating and the copper on that line with an exacto knife. A single clean cut is sufficient, but if the cut doesn't look clean you could make two cuts and then dig out the circumscribed piece and then reseal the copper with nail polish. With that cut, the antenna will have maximum power near 915 MHz. +## Radio stick (only if not using Explorer Board) + +We recommend the Explorer Board with a built-in radio (see above), because if you get an Explorer Board, you don't need an additional radio stick or CC-Debugger. If you don't use the Explorer Board, you can use a number of radio sticks: a [TI-USB-Sticks](http://www.ti.com/tool/cc1111emk868-915), running [subg_rfspy](https://github.com/ps2/subg_rfspy); [Wireless Things ERF](https://www.wirelessthings.net/erf-0-1-pin-spaced-radio-module); [Wireless Things Slice of Radio](https://www.wirelessthings.net/slice-of-radio-wireless-rf-transciever-for-the-raspberry-pi) a Slice of Radio; or a Rileylink. For details about setup with these other stick and board options, [the best instructions will be found in the mmeowlink wiki](https://github.com/oskarpearson/mmeowlink/wiki) for setting up your board and stick. Note you may also need a CC debugger for these. Then, come back to Phase 1 of the docs once you complete that. @@ -30,19 +53,41 @@ If you don't use the Explorer Board, you can use a number of radio sticks: a [TI You will need two micro USB cables - with a micro connector on one end and a standard (Type A) connector on the other. Most cables will work fine, but some prefer to select lengths. You may already have one for charging a Dexcom receiver, or an Android phone, lying around at home. If you don't, here's an example of one that will work: [Monoprice Premium USB to Micro USB Charge, Sync Cable - 3ft](http://www.monoprice.com/Product?c_id=103&cp_id=10303&cs_id=1030307&p_id=9763&seq=1&format=2). +Warning: bad cables cause a lot of headaches during the Edison flashing process, so it may be worth verifying before you start if you have good cables that can transfer data. + +## Micro USB to Micro USB OTG Cable + +You may need to connect your Dexcom Receiver to your Explorer Board for offline looping. For this you will need to use a micro USB to micro USB OTG cable (or an OTG adapter). Here is an example of a cable that will work: [BestGameSetups Micro USB to Micro USB OTG (On-The-Go) 12" (30cm) Data Cable](https://www.amazon.com/dp/B00TQOEST0/ref=cm_sw_r_cp_api_Niqfzb3B4RJJW) + ## Nuts and Bolts -You will likely want to screw your Edison onto the Explorer Board to stabilize the rig. You can order a kit, or use (2) M2 screws and (6) M2 nuts (four used as spacers). +You will likely want to screw your Edison onto the Explorer Board to stabilize the rig. You can order a kit, or use (2) M2 screws and (6) M2 nuts (four used as spacers). Here's an example of a harware pack with screws and nuts that will work: [Sparkfun Intel Edison Hardware Pack](https://www.sparkfun.com/products/13187) ## Cases There are a few 3D-printed cases that are being designed, so check back here for more links in the future. A few options that we know will work with an Explorer Board/Edison rig and a standard 2000mah battery: + +### Hard cases * [RadioShack Project Enclosure (3x2x1 inch)](https://www.radioshack.com/products/radioshack-project-enclosure-3x2x1?utm_medium=cpc&utm_source=googlepla&variant=20332262405&gclid=Cj0KEQiA-MPCBRCZ0q23tPGm6_8BEiQAgw_bAkpDZCXfIgbEw8bq76VHtV5mLwR2kHKfJrsGsF3uqqgaAtxP8P8HAQ) * [Ken Stack's 3D design for a case with the battery next to the board](https://github.com/Perceptus/explorer_board_case) * [Rob Kresha's design with the battery compartment stacked on-top of the board compartment](http://www.thingiverse.com/thing:2020161) * [Gustavo's 3D design](https://github.com/Perceptus/explorer_board_case_2) * [Sulka Haro's 3D design](https://www.tinkercad.com/things/4a6VffpcuNt) +* [tazitoo's 3D design: CAD](https://www.tinkercad.com/things/aRYGnHXt7Ta-explorer-case/editv2) ([or STL for 3D printing](http://www.thingiverse.com/thing:2106917)) +* [danimaniac's Protective Cases & Accessories](https://github.com/danimaniac/OpenAPS-Explorer-Board-Edison-vented-case) +* [Luis's ventilated acrylic simple design](https://drive.google.com/drive/folders/0BxeFg9yJZ_FZdWJEcG5KMXdUMjg?usp=sharing) +* [Small clear plastic case perfect for larger Sparkfun 2000mah battery: #8483](http://www.ebay.com/itm/272062812611) +* [Robert Silvers and Eric Burt's case for Explorer and 2500 mAh battery](http://www.thingiverse.com/thing:2282398) +* [Robert Silvers' case for Explorer and 2000 or 2500 mAh battery](http://www.thingiverse.com/thing:2291125) + +### Soft Cases +* [TallyGear soft case](http://www.tallygear.com/index.php?route=product/category&path=90) - these are the soft cases Dana uses ([see this example](https://twitter.com/danamlewis/status/792782116140388353)). To order, just pick the pattern/fabric for a Dexcom G4/G5 case (per the link) and put that you want it OpenAPS sized or 2x3" in the notes. + # Next steps after you get your hardware -Once you've gotten your equipment, you'll want to head to the "[Setting Up Your Intel Edison](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/setup-edison.html)" page. +Once you've gotten your equipment, you'll want to head to the "[Setting Up Your Intel Edison](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/setup-edison.html)" page. **Note that this page has setup instructions for all types of computers, and also has the most thorough troubleshooting section**. There is also an Edison setup page for Mac specifically ([see the Mac-Edison page here](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/edison-explorer-board-Mac.html)) and for PC specifically ([see the PC-Edison page here](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/windows-edison.html)). Even with the Mac or PC specific pages, you may find the main page with all setup types to have the most thorough troubleshooting section if you run into any trouble. + +* If you bought an Edison un-flashed from Amazon, etc. you will start at the top of one of those pages to flash your Edison with Jubilinux. +* If you bought a pre-flashed Edison with Jubilinux, [you can skip down to the section of the docs here where you will log in to the Edison as root](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/setup-edison.html#initial-edison-setup) and go on from there. (That's a link to the page with all setups; but you can find the same section in the Mac or PC page listed above). +* **Note**: If you don't know how to log in to your Edison as root, [you may find this page for accessing your rig](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/accessing-your-rig.html) to be a good read first. diff --git a/docs/docs/walkthrough/phase-0/hardware/hardware.md b/docs/docs/walkthrough/phase-0/hardware/hardware.md index e44c529b1..957a6b076 100644 --- a/docs/docs/walkthrough/phase-0/hardware/hardware.md +++ b/docs/docs/walkthrough/phase-0/hardware/hardware.md @@ -6,10 +6,10 @@ but the following items are recommended for getting started. _The basic setup requires:_ * a compatible insulin pump -* CGM data -* a small computer -* a radio stick -* battery +* a Dexcom G4 or G5 CGM, or a Medtronic CGM +* a small computer (Intel Edison, for example) +* a radio stick (not necessary for an Intel Edison plugged into an Explorer Board, which has radio comms built in) +* a battery If you come across something that doesn't seem to work, is no longer available, or if you have a notable alternative, feel free to edit this documentation with your @@ -23,3 +23,6 @@ compatible for OpenAPS. To be compatible, we must be able to send remote tempora If you're interested in working on communication for another pump (Omnipod, Animas, etc), [click here](http://bit.ly/1nTtccH) to join the collaboration group focusing on alternative pump communication. + +#### Notes about deprecated hardware setups + If you have looked at the docs before, you may remember seeing Carelink sticks and/or Raspberry Pi's as a more prominent recommendation. The community has generally moved away from Carelink sticks (because of poor range and other errors) as part of reliable rig use. The community has also moved toward using Edison-based rig setups due to the smaller size and lesser cost of these setups overall compared to the Pi rigs. The [Pi instructions still work and still exist](https://github.com/openaps/docs/blob/master/docs/docs/walkthrough/phase-0/hardware/raspberry-pi.md); however as of March 12, 2017, they are no longer the top recommended setup option. The community recommends following the documentation for buildling a rig based on the Edison and Explorer Board (which has a built-in radio stick to further reduce size and increase portability). diff --git a/docs/docs/walkthrough/phase-0/hardware/pump.md b/docs/docs/walkthrough/phase-0/hardware/pump.md index 610fb653f..d4f3603ff 100644 --- a/docs/docs/walkthrough/phase-0/hardware/pump.md +++ b/docs/docs/walkthrough/phase-0/hardware/pump.md @@ -10,9 +10,11 @@ Currently, only the following Medtronic MiniMed models allow us to remotely set 523/723 (with firmware 2.4A or lower) 554/754 (European Veo, with firmware 2.6A or lower; OR Canadian Veo with firmware 2.7A or lower) -## How to check pump firmware +NOTE: For European/WorldWide users who have access to a `DANA*R` insulin pump, you may be able to use AndroidAPS, which leverages OpenAPS's oref0 algorithm but allows you to interface using an Android phone and Bluetooth to communicate directly with the `DANA*R` pump. [See here for instructions and details related to AndroidAPS](https://github.com/MilosKozak/AndroidAPS). -To check firmware, hit Esc on the home screen and scroll all the way to the bottom. You can also go into the Utilities menu and look for a PC Connect option. If that is present, the pump will not work for looping. If it’s absent, it should be able to receive temp basal commands.) +## How to check pump firmware (check for presence of PC Connect) + +To check firmware, hit Esc on the home screen and scroll all the way to the bottom. You can also go into the Utilities menu and "Connect Devices" menu and look for a PC Connect option. If that is present, the pump will not work for looping. If it’s absent, it should be able to receive temp basal commands.) If you have one of the above mentioned pumps, but it has buttons that do not work, use the instructions found on this [Imgur photo album](http://imgur.com/a/iOXAP) to repair your pump. @@ -39,6 +41,10 @@ Note: If you're buying a pump online, we recommend you ask the seller to confirm firmware version of the pump. (You may also want to consider asking for a video of the pump with working functionality before purchasing.) +## Make sure you understand your pump basics + +If you are considering moving from Multiple Daily Injections (MDI) to an insulin pump - or changing brands/types of pumps - it is important that you have VERY detailed knowledge about the way a pump works. Insulin pumps use both basal and bolus settings for dosing and only use fast acting insulin. If you just purchased a compatible pump you are probably eager to start closing the loop. OpenAPS uses the settings and information that is manually set by the user (usually with help from their Healthcare Provider) into the pump to make dosing adjustments. First things first: make sure you understand how to safely use your pump in "manual mode" before proceeding. + ## Battery usage Repeated wireless communication with the pump drains the battery quite quickly. diff --git a/docs/docs/walkthrough/phase-0/hardware/raspberry-pi.md b/docs/docs/walkthrough/phase-0/hardware/raspberry-pi.md index 98b7d7fb2..6e443dacd 100644 --- a/docs/docs/walkthrough/phase-0/hardware/raspberry-pi.md +++ b/docs/docs/walkthrough/phase-0/hardware/raspberry-pi.md @@ -1,5 +1,6 @@ # Hardware information for Raspberry Pi setups +(**Note:** _If you're defaulting to Raspberry Pi because that's what you've seen pictures or heard stories of - you should also check out the Edison-based setup instructions for details on a smaller, more mobile friendly option. A Pi/TI stick rig is a good "at home" rig, but most people want the smallest, which is an Edision/Explorer Board rig [(pictured here)](https://twitter.com/danamlewis/status/776248916077522944?ref_src=twsrc%5Etfw) that they can slip in their pocket. The [next page](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/hardware/edison.html) has the Edison required hardware._ The Edison/Explorer Board setup is the main community-supported setup moving forward after March 2017.) The Raspberry Pi (RPi) is a credit-card sized single-board computer. The RPi primarily uses Linux kernel based operating systems, which must be installed by @@ -12,8 +13,7 @@ via an SSH client on Windows, Mac OS X, Linux, iOS, or Android. The RPi has 4 USB ports, an Ethernet port, an HDMI port, and a micro USB power-in jack that accepts 2.1 Amp power supplies. In this tutorial, you will need to access the USB ports, micro USB power-in jack, and possibly the Ethernet -jack (if wireless failure occurs). You will not require the HDMI port or a -monitor. +jack (if wireless failure occurs). High level list of supplies needed for a Pi-based setup: * One of the following: @@ -50,9 +50,9 @@ Raspberry Pi 2. So when selecting portable battery packs bear this in mind. [Raspberry Pi 3 Model B](https://www.raspberrypi.org/products/raspberry-pi-3-model-b/) -## CareLink USB Stick +## CareLink USB Stick - NOT RECOMMENDED -The easiest device for uploading pump data and interfacing OpenAPS is the CareLink USB stick for the RPi. Due to the short range of communication between the CareLink stick and the Medtronic pumps, some users set up multiple sticks in different locations to maximize the chances of successful transmissions. CareLink is not the modern communication device sold by Medtronic. CareLink has been replaced by a newer system but OpenAPS uses the older original communication device, CareLink. Some places to purchase: [Medtronic](https://medtronicdiabetes.secure.force.com/store/remotes-parts/carelink-usb-device/usb-wireless-upload-device) or [American Diabetes Wholesale](http://www.adwdiabetes.com/product/minimed-carelink-usb-upload_1164.htm). +The easiest device for uploading pump data and interfacing OpenAPS is the CareLink USB stick for the RPi. Due to the short range of communication between the CareLink stick and the Medtronic pumps, some users set up multiple sticks in different locations to maximize the chances of successful transmissions. CareLink is not the modern communication device sold by Medtronic. CareLink has been replaced by a newer system but OpenAPS uses the older original communication device, CareLink. A limitation of the Carelink USB stick is the short range of radio communications with the Medtronic pump. The radio signals are transmitted from @@ -60,9 +60,9 @@ the end of the stick opposite the USB connector, on the flat grey side of the stick (see this [set of experiments](https://gist.github.com/channemann/0ff376e350d94ccc9f00) for details). Using a USB extension cable and angling the stick appropriately will assist in improving the connection. See [Rerii 90 Degree USB Extension Cable](http://www.amazon.com/gp/product/B00ZQVADNM) or [Mediabridge Products USB Extension Cable](https://www.mediabridgeproducts.com/product/usb-2-0-usb-extension-cable-a-male-to-a-female-6-inches/). -## Alternative to Carelink USB - Use a TI stick +## Recommended alternative to Carelink USB - Use a TI stick -A [TI stick](http://www.ti.com/tool/cc1111emk868-915) has improved range compared to a carelink stick. However, the main setup docs refer to a carelink stick, so if you pick a TI stick you'll want to head over to [the mmeowlink wiki](https://github.com/oskarpearson/mmeowlink/wiki) for information about preparing and using the TI stick. Then, come back to Phase 1 docs to continue your setup process. +A [TI stick](http://www.ti.com/tool/cc1111emk868-915) has improved range compared to a Carelink stick. However, the main setup docs refer to a Carelink stick, so if you pick a TI stick you'll want to head over to [the mmeowlink wiki](https://github.com/oskarpearson/mmeowlink/wiki) for information about preparing and using the TI stick. Then, come back to Phase 1 docs to continue your setup process. ## Micro SD Card diff --git a/docs/docs/walkthrough/phase-0/img/explorer.png b/docs/docs/walkthrough/phase-0/img/explorer.png new file mode 100644 index 000000000..077a36daa Binary files /dev/null and b/docs/docs/walkthrough/phase-0/img/explorer.png differ diff --git a/docs/docs/walkthrough/phase-0/index.rst b/docs/docs/walkthrough/phase-0/index.rst index f914d6d9b..a492ff10d 100644 --- a/docs/docs/walkthrough/phase-0/index.rst +++ b/docs/docs/walkthrough/phase-0/index.rst @@ -10,10 +10,9 @@ Phase 0: General Setup hardware/hardware hardware/pump hardware/CGM - hardware/raspberry-pi hardware/edison - rpi setup-edison + edison-explorer-board-Mac.md loops-in-progress diff --git a/docs/docs/walkthrough/phase-0/loops-in-progress.md b/docs/docs/walkthrough/phase-0/loops-in-progress.md index b4cd664c4..a50feeb55 100644 --- a/docs/docs/walkthrough/phase-0/loops-in-progress.md +++ b/docs/docs/walkthrough/phase-0/loops-in-progress.md @@ -25,7 +25,7 @@ List of people who are working on closed loops: - Andy Pabari - Rob Kresha - (Papillion, NE, USA) - Christian Robinson (London, UK) -- Gary Kidd +- Gary Kidd (Wilton, CT) - Nathan Morse - Paul Davis (Brighton, UK) - Marion Barker (Sunnyvale, CA, USA) @@ -50,12 +50,13 @@ List of people who are working on closed loops: - Sara and David Goya (Anaheim, CA) - Rafael Matuk (Chicago, IL) - Luuc Verburgh (Eindhoven, The Netherlands) +- Iain Cartwright (Adelaide, Australia) - Julie Raines (Poughkeepsie, NY) - Brandon Parrish (Augusta, GA) - Katie Ellison (Bellevue, WA) - Sarah Easter (Georgetown, TX) - Terri Lyman (Prescott Valley, AZ) -- Gina Lyon (Laurel, MS) +- Gina Lyon (Laurel, MS) Edison-Explorer Bd, DexG5 - Eric Jensen (Swarthmore, PA) - John Dodds (Glasgow, UK) - Lindsey Maguire (Silicon Valley) @@ -71,7 +72,7 @@ List of people who are working on closed loops: - David Eddy (Madbury, NH) - Tirzah Heide for Nathanael (St. Louis, MO) - Tracy Osheroff (Seattle, WA) -- Mike & Jennifer Crawford (Calgary, AB) +- Mike & Jennifer Crawford (Calgary, AB, Canada) - Matthew Byatt (Cambridge, UK) - Anna Hassan (New Orleans, LA) - Tony Zarro (Atlanta, GA) @@ -101,7 +102,6 @@ List of people who are working on closed loops: - Marcus Whitley (Greenbrier, AR) - Trevor Wood (Santaquin, UT) - Anne Svejda (Virginia Beach, VA) -- Jeff Kramer for Hannah (Clive, IA) - Melody Andrews-Caron (Ontario, Canada) - Andy Sharrow (Saginaw, MI) - John Benjamin (Clawson, MI) @@ -120,4 +120,62 @@ List of people who are working on closed loops: - Lorenzo Conte (Chicago, IL) - Alasdair McLay (Derby, UK) - Ahanu Banerjee (Pittsburgh, PA) - +- Ken Huat CHONG (Kuala Lumpur, Malaysia) +- Daniel Bjørnbakk (Norway) +- Katie DiSimone (Paso Robles, CA) +- Rebecca Jervey (Philadelphia, PA) +- Ivica Suran (Pazin, Croatia) +- David Rimmer (Melbourne, Australia) +- Kyle King (Opelika, AL) +- Sonya Neufer +- Sacha M (New Zealand) +- Joe Dunn for Lizzie +- Michele Lawford (Canada) +- parenthetic (diabetic) +- Lorenzo Sandini (Finland) +- Deidra Little (Seattle, WA) +- Tim Mathis (Fort Walton Beach, FL) +- Greg Uhlenkott (Grangeville, ID, USA) +- Song Ming Jie (China) +- Chuck Vanderwist (Western Colorado, USA) +- James Corbett (Greenbrier, TN USA) +- Meghan Rutledge (Dallas, TX) +- Rick Warren (Vancouver, BC, Canada) +- Carl-Johan Wehtje (London, UK) +- Cameron Renwick (Muskoka, Ontario, Canada) +- Cameron Chunn (Huntsville, AL) +- Patrick & Lesly Kelly for Addy (Tempe, AZ) +- Melanie Mason for Toby (Leicester, UK) +- Mohamed Ali Bedair (Cairo, Egypt) +- Hilary Koch (Waterville, ME) +- Eric Feibelman (Alachua, FL) +- Winfried Kuiper (Langballig, Germany) +- Selin Aygün (Ankara,Türkiye) +- Ken Kotch (Boulder, CO, USA) +- Brian Densmore (Clovis, CA, USA) +- Jesse Szypulski (Louisville, KY, USA) Edison / Explorer Board +- Robert Silvers (Norwell, MA) +- Eric Metzler (St. Paul, MN) +- Helene Brashear (Austin, TX) +- Jeremy B. for CM (New York, NY) +- Molly Duerr (Minneapolis, MN) +- Amber K (Ithaca, NY) +- Melanie Shapiro (Gainesville, FL) +- Brandon (Philly) +- Justin W (Charlottesville, VA) +- Chris Creek (Martinsburg, PA) +- Tom Petrillo (San Diego, CA) +- Christian Driver for Lucy (Wilmslow, UK) +- Katie Aldridge +- Darlene Morissette (Winnipeg, MB, Canada) +- Jake Punshon (Saskatoon, SK, Canada) +- Elisa Kelley (Austin, TX) +- Stuart Raphael (Sydney, Australia) +- Dan Durham (Edmonton, AB, Canada) +- Niels Hartvig (Odense, Denmark) +- Dirk Gastaldo (Newbury Park, CA, USA) +- Clayton McCook (Edmond, OK, USA) +- Kris Schmitz (Washington, DC/New Brunswick, NJ) +- Steven Miller (Vancouver, BC, Canada) +- Kyle Larsen (Provo, UT) +- Ben Fowler (Huntsville, AL) diff --git a/docs/docs/walkthrough/phase-0/rpi.md b/docs/docs/walkthrough/phase-0/rpi.md index dc98f6d8e..484cbb0c7 100644 --- a/docs/docs/walkthrough/phase-0/rpi.md +++ b/docs/docs/walkthrough/phase-0/rpi.md @@ -74,7 +74,7 @@ If necessary, you can erase (format) your SD card using https://www.sdcard.org/d * Next, connect your RPi2 to a monitor or T.V. using the included HDMI cable. * Finally connect your RPi2 using the power adapter. * You should see the GUI appear on screen. -* As of 12/11/2016 the Raspberry Pi Foundation is disabling SSH by default in Raspbian as a security precaution. To enable SSH from within the GUI, open up the terminal window and type `sudo raspi-config`. On the configuartion menu that opens, scroll down and choose `Advanced Options` and then navigate to `ssh`, press `Enter` and select `Enable` ssh server. +* As of 12/11/2016 the Raspberry Pi Foundation is disabling SSH by default in Raspbian as a security precaution. To enable SSH from within the GUI, open up the terminal window and type `sudo raspi-config`. On the configuartion menu that opens, scroll down and choose `Interfacing Options` and then navigate to `ssh`, press `Enter` and select `Enable` ssh server. * Configure WiFi per the instruction pamphlet included with your CanaKit. For those not using the CanaKit, click the computer monitors next to the volume control in the upper-right side and there will be a drop-down menu of available WiFi networks. You should see your home network. If you have trouble connecting to the RPi2 via WiFi, check your router settings. The router may need to be switched from WEP to WPA2. * Once you have installed Raspbian, connected to WiFI, and enabled SSH you can disconnect the mouse, keyboard and HDMI cable. diff --git a/docs/docs/walkthrough/phase-0/setup-edison.md b/docs/docs/walkthrough/phase-0/setup-edison.md index b5109d129..42ec8b9d0 100644 --- a/docs/docs/walkthrough/phase-0/setup-edison.md +++ b/docs/docs/walkthrough/phase-0/setup-edison.md @@ -1,15 +1,17 @@ # Setting Up Your Intel Edison -The Intel Edison system comes with a very limited Operating System. It's best to replace this with a custom version of Debian, so that the config is as-close to the Raspberry Pi as possible. This fits best with OpenAPS, and it also means you have the latest security and stability patches. (These setup instructions were pulled from the mmeowlink wiki; if you're an advanced user and want/need to use Ubilinux instead of the recommended Jubilinux, [go here](https://github.com/oskarpearson/mmeowlink/wiki/Prepare-the-Edison-for-OpenAPS).) The setup instructions also are going to assume you're using the Explorer Board that has a built in radio stick. If you're using any other base board and/or any other radio sticks (TI, ERF, Rileylink, etc.), check out [the mmeowlink wiki](https://github.com/oskarpearson/mmeowlink/wiki) for support of those hardware options. +The Intel Edison system comes with a very limited Operating System. It's best to replace this with a custom version of Debian, as this fits best with OpenAPS, and it also means you have the latest security and stability patches. (These setup instructions were pulled from the mmeowlink wiki; if you're an advanced user and want/need to use Ubilinux instead of the recommended Jubilinux, [go here](https://github.com/oskarpearson/mmeowlink/wiki/Prepare-the-Edison-for-OpenAPS).) The setup instructions also are going to assume you're using the Explorer Board that has a built in radio stick. If you're using any other base board and/or any other radio sticks (TI, ERF, Rileylink, etc.), check out [the mmeowlink wiki](https://github.com/oskarpearson/mmeowlink/wiki) for support of those hardware options. ## Helpful notes before you get started Your Explorer Board has 2 micro USB connectors, they both provide power. On the community developed Edison Explorer Board the port labeled OTG is for flashing, and the one labeled UART provides console login. You must connect both ports to your computer to complete the flash process. You must use a DATA micro USB to USB cable. How do you know if your cable is for data? One good way is to plug the cable into your computer USB port and the explorer board OTG port. If your folder/window explorer shows Edison as a drive then the cable supports data. +The steps outlined below include instructions for the various build-platforms (Windows PC, Mac, and Raspberry Pi). If you'd prefer to follow directions specific to one platform you are using, you can use the [Windows PC cheat sheet](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/windows-edison.html) or the [Mac OSX cheat sheet](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/edison-explorer-board-Mac.html). + ## Prerequisites -### If you’re using a Raspberry Pi to flash: +### If you’re using a Raspberry Pi - prerequisites: To flash the Edison using a Raspberry Pi, you’ll need a large (preferably 16GB+) SD card for your Pi. The Edison image is almost 2GB, so you’ll not only need space for the compressed and uncompressed image, but you’ll also need to enable a large swapfile on your Pi to fit the image into virtual memory while it is being flashed. Using an SD card as memory is very slow, so allow extra time to flash the Edison image using a Pi. @@ -18,7 +20,7 @@ To flash the Edison using a Raspberry Pi, you’ll need a large (preferably 16GB - Run `sudo /etc/init.d/dphys-swapfile stop` and then `sudo /etc/init.d/dphys-swapfile start` to enable the new swap file. - If you installed `watchdog` on the pi, it's a good idea to stop it since loading the image into memory to flash is intensive -### If you're using a Windows PC: +### If you're using a Windows PC - prerequisites: - Install the [Intel Edison drivers for Windows]( https://software.intel.com/en-us/iot/hardware/edison/downloads). Select the "Windows standalone driver" download. You do not need to reflash the Edison or setup security or Wi-Fi with this tool because later steps in this process will overwrite those settings. - Install [PuTTY]( http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html). Download the installation file that matches your PC's architecture (32-bit or 64-bit). @@ -35,7 +37,7 @@ Windows PCs with less than 6 GB of RAM may need to have the size of the page fi - Reboot and attempt the flash proccess. -### If you're using a Mac: +### If you're using a Mac to flash - prerequisites: - Read, but only follow steps 3-5 of, [these instructions](https://software.intel.com/en-us/node/637974#manual-flash-process) first. When you get to step 6, you'll need to cd into the jubilinux directory (see how to create it in the Jubilinux section below if you don't already have it) instead of the Intel image one, and continue with the directions below. - Check also to see if you have lsusb installed prior to proceeding. If not, follow the instructions here to add: https://github.com/jlhonora/homebrew-lsusb @@ -45,11 +47,11 @@ Windows PCs with less than 6 GB of RAM may need to have the size of the page fi ## Downloading image ### Jubilinux -[Jubilinux](http://www.robinkirkman.com/jubilinux/) "is an update to the stock ubilinux edison distribution to make it more useful as a server, most significantly by upgrading from wheezy to jessie." That means we can skip many of the time-consuming upgrade steps below that are required when starting from ubilinux. +[Jubilinux](http://www.jubilinux.org/) "is an update to the stock ubilinux edison distribution to make it more useful as a server, most significantly by upgrading from wheezy to jessie." That means we can skip many of the time-consuming upgrade steps that are required when starting from ubilinux. - - Download [jubilinux.zip](http://www.robinkirkman.com/jubilinux/jubilinux.zip) - - In download folder, right-click on file and extract (or use `unzip jubilinux.zip` from the command line) - - Open a terminal window and navigate to the extracted folder: `cd jubilinux`. This is your "flash window", keep it open for later. + - Download the latest [jubilinux.zip](http://www.jubilinux.org/dist/) + - In download folder, right-click on file and extract (or use `unzip jubilinux.zip` from the command line) You will access this directory from a command prompt in the next step. It is a good idea to create the Jubilinux in your root directory to make this easier to access. + - Open a terminal window and navigate to the extracted folder: `cd jubilinux`. If using Windows OS use the command prompt (cmd). This is your "flash window", keep it open for later. For Windows OS: @@ -63,38 +65,39 @@ Windows PCs with less than 6 GB of RAM may need to have the size of the page fi - Connect a USB cable (one that carries data, not just power) to the USB console port. On the Explorer board or Sparkfun base block, this is the port labeled `UART`. On the Intel mini breakout board, this is the USB port that is labled P6 (should be the USB closest to the JST battery connector). Plug the other end into the computer (or Pi) you want to use to connect to console. - Plug another USB cable (one that carries data, not just power) into the USB port labeled OTG on the Explorer board or Sparkfun base block, or the port that is almost in the on the bottom right (if reading the Intel logo) if setting up with the Intel mini breakout board. Plug the other end into the computer (or Pi) you want to flash from. -### If you’re using a Raspberry Pi: +### If you’re using a Raspberry Pi for console: - Open a terminal window and type `sudo screen /dev/ttyUSB0 115200` or similar. If you do not have screen installed you can install with `sudo apt-get install screen`. -### If you're using a Windows PC: - - Go to Control Panel\All Control Panel Items\Device Manager\Ports\ and look for USB Serial Port COMXX. - - Open PuTTY, change from SSH to Serial, and connect to that COMXX port. - - Make sure you change the Speed(baudrate) from 9600 to 115200. - - Once you've made those changes, Click on OPEN at the bottom of your Putty configuration wondow. You may need to click on Enter on your key board a few times. +### If you're using a Windows PC for console: + - Go to Control Panel\All Control Panel Items\Device Manager\Ports\ and look for USB Serial Port COMXX. If you have multiple and unsure of which is the port you need: Make note of existing ports. Unplug the cable from the Explorer board. Notice which port disappears. this is the port you are looking for. + - Open PuTTY, change from SSH to Serial. It normally defaults to COM1 and speed of 9600. Change the COM number to the number you found when you plugged into the Explorer board. Change the speed (baud rate) to 115200. + - Once you've made those changes, Click on OPEN at the bottom of your Putty configuration window. + - Continue with the All platforms section below. -### If you're using a Mac: +### If you're using a Mac for console:  - Open a terminal window and type `sudo screen /dev/tty.usbserial-* 115200` If necessary, replace the '*' with your Edison UART serial number, obtained using lsusb. ### All platforms: - Once the screen comes up, press enter a few times to wake things up. This will give you a "console" view of what is happening on your Edison. - - Now you will see a login prompt for the edison on the console screen. Login with username root and no password. This will have us ready to reboot from the command line when we are ready. + - Now you will see a login prompt for the edison on the console screen. Login using the username "root" (all lowercase) and no password. This will have us ready to reboot from the command line when we are ready. + - Don't resize your console window: it will likely mess up your terminal's line wrapping. (Once you get wifi working and connect with SSH you can resize safely.) ## Flashing image onto the Edison -### If you’re using a Raspberry Pi: +### If you’re using a Raspberry Pi - starting flash: - In the "flash window" from the Download Image instructions above, run `sudo ./flashall.sh`. If you receive an `dfu-util: command not found` error, you can install dfu-util by running `sudo apt-get install dfu-util` -### If you’re using a Mac +### If you’re using a Mac - starting flash: - In the "flash window" from the Download Image instructions above, run `./flashall.sh`. If you receive an `dfu-util: command not found` error, you can install dfu-util by following [the Mac instructions here](https://software.intel.com/en-us/node/637974#manual-flash-process). -### If you're using a Windows PC: +### If you're using a Windows PC - starting flash: - In the "flash window" from the Download Image instructions above, run `flashall.bat` ### All platforms: - The flashall script will ask you to reboot the Edison. Go back to your console window and type `reboot`. Switch back to the other window and you will see the flash process begin. You can monitor both the flash and console windows throughout the rest of the flash process. If nothing else works and you are feeling brave, you can try pulling the Edison out and reconnecting it to the board to start the flash process. - It will take about 10 minutes to flash from Mac or Windows. If the step that flashall says should take up to 10 minutes completes in seconds, then the flash did not complete successfully, perhaps because you didn't set up the virtual memory / swap settings correctly. If you’re using a Raspberry Pi, it may take up to 45 minutes, and for the first 10-15 minutes it may appear like nothing is happening, but eventually you will start to see a progress bar in the console. - After flashing is complete and the Edison begins rebooting, watch the console: you may get asked to type `control-D` to continue after one or more reboots. If so, press `Ctrl-d` to allow it to continue. - - After several more reboots (just about when you'll start to get concerned that it is stuck in a loop), you should get a login prompt. If so, congratulations! You’re Edison is flashed. The default password is `edison`. + - After several more reboots (just about when you'll start to get concerned that it is stuck in a loop), you should get a login prompt. If so, congratulations! Your Edison is flashed. The default password is `edison`. If you have any difficulty with flashing, skip down to [Troubleshooting](#troubleshooting) @@ -105,24 +108,24 @@ Log in as root/edison via serial console. Type/edit the following: - myedisonhostname= + myedisonhostname= #Do not type the <> And then paste the following to rename your Edison accordingly: echo $myedisonhostname > /etc/hostname - sed -i"" "s/localhost$/localhost $myedisonhostname/" /etc/hosts + sed -r -i"" "s/localhost( jubilinux)?$/localhost $myedisonhostname/" /etc/hosts -Run these commands to set secure passwords: +Run these commands to set secure passwords. It will ask you to enter your new password for each user 2 times. Type the password in the same both times. To use SSH (which you will need to do shortly) this password needs to be at least 8 characters long. Do not use a dictionary word or other easy-to-guess word/phrase as the basis for your passwords. Do not reuse passwords you've already used elsewhere. passwd root passwd edison -## Multiple Wifi Networks: +## Set up Wifi: `vi /etc/network/interfaces` Type 'i' to get into INSERT mode -* Uncomment 'auto wlan0' +* Uncomment 'auto wlan0' (remove the `#` at the beginning of the line) * Edit the next two lines to read: ``` auto wlan0 @@ -131,11 +134,28 @@ iface wlan0 inet dhcp ``` Comment out or delete the wpa-ssid and wpa-psk lines. +After editing, your file should look like: + +``` +# interfaces(5) file used by ifup(8) and ifdown(8) +auto lo +iface lo inet loopback + +auto usb0 +iface usb0 inet static + address 192.168.2.15 + netmask 255.255.255.0 + +auto wlan0 +iface wlan0 inet dhcp + wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf +``` + Press Esc and then type ':wq' and press Enter to write the file and quit `vi /etc/wpa_supplicant/wpa_supplicant.conf` -Type 'i' to get into INSERT mode and add the following to the end, once for each network you want to add: +Type 'i' to get into INSERT mode and add the following to the end, once for each network you want to add. Be sure to include the quotes around the network name and password. ``` network={ @@ -143,32 +163,62 @@ network={ psk="my wifi password" } ``` -Press Esc and then type ':wq' and press Enter to write the file and quit -Run `ifup wlan0` to make sure you can connect to wifi +If you want to add open networks to your list, then add: + +``` +network={ + key_mgmt=NONE + priority=-999 +} +``` + +If you have a hidden wifi network add the line `scan_ssid=1`. + +Some wifi networks require you to accept a terms and conditions prior to allowing access. For example, Starbucks coffee shops and many hotels. These networks are termed "captive" networks and connecting your rig to them is currently not an option. + +Other wifi networks may require you to enter a login name and password at an initial screen before allowing access (such as many school district wifi networks). Some users have success in using the following wpa network settings for those types of networks: + +``` +network={ + scan_ssid=1 + ssid="network name" + password="wifi password" + identity="wifi username" + key_mgmt=WPA-EAP + pairwise=CCMP TKIP + group=CCMP TKIP WEP104 WEP40 + eap=TTLS PEAP TLS + priority=1 +} +``` + +Press Esc and then type ':wq' and press Enter to write the file and quit -`reboot` so you can connect via ssh +`reboot` to apply the wifi changes and (hopefully) get online -If you need more details on setting up wpa-supplicant, see one of these guides: +After rebooting, log back in and type `iwgetid -r` to make sure you successfully connected to wifi. -http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/ +Run `ifconfig wlan0` to determine the IP address of the wireless interface, in case you need it to SSH below. -http://www.geeked.info/raspberry-pi-add-multiple-wifi-access-points/ +Leave the serial window open in case you can't get in via SSH and need to fix your wifi config. + +If you need more details on setting up wpa_supplicant.conf, see one of these guides: -http://raspberrypi.stackexchange.com/questions/11631/how-to-setup-multiple-wifi-networks +* [http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/](http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/) +* [http://www.geeked.info/raspberry-pi-add-multiple-wifi-access-points/](http://www.geeked.info/raspberry-pi-add-multiple-wifi-access-points/) +* [http://raspberrypi.stackexchange.com/questions/11631/how-to-setup-multiple-wifi-networks](http://raspberrypi.stackexchange.com/questions/11631/how-to-setup-multiple-wifi-networks) +* [http://www.cs.upc.edu/lclsi/Manuales/wireless/files/wpa_supplicant.conf](http://www.cs.upc.edu/lclsi/Manuales/wireless/files/wpa_supplicant.conf) ## Install packages, ssh keys, and other settings -From a new terminal or PuTTY window, `ssh myedisonhostname.local`. +From a new terminal or PuTTY window, `ssh myedisonhostname.local`. If you can't connect via `youredisonhostname.local` (for example, on a Windows PC without iTunes), you can instead connect directly to the IP address you found with `ifconfig` above. Log in as root (with the password you just set above), and run: dpkg -P nodejs nodejs-dev apt-get update && apt-get -y dist-upgrade && apt-get -y autoremove - -Then: - apt-get install -y sudo strace tcpdump screen acpid vim python-pip locate And: @@ -176,12 +226,13 @@ And: adduser edison sudo adduser edison dialout dpkg-reconfigure tzdata # Set local time-zone + Use arrow button to choose zone then arrow to the right to make cursor highlight then hit ENTER -Edit (with `nano` or `vi`) /etc/logrotate.conf and set the log rotation to `daily` from `weekly` and enable log compression by removing the hash on the #compress line, to reduce the probability of running out of disk space +Edit (with `nano` or `vi`) /etc/logrotate.conf and change the log rotation to `daily` from `weekly` and enable log compression by removing the hash on the #compress line, to reduce the probability of running out of disk space If you're *not* using the Explorer board and want to run everything as `edison` instead of `root`, log out and log back in as edison (with the password you just set above). (If you're using an Explorer board you'll need to stay logged in as root and run everything that follows as root for libmraa to work right.) -If you have an ssh key and want to be able to log into your Edison without a password, copy your ssh key to the edison (directions you can adapt are here: http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/rpi.html#mac-and-linux) +If you have an ssh key and want to be able to log into your Edison without a password, copy your ssh key to the Edison (directions you can adapt are here: [http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/rpi.html#mac-and-linux](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/rpi.html#mac-and-linux)). For Windows/Putty users, you can use these instructions: [https://www.howtoforge.com/ssh_key_based_logins_putty](https://www.howtoforge.com/ssh_key_based_logins_putty). If you're *not* using the Explorer board, are running as the `edison` users, and want to be able to run sudo without typing a password, run: ``` @@ -195,113 +246,6 @@ and add to the end of the file: You have now installed the operating system on your Edison! You can now proceed to the next step of adding yourself to [Loops in Progress](https://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/loops-in-progress.html) -## Configure Bluetooth Low Energy tethering on Edison running Jubilinux [optional] This is still in testing as of 1-1-2017 - -The Intel Edison can be tethered to a smartphone and share the phone's internet connection. Bluetooth tethering needs to be enabled and configured on the phone device and your carrier/plan must allow tethering. - -The main advantages of using BLE tethering are that it consumes less power on the phone device than running a portable WiFi hotspot. The way the script is currently setup, the Edison will try to connect to Wifi first, if it is unable to connect, it will then try to connect with your paired phone. so once you are away from your home wifi, as long as you have the Bluetooth tethering turned on, on your phone, it should work. - -First, Currently the Bluetooth Tethering is only availble on the dev branch of Oref0 - -``` -$ mkdir -p ~/src; cd ~/src && git clone -b dev git://github.com/openaps/oref0.git || (cd oref0 && git checkout dev && git pull) - -``` - -due to this being a dev branch, you will need to run the next instruction in order to get the new oref0-online to work - -``` -cd ~/src/oref0/ && npm run global-install -``` - -You will need to get the Mac address from your phone or whatever device you are using. on the -Android -settings/about phone/ Status; you will a Bluetooth adress looking like AA:BB:CC:DD:EE:FF -iPhone - settings/general/About and it will be under Bluetooth and will look like AA:BB:CC:DD:EE:FF - -when you run the oref0-setup you will need to add that to the install parameters replacing AA:BB:CC:DD:EE:FF with what you found above. - -``` -cd && ~/src/oref0/bin/oref0-setup.sh --btmac=AA:BB:CC:DD:EE:FF -``` - -The first time running the script will take quite a bit longer as it is installing Bluez on your edison. -Once you are installed and running. it may fail after installing the Bluez, just reboot your edison and run the above command again. - -note if you have rebooted the board (which you will have to on an Explorer board) you must run the following command to startup the bluetooth servies, this is needed because at this point in time, you are more than likely connected to your normal Wifi network. and the oref0-online script is run only runs this if the wifi network is not connected. so this will allow you to pair your BT to your phone while running on your home network. - -``` -sudo killall bluetoothd; sudo /usr/local/bin/bluetoothd --experimental & - -sudo hciconfig hci0 name $HOSTNAME - -bluetoothctl - -power off - -power on - -discoverable on - -agent on - -default-agent -``` - -For Android -******************************** -The adapter is now discoverable for three minutes. Search for bluetooth devices on your phone and initiate pairing. The process varies depending on the phone and the dongle in use. The phone may provide a random PIN and bluetoothctl may ask you to confirm it. Enter 'yes'. Then click 'pair' on the phone. - -For iPhone -******************************** -you must use the edison to initiate pairing -``` -pair AA:BB:CC:DD:EE:FF -``` -******************************** -you will see on the edison - -`Request confirmation -[agent] Confirm passkey 123456 (yes/no): yes` - -You must type in **yes** not just **y** to pair - -After, the phone may ask you to enter a PIN. If so, enter '0000' and when bluetoothctl asks for a PIN, enter the same code again. Either way, bluetoothctl should inform you that pairing was successful. It will then ask you to authorize the connection - enter 'yes'. - -Then on your phone you can hit the pair button that popped up. - -Execute the paired-devices command to list the paired devices - - -``` -paired-devices -Device AA:BB:CC:DD:EE:FF Samsung S7 -``` - -Your paired phone should be listed (in this example, a Samsung Galaxy S7). Copy the bluetooth address listed for it; we will need to provide this later. - -Now trust the mobile device - -`trust AA:BB:CC:DD:EE:FF` - -Quit bluetoothctl with 'quit'. - -****************************** -**For Testing** -Option 1 - If you are still on your home wifi you can test to see if you can pair by running (this only works with the Android) -``` -sudo killall bluetoothd; sudo /usr/local/bin/bluetoothd --experimental & - -sudo hciconfig hci0 name $HOSTNAME -``` -then -``` -sudo bt-pan client AA:BB:CC:DD:EE:FF -``` -Option 2 - If you have a serial console connection to your Edison and are using wpa_supplicant, you can comment out your home wifi in `nano /etc/wpa_supplicant/wpa_supplicant.conf`, then reboot. (takes about 1 min after reboot for the Bluetooth Network to connect) - -Option 3 - Take a walk, and as soon as you are out of range of your wifi, you should see that a device is connected to your personal network. Shortly after that you will see things update on nightscout. - -This has been tested with a Samsung Galaxy S7, and a iPhone 6s and has proven reliable. But further testing is needed. So let it be known if you are able to get this to work or if you have problems. - ## Troubleshooting @@ -325,7 +269,7 @@ in something closer to 10 seconds than 10 minutes, then you likely didn't set up c) If you have a failed flash or have problems with the reboot, try starting the console and hitting enter a bunch of times while connecting to stop autoboot. You'll then be at a `boot>` prompt. Run `sudo ./flashall.sh` and when it asks you to reboot type and enter `run do_flash` at the `boot>` prompt. -d) If you get an error that says "Ready to receive application" on the Edison the problem is you don't have enough power to properly boot up the Edison. This can happen if you are powering from your Pi. You should either connect a battery to the Edison board to give it a little boost, or use a powered USB hub between the Pi and the Edison. +d) If you get stuck on an error that says "Ready to receive application" on the Edison the problem is you don't have enough power to properly boot up the Edison. This can happen if you are powering from your Pi. You should either connect a battery to the Edison board to give it a little boost, or use a powered USB hub between the Pi and the Edison. e) If Edison reboots correctly but never gets picked up by the flashall.sh script and the flashing process does not start, check the Edison device ID. It will probably come out automatically after the flashall.sh script fails with a list of available devices connected to the machine. On Linux, you can run lsusb to get a list of usb devices with their device ID. If the device ID is different from the one expected on flashall.sh, you can edit the script and change lines containing: USB_VID=8087 & USB_PID=0a99 to whatever the Edison has for an ID. Some users have encountered their devices ID to be 8087:0a9e @@ -405,3 +349,31 @@ Some users have reported problems with connecting to internet sites. If you are nameserver 8.8.8.8 Also see the instructions [here](https://wiki.debian.org/NetworkConfiguration#The_resolvconf_program) to add these nameservers to your `/network/interfaces` file as the `resolv.conf` file is likely to be overwritten. + +Alternatively, add the nameservers you want to see in `resolv.conf` to `/etc/resolvconf/resolv.conf.d/tail` and they'll be automatically added to `resolv.conf`. (You may need to create the folder by running this command first: `mkdir -p /etc/resolvconf/resolv.conf.d`) + + +### IP address conflicts (able to ping external but not LAN addresses) + +Some users have reported problems where the local router uses the same IP block as that of usb0 config. The default configuration for usb0 in `/etc/network/interfaces` uses 192.168.2.15, so if your local router also uses 192.168.2.xx you may not be able to properly connect to your Edison using SSH, and external connectivity may intermittently fail. + +To check which IP address your router is using, you can run `ipconfig` on Windows or `ifconfig` on Mac/Linux. If you're getting an address starting with 192.168.2.x, you'll want to edit your Edison's configuration to use a different subnet for usb0: + +Use `vi /etc/network/interfaces` to edit the static usb0 interface address from 192.168.2.15 to another valid private IP, like 192.168.29.29. The resulting config should look like: + +``` +# interfaces(5) file used by ifup(8) and ifdown(8) +auto lo +iface lo inet loopback + +auto usb0 +iface usb0 inet static + address 192.168.29.29 + netmask 255.255.255.0 + +auto wlan0 +iface wlan0 inet dhcp + wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf +``` + +Once that looks correct, save the file and `reboot` your rig for the changes to take effect. diff --git a/docs/docs/walkthrough/phase-0/setup.md b/docs/docs/walkthrough/phase-0/setup.md index adac08dca..fd508082a 100644 --- a/docs/docs/walkthrough/phase-0/setup.md +++ b/docs/docs/walkthrough/phase-0/setup.md @@ -1,6 +1,6 @@ # General Setup and Project Prep -The initial setup process is broken into three parts: acquiring the hardware you need; storing baseline data; and configuring the Raspberry Pi or Intel Edison. +The initial setup process is broken into three parts: acquiring the hardware you need; storing baseline data; and configuring the hardware (i.e. Edison). At this stage, you may want to begin documenting each step that you take. This will help in two ways. diff --git a/docs/docs/walkthrough/phase-0/understanding-your-Explorer-Board-rig.md b/docs/docs/walkthrough/phase-0/understanding-your-Explorer-Board-rig.md new file mode 100644 index 000000000..360eb472a --- /dev/null +++ b/docs/docs/walkthrough/phase-0/understanding-your-Explorer-Board-rig.md @@ -0,0 +1,50 @@ +# Understanding your Edison/Explorer Board rig + +## Getting Physical: Build your rig/put the physical pieces together + +The Explorer board is where all the communications are housed for the rig, as well as the battery charger. The Edison is the mini-computer where all the OpenAPS code will be sent and used. In order for this to work, first you have to screw and connect the Edison and Explorer Board together with the nuts and bolts you order. + +The nuts and bolts are tiny, and the spaces are a little tight. It really helps to use a set of tweezers and a small Phillips head screwdriver. + +It's easiest to start with the Explorer board and put on 2 nuts and gold screws (nuts on the side with most of the wiring) inside the little outline where the Edison will eventually sit. Gold screws should be placed as shown, with nuts on the backside. Then, lay the Edison board on top, aligning the screw holes. Use a small Phillips head screwdriver to tighten the screws into the gold screws beneath them. The Edison board should not wobble, and should feel secure when you are done. Attach your battery into the explorer board plug. A single red light should appear and stay lit. During the course of your OpenAPS rig use, it's good practice to periodically check that the nuts and screws stay tightened. If they come loose, the Edison can wobble off the connection to the Explorer board and you will either get looping failures (if it's loose) or be unable to connect to the Edison (if it comes completely off). + +![Edison/Explorer Board rig with red light on](../../Images/Edison/Edison_Explorer_Board.png) + +![Edison/Explorer Board rig with labels](img/explorer.png) + +### Charging Lipo Battery + +You can use the little white block that comes with an iPhone (or similar charger) and a microB-USB cable. The same cables you used to setup the rig and connect to the computer will work for charging, too. Either one of the USB ports on the explorer board will work for charging. When charging is active, there is an extra red light on in the corner of the Explorer board. When charging is complete, that corner red light will turn off. It may come back on periodically as the battery "tops off". You won’t do any damage leaving the rig plugged in for longer than the charge takes. + +While the rig is plugged in for charging, the Nightscout battery pill will read approximately 65%. This is because it is reading the charging voltage rather than the battery voltage. Once you disconnect from the charger, the Nightscout battery pill will display the lipo battery's voltage and percent again. + +### What the lights mean and where they are + +* The LED between the two ports is the power. If this light is on, your rig is on. +* The LED in the corner is the charging indictator. +* The two next to the microUSBs (one green on the latest boards) are for the cc1110 radio chip. By default they just blink once each when you mmtune or otherwise reset it. + +### Where is the power button? + +The little black button on the end of the board near the JST connector is the power button. If you want to reboot your rig, the easiest way is to hold down the tiny power button for 10-15 seconds until the power light turns off. Wait a couple seconds and then press the power button again until the light turns back on. Give the loop a couple minutes to get itself going again…rebooting solves a great majority of any temporary rig issues. + +### Where is the radio? + +The radio and antenna are down on the end of the board where you see a little white stick. (Opposite end of the board from where your battery connects at the JST connector). + +### Cutting the trace to improve radio communication +Some OpenAPS users have found that cutting a portion of the Explorer Board's hidden copper antenna wire (called a trace) will improve radio comms with the pump. Before doing this, remember to disconnect any attached battery or power source first. For North American (NA) pumps (using the 916MHz band), you're looking to cut near that white line that is between the 1 and the 5 in the "915." Consider cutting on the 1-side rather than the exact spot where the white "cut" line is drawn because it is so close to the corner where the rest of the copper wire goes. To make the cut, use a sharp x-acto blade to cut through the copper just beneath the green surface of board. It will take a few swipes and you'll hear a small scraping noise when you get through the wire. Make sure you've cut all the way through the wire to the green circuit board material on the other side. + +Watch this video for an example: https://www.facebook.com/groups/TheLoopedGroup/permalink/1854229718127019/?hc_location=ufi + +### Lipo Battery + +Lipo batteries are great for a lot of things…but taking damage is not one of them. Please treat lipo batteries with care. Keep them protected from puncture. The explorer board has some “pointy” parts on the underside, so providing some protection from the board’s squish is a good idea. A small piece of protection (such as a business card or non-conductive thin foam sheet) will help protect the battery from the board above it. + +Since there is some warmth with an OpenAPS rig, it is also not recommended to put a rig unprotected in a pocket close to the body. The lipo battery can become warped from the heat or bent from being in the pocket and potentially compromised. A durable case or waist-belt pouch is a good idea (see [here](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/hardware/edison.html#cases) for both hard and soft case ideas). + +There are several places to get lipo batteries, with lots of different dimensions and capacities. A 2000 mAh lipo will get you about 12-14 hours of use, assuming you have the standard setup (which is what you get following these docs) running. + +### What happens if you have multiple rigs? + +If you have multiple OpenAPS rigs, they’re built to be polite to each other - so even if you had 2+ rigs in same room, they won’t trip each other up. They “wait for silence” before issuing any commands to the pump. By having multiple rigs throughout a house, you can move from room-to-room without carrying rigs because the rigs will pass-off comms as you moves in and out of the rig’s range. While stationary rigs will not need lipo batteries and can be plugged directly into the wall from the explorer board, you may still want to consider hooking up a battery so that the rig can quickly be taken with you on the go if needed and should the power fail you can still stay looping. diff --git a/docs/docs/walkthrough/phase-0/windows-edison.md b/docs/docs/walkthrough/phase-0/windows-edison.md new file mode 100644 index 000000000..06202c9c9 --- /dev/null +++ b/docs/docs/walkthrough/phase-0/windows-edison.md @@ -0,0 +1,261 @@ +# Setting up Edison/Explorer Board on Windows- Alpha Instructions + +(This is testing a separate workflow for Windows only. Please refer to the [main Edison setup guide](./setup-edison.md) as well for troubleshooting & full instructions for other computer setup processes.) + +### Hardware Assumptions for this page + +1. Using an Explorer Board and Edison +2. Using an Windows computer + +## Preparing/flashing the Edison + +We recommend [buying an Edison that is preinstalled with jubilinux](hardware/edison.md#edison). If you did that, you can skip down to [section 1-4 Hostname for Edison](windows-edison.md#1-4-hostname-for-edison). + +If you didn't buy your Edison with jubilinux preinstalled, it comes with an operating system, called Yocto, that doesn’t work easily with OpenAPS. The first step is to replace the operating system with a new one. This is called “flashing” the Edison. Both your Windows computer and the Edison board will need some work. + +### **1-1 Prepare Windows Computer** + +- Install the [Intel Edison drivers for Windows]( https://software.intel.com/en-us/iot/hardware/edison/downloads). Select the "Windows standalone driver" download. After it is done downloading, click on the downloaded file and it will execute installation. + +![Edison Drivers](../../Images/Edison/edison_driver.png) + +![Edison Drivers](../../Images/Edison/edison_driver2.png) + + +- Install [PuTTY]( http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html). PuTTY is the program you will normally use to login to your rig in the future from the computer. Creating a desktop shortcut for it is a good idea, since you will likely use it often. Download the installation file that matches your PC's architecture (32-bit or 64-bit). If you are unsure, you can check your computer's build and memory in the Control Panel. Example shown is for a 64-bit computer. If unsure, installing the 32-bit version won't harm anything...it just might be a little slower to use PuTTY. + +![Control Panel](../../Images/Edison/64_bit.png) + +![Putty](../../Images/Edison/putty.png) + +![Putty](../../Images/Edison/putty2.png) + +![Putty](../../Images/Edison/putty3.png) + +**************************** +#### Side Note regarding computers with less than 6 GB RAM + +Windows PCs with less than 6 GB of RAM may need to have the size of the page file increased to flash the Edison. You can check your RAM as shown in the Control Panel picture above. If less than 6 GB is showing, then close all unnecessary programs and attempt to flash the device. If the flash operation fails follow these steps to ensure enough swap space is allocated when the computer boots, then restart and try again. Only do this if flashing the device doesn't work without changing these settings. + +*Important: Write down the settings in the Virtual Memory window before you make any changes to your system. When you finish the flash process you must return these settings to their original values or Windows may become unstable.* + + - Go to the Control Panel, click All Control Panel Items, then click System. At top left click the Remote Settings link. + - Select the Advanced tab in the System Properties window, then under Performance click Settings. + - On the Advanced tab click the Change... button to change the page size. + - In the Virtual Memory window uncheck "Automatically manage paging file size for all drives," click "Custom size," and set the initial size to at least 4096 MB. If you have already attempted this process at least once continue to increase this number by 1024 MB. Set the maximum size to 2048 MB higher than the initial size you used. + - Click the Set button, then click OK until all windows are closed. + - Reboot and attempt the flash proccess. +****************************** + +#### Download jubilinux and dfu-util + +- Download the latest [jubilinux.zip](http://www.jubilinux.org/dist/). Jubiliniux will download in a zipped format to your Downloads folder. Locate the folder in your Downloads and right-click the `jubilinux.zip` folder. Select `extract all` from the menu. Saving it to your root user directory is a good idea. Your root directory is the set of folders that exist under your User name in Windows. For example, the destination for saving jubilinux to your root directory would be `C:\Users\yourusername\jubilinux` + +**Note** The `extract all` command comes standard for all Windows machines. However, in some instances, it may not be active for zipped files. If you do not see the `extract all` option in the right-click menu, right-click the zipped file, choose `Properties` at the bottom of the context menu. On the General tab, click on the button next to the "opens with" and change it to use Windows Explorer. Apply the change and select `OK` to save the change. You should now be able to right-click the jubilinux.zip file to extract all. + +- Now we are going to download two files from DFU-UTIL: [libusb-1.0.dll](http://dfu-util.sourceforge.net/releases/dfu-util-0.8-binaries/win32-mingw32/libusb-1.0.dll) and [dfu-util.exe](http://dfu-util.sourceforge.net/releases/dfu-util-0.8-binaries/win32-mingw32/dfu-util.exe). Click on those two links to download the files to your Downloads folder. Navigate to your Downloads folder and choose to "move" those folders to the jubilinux folder that you unzipped earlier. When you sucessfully move those two folders into the jubilinux folder, you should see files/folders inside the jubilinux folder like so: + +![Ready to Flashall](../../Images/Edison/ready.png) + +### **1-2 Prepare Edison** +Now we move to the Edison. You’ll see two microB USB ports on your explorer board. One is labeled OTG (that’s for flashing) and one is labeled UART (that’s for logging into the Edison from a computer). We will need to use both to flash. We’re going to plug both of those into our computer’s USB ports using the cables listed in the parts list (Dexcom’s charging cable will work too). + +![Explorer Board rig with two cables and red light on](../../Images/Edison/ExplorerBoard_two_charging_cables.png) + +Once you plug in the cables, you should see your Edison board pop-up as a connected “device”. If you don’t…try different cables. + +![Edison popup](../../Images/Edison/edison_popup.png) + + - Go to Control Panel\All Control Panel Items\Device Manager\Ports\ and look for USB Serial Port COMXX. If you have multiple and unsure of which is the port you need: Make note of existing ports. Unplug the cable from the Explorer Board. Notice which port disappears. this is the port you are looking for. If only one shows up, that is your Edison's port. + +![Port Select](../../Images/Edison/port.png) + + - Open PuTTY, change from SSH to Serial. It normally defaults to COM1 and speed of 9600. Change the COM number to the number you found when you plugged into the Explorer Board. Change the speed (baud rate) to 115200. + - Once you've made those changes, Click on OPEN at the bottom of your Putty configuration window. + + ![Putty port](../../Images/Edison/putty_port.png) + + - Once the screen comes up, press enter a few times to wake things up. This will give you a "console" window of what is happening on your Edison. Move that window over to the right side of your screen without resizing it, if you can. (We are going to open another window later on the left side.) +- Now you will see a login prompt for the Edison on the console screen. Login using the username "root" (all lowercase) and no password. This will have us ready to enter the commands coming up in the next steps later. + +- Now we are going to open a second window...a "flash" window...using a different program than PuTTY. Go to your Windows Start menu and search for a program called Command Prompt. Open Command Prompt and you should be given at a prompt for your User Root directory. Assuming you saved your jubilinux folder to your user root directory (as described above), enter `cd jubilinux` in the prompt and press return. If you saved it somewhere else, you will need to navigate to that location. Move that flash window to the left side of the screen. + +Your screens should look like this: + + ![Ready to Flash](../../Images/Edison/ready_to_flash.png) + +### **1-3 Flash the Edison** + +* In your flash window on the left (command prompt window), enter `flashall.bat` + +* You’ll get a prompt that asks you to "plug and reboot" the Edison board. You’re done with this screen for now. Just leave it alone (**don’t close window**) and go to next step. + + ![Reboot](../../Images/Edison/flash.png) + +* Return to the screen on the right (the PuTTY window) and enter `reboot` + +You will see many, many messages go by on the screens (mostly on the right-side screen). + +![flash continues](../../Images/Edison/mid_flash.png) + +After several reboots (don’t panic), you should get a ubilinux login prompt (If you see Yocto instead of ubilinux, then you need to go back to Step 1-2 and start the flash process over again). Use login `root` and password `edison`. + +![Successful flash](../../Images/Edison/successful.png) + +CONGRATULATIONS! You just flashed the Edison! Wahoo! Now, let's keep going. + +### **1-4 Hostname for Edison** + +Now that you’ve finished flashing, the Edison is going to need a couple things to finish setting it up; Hostname/passwords and Multiple WiFi networks + +Hostname and password + +* From that same screen we just left off , enter these three commands in succession +`myedisonhostname=` <---But replace the <> section with your chosen hostname. +Then run the next two lines, one at a time, without modification. +``` +echo $myedisonhostname > /etc/hostname +sed -r -i"" "s/localhost( jubilinux)?$/localhost $myedisonhostname/" /etc/hosts +``` + +***************************** +**IMPORTANT** + +* To change the password for your Edison to a more secure password than “edison”, enter `passwd root` + +* Follow the commands to reset the password. Repeat for `passwd edison` + +* SAVE PASSWORDS somewhere, you’ll want them. +***************************** + + +### **1.5 Set up Wifi** + +Enter `vi /etc/network/interfaces` + +Type “i” to enter INSERT mode for editing on the file. + +**HELPFUL TIP**: If you are new to insert mode, realize that it inserts characters at the highlighted cursor (it does not overwrite the character showing beneath the cursor). And, the default is that the cursor will be at the top left of the screen to start, so you will need to use the arrow keys to move the cursor to the area where you want to start typing. If you freak out that you’ve made a change that you don’t want to commit...you can simply press the ESC key and then type (no quotes) “:q!” to quit without saving any of your typing/changes. + +* Uncomment 'auto wlan0' (remove the `#` at the beginning of the line) +* Edit the next two lines to read: +``` +auto wlan0 +iface wlan0 inet dhcp + wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf +``` +Comment out or delete the wpa-ssid and wpa-psk lines. + +After editing, your file should look like: + +``` +# interfaces(5) file used by ifup(8) and ifdown(8) +auto lo +iface lo inet loopback + +auto usb0 +iface usb0 inet static + address 192.168.2.15 + netmask 255.255.255.0 + +auto wlan0 +iface wlan0 inet dhcp + wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf +``` + +![Wifi Interfaces](../../Images/Edison/wifi_interfaces.png) + +Press Esc and then type ':wq' and press Enter to write the file and quit + +`vi /etc/wpa_supplicant/wpa_supplicant.conf` + +Type 'i' to get into INSERT mode and add the following to the end, once for each network you want to add. Be sure to include the quotes around the network name and password. + +``` +network={ + ssid="my network" + psk="my wifi password" +} +``` + +If you want to add open networks to your list, then add: + +``` +network={ + key_mgmt=NONE + priority=-999 +} +``` + +If you have a hidden wifi network add the line `scan_ssid=1`. + +Some wifi networks require you to accept a terms and conditions prior to allowing access. For example, Starbucks coffee shops and many hotels. These networks are termed "captive" networks and connecting your rig to them is currently not an option. + +Other wifi networks may require you to enter a login name and password at an initial screen before allowing access (such as many school district wifi networks). Some users have success in using the following wpa network settings for those types of networks: + +``` +network={ + scan_ssid=1 + ssid="network name" + password="wifi password" + identity="wifi username" + key_mgmt=WPA-EAP + pairwise=CCMP TKIP + group=CCMP TKIP WEP104 WEP40 + eap=TTLS PEAP TLS + priority=1 +} +``` + +Press Esc and then type ':wq' and press Enter to write the file and quit. + +### **1.6 Test internet connection** + +`reboot` to apply the wifi changes and (hopefully) get online + +After rebooting, log back in and type `iwgetid -r` to make sure you successfully connected to wifi. + +Run `ifconfig wlan0` to determine the IP address of the wireless interface, in case you need it to SSH below. Alternatively, if you know how to login to your router, you can also see the Edison's IP address there. + +![IP address](../../Images/Edison/ip_address.png) + +Leave the serial window open in case you can't get in via SSH and need to fix your wifi config. + +If you need more details on setting up wpa_supplicant.conf, see one of these guides: + +* [http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/](http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/) +* [http://www.geeked.info/raspberry-pi-add-multiple-wifi-access-points/](http://www.geeked.info/raspberry-pi-add-multiple-wifi-access-points/) +* [http://raspberrypi.stackexchange.com/questions/11631/how-to-setup-multiple-wifi-networks](http://raspberrypi.stackexchange.com/questions/11631/how-to-setup-multiple-wifi-networks) +* [http://www.cs.upc.edu/lclsi/Manuales/wireless/files/wpa_supplicant.conf](http://www.cs.upc.edu/lclsi/Manuales/wireless/files/wpa_supplicant.conf) + + +### **1.7 Install packages, ssh keys, and other settings** + +From a new terminal or PuTTY window, `ssh myedisonhostname.local`. If you can't connect via `myedisonhostname.local` (for example, on a Windows PC without iTunes), you can instead connect directly to the IP address you found with `ifconfig` above. + +Login as root (with the password you just set above), and run the following lines one by one. The first line "dpkg -P ... " will be quick. Check the printout to see that it ran without error. Then run the apt-get lines one at a time. They will take a long while. + + +``` +dpkg -P nodejs nodejs-dev + +apt-get update && apt-get -y dist-upgrade && apt-get -y autoremove + +apt-get install -y sudo strace tcpdump screen acpid vim python-pip locate +``` + +And then run the next lines (first two will be quick, the last one will take you into a timezone selection menu. Run each line separately until finished) + +``` +adduser edison sudo + +adduser edison dialout + +dpkg-reconfigure tzdata +``` + +`vi /etc/logrotate.conf` and change the log rotation to `daily` from `weekly` and enable log compression by removing the hash on the #compress line, to reduce the probability of running out of disk space. + +![Log Rotate edits](../../Images/Edison/logrotate.png) + +You have now installed the operating system and wifi networks on your Edison! You can move onto the next steps in building your OpenAPS rig. diff --git a/docs/docs/walkthrough/phase-1/add-alias.md b/docs/docs/walkthrough/phase-1/add-alias.md new file mode 100644 index 000000000..e1a343ef1 --- /dev/null +++ b/docs/docs/walkthrough/phase-1/add-alias.md @@ -0,0 +1,33 @@ +# Adding shortcuts to command lines + +Linux command lines can be long-to-type and difficult-to-remember. Sometimes it is really helpful to create aliases (a.k.a, shortcuts) for frequently used commands or combination of commands that you'll use in your OpenAPS rig. Here's a short set of instructions for setting up aliases. You can customize the initial list of aliases however you'd like. + +By setting up these aliases, you can just use the shortcut command while logged into your rig instead of typing out the much longer version of the command. For example, typing `cat-pref` will show you a print out of your preferences.json file. Typing `edit-wifi` will bring up your wpa-supplicant file so that you can add or edit wifi networks for your rig. + +* Create a blank profile +
+`nano ~/.bash_profile` +
+* Copy and paste (or make your own aliases) the following aliases into the blank profile +
+``` +alias autosens-loop="tail -n 100 -F /var/log/openaps/autosens-loop.log" +alias autotune="tail -n 100 -F /var/log/openaps/autotune.log" +alias ns-loop="tail -n 100 -F /var/log/openaps/ns-loop.log" +alias pump-loop="tail -n 100 -F /var/log/openaps/pump-loop.log" +alias cat-pref="cd ~/myopenaps && cat preferences.json" +alias edit-wifi="vi /etc/wpa_supplicant/wpa_supplicant.conf" +alias cat-wifi="cat /etc/wpa_supplicant/wpa_supplicant.conf" +alias edit-pref="cd ~/myopenaps && vi preferences.json" +alias log-wifi="tail -n 100 -F /var/log/openaps/network.log" +alias git-branch="cd ~/src/oref0 && git branch" +alias cat-autotune="cd ~/myopenaps/autotune && cat autotune_recommendations.log" +alias edit-runagain="cd ~/myopenaps && nano oref0-runagain.sh" +alias cat-runagain="cd ~/myopenaps && cat oref0-runagain.sh" +``` +
+Exit the nano editor by pressing `control-x`, then typing `y` to save file, and then `return` to save with same file name. +
+* Tell your rig to use this profile (note: this command will need to be done after each update to the profile too, or the new aliases won't be activated until you reboot) +
+`source ~/.bash_profile` diff --git a/docs/docs/walkthrough/phase-1/img/add_vars.jpg b/docs/docs/walkthrough/phase-1/img/add_vars.jpg new file mode 100644 index 000000000..6a55e2df2 Binary files /dev/null and b/docs/docs/walkthrough/phase-1/img/add_vars.jpg differ diff --git a/docs/docs/walkthrough/phase-1/img/deploy_branch.jpg b/docs/docs/walkthrough/phase-1/img/deploy_branch.jpg new file mode 100644 index 000000000..0696f96a0 Binary files /dev/null and b/docs/docs/walkthrough/phase-1/img/deploy_branch.jpg differ diff --git a/docs/docs/walkthrough/phase-1/img/deploy_button.jpg b/docs/docs/walkthrough/phase-1/img/deploy_button.jpg new file mode 100644 index 000000000..fbbc4802b Binary files /dev/null and b/docs/docs/walkthrough/phase-1/img/deploy_button.jpg differ diff --git a/docs/docs/walkthrough/phase-1/img/deploy_heroku.jpg b/docs/docs/walkthrough/phase-1/img/deploy_heroku.jpg new file mode 100644 index 000000000..757343eb4 Binary files /dev/null and b/docs/docs/walkthrough/phase-1/img/deploy_heroku.jpg differ diff --git a/docs/docs/walkthrough/phase-1/img/deploy_success.jpg b/docs/docs/walkthrough/phase-1/img/deploy_success.jpg new file mode 100644 index 000000000..ed7311ddf Binary files /dev/null and b/docs/docs/walkthrough/phase-1/img/deploy_success.jpg differ diff --git a/docs/docs/walkthrough/phase-1/img/heroku_signup.jpg b/docs/docs/walkthrough/phase-1/img/heroku_signup.jpg new file mode 100644 index 000000000..6b7739280 Binary files /dev/null and b/docs/docs/walkthrough/phase-1/img/heroku_signup.jpg differ diff --git a/docs/docs/walkthrough/phase-1/img/no_profile.jpg b/docs/docs/walkthrough/phase-1/img/no_profile.jpg new file mode 100644 index 000000000..b143ae95d Binary files /dev/null and b/docs/docs/walkthrough/phase-1/img/no_profile.jpg differ diff --git a/docs/docs/walkthrough/phase-1/img/ns_deploybranch.png b/docs/docs/walkthrough/phase-1/img/ns_deploybranch.png new file mode 100644 index 000000000..0ddf2bae7 --- /dev/null +++ b/docs/docs/walkthrough/phase-1/img/ns_deploybranch.png @@ -0,0 +1 @@ +i diff --git a/docs/docs/walkthrough/phase-1/img/ns_fork.jpg b/docs/docs/walkthrough/phase-1/img/ns_fork.jpg new file mode 100644 index 000000000..b2eb4d101 Binary files /dev/null and b/docs/docs/walkthrough/phase-1/img/ns_fork.jpg differ diff --git a/docs/docs/walkthrough/phase-1/img/open_app.jpg b/docs/docs/walkthrough/phase-1/img/open_app.jpg new file mode 100644 index 000000000..0dd142992 Binary files /dev/null and b/docs/docs/walkthrough/phase-1/img/open_app.jpg differ diff --git a/docs/docs/walkthrough/phase-1/img/profile.jpg b/docs/docs/walkthrough/phase-1/img/profile.jpg new file mode 100644 index 000000000..ec4def0ea Binary files /dev/null and b/docs/docs/walkthrough/phase-1/img/profile.jpg differ diff --git a/docs/docs/walkthrough/phase-1/img/settings_heroku.jpg b/docs/docs/walkthrough/phase-1/img/settings_heroku.jpg new file mode 100644 index 000000000..fb5b87bea Binary files /dev/null and b/docs/docs/walkthrough/phase-1/img/settings_heroku.jpg differ diff --git a/docs/docs/walkthrough/phase-1/img/settings_ns.jpg b/docs/docs/walkthrough/phase-1/img/settings_ns.jpg new file mode 100644 index 000000000..b93a24445 Binary files /dev/null and b/docs/docs/walkthrough/phase-1/img/settings_ns.jpg differ diff --git a/docs/docs/walkthrough/phase-1/index.rst b/docs/docs/walkthrough/phase-1/index.rst index 11f1e0b79..3f772991b 100644 --- a/docs/docs/walkthrough/phase-1/index.rst +++ b/docs/docs/walkthrough/phase-1/index.rst @@ -6,13 +6,6 @@ Phase 1: Monitoring and Visualization nightscout-setup - log-clean-analyze - analyze-existing-data - using-openaps-tools - visualization - openaps-to-nightscout - offline-monitoring - - - - + offline-looping-and-monitoring + papertrail + add-alias diff --git a/docs/docs/walkthrough/phase-1/nightscout-setup.md b/docs/docs/walkthrough/phase-1/nightscout-setup.md index 6f7b64b20..5f00fa393 100644 --- a/docs/docs/walkthrough/phase-1/nightscout-setup.md +++ b/docs/docs/walkthrough/phase-1/nightscout-setup.md @@ -2,133 +2,270 @@ ## Nightscout Introduction -[Nightscout](http://nightscout.info) in their own words: Nightscout (CGM in the -Cloud) is an open source, DIY project that allows real time access to a CGM data +[Nightscout](http://nightscout.info) is an open source, DIY project that allows real-time access to a CGM data via personal website, smartwatch viewers, or apps and widgets available for -smartphones. +smartphones. Setting up a Nightscout web app is the recommended way to visualize your +OpenAPS closed loop. -It basically allows a user to upload CGM data from a variety of sources, to an +Nightscout allows a user to upload CGM data from a variety of sources, to an online database and cloud computing service. The information is then processed and displayed visually as a graph. There are plugins that allow greater -information to be shown about OpenAPS too. As the data is uploaded to an online -website and then retrieved by OpenAPS it allows OpenAPS a wider range of +information to be shown about OpenAPS, too. As the data is uploaded to an online +website and then retrieved by OpenAPS, it allows OpenAPS a wider range of compatibility with various CGM solutions. **[Nightscout](http://nightscout.info) is the recommended way to visualize your OpenAPS closed loop.** -Even if you don't choose to share your Nightscout instance +Even if you don't choose to share your Nightscout site with another person, it will be helpful for you to visualize what the loop is doing; what it's been doing; plus generate helpful reports for understanding -your data and also allowing you to customize watchfaces with your OpenAPS data. -This provides a visual alternative to SSHing into your Raspberry Pi or loop -system and looking through log files. - -At this point it is recommended that you go to the -[Nightscout](http://nightscout.info) website and set Nightscout up. They have -excellent guides of how to get various CGM systems working as well as displaying -your data on a variety of additional devices. Once your website is up and -running you can integrate Nightscout to your OpenAPS using the guide below. - -**NOTE**: If you plan to use Nightscout to vizualize a production OpenAPS instance, we -recommend using the $7/mo Heroku plans, as OpenAPS' can reach the usage limits of -the free Azure plan and cause it to shut down for hours or days. - -## Nightscout Integration - -The integration requires setting up Nightscout and making changes and additions -to your OpenAPS implementation. - -### Nightscout Setup - -OpenAPS requires you to be on the Grilled Cheese master of Nightscout or any future dev versions, which can be -found [here](https://github.com/nightscout/cgm-remote-monitor/tree/dev). If you -are already using Nightscout, you may have to do a pull request (PR) to update the master branch in your repository. To update -your version to the latest dev, go to the -[Beta Test tool](http://nightscout.github.io/pages/test-beta/?branch=dev), look -for the "I'm ready" button, and create a PR to your dev branch. Once you have -completed these steps, log on to Heroku or Azure and disconnect the deployment -source. Thereafter choose your cgm-remote-monitor github repository as source -again. -_________________________ -**If this doesn't work then from the command prompt in terminal run the -following: - -``` -git clone -b dev https://github.com//cgm-remote-monitor.git -cd cgm-remote-monitor -git remote add upstream https://github.com/nightscout/cgm-remote-monitor -git fetch upstream -git merge upstream/dev -git push origin dev -``` - -**where `` is replaced with your repository name -found in your Github, upper left once in any of your repositories and also -"signed in as" from the pull-down menu in the top right where all your profile -and settings are found. When you run this it will stop at some point and give -you "git push origin dev" and you can hit enter. Then it will ask for "Username -for 'https://github.com'" where you type in your username (usually your email -address associated with Github) and hit enter. Then it will ask for "Password -for 'https://name@email.com@github.com':" where you type in your password (in -your actual results, the username you entered will be where it says -"name@email.com"). -____________________________ - -## Enable these plugins - -The steps discussed here are essentially the same for both Heroku and Azure -users. Two configuration changes must be made to the Nightscout implementation: - -* Add "openaps" (without the quotes) and, optionally, "pump" (without the - quotes) to the list of plugins enabled, and -* Add a new configuration variable DEVICESTATUS_ADVANCED="true" (without the - quotes) - -For Azure users, here is what these configuration changes will look like (with -just "openaps" added): ![azure config -changes](https://files.gitter.im/eyim/lw6x/blob) - -For Heroku users, exactly the same changes should be made on the Config Vars -page. The optional "pump" plugin enables additional pump monitoring pill boxes. -For example, assuming you have added "pump" to the list of enabled plugins, you -may add a new configuration variable `PUMP_FIELDS="reservoir battery"` to -display pump reservoir and battery status on the Nightscout page. The "pump" -plugin offers a number of other options, as documented on the -[Nightscout readme](https://github.com/nightscout/cgm-remote-monitor/blob/dev/README.md#built-inexample-plugins). - -## Make sure to select the pills to display from your Nightscout site - -Next, on your Nightscout website, go to the Settings (3 horizontal bars) in the -upper right corner. At the very bottom of the Settings menu, in the "About" -section, you may check the Nightscout version (e.g. version 0.9.0-dev). Just above is a list of Plugins available. OpenAPS should show up. Click the check box to enable. Similarly, in the case you've enabled the "pump" plugin, "Pump" -should also show up in the list, and you may check the box to enable. You -should now see the OpenAPS pill box (and any optional pump monitoring pill -boxes) on the left side of the Nightscout page near the time. - -Please note: If you are using a "test pump" that has not not received sufficient data in some time, Nightscout pills will NOT be displayed onscreen. If this happens, simply use this pump in tandem with a CGM so glucose values are recorded and eventually uploaded to Nightscout. Once sufficient data has been collected, (and OpenAPS plugin is enabled and saved), the OpenAPS pills should appear automatically. - -## How to display basal changes ("render basal") - -We also recommend that you "render"/display the basal rates (the blue lines to show what temp basals have been enacted, if any.) To do so, select "Default" or "Icicle" from the "Render Basal" pull-down menu in the Settings. - - -### Configure Nightscout profile - -You need to create a profile in your Nightscout site that contains the Timezone, -Duration of Insulin Activity (DIA), Insulin to carb ratio (I:C), Insulin -Sensitivity Factor (ISF), Carbs Activity / Absorption rate, Basal Rates and -Target BG range. - -These settings are not currently updated from the values stored in the pump. You -will need to keep the Nightscout profile in sync with any changes you make in -your pump. - -To configure your profile, on your Nightscout website, go to the Settings (3 -horizontal bars) in the upper right corner. Click on the Profile Editor button. -Create a new profile (if you don't already have one) using the settings that -match what you already have set up in your pump. Fill out all the profile fields -and click save. +your data, customized watchfaces with your OpenAPS data, and integration with IFTTT. You can read more about the latest Nightscout features [here](http://www.nightscout.info/wiki/welcome/website-features/0-9-features). + +## Nightscout Setup + +* If you plan to use Nightscout with OpenAPS, we recommend using Heroku, as OpenAPS can reach the usage limits of the free Azure plan and cause it to shut down for hours or days. If you end up needing a paid tier, the $7/mo Heroku plan is also much cheaper than the first paid tier of Azure. Currently, the only added benefit to choosing the $7/mo Heroku plan vs the free Heroku plan is a section showing site use metrics for performance (such as response time). This has limited benefit to the average OpenAPS user. **In short, Heroku is the free and OpenAPS-friendly option for NS hosting.** + +* Create an account at [Heroku](https://www.heroku.com) and choose the Primary Development Language to be Node.js when you create your account. You’re going to use a free account, but you will still need to enter credit card information for your account setup before the app will deploy. You'll need confirm your Heroku account by clicking a link sent via email. + +![Heroku signup example](../phase-1/img/heroku_signup.jpg) + +* Create an account at [GitHub](https://github.com) +***************** +**Note:** If you already have an existing GitHub account and NS site, you may just need to update your repository by doing a Compare in GitHub. Use `https://github.com/yourgithubname/cgm-remote-monitor/compare/master...nightscout:master` and replace yourgithub name. Click the big green `Create pull request` button. Another screen will appear, fill in a title and click button to `create the pull request`, and then you can `Merge pull request`, and finally `Confirm merge`. That process updates your Nightscout repository in Github. Once updated, you can skip the "click the Fork Button" step below and start following along with the purple `Deploy to Heroku` button step from your updated Nightscout cgm-remote-monitor repository. +***************** +* Go to the [Nightscout cgm-remote-monitor repository](https://github.com/nightscout/cgm-remote-monitor) + +* Click the `Fork` button in the upper right corner + +![Fork example](../phase-1/img/ns_fork.jpg) + +* Scroll down until you see the purple `Deploy to Heroku` button. Click that button. + +![Deploy to heroku button](../phase-1/img/deploy_heroku.jpg) + +* Give your app a name, this will be the prefix of your NS site’s URL. For example, `https://yourappname.herokuapp.com` + +* Fill out the information lines in the `Config Variables` Section of that page, as shown below. Some of the lines can stay with the default entries already provided. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KEYVALUE
API_SECRETCreate your own API_SECRET…this is like the password to your NS site. Please write it down somewhere safe or commit it to memory, you will be using it in the future. It needs to be at least 12 characters long and should NOT use the `@` symbol.
DISPLAY_UNITSenter either mg/dl or mmol
ENABLEbridge openaps pump iob basal careportal sage cage maker

(Enter all of the words without commas. Just a single space between each word. Make sure autocorrect does not add space between careportal. **Notice we are not including cob here.** If you have other plugins that you would like to enable, please add them here.)
DISABLELeave blank
ALARM_TYPESsimple
BG_HIGHEnter the numeric value of BG you’d like as an urgent high alarm.
BG_TARGET_TOPEnter the numeric value of the top of your target BG.
BG_TARGET_BOTTOMEnter the numeric value of the bottom of your target BG.
BG_LOWEnter the numeric value of the BG you’d like as an urgent low alarm.
PUSHOVER linesCan be left blank for now. If you decide to use Pushover later, you can come back and add your info to these lines.
CUSTOM_TITLEThis will be the text displayed in the upper left part of the NS website.
THEMEchange from default to colors
BRIDGE_USER_NAMEEnter your Dexcom Share Account login name. This should be the same account name used in the Share2 or G5 Mobile app.
BRIDGE_PASSWORDEnter your Dexcom Share Account password.
BRIDGE_MAX_COUNTDefault value is 1. Setting this to 7 will update the last 35 minutes of data.
+ +**The remaining variables can be left at their default values.**

+ +***************** +**Note:** for BRIDGE_MAX_COUNT: This value sets the number of BG values to pull from Share per update. Each Dexcom BG value represent 5 minutes. Nightscount defaults to BRIDGE_MAX_COUNT=1. If you lose connectivity with your Dexcom transmitter, your Share app will automatically backfill data points when you regain connectivity. Nightscount does not do this and you will have gaps in the data for when you were out of range. More information here https://github.com/nightscout/cgm-remote-monitor#bridge-share2nightscout-bridge + +You can change the BRIDGE_MAX_COUNT value to pull more samples per query, which will backfill BRIDGE_MAX_COUNT values for you. This change increases your data usage and may affect your Nightscout billing tier. Setting BRIDGE_MAX_COUNT to 7 will update the previous 35 minutes of data and will keep OpenAPS up to date on your current BG trends. If you frequently have larger data gaps and you use autotune, you may consider increasing this number more to backfill data more aggressively. +***************** + +* Click the purple `Deploy` button at the bottom of screen. + +![Deploy](../phase-1/img/deploy_button.jpg) + +* Wait a little bit while Heroku builds your NS app. You’ll see some text scroll by in the Build App box, and then finally, you will have a message that the NS app was successfully deployed. If the app fails to deploy, it may be that you have not added your credit card information to your account yet. Go add that information in your account billing section, and then come back and press the deploy button again. Don't worry, your account is still free unless you choose otherwise. The credit card simply gives you added dyno hours on your free account (win-win). + +![Successful deploy](../phase-1/img/deploy_success.jpg) + +* You can verify your site’s successful build by clicking `View` (you should see black site with a profile warning). You will be redirected to a profile set-up page. (If it doesn't redirect automatically, refresh your webpage). + +![No profile](../phase-1/img/no_profile.jpg) + +You do not have to enter all the information in the profile if you are using OpenAPS (since OpenAPS will be providing the information for IOB and COB rather than letting NS calculate them), but you do have to fill out the `Basal Profile` and `TimeZone` at a minimum in order to have your temp basals properly display. Click `Save` when you have entered the information. You will be prompted to authenticate, if it is the first time you’ve used the device to make changes in your profile. Click on the `Authenticate` link at the bottom of the site, and enter your API_SECRET to complete the authentication. + +**Note:** OpenAPS will only work based on the values in your pump; not the values that you put into Nightscout profile. You will need to keep the Nightscout basal profile in-sync with any changes you make in your pump to prevent later confusion in watching the temp basal rendering. + +![Profile for basals](../phase-1/img/profile.jpg) + +* Assuming your previous browser tab is still open for "Create a new App | Heroku", let's go back to that tab. This time instead of choosing the `View` option, we are going to select the `Manage App` button. Then, select the `Settings` tab near the top of the screen on your Heroku app. + +![Heroku settings](../phase-1/img/settings_heroku.jpg) + +* Click on `Reveal Config Vars`. Scroll down the bottom of the Config Vars lines until you find the last blank one. You are going to add several additional lines of config vars for OpenAPS use; the DEVICESTATUS_ADVANCED is a required line, the others just make Nightscout more useful when using OpenAPS. + +![Add vars](../phase-1/img/add_vars.jpg) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KEYVALUE
DEVICESTATUS_ADVANCEDtrue
PUMP_FIELDSbattery reservoir clock status
PUMP_RETRO_FIELDSbattery reservoir clock status
SHOW_FORECASTopenaps
SHOW_PLUGINSopenaps pump iob sage cage careportal
PUMP_ENABLE_ALERTStrue
PUMP_URGENT_BATT_V1.3

(This is the pump battery voltage that will trigger a red, urgent alert in NS.)
PUMP_URGENT_RES10

(This is the reservoir volume that will trigger a red, urgent alert in NS.)
PUMP_URGENT_CLOCK30
OPENAPS_ENABLE_ALERTStrue
OPENAPS_FIELDSstatus-symbol status-label iob meal-assist rssi
OPENAPS_RETRO_FIELDSstatus-symbol status-label iob meal-assist rssi
OPENAPS_WARN20

(This is the minutes since OpenAPS last successfully looped. This will be a yellow alert in NS.)
OPENAPS_URGENT60

(Same as the alert above, but will be red in color and have a shorter snooze option.)
+ +If you are using the Nightscout Bridge to bring in CGM data from Dexcom servers (G4 Share2 app or G5 Mobile app) and are outside the US, you will need to add a setting for `BRIDGE_SERVER` and set the value to `EU`. + +* Click on `Open App` in the top right corner of your Heroku site. + +![Open app](../phase-1/img/open_app.jpg) + + +* Click on the settings (those three horizontal lines in upper right corner). Now check that your basal render is selected to either default or icicle (personal preference for how the temp basals show as blue lines in NS site), check the boxes that you’d like display pills in the SHOW PLUGINS (usually all of them), and then press save. Your NIGHTSCOUT site is all set-up. Congrats! + +![NS Settings](../phase-1/img/settings_ns.jpg) + +### It's not working - I'm missing data in Nightscout? + +If you are using a "test pump" that has not received sufficient data in some time, Nightscout pills will NOT be displayed onscreen. Nightscout may also not work if it hasn't had CGM data in a while - so if you haven't been using a CGM and uploading CGM data to Nightscout for the past few days, the site may be empty as well. If this happens, simply use this pump in tandem with a CGM so glucose values are recorded and eventually uploaded to Nightscout. Once sufficient data has been collected, (and OpenAPS plugin is enabled and saved), the OpenAPS pills should appear automatically. Medtronic CGM users may also [need to do this to get their CGM data flowing into Nightscout after a gap in uploading data](http://openaps.readthedocs.io/en/dev/docs/walkthrough/phase-1/offline-looping-and-monitoring.html#note-about-recovery-from-camping-mode-offline-mode-for-medtronic-cgm-users). + +### Switching from Azure to Heroku + +* If you are a current OpenAPS user and want to switch from Azure to Heroku, you will need to change your NS URL in both `ns.ini` and in `cron`. Alternatively, you can edit your runagain.sh file and run the setup script again. + +* If you’d like to seamlessly keep all your old Azure NS data showing in your new Heroku NS site, you’ll need to copy and paste your old `MONGODB` string from your Azure site. Find it in either Application Settings or Connection strings in your Azure control panel and then go to Heroku’s `MONGODB_URI` line. Replace the content with your copied string from Azure. Double check that your Azure collection used the “entries” name…if it doesn’t, then you will need to update that variable in Heroku to match as well. + +**Note:** It's a good idea to to check your deployment connection in Heroku's dashboard after your deploy (typically this still needs to be manually connected after initial setup). Go your `Deploy` tab in your Heroku dashboard, click on the GitHub service, and select your GitHub cgm-remote-monitor repository. You can select the cgm-remote-monitor branch you'd like to deploy at the bottom of the screen. Both master and dev branches work for OpenAPS. + +![Deploy branch](../phase-1/img/deploy_branch.jpg) + + +### A Note about Nightscout's COB Pill + +If you have the Advanced Meal Assist (AMA) OpenAPS feature turned on, OpenAPS calculates COB *dynamically*. To see your COB on your Nightscout web app, look inside the OpenAPS pill. _(If it says "undefined", this means you do NOT have AMA turned on.)_ + +Nightscout, however, has its own COB pill, which decays carbs *statically*, and it is **NOT** used in OpenAPS calculations. + +* **We highly recommend NOT using the Nightscout COB pill.** We even recommend removing it from your Nightscout ENABLE web app settings as it causes bugs, and great confusion, because it will do a static decay and/or mess up your Nightscout. + +* **Note also**: Nightscout's Bolus Wizard Preview (BWP) pill also decays carbs *statically*. + +* **To avoid confusion: Turn off all other Nightscout pills that use *static* COB calculations.** + +### How to display basal changes ("render basal") + +* In case you missed it during setup: we recommend that you "render"/display the basal rates (the blue lines to show what temp basals have been enacted, if any.) To do so, select "Default" or "Icicle" from the "Render Basal" pull-down menu in the Settings. + +### How to display OpenAPS purple prediction/forecast lines + +* Click the three dots next to your timeframe horizon (3HR, 6HR, 12HR, 24HR) and then enable “Show OpenAPS Forecasts”. Don't see this option? Check and make sure you added this variable and that your OpenAPS has successfully run. ### Understanding the OpenAPS pill @@ -141,17 +278,13 @@ minutes: Enacted, Looping, Waiting, and Warning: * Looping means OpenAPS is running but has not enacted the pump * Unknown means Error or Timeout; OpenAPS has reported a failure, or has reported no status for many hours. -Some things to be aware of: +### All of a sudden, Nightscout is no longer showing treatments (bolus, carbs, finger BGs) on the graph or rendering my basals. + +If you suddenly find that Nightscout is not showing treatments (bolus, carbs, finger BGs etc.) on the graph; and/or that your basals are no longer being rendered in the blue basal line; but otherwise, everything looks normal and you are looping properly: -* Make sure that the timezones for the pi (if need be you can use `sudo - raspi-config` to change timezones), in your monitor/clock-zoned.json report, - and the Nightscout website are all in the same time zone. -* The basal changes won't appear in Nightscout until the second time the loop - runs and the corresponding upload is made. -* You can scroll back in time and at each glucose data point you can see what - the critical information was at that time +You probably somehow got a future-dated treatment. One possible reason is a clock-time mismatch between your devices - for example, your BG meter, pump, CGM, or OpenAPS rig may have different dates or times set. -Note: Remember to add `careportal` to Nightscout's `ENABLE` environment variable -in case it is not already there. +**To remove future treatments:** +* Go into Nightscout under "Settings" and "Admin tools" and delete any future-dated treatments (press the "remove treatments in the future" button). If the future treatments were caused by a time mismatch, you'll need to resolve that first, or the future dated treatments may simply be re-uploaded. -Note for Heroku Users: If you are switching from Azure to Heroku, at this time you will need to change your URL in both ns.ini and in cron +![How to delete future-dated treaments](../../Images/Remove_future_treatments.png) diff --git a/docs/docs/walkthrough/phase-1/offline-looping-and-monitoring.md b/docs/docs/walkthrough/phase-1/offline-looping-and-monitoring.md new file mode 100644 index 000000000..e281e541b --- /dev/null +++ b/docs/docs/walkthrough/phase-1/offline-looping-and-monitoring.md @@ -0,0 +1,395 @@ +# Offline monitoring + +There are a number of ways to have an "offline" OpenAPS rig, and numerous ways to monitor offline. Offline refers to situations where your rig moves into an area where it does not have internet access (i.e., the rig does not have a known wifi network available and the cell phone used with the rig does not have cell coverage/hotspot available). By setting up one of these offline solutions, your rig can still loop while in an offline area. Depending on the setup, the opportunities to visualize or monitor the loop actions (e.g., check what temp basal is actually being set) may vary until you can get back into an online area. + +## Offline looping + +### Medtronic CGM users +Medtronic CGM users can, by default, automatically loop offline because the rig will read CGM data directly from the pump. + +### Dexcom CGM users +Dexcom CGM users have a few different alternatives to retrieve blood glucose values locally for offline use. The options to choose from are: + +1. For android users, you can use xDrip or xDrip+. NOTE: All active development is being done on xDrip+. The details for setting up this configuration are described in the section below for xDrip offline. + * xDrip: [http://stephenblackwasalreadytaken.github.io/xDrip/](http://stephenblackwasalreadytaken.github.io/xDrip/) + * xDrip+: [https://jamorham.github.io/#xdrip-plus](https://jamorham.github.io/#xdrip-plus) + +2. For iPhone users, you can set up a modified Loop app to bring data in locally. The directions for this configuration are provided in the section below for local, offline BGs using Loop app. + +3. **EASIEST:** For either Android or iPhone users, you can plug the CGM receiver directly into your rig via USB. This will pull BGs into the rig directly from the receiver and be used for looping. If you are a G4 user, this will also bring RAW BG data into the rig during sensor restarts or ??? times. The rig will loop using RAW BGs so long as the BG value is under 150 mg/dl. A few notes about how to make the direct-receiver configuration work: + + * Explorer boards built prior to late January of 2017 are not always working well/automatically with a CGM receiver plugged in. These boards can be identified by looking to see if they say "2016" on the board's label tag, as shown in the photo below. The boards can be fixed to use a CGM receiver by making a single trace cut, but doing so will disable the board's the ability to re-flash your Edison. Please make sure you have a second Explorer board or another base block or breakout board that you can use to re-flash the Edison if needed before considering this modification. For more details, see [this issue](https://github.com/EnhancedRadioDevices/915MHzEdisonExplorer/issues/14), and if you decide to make the cut, see [this document for details on how to cut the copper trace from pin 61 of the 70 pin connector](https://github.com/EnhancedRadioDevices/915MHzEdisonExplorer/wiki#usb-otg-flakiness). Cut in two places and dig out the copper between. Cut by poking a razor point in. Avoid the narrow trace above the one being cut. + + * Explorer Boards that shipped at or after the end of February 2017/first week of March 2017 should enable users to simply plug in the CGM receiver to the OTG port, and a USB battery into the UART port, in order to run offline and pull BGs from the receiver. Those boards will have a label of v1.2 2017. + + ![Old explorer board version](../../Images/versions.jpg) + + * The order of the cables and ports is important. The OTG cable must be plugged into the OTG port on the Explorer board. There are two kinds of OTG cables; (1) both ends are micro-USB like the one you can [order here](https://www.amazon.com/dp/B00TQOEST0/ref=cm_sw_r_cp_api_Niqfzb3B4RJJW) or (2) one end is USB and one end is micro-USB like the one you can [order here](https://www.adafruit.com/product/1099). Both will work, but if you have the second kind, that cable must be the one plugged into the rig directly, and the other non-OTG cable must be plugged into the receiver (as shown in photo below). That port is labeled on the underside of the port, it is the one closest to the lipo battery plug. A USB battery or wall charger must be plugged into the UART port to supply sufficient voltage to the ORG port (the lipo battery alone is not enough to power the OTG port). + + ![OTG configurations](../../Images/otg.jpg) + +* If you are using this configuration for G4 receivers and (1) are online and (2) want to see RAW BGs in NS, then you must remember to add `rawbg` to your ENABLE line in your Heroku/Azure settings. You will also have to go to your Nightscout site's settings and select "always" from the Show RAW BG options. You will also have to select `g4-raw` (if on master branch) or `g4-upload` (if on dev branch) as the CGM type in the loop setup script. + +## Offline monitoring + +* See Pancreabble instructions below for connecting your rig to your watch +* See xDrip/xDrip+ instructions below for seeing offline loop status +* See HotButton instructions below for setting temp targets and controlling your rig offline via an Android + +### Note about recovery from Camping Mode/Offline mode for Medtronic CGM users: + +If you have been running offline for a significant amount of time, and use a Medtronic CGM, you may need to run + +``` +openaps first-upload +``` +from inside your openAPS directory, before your loop will start updating correctly to your nightscout site. + +### Pancreabble + +_(TO DO Note - Pancreabble instructions for OpenAPS need to be re-worked to reflect the oref0-setup script way of making it work. Below is notes about Pancreabble setup prior to oref0-setup.sh being in existence.)_ + +[Pancreabble] is a way to monitor your loop _locally_, by pairing a Pebble smartwatch directly with the Raspberry Pi or Intel Edison. + +In other words, whereas the default setup looks like this: + +``` +Raspberry Pi/Intel Edison -> network -> Nightscout server -> network -> smartphone + | + -> laptop + | + -> Pebble watch +``` + +And by default, your Pebble is paired thus: + +``` + smartphone -> Bluetooth -> Pebble watch +``` + +With Pancreabble, the setup looks like this: + +``` +Raspberry Pi/Intel Edison -> Bluetooth -> Pebble watch +``` + +Using a Pebble watch can be especially helpful during the "open loop" phase: you can send the loop's recommendations directly to your wrist, making it easy to evaluate the decisions it would make in different contexts during the day (before/after eating, when active, etc.). + +See [Pancreabble] for initial setup instructions. + +[Pancreabble]: https://github.com/mddub/pancreabble + +Once you've done the first stages above, you'll need to do generate a status file that can be passed over to the Pebble Urchin watch face. Fortunately, the core of this is available in oref0. + +Go to `~src/oref0/bin` and look for `peb-urchin-status.sh`. This gives you the basic framework to generate output files that can be used with Pancreabble. To use it, you'll need to install jq using: + +`apt-get install jq` + +If you get errors, you may need to run `apt-get update` ahead of attempting to install jq. + +Once jq is installed, the shell script runs and produces the `urchin-status.json` file which is needed to update the status on the pebble. It can be incorporated into an alias that regularly updates the pebble. You can modify it to produce messages that you want to see there. + +When installing the oref0-setup you will need to replace all instances of AA:BB:CC:DD:EE:FF with the Pebble MAC address. This can be found in Settings/System/Information/BT Address. NOTE: Make sure the MAC address is in ALL CAPS. + +Once you've installed, you will need to pair the watch to your Edison. + +#### Bluetooth setup for Pancreabble + +* Restart the Bluetooth daemon to start up the bluetooth services. (This is normally done automatically by oref0-online once everything is set up, but we want to do things manually this first time): + +`sudo killall bluetoothd` + +* Wait a few seconds, and run it again, until you get `bluetoothd: no process found` returned. Then start it back up again: + +`sudo /usr/local/bin/bluetoothd --experimental &` + +* Wait at least 10 seconds, and then run: + +`sudo hciconfig hci0 name $HOSTNAME` + +* If you get a `Can't change local name on hci0: Network is down (100)` error, start over with `killall` and wait longer between steps. + +* Now launch the Bluetooth control program: `bluetoothctl` + +* And run: `power off` + +* then `power on` + +* and each of the following: + +``` +discoverable on + +scan on + +agent on + +default-agent +``` + +#### On Your Pebble + +Settings/BLUETOOTH to make sure Pebble is in pairing mode + +from terminal + +`trust AA:BB:CC:DD:EE:FF` +`pair AA:BB:CC:DD:EE:FF` + +you might need to do this several times before it pairs + +you will see on the edison + +`Request confirmation +[agent] Confirm passkey 123456 (yes/no): yes` + +* (WARNING: You must type in **yes** not just **y** to pair) + +Once paired, type quit to exit. + + +Currently the `peb-urchin-status.sh` has 1 notification and 3 different options for urchin messages. +in you APS directory there is a file called 'pancreoptions.json' +``` +"urchin_loop_on": true, <--- to turn on or off urchin watchface update +"urchin_loop_status": false, <--- Gives a message on urchin watchface that it's running +"urchin_iob": true, <--- Gives a message on urchin watchface of current IOB +"urchin_temp_rate": false, <--- Gives a message on urchin watchface of current temp basal +"notify_temp_basal": false <--- Notificaiton of temp basal when one shows up in enact/suggested.json +``` +note only one of the messages for the urchin watchface can be true at once + +the `peb-urchin-status.sh` gets called from the crontab and will run automatically. +By default the urchin_loop_on, and urchin_iob is set to true. You must manually change notify_temp_basal to true to start getting temp basal notifications. +you can edit this file using `nano pancreoptions.json` from your APS directory. + +******************************** + +### xDripAPS for offline BGs for Android users + +**Note as of 1/26/17:** The below documentation is WIP and needs additional testing. + +Do you use OpenAPS and the xDrip/xDrip+ Android App? Until now this required an internet connection to upload your xDrip/xDrip+ Android App CGM data to an online Nightscout instance (the OpenAPS community recommends utilizing Heroku). Then your data was downloaded to your OpenAPS rig for use in your online loop. The xDripAPS code resides on your OpenAPS rig and allows the direct transfer of xDrip/xDrip+ Android App CGM data to your OpenAPS rig without an internet connection. xDripAPS creates an offline OpenAPS rig which utilizes a "local" or "personal" network (WiFi hotspot or Bluetooth PAN tethering) for direct communication between the xDrip/xDrip+ Android device and the OpenAPS rig. Data which is 'missing' from Nightscout will be uploaded when the OpenAPS rig regains internet connectivity. + +The OpenAPS community recommends an Explorer Board / Intel Edison rig, but xDripAPS also works with a Raspberry Pi rig. + +Configuring an offline OpenAPS rig is quite easy because the OpenAPS setup script (oref0-setup.sh v0.4.0 and later) supports an automated installation of xDripAPS and dependencies. When running the OpenAPS setup script you simply specify "xdrip" (without the quotes) when promped to specify a CGM type (e.g. MDT, G4). Alternatively, manual installation instructions can be found at the bottom of this page. + +#### Overview of xDripAPS +With xDripAPS, the flow of data is as follows - + +(1) CGM transmitter --> (2) xDrip/xDrip+ Android app --> (3) OpenAPS rig (e.g. Edison) --> (4) Nightscout + +1. Usually a Dexcom G5, or G4 plus xDrip wireless bridge. +2. Either xDrip or xDrip+ can be used. In the app, the REST API Upload feature is normally used to upload CGM data to Nightscout. Instead, we use this feature to upload to xDripAPS on your OpenAPS rig (further details below). +3. Your OpenAPS rig - usually a Raspberry Pi or an Intel Edison. +4. The xDrip or xDrip+ app is now uploading your data to xDripAPS on your OpenAPS rig rather than to Nightscout. OpenAPS will now upload your CGM data to Nightscout as well as treatments, pump status, etc. So your Nightscout site will still be updated. Note that it will take a couple of minutes longer for CGM data to reach Nightscout, compared with when uploading directly from xDrip or xDrip+ + +#### Setup Steps (using oref0-setup.sh script) + +##### Setting up your OpenAPS rig +Install OpenAPS as per the documentation. While running the oref0-setup script you will be prompted to specify a CGM source. Enter "xdrip" (without the quotes). The setup script takes care of the rest! Follow the remainder of the setup script as normal. + +##### Connect your Android phone and your OpenAPS rig +For the xDrip/xDrip+ app on your Android phone to be able to send CGM data to xDripAPS on your OpenAPS rig, they both need to be connected to the same "personal" network. Note that an internet connection is not required - this solution allows you to loop without internet connectivity. + +There are two approaches for establishing a "personal" network between your phone and your OpenAPS rig. The first is to run a WiFi hotspot on your phone and connect your OpenAPS rig to the WiFi network your phone exposes. This is the easiest option, but there are two drawbacks - it drains your phone battery quickly, and some phones cannot connect to a normal WiFi network while the WiFi hotspot is enabled (it can connect to the internet via 3G/4G when coverage is available). + +The other option is to enable bluetooth PAN tethering on your phone and have your OpenAPS rig connect to it. This does not drain the phone's battery as quickly and means that the phone can still connect to a normal WiFi network for internet access when available (and to 3G/4G networks when WiFi is not available). I use this approach 24/7 - my OpenAPS rig is permanently tethered to my Nexus 6P phone. I can get a full day of phone usage without running out of battery, unless I make a lot of calls or have a lot of screen-on time. + +Instructions on both approaches can be found in the main OpenAPS documentation. + +##### Configuring the xDrip/xDrip+ Android app +First, determine your OpenAPS rig's IP address within your "personal" network. If you can open a terminal session to your rig via serial, then `ifconfig wlan0` (when using the WiFi hostpost option) or `ifconfig bnep0` (when using bluetooth tethering) will display your IP address. Alternatively, you can use an Android app - there are lots of "Network IP Scanner" apps in the Play store. The Hurricane Electric Network Tools app works with both the WiFi hotspot and BT tethering options. + +Next, open xDrip or xDrip+ and navigate to Settings > Cloud Upload > API Upload (REST). In the `Base URL` setting, configure the following URL + +`http://@:5000/api/v1/` + +A few notes to clarify: + * enter "http://" NOT "https:// + * is the plain-text API secret used when creating your online Nightscout instance. + * is the IP address of your OpenAPS rig assigned by your WiFi, WiFi hotspot, or Bluetooth PAN tether connection. It will usually take the form of: `192.168.xxx.xxx`. + +![REST API Upload setting](https://github.com/colinlennon/xDripAPS/blob/master/xDrip_REST_API_cropped.png "REST API Upload setting") + +If using xDrip+ navigate to Settings > Cloud Upload > MongoDB and uncheck the "Skip LAN uploads" option. Do not turn on the "Enable Nightscout Mongo DB sync" option. Next, navigate to Settings > Cloud Upload > API Upload (REST) and uncheck the "Skip LAN uploads" option. NOTE: if you don't have these options, update to a recent version of the xDrip+ app. These options were added to a nightly build in December 2016. + +##### Advanced Options + +* Use both API Upload (REST) and MongoDB + * You can use both the API Upload (REST) and the MongoDB upload options. This has the advantage of immediately showing your BG values in Nightscout and allows OpenAPS to continue to get BG values if the link ever fails between your xDrip/xDrip+ uploader phone and your rig. One disadvantage to this method is that you will have duplicate entries in your Mongo database. +* Enter multiple REST URLs + * If you are needing to constantly switch between two or more "personal" networks, you would have to edit the `Base URL` each time with the new IP address. To simplify this process, multiple URLs can be added to the REST API Upload `Base URL` setting, and xDrip/xDrip+ will attempt to upload to each URL. NOTE: the URLs must be "space" deliminated. For example: +``` +http://@:5000/api/v1/ http://@:5000/api/v1/ +``` + +#### Manual installation steps + +##### N.B. It is recommended that you use the oref0-setup script as described above, rather than installing manually. + +1. Install SQLite3 - + + a. Raspbian - + ``` + apt-get install sqlite3 + ``` + + b. Yocto - + ``` + cd ~ + wget https://sqlite.org/2016/sqlite-tools-linux-x86-3150200.zip + unzip sqlite-tools-linux-x86-3150200.zip + mv sqlite-tools-linux-x86-3150200 sqlite + ``` + +2. Get dependencies - + ``` + pip install flask + pip install flask-restful + ``` + +3. Clone this repo - + ``` + cd ~ + git clone https://github.com/colinlennon/xDripAPS.git .xDripAPS + ``` + +4. Create directory for database file - + ``` + mkdir -p ~/.xDripAPS_data + ``` + +5. Add cron entry to start the microservice at startup - + e.g. - + `@reboot python /home/root/.xDripAPS/xDripAPS.py` + +6. Cofigure the xDrip Android app - + `xDrip > Settings > REST API Upload > Set Enabled and enter Base URL: http://[API_SECRET]@[Pi/Edison_IP_address]:5000/api/v1/` + + (Note: Enter your plain-text API_SECRET in the Android app, not the hashed version of it). + + +7. Use the microservice within OpenAPS + e.g. + ``` + openaps device add xdrip process 'bash -c "curl -s http://localhost:5000/api/v1/entries?count=288"' + openaps report add monitor/glucose.json text xdrip shell + ``` + +### Hot Button - also for Android users + +#### Purpose +[Hot Button app](https://play.google.com/store/apps/details?id=crosien.HotButton) can be used to monitor and control OpenAPS using SSH commands. It is especialy useful for offline setups. Internet connection is not required, it is enough to have the rig connected to your android smartphone using bluetooth tethering. + +#### App Setup +To setup the button you need to long click. Setup the Server Settings and set them as default. For every other button you can load them. + +#### Basic commands +To the Command part of the button setup you can write any command which you would run in the ssh session. For example to show the automatic sensitivity ratio, you can set: +`cat /root/myopenaps/settings/autosens.json` + +After button click the command is executed and the results are displayed in the black text area bellow the buttons. + +#### Temporary targets +It is possible to use Hot Button application for setup of temporary targets. This [script](https://github.com/lukas-ondriga/openaps-share/blob/master/start-temp-target.sh) generates the custom temporary target starting at the time of its execution. You need to edit the path to the openaps folder inside it. + +To setup activity mode run: +`./set_temp_target.sh "Activity Mode" 130` + +To setup eating soon mode run: +`./set_temp_target.sh "Eating Soon" 80` + +The script is currently work in progress. The first parameter is probably not needed, it is there to have the same output as Nightscout produces. It is not possible to set different top and bottom target, but this could be easily added in the future. +To be able to use the script, the most straigtforward solution is to disable the download of temporary targets from Nightscout. To do that edit your openaps.ini and remove `openaps ns-temptargets` from ns-loop. + +#### SSH Login Speedup +To speed up the command execution you can add to the `/etc/ssh/sshd_config` the following line: +`UseDNS no` + +******************************** + +### Local, offline BGs for iPhone users using a separate Loop app + +These instructions describe how to use a Loopkit/Loop app as a glucose data source for offline looping using OpenAPS. Note that most of the features of Loop itself are not used in this modification; we are using Loop simply as a local bridge for glucose data from the G5 transmitter to the OpenAPS rig. If you have a working version of Loop already installed, it is recommended build this branch as a separate app by using a unique bundle identifier. + +Also, for those unfamiliar with Loop, note the below instructions are about creating a developer account to self-deploy the app. This is free, but you'd have to re-build the app every 7 days (and it will probably drive you crazy). Otherwise, it's $99 for a developer licenese where you don't have to re-deploy weekly. (For other alternatives for offline BG, see the top of this page). + +#### Prerequisites for using Loop app on iPhone for local, offline BGs to the rig +1. Build (and deploy to your iPhone) a version of Loop using the `lookout` branch from @thebookins. Follow the instructions in [Loop Docs](https://loopkit.github.io/loopdocs/) but install Loop as follows: +``` +git clone https://github.com/thebookins/Loop.git +cd Loop +git checkout lookout +``` +(alternatively, merge the `lookout` changes with your own Loop fork). Depending on the version of XCode you are using, it may be necessary to rebuild the linked frameworks using carthage: +``` +carthage update --platform iOS +``` + +2. If you haven't already done so, install the dev branch of OpenAPS using the [setup script](https://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/oref0-setup.html) with `xdrip` as the glucose source. + +3. Step 2 will set up [xDripAPS](https://github.com/colinlennon/xDripAPS) on your OpenAPS rig. This is a Python program that exposes a very simplified NightScout instance running on the rig to which we can send glucose data. A couple of changes to xDripAPS are required to get it to accept glucose data from Loop. Pull these changes as follows: +``` +cd +rm -r .xDripAPS +git clone https://github.com/thebookins/xDripAPS.git $HOME/.xDripAPS +cd .xDripAPS +git checkout lookout +``` + +4. Setup up [Bluetooth tethering](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-4/bluetooth-tethering-edison.html) between your iPhone and your OpenAPS rig. + +5. Open Loop and the Dexcom app on your iPhone. The Dexcom app will control the G5 transmitter; Loop just listens in. + +#### Setup +1. In Loop, select G5 Transmitter in Settings and enter the G5 Transmitter ID. Do not add the pump serial number as we are using Loop only as a local bridge to get BG data to OpenAPS. (Without a RileyLink, it's impossible to control the pump anyway.) + +2. In Loop, select Nightscout in Settings and enter the local IP address for your Edison in URL format with the addition of `:5000` at the end (which will look like this `http://[YOUR EDISON'S IP ADDRESS]:5000`). Then, enter your API secret as requested in Loop. + +All done. Loop will now send glucose data to the edison URL every five minutes, ready to be picked up by oref0. + +******************************** + +### Creating an information web page that can be picked up using the rig's URL. + +**TODO** - implement this as a proper oref0 script that can be installed by oref0-setup + +This allows you to extract data from the various files that OpenAPS creates and access the locally from the phone that is connected to the rig, giving a full information set. + +Firstly, you need to set up the script that will do this for you. An example is shown below: + +``` +rm ~/myopenaps/enact/index.html +touch ~/myopenaps/enact/index.html + +(cat ~/myopenaps/enact/smb-enacted.json | jq -r .timestamp | awk '{print substr($0,12,5)}') >> ~/myopenaps/enact/index.html + +(cat ~/myopenaps/enact/smb-enacted.json | jq -r .reason) >> ~/myopenaps/enact/index.html +(echo -n 'TBR: ' && cat ~/myopenaps/enact/smb-enacted.json | jq .rate) >> ~/myopenaps/enact/index.html +(echo -n 'IOB: ' && cat ~/myopenaps/enact/smb-enacted.json | jq .IOB) >> ~/myopenaps/enact/index.html +(echo -n 'Edison Battery: ' && cat ~/myopenaps/monitor/edison-battery.json | jq -r .battery | tr '\n' ' ' && echo '%') >> ~/myopenaps/enact/index.html +(echo -n 'Insulin Remaining: ' && cat ~/myopenaps/monitor/reservoir.json) >> ~/myopenaps/enact/index.html +``` +You may need to adjust the values in `'{print substr($0,12,5)}'` - whilst I know these work on the rigs I have set them up on, other's have had better results with `{print substr($0,13,5)}'` + +It can be set up where you choose, either in your openaps directory or at root. + +You will also need to start up the SimpleHTTPserver service that is already installed on jubilinux in the location you will place your file. This is done by adding the following line to your Cron: + +``` +@reboot cd /root/myopenaps/enact && python -m SimpleHTTPServer 1337 +``` +The final thing to do is to make sure the script runs regularly to collect the data and publish it. This requires an additional cron line: + +``` +*/5 * * * * (bash /root/http.sh) 2>&1 | tee -a /var/log/openaps/http.log +``` +In this case the script is running from the /root directory and I am publishing to the ~/myopenaps/enact directory. + +To access this from an iphone browser, enter something like the following: http://172.20.10.x:1337/index.html and you should receive an unformatted html page with the data in it. If you want to improve the output for a browser, the script can be modified to generate html tags that will allow formatting and could provide colouring if various predicted numbers were looking too low. + +On Android, you can download http-widget (https://play.google.com/store/apps/details?id=net.rosoftlab.httpwidget1&hl=en_GB) and add a widget to your home screen that will display this data. + +If you use a Samsung Gear S3 watch, you can use the above http-widget with Wearable Widgets (http://wearablewidgets.com) to view what OpenAPS is doing locally, without internet connection. diff --git a/docs/docs/walkthrough/phase-1/offline-monitoring.md b/docs/docs/walkthrough/phase-1/offline-monitoring.md deleted file mode 100644 index e99dcd24e..000000000 --- a/docs/docs/walkthrough/phase-1/offline-monitoring.md +++ /dev/null @@ -1,33 +0,0 @@ -# Offline monitoring - -## Pancreabble - -Nightscout is the default way to visualize what your loop is doing, but your OpenAPS rig must be connected to the internet to upload its status. [Pancreabble] is a way to monitor your loop _locally_, by pairing a Pebble smartwatch directly with the Raspberry Pi or Intel Edison. - -In other words, whereas the default setup looks like this: - -``` -Raspberry Pi/Intel Edison -> network -> Nightscout server -> network -> smartphone - | - -> laptop - | - -> Pebble watch -``` - -And by default, your Pebble is paired thus: - -``` - smartphone -> Bluetooth -> Pebble watch -``` - -With Pancreabble, the setup looks like this: - -``` -Raspberry Pi/Intel Edison -> Bluetooth -> Pebble watch -``` - -Using a Pebble watch can be especially helpful during the "open loop" phase: you can send the loop's recommendations directly to your wrist, making it easy to evaluate the decisions it would make in different contexts during the day (before/after eating, when active, etc.). - -See [Pancreabble] for setup instructions. - -[Pancreabble]: https://github.com/mddub/pancreabble diff --git a/docs/docs/walkthrough/phase-1/papertrail.md b/docs/docs/walkthrough/phase-1/papertrail.md new file mode 100644 index 000000000..1a9a72275 --- /dev/null +++ b/docs/docs/walkthrough/phase-1/papertrail.md @@ -0,0 +1,196 @@ +# Papertrail remote monitoring of OpenAPS logs (RECOMMENDED) + +If you want to remotely view the rig's logs/loops, you can use Papertrail service. We HIGHLY recommend setting up this service for at least the first month of your OpenAPS use to help remotely and quickly troubleshoot your rig, if you have problems. The first month of Papertrail comes with a very generous amount of free data. If you decide you like the service, you can sign up for monthly plan. Typically, the monthly cost for using Papertrail with OpenAPS is approximately $5-7 depending on how many rigs you use and how long you'd want to save old data. + +### Get an account at Papertrail + +Go to http://papertrailapp.com and setup a new account. Choose to setup a new system. Notice the header at the top of the new system setup that says the path and port that your logs will go to. You’ll need that information later. + +![Papertrail hosting information](../../Images/papertrail_host.png) + +### System logging + +Login to your rig. If you need help with that, please see the [Accessing Your Rig](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/accessing-your-rig.html) section of these docs. Copy and paste the code that is displayed in your new system setup's shaded box, as shown in the red arrowed area in the screen shot above. This will setup papertrail for just your syslogs. But, we now will need to add more (aggregate) your logs such as pump-loop and ns-loop. + +### Aggregating logs + +* Copy and paste each of these four command lines, one at a time. The screenshot below shows the successful results of each command. The first command will run for a short time and end with similar information to the green box. The remaining three commands will not display anything specific as a result of the command. + +`wget https://github.com/papertrail/remote_syslog2/releases/download/v0.19/remote_syslog_linux_i386.tar.gz` + +`tar xzf ./remote_syslog*.tar.gz` + +`cd remote_syslog` + +`sudo cp ./remote_syslog /usr/local/bin` + +![Papertrail aggregating](../../Images/aggregating_logs.png) + +* Create the file that will store all the logs you'd like to aggregate: + +`vi /etc/log_files.yml` + +* press "i" to enter INSERT mode, and then copy and paste the following (updating your host and port on the lines shown to match what your new system info shows as described above): + +``` +files: + - /var/log/openaps/pump-loop.log + - /var/log/openaps/autosens-loop.log + - /var/log/openaps/ns-loop.log + - /var/log/openaps/network.log + - /var/log/openaps/autotune.log + - /var/log/openaps/cgm-loop.log + - /var/log/openaps/pushover.log +destination: + host: logs5.papertrailapp.com # NOTE: change this to YOUR papertrail host! + port: 12345 # NOTE: change to your Papertrail port + protocol: tls +``` +type ESC and ":wq" to save changes and exit. + +* Start a new aggregate + +`sudo remote_syslog` + +Now you should be able to see your new logs in your papertrail, but we need to make it so this runs automatically when the rig is restarted. + +### Install auto restart at reboot + +* Create a new file that will restart the papertrail logging at reboot + +`vi /etc/systemd/system/remote_syslog.service` + +* press "i" to enter INSERT mode, and then copy and paste the following: + +``` +[Unit] +Description=remote_syslog2 +Documentation=https://github.com/papertrail/remote_syslog2 +After=network-online.target + +[Service] +ExecStartPre=/usr/bin/test -e /etc/log_files.yml +ExecStart=/usr/local/bin/remote_syslog -D +Restart=always +User=root +Group=root + +[Install] +WantedBy=multi-user.target +``` + +type ESC and ":wq" to save changes and exit. + +* enable the reboot service by using these two commands, one at a time. + +`systemctl enable remote_syslog.service` + +`systemctl start remote_syslog.service` + +* reboot your rig to test the papertrail + +`reboot` + +and then go to your papertrailapp website to see the log + +![papertrail log example](../../Images/papertrail.png) + +### Optimize Papertrail use + +To make the most of your Papertrail logs, setting up some of your account settings and filters will help streamline your troubleshooting + +#### Account Filters + +Adding filters to your incoming Papertrail logs will help minimize unuseful data (and help keep you below your data caps) and streamline your review of your relevant OpenAPS logs. You can go to your Papertrail account's `Settings` and then choose the `Log Destinations`. Click on `Log Filters` to go to the screen where you can add specific filters. + +![papertrail log destinations](../../Images/log_destinations.png) + +Click on the `Add Log Filter` button and add three filters for `CRON`, `libmraa`, and `sudo`. Save the changes and within 60 seconds, your logs will be filtered. The CRON, libmraa, and sudo logs usually provide very little help for troubleshooting OpenAPS problems. You can always undo these filters, if you want to see what those provide in the future. + +![papertrail log filters](../../Images/log_filters.png) + +#### Saved Filters + +Unfortunately, Papertrail does not currently have an app for use on mobile devices. Instead, you will be using an internet browser to view your papertrail. Setting up saved filters, in advance, can help you sort through your logs more efficiently. Most OpenAPS troubleshooting will involve either wifi connection issues or pump communications. Some helpful filters to save to find those issues fastest are: + +* `pump-loop.log` to see just your pump loop...similar to using the `l` command when logged into your rig. + +* `network` will show just your oref0-online results and whether/which wifi network your rig is connected to. If you see results of `192.168.1.XX`, then your rig is likely connected to a wifi network. If you see results of `172.20.10.XX` then your rig is likely connected to your phone's personal hotspot. If you see `error, cycling network` results, you should check out troublehsooting steps. + +* `pump-loop.log adjust` will show your basal and ISF adjustments being made by autosens, if enabled. + +If you are running multiple rigs, you can also setup these filters to include the hostname of a particular rig, if you want to filter just for that rig. For example, this screenshot below would be setting and saving up a filter for a particular rig with the hostname of `edison1` and only for its pump-loop.log. + +![papertrail log filters](../../Images/save_filter.png) + +Once you get your desired filters saved, it is an easy process to make them more accessible on your mobile device by using the `add to homescreen` button. For example, below are the quick links to the saved filters for an OpenAPS user with three rigs... + +![papertrail homescreen buttons](../../Images/papertrail_home_buttons.png) + +#### Troubleshooting using Papertrail + +Papertrail can be very valuable to quickly troubleshoot a rig, becuase it is quite easy to see all the loops that log information about your rig's actions. BUT, the way that the information comes into Papertrail is based on the time the action took place. So, you'll be seeing information stream by that may or may not help you troubleshoot WHICH area your issues are. + +First, let's start with messages that **ARE NOT ERRORS** + +* Anything in the first 15 minutes (pretty much) of a new loop setup. Let the loop run for 15 minutes before you start to investigate the messages. Many messages resolve themselves during that time, such as `cat: enact/enacted.json: No such file or directory` is because the loop hasn't enacted a temp basal suggestion yet...so the file doesn't exist. + +* `Radio ok. Listening: .No pump comms detected from other rigs` This message is NOT an error. This means your rig is checking to make sure it is not interrupting another rig that may already be talking to your pump. It's being polite. + +* `[system] Failed to activate service 'org.freedesktop.hostname1': timed out` This message is NOT an error. Jubilinux does not use the hostname service...so it does not activate. + +* Many messages that say there are failures, are not really failures for your rig. For example, there are a lot of scary looking messages when your rig is changing networks from wifi to/from BT...an unfiltered papertrail will show every message like this: + +![papertrail homescreen buttons](../../Images/error-messages.png) + +But, really, most of those messages are the normal course of the rig telling you what's going on. Like "Hey, I seem to have disconnected from the wifi...I'm going to look for BT now. Hold on. I need to organize myself. Bringing up my stuff I need to find BT. Ok, found a BT device. Well, I can connect to it, but some of the features I don't need...like an audio BT connection." But, the rig doesn't speak English...it speaks code. So, if you don't speak code...sometimes a filer for `network` might help you filter for the English bits of info a little better. Here's what that same period of time looked like with a `network` filter applied. It's a little more clear that my rig was changing from a BT tether to a wifi connection when you filter the results. + +![papertrail homescreen buttons](../../Images/network-filter.png) + +Therefore when you start to troubleshoot, **USE YOUR FILTERS** to narrow down the logs that you are looking at. Here are some specific errors/issues you may find. + +**PUMP TUNING** + +Use `pump-loop` search filter to start with. What messages are you seeing? Poor pump comms are one of the most frequent causes of loops stopping. If you see `916, 0, -99` tuning results, then you know that your rig is not getting a useable communication with your pump. Try moving your pump and rig closer together. Check if your pump battery is good. + +![papertrail poor pump tune](../../Images/poor_tuning.png) + + Ideally you should be seeing pump tuning somewhat like the filter for `mmtune` below shows...this is a kid at school, carrying the rig in a purse/backpack. Some periods of time she leaves her rig behind (like PE class) and other shorter times where there's poor pump comms. But, generally speaking seeing mmtune results in the 70s and 80s will sustain good looping. + +![papertrail mm tune](../../Images/mmtune.png) + +**GIT LOCK** + +There are files that get written to in a directory called `/root/myopenaps/.git` Sometimes a process crashes and causes a file in that directory to get locked and the writing can't continue. Your loop may fail as a result. This can be a short term issue, and it could resolve on it's own...other times it may require you to delete the file that is causing the problem. For example, below is a short-term error. The message says there is a problem in the `/root/myopenaps/.git` and I may need to remove that file to get things going again. However, you can also see that a few minutes later, the problem resolved on its own. + +If you find a .git lock error is causing a long period of time where your loop is failing, you can remove the file, as the error suggests by using `rm -rf /root/myopenaps/.git/filename` or you can delete the whole `.git` directory (it will get rebuilt by the loop automatically) with `rm -rf /root/myopenaps/.git` + +![papertrail git lock](../../Images/git-lock.png) + +**FLAKEY WIFI** + +Having flaky router or wifi issues? Some routers or ISPs (I still haven't completely determined the cause) will not work nice with the Avahi-daemon. What the means for you...spotty time staying connected to your wifi. Does your rig not loop consistently? Sometimes are you getting kicked out of ssh sessions with your rig? Look for the message shown in the screenshot below: + +![papertrail avahi error](../../Images/avahi.png) + +Or alternatively, if you see this message when you login to your rig: + +![papertrail avahi at login](../../Images/avahi2.png) + +The solution to this is to login to your rig and use this command `systemctl disable avahi-daemon` as shown below + +![papertrail avahi disable](../../Images/avahi-fix.png) + +AND also make this edit using `vi /etc/default/avahi-daemon` Change the number on the last line from `1` to `0` so that it reads `AVAHI_DAEMON_DETECT_LOCAL=0` as shown in the screenshot below. (remember `i` to enter INSERT mode for editing, and `esc` and `:wq` to save and exit the editor) + +![papertrail avahi disable](../../Images/avahi-fix2.png) + +`reboot` your rig after the change to enable the fix. + +**subg_rfspy state or version??** + +If your loop is failing, lights are staying on, and you see repeated error messages about "Do you have the right subg_rfsby state or version?" as below, then you need to head to [this section of docs](http://openaps.readthedocs.io/en/latest/docs/Resources/troubleshooting.html#could-not-get-subg-rfspy-state-or-version-have-you-got-the-right-port-device-and-radio-type) to fix that issue. Don't worry, it is a 5 minute fix. Very straight-forward. + +![papertrail subg error message](../../Images/subg_rfspy.png) + +![papertrail subg lights](../../Images/subg_rfspy2.jpg) diff --git a/docs/docs/walkthrough/phase-2/accessing-your-rig.md b/docs/docs/walkthrough/phase-2/accessing-your-rig.md new file mode 100644 index 000000000..21f487449 --- /dev/null +++ b/docs/docs/walkthrough/phase-2/accessing-your-rig.md @@ -0,0 +1,138 @@ +# How to access your OpenAPS rig + +You will need to access your OpenAPS rig’s software when you want to: + +* Update your loop software (oref0 update, especially when new features are available) +* Change your preferences.json (update max-iob, turn on/off advances features) +* Change your pump (update pump serial number for different pump) +* Change your Dexcom system (G4 to G5) +* Change your Nightscout URL that you use +* Get a new iPhone and need to re-pair bluetooth with rig +* Add/change known wifi networks and network passwords +* Run reports or check logs + +Since the rig is basically a computer without a screen or keyboard, there are various options to get you access you’ll need. The option available will depend mostly on the wifi network your gear is connected to. + +If you are using a Mac computer, access will be using the Terminal App which comes with the computer. It can be found in the Utilities folder within Applications. + +If you are using a Windows computer, access will be using PuTTY program. You likely already downloaded it when you setup your OpenAPS rig. If you are at a new computer and need to [install Edison drivers](https://software.intel.com/en-us/iot/hardware/edison/downloads) and [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html). If you need details about installing them, go back to the [Windows guide Step 1-1](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/windows-edison.html#) + +## If your computer and rig are on the same wifi network + +![If your computer and rig are on the same wifi network](../../Images/Computer_rig_same_wifi.png) + +### For Mac computers + +* Open the Terminal App found in the Utilities folder in Applications. + +* Use the command `ssh root@edisonhost.local` (**or whatever you named your edison host**, in the example below, the hostname was edison1). If this is your first time logging in to the rig on the computer, you may get a message about the authenticity of the host and whether you want to add the key fingerprint to the list of known hosts. Go ahead and answer yes. You will be asked for the password for the rig...enter your root password that you setup in Phase 0 (the default was edison). Realize that keystrokes will not appear as you enter the password. A successful login will result in a screen similar to below. + +![Mac ssh login](../../Images/access_mac1.png) + +* If you get an error about "could not resolve hostname", it is likely that your rig is actually connected to a different wifi network than the computer. Try the screen method (directions below) for connecting to your rig. + +![Mac ssh unknown host](../../Images/access_mac2.png) + +* If you get an scary looking error about "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!" that is likely because you are attempting to login to a rig that has the same hostname as a previous rig that has been logged into on the computer. (This is why you want to use unique hostnames if you are going to have multiple rigs.) You can delete the history of known hosts for the rig by entering the commands `cd .ssh` and then `rm known_hosts`. This will delete the log of known hosts on your computer. There's no significant downside to removing the known_host log, except that you will need to answer yes to the key fingerprint additions again for the first time you login to old rigs again. After you delete the known hosts, you can use the `ssh root@edisonhost.local` command to login, as described above. + +![Mac spoofing error](../../Images/access_mac3.png) + +### For Windows computers + +* Open PuTTY program + +* Click the SSH radio button and then enter the IP address of the rig on the "Host Name" line in PuTTY. + +![Windows IP address for rig](../../Images/access_5.png) + +* If you do not know the IP address of the rig, you can obtain it by first logging on using Serial connection (described below) and using the command `ifconfig`. + +![Windows IP address for rig](../../Images/access_4.png) + +* Click the "Open" button in the PuTTY window and, if this is your first time logging into the rig using PuTTY using ssh, you may see a warning regarding the server's host key. Click yes to add the host key to PuTTY's cache. + +![Windows key hostname](../../Images/access_6.png) + +* Login using login name `root` and password is whatever you changed it to during setup in Phase 0. The default password was edison. As you type the password, no keystrokes will appear on the screen. Successful login will leave you at a prompt for the root user. + +![Windows IP address for rig](../../Images/access_7.png) + +## If your computer and rig are on different wifi networks + +![If your computer and rig are on different wifi networks](../../Images/Computer_rig_different_wifi.png) + +**Access to the rig will need a cable to connect the UART port on the rig with the USB port on the computer. You will need a cable capable of transmitting data. If you try all of the steps below and are unsuccessful at connecting, try a new cable.** + +### For Mac computers + +* Use the Terminal app on the Mac, or follow [these directions for Windows](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/setup-edison.html#if-you-re-using-a-windows-pc-for-console) + +* If you're using a Mac, use the command `sudo screen /dev/tty.usbserial-* 115200` to enable “screen” mode. You will be prompted to enter a password. Enter your **computer's password** not the rig's password here. + +![Mac Screen first password](../../Images/access_mac_password.png) + +* You may see a blank screen. Press RETURN to bring up the edison’s login screen. Login as `root` and use your root password (you should have changed it from the default of `edison` during the setup of the rig - if not, please [go back and do so now](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/setup-edison.html#initial-edison-setup). A successful login will look like below. + +![Mac Screen successful login](../../Images/access_mac_screen.png) + +* If instead, you see a message at the bottom of the screen that says "Sorry, could not find a PTY." that usually means the system has not cleared a previous screen session. If you only had the rig connected by one cable in the UART port on rig, you can simply unplug the rig from the computer and move to a new USB port on the computer. If you don't have any "new" USB ports that were not used by the previous login attempt, then close out terminal app, restart the computer, and try again. This will clear the error. + +![Mac Screen message for busy port](../../Images/access_mac_sorry.png) + +* If instead you see a message at the bottom of the screen that says "Cannot exec '/dev/tty.usbserial-*': No such file or directory", double check that you have your rig and computer connected via the rig's UART port. Using the OTG port will cause this error message. Or typos in the screen command will have same result. Double check your spelling, or better yet...use copy and paste whenever possible. + +![Mac Screen message for OTG port](../../Images/access_mac_no_exec.png) + +### For Windows Users + +* Navigate to your Control Panel and then to Device Manager. Click on the Ports to open your USB serial port. Find the COM port that the rig is connected to. In the screenshot below, COM7. Note: different USB ports will have different numbers. If you regularly plug your rig into the computer and use this connection type, you may need to make sure you update the COM number in the steps below if you are switching between different USB ports. + +![Windows COM port number](../../Images/access_1.png) + +* Open PuTTY program. Click on the Serial radio button, enter the COM number you got from the previous step into the Serial line number and change the speed to 115200. Click on Open button. + +![Windows serial setup](../../Images/access_2.png) + +* Enter `root` for the login and the password is whatever you changed it to during setup in Phase 0. The default password was edison. As you type the password, no keystrokes will appear on the screen. Successful login will leave you at a prompt for the root user as shown below. + +![Windows serial login success](../../Images/access_3.png) + + +## If your iPhone and rig are on the same wifi network + +![If your iPhone and rig are on the same wifi network](../../Images/Iphone_rig_same_wifi.png) + +One of the most convenient ways to do quick edits on your rig’s settings may be by using an app on your iPhone. You will need to make sure your rig and your iPhone are sharing the same network (e.g., home wifi, mifi, or personal hotspot) and here are the instructions. Each connection point will need it’s own “host” setup in the app. + +* Download “Termius SSH Shell/Console/Terminal” from iPhone app store + +* Set up a new “host” in the app with the following information. Remeber, you will need to setup a new "host" for every rig and every wifi connection that you will use to connect. For example, I have three rigs that I regularly connect to on my home wifi network; edison1 (the rig my daughter regularly wears), edison2 (the rig we keep in her bedroom), and edison3 (the rig we keep in the living room). Since my daughter's mobile rig (edison1) can sometimes need to be accessed while we are on the road, I also have a host setup for when her rig is connected to my phone's hotspot. + +``` +Alias: enter a name that will remind you which rig and what network (such as rig name @ home wifi, iphone hotspot, or mifi device since each connection will have a unique IP address) +Username: root +Hostname: enter the IP address of the rig on that particular wifi network (see below if you need help finding the IP address) +Password: enter your rig's root password +``` +* Clicking on the “host” in the app will launch an ssh connection with the rig and you can use the iPhone to access the rig’s software. They must be on the same network as the “host” connection specifies though, or else the connection will fail. + +![Terminus app hostnaming](../../Images/terminus.png) + +## How to determine the IP address of your rig? + +Private IP addresses are assigned for devices and are unique to the connection. So, your rig’s IP address when using your iPhone’s hotspot will be different than your rig’s IP address when using your home wifi. So, you’ll need to find the IP address for the particular connection you are using. + +* If rig and iPhone connected to a mifi device, the mifi device may list connected devices and IP addresses. Look for your edison rig on there. + +* If iPhone and rig are connected via the iPhone’s personal hotspot, you can download an app such as iNet to scan the network for devices and find your edison rig. The IP address will be listed with the scan information. + + +* If the rig is accessible by computer (by either method listed above, ssh or console) **AND** the iPhone and rig are on same network as each other, you have a couple options. You can login on Terminal app and use `ifconfig` to read the wlan0 inet address + +![ifconfig example](../../Images/ifconfig_example.png) + +OR login to your router to see the list of connected devices and find your edison rig. Google your router’s brand name and “router login” (e.g., Netgear router login) to find out how to access your router’s administrative area. + +## Shortcut to see IP and wifi network name that your rig is on + +**Tip**: for rigs updated ([here is how to update](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/update-your-rig.html)) after 2/7/17, you can also now type `wifi` hit enter; it will bring up the last 100 lines of the network log so you can see your IP address AND the network name of the wifi that your rig is on. diff --git a/docs/docs/walkthrough/phase-2/index.rst b/docs/docs/walkthrough/phase-2/index.rst index 7313cacc7..cab943fc5 100644 --- a/docs/docs/walkthrough/phase-2/index.rst +++ b/docs/docs/walkthrough/phase-2/index.rst @@ -9,7 +9,9 @@ Phase 2: Creating a PLGM Loop considerations oref0-setup troubleshoot-oref0-setup - + accessing-your-rig + on-the-go-wifi-adding + update-your-rig diff --git a/docs/docs/walkthrough/phase-2/on-the-go-wifi-adding.md b/docs/docs/walkthrough/phase-2/on-the-go-wifi-adding.md new file mode 100644 index 000000000..39e16dee9 --- /dev/null +++ b/docs/docs/walkthrough/phase-2/on-the-go-wifi-adding.md @@ -0,0 +1,111 @@ +# How to add a new wifi network while out and about + +Since OpenAPS rig needs internet connection, most of the times we would prefer to have the rig on a wifi connection. Using our iPhones as hotspots can rack up data use and burn iPhone battery pretty quick. So, let’s say your kid is going to a sleepover at a friend’s house and you’d like to put her rig on the friend’s wifi network. Unless you bring your laptop with you…you might be stumped how to do that? Here’s a walkthrough for how to get that done…the setup is a bit long at first, but you can use the resulting connection to do many other things with your rig on-the-go. + +1. Get a couple iPhone apps to help us +2. Hotspot connect the iPhone and rig +3. Get an IP address for the rig +4. Set up a connection to the rig on the iPhone +5. Edit the list of wifi networks on the rig + + +## 1. Get a couple of iPhone apps + +On the iPhone, download these two apps: + +* Termius – SSH Shell/Console/Terminal +* iNet + +![Example of apps](../../Images/Example_iphone_apps.png) + +## 2. Hotspot connect iPhone and rig + +You should have already added your iPhone’s hotspot info to the wifi network list previously. If you have questions about how to do that, see the [Simple Mac setup guide](../phase-0/edison-explorer-board-Mac.md). + +But, as a hint, you can find your iPhone hotspot information under Settings, Personal Hotspot. Your network name and password are listed there. Use the `vi /etc/wpa_supplicant/wpa_supplicant.conf` command while logged on the rig from a computer. + +![Personal hotspot](../../Images/personal_hotspot.png) + +We’ve made sure your iPhone is in the rig’s network list (technically called a “wpa supplicant list”). Now get in a place where your rig is not on another network. In other words, if you are at home…turn off your wifi for a bit by unplugging your router. Or get in your car and drive a few blocks away. We need the rig to connect to your iPhone hotspot. + +You can tell your rig is connected to your iPhone when you see a blue bar above the screen. It will tell you one “1 Connection”…and that is your rig! Yes. + +![Successful hotspotting](../../Images/hotspot_running.png) + +## 3. Get an IP address for the rig + +* Open the iNet app + +* Click on the big “NETWORK SCANNER” +![Network scanner app](../../Images/network_scanner.png) + +* Click on the three little bars in the upper right, and then choose “Scan Settings” from the drop down list that will appear. + +![Scan settings](../../Images/scan_settings.png) + +* Edit the Start IP and End IP scan settings to 172.20.10.1 and 172.20.10.20 (devices connected to your iPhone hotspot will be in that range). + +* Press the blue/black “Scan” button on the bottom right of the screen (it may be a little hidden because the display gets a little pushed down by the hotspot bar on the top of iPhone). + +![Edit start and end IP and pres scan](../../Images/edit_network_scanner.png) + +* The scan results should show a device labeled “edisonhost” (or whatever name you chose for the rig in the setup process. If you don’t see it quickly, try rescanning. + +* Copy down or screenshot the IP address listed under the device. (in this example, 172.20.10.10) + +![Successful network scanner screen](../../Images/successful_network_scanner.png) + +We are all done with the iNet app. + + +## 4. Set up a connection to the rig on the iPhone + +Now we are moving over to the Termius app. When you first open the app, it will prompt you to add a new host. Go ahead and click the button to add a new host. You are going to fill out the following lines: +``` +Alias – pick a name that let’s you know this is the rig when it’s hotspotted with your iPhone + +Username – click to the left of the little blue man and type “root” + +Hostname – Enter the IP address we just got from the iNet app + +Password – Enter your rig’s root password (default is “edison” but you likely changed it during setup) +``` + +Click “Save” in the upper right corner. + +![Terminus adding new hosts](../../Images/Terminus_add_new_host.png) + +Congrats…you should now see the host you just created. If you click on that host, you’ll see a message that it is connecting and then… + +![Terminus with hosts showing](../../Images/Terminus_with_hosts.png) + +## 5. Edit the list of wifi networks on the rig + +You’re IN! Congrats! + +**Warning** The instructions below describe how to edit your rig's network settings, which determine whether your rig can connect to your hotspot. Just in case you might mess up the config and "step on your own air hose", be sure you have a backup method of connecting to your rig (perhaps using Bluetooth, or your laptop and a USB console connection) or a backup rig available. Be careful when editing wpa_supplicant.conf to copy the syntax exactly, to avoid having it refuse to load the config at all due to a misplaced quote or curly brace or something. + +If you are out and about, don't have a backup method of connecting, and this is your only rig, you might want to consider waiting until you get home to change your wpa_supplicant config. + +If you're ready to proceed, you’ll want to enter : + +`vi /etc/wpa_supplicant/wpa_supplicant.conf` + +and that will bring up your network list for the rig: + +![network list in the rig](../../Images/network_list_in_rig.png) + +**HINT:** Turn your iPhone sideways and the keyboard will show some useful options. Like those arrow keys to navigate with. + +**HINT 2:** you can also use this host portal to run any other commands (not just adding wifi networks). This host will work anytime your iPhone and rig are hotspotted together. + +* Type “i” to enter INSERT mode. + +![Insert mode to add new wifi](../../Images/add_new_wifi.png) + +* Add your new wifi network + +* Press the “esc” key and then type “:wq” to save and quit +(or “:q!” if you panic and don’t want to save the changes) + +CONGRATS! You just set up a convenient on-the-go editing tool! diff --git a/docs/docs/walkthrough/phase-2/oref0-setup.md b/docs/docs/walkthrough/phase-2/oref0-setup.md index 8c8f0d19e..564852a6b 100644 --- a/docs/docs/walkthrough/phase-2/oref0-setup.md +++ b/docs/docs/walkthrough/phase-2/oref0-setup.md @@ -14,15 +14,25 @@ Running this code will install all of the dependencies for you automatically: `curl -s https://raw.githubusercontent.com/openaps/docs/master/scripts/quick-packages.sh | bash -` +(If you run into errors with code above, you likely skipped installing required code packages at http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-0/setup-edison.html#install-packages-ssh-keys-and-other-settings, go back and install them and then run code again) + +You will see some colorful screens go by such as the screenshot below: + +![NPM install](../../Images/npm_screenshot.png) + If the install was successful, the last line will say something like: - openaps 0.1.5 (although the version number may have been incremented) + openaps 0.1.5 + +The version number above may have been incremented from what is shown here, and that is okay. All you are really looking for is `openaps` followed by a version number. This lets you know that the install has completed successfully. + +![NPM install](../../Images/dependencies_success.png) -If you do not see this or see error messages, try running it multiple times. It will not hurt to run this multiple times. +If you do not see the screen above, or see error messages, try running it multiple times. It will not hurt to run this multiple times. (Interested in the development repositories? [See this shell script.](https://raw.githubusercontent.com/openaps/docs/master/scripts/quick-src.sh)) -### Manual Installation +### (If you did the above, skip this and go on to Step 1) Manual Installation If you prefer to install the dependencies yourself, the following Debian/Ubuntu packages are required: @@ -42,36 +52,92 @@ Pull/clone the latest oref0 master by running: `mkdir -p ~/src; cd ~/src && git clone git://github.com/openaps/oref0.git || (cd oref0 && git checkout master && git pull)` -## Step 2: Run oref0-setup +![NPM install](../../Images/clone_oref0.png) -__Note:__ If you're using the 915MHz Explorer board, you'll need to log in as root to run oref0-setup.sh, as the mraa package doesn't yet support running under an ordinary user account. Also read below regarding port and other information to enter when running the script. +If you have been looping for awhile, are setting up an additional rig, are comfortable using the advanced features from the master branch, and want to test out the latest features of the oref0 dev branch (which may still be highly experimental) you can use: -Run this: +`mkdir -p ~/src; cd ~/src && git clone -b dev git://github.com/openaps/oref0.git || (cd oref0 && git checkout dev && git pull)` -`cd && ~/src/oref0/bin/oref0-setup.sh` +`cd ~/src/oref0 && npm run global-install` (note this is only necessary for the dev branch, NOT for master) -to run the script interactively, or get usage guidelines for providing inputs as command line arguments. +## Step 2: Run oref0-setup + +__Note:__ If you're using the 915MHz Explorer board, you'll need to log in as root to run oref0-setup.sh, as the mraa package doesn't yet support running under an ordinary user account. **Be prepared to enter the following items:** -* Directory name for your openaps +* directory name for your openaps +* email address for github commits * serial number of your pump -* the mmeowlink port: - * /dev/spidev5.1 if using explorer board - * see [here](https://github.com/oskarpearson/mmeowlink/wiki/Installing-MMeowlink) for other port options -* how you are getting cgm data and cgm serial numbers if needed -* nightscout host and api-secret if using nightscout -* whether you want any of the oref0 advanced implementations +* whether or not you are using an Explorer board +* if you're not using an Explorer board or a Carelink stick, you'll need to enter the mmeowlink port for TI stick or Explorer board (built in TI stick): + * see [here](https://github.com/oskarpearson/mmeowlink/wiki/Installing-MMeowlink) for directions on finding your port + * Note: if you're using a Carelink, you will NOT be using mmeowlink + * Note: if you're using an Explorer board, you will be using mmeowlink but this will be setup automatically +* how you are getting CGM data. The options are `g4` (default), `g4-raw`, `g5`, `mdt`, and `xdrip`. Note: OpenAPS also attempts to get BG data from your Nightscout. OpenAPS will always use the most recent BG data regardless of the source. +* Nightscout URL and API secret +* whether you want any of the oref0 advanced features (AMA, Autosens, and/or Autotune) +* BT MAC address of your phone, if you want to pair for BT tethering to personal hotspot * whether or not you want to automate your loop (using cron) -**Hint:** if you're not sure if you need something (advanced features), you probably don't, but for more information on the advanced features, see [here](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-4/advanced-features.html). Also, scheduling something in cron means scheduling the loop to run automatically. So if you want an automated closed loop, Yes, you want to schedule it in cron. If you don't want an automated loop yet, you can always come back and run the script again later to automate. In addition, running the script again will update the various packages that the script installs. +**Hint:** If you're not sure if you need something (advanced features), you probably don't, but for more information on the advanced features, see [here](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-4/advanced-features.html). Also, scheduling something in cron means scheduling the loop to run automatically. So if you want an automated closed loop, Yes, you want to schedule it in cron. If you don't want an automated loop yet, you can always come back and run the `bash ~/myopenaps/oref0-runagain.sh` command later to automate. In addition, running the script again will update the various packages that the script installs. + +**Read this note before running the script**: The very first time may take a while (15-20 minutes) for it to successfully read and pull a full history from your pump. Wait at least 20 minutes while watching the log (see below, in step 3 on this page) before asking for help. If it looks like it is giving you an error message, make sure you completed step 0 and 1 (see above!). If in doubt, run step 0 and step 1 again, and run the setup script (step 2) again as well. It will not hurt to run it multiple times, but you will probably want to answer `yes` to the setup script prompt asking if you want to delete any existing crons. Go on to the [next page](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/troubleshoot-oref0-setup.html) for other ideas of troubleshooting. Read that page's troubleshooting tips before jumping into Gitter with questions about what to try next [and make sure to utilize these tips when asking for help](https://diyps.org/2017/03/19/tips-for-troubleshooting-diy-diabetes-devices-openaps-or-otherwise/). + +**Two options for running the oref0-setup script are with or without BT** Eventually, most users will want to run their rig with BT enabled. You can run the script with Bluetooth and always come back at a later time to finish the pairing steps in Phase 4. Until you finish the pairing, your rig will rely on known wifi networks in your wpa-supplicant list that you setup in Phase 0 (or on any offline setups that you have done). + +#### oref0-setup.sh script (without Bluetooth tethering - recommended to do for your first setup ) + +`cd && ~/src/oref0/bin/oref0-setup.sh` + +to run the script interactively, or get usage guidelines for providing inputs as command line arguments. + +#### oref0-setup.sh script with Bluetooth + +If you want to add Bluetooth tethering to the mix: + +`cd && ~/src/oref0/bin/oref0-setup.sh --btmac=AA:BB:CC:DD:EE:FF` (where AA:BB:CC:DD:EE:FF is your phone's BT MAC address) NOTE: Make sure the MAC address is in ALL CAPS. + +Please see [Phase 4](https://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-4/bluetooth-tethering-edison.html) for the directions to complete the BT pairing. **Worldwide pump users** If you are running from the master branch and not the WW branch, you'll need to follow the instructions at https://github.com/oskarpearson/mmeowlink/wiki/Non-USA-pump-settings to ensure that the correct frequency is used by mmtune. -The very first time may take a while (10-15 minutes) for it to successfully read and pull a full history from your pump. Wait at least 15 minutes when watching the log (see below, step 3) before asking for help. If it looks like it is giving you an error message, make sure you completed step 0 and 1 (see above!). If in doubt, run step 0 and step 1 again, and run the setup script (step 2) again as well. It will not hurt to run it multiple times, but you will probably want to comment out any existing crons before adding another. Go on to the [next page](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/troubleshoot-oref0-setup.html) for other ideas of trouble shooting. Read that page's troubleshooting tips before jumping into Gitter with questions about what to try next. +When you've successfully answered all the input questions from the setup script, it will print a summary of the inputs for you before asking if you want to continue, as shown below: + +![NPM install](../../Images/setup_entries.png) + +After the setup script builds your myopenaps, it will ask if you want to schedule a cron (in other words, automate and turn on your loop). Usually you'll want to answer `yes` and also then press `enter` to reboot after the cron is installed. + +![NPM install](../../Images/cron_reboot.png) -## Step 3: Watch the logs +### Re-running the oref0-setup.sh script -When you decide to enable the new loop in cron, follow the log file (and watch Nightscout) to make sure that it is working properly: +In the future, you may want to run the setup script again (such as when you want to come back and turn on new, advanced features). To do so, you will be able to run `bash ~/myopenaps/oref0-runagain.sh` to start running the setup script again with those options. (You may first want to `cd ~/myopenaps && cat oref0-runagain.sh` to see what options you have saved in there. To run it again with different options, you can copy and paste and modify that output, or you can `cd ~/myopenaps && nano oref0-runagain.sh` to change what's saved in the file to run the next time. Make sure to change `myopenaps` to your openaps directory name if you chose something non-standard when you ran oref0-setup originally.) + +If you are running this and the file does not exist, that just means you have not run oref0-setup since updating oref0 to 0.4.0 or later. You will need to run oref0-setup per the above section (with or without Bluetooth); then in the future you can use oref0-runagain.sh. + +## Step 3: Watch the logs - REQUIRED! + +THIS IS A REQUIRED MUST-LEARN HOW-TO STEP - DO NOT MOVE ON WITHOUT DOING THIS! This is a key skill for monitoring your OpenAPS setup to "check" or "monitor" or "watch" the logs. It's easy: + +(For rigs updated to master after 2/7/17 ([here is how to update](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/update-your-rig.html)), you can simply type the letter "l" (aka the single letter `l`), or use the full tail command below to see the logs). `tail -F /var/log/openaps/pump-loop.log` + +Type control-C to exit the pump-loop log. + +This will work anytime, anywhere when you log into your rig and is a necessary step for troubleshooting in the future. Do not move forward without having done this step. + +Also, there are several loop logs contained within your OpenAPS setup...not just a pump-loop. For example, there are also logs for the following operations in your rig: + +* Autosens adjustments log: `tail -F /var/log/openaps/autosens-loop.log` + +* Nightscout log: `tail -F /var/log/openaps/ns-loop.log` + +* oref0-online or wifi connection log: `tail -F /var/log/openaps/network.log` + +* Autotune log: `tail -F /var/log/openaps/autotune.log` + +Please see [Phase 1 Papertrail](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-1/papertrail.html) for an easy way to track all your logs in one easy setup. Papertrail will even allow you to remotely track your logs when you are not logged into your rig. Setting up Papertrail and watching your logs will dramatically help you understand your rig and help troubleshoot if you run into problems. + + diff --git a/docs/docs/walkthrough/phase-2/troubleshoot-oref0-setup.md b/docs/docs/walkthrough/phase-2/troubleshoot-oref0-setup.md index 83b455c95..7a4c49217 100644 --- a/docs/docs/walkthrough/phase-2/troubleshoot-oref0-setup.md +++ b/docs/docs/walkthrough/phase-2/troubleshoot-oref0-setup.md @@ -1,5 +1,7 @@ # Troubleshooting oref0-setup script process +Please be patient. It can take 15-20 minutes for your new OpenAPS rig to enact temp basal rates on your insulin pump after powering on for the first time. Your OpenAPS rig can require the same 15-20 minutes if it's been powered off for more than 20 minutes. It often takes less time but don't over-react. Your rig has to establish network connections, pull CGM data, pump history data, and perform complex calculations prior to enacting temp basals. If your insulin pump does not indicate a temp basal after approximately 15-20 minutes, however, you can begin troubleshooting the cause. A simple reboot, instead of a power on, should take much less time. + ## Re-run the script again You won't hurt anything by running the script (step 2) multiple times, as long as you name it something different. If you already have a working loop and are testing the setup scripts, just make sure to comment out in cron the loop you don't want running. @@ -14,38 +16,85 @@ To stop cron'd jobs and enter an openaps command: `killall -g openaps; openaps If you'd like to run multiple commands without having to do `killall -g openaps; ` before each one, you can run `sudo service cron stop` first.
-To start cron: `sudo service cron start` +To start cron: `sudo service cron start` or reboot your rig. To prevent cron running on initial boot, either clear the `crontab -e` file or "comment out" (`#`) each line of the crontab file. If you've cleared the crontab file, but would like to enable cron'd tasks, rerun the initial setup script (step 2) and indicate you'd like to use cron. This will regenerate the configuration. ## How do I know if it is working? +Please be patient. We can not emphasize this enough. + * Check your pump to see if it is setting temp basals. * "Tail" the pump log to see what is is doing: `tail -F /var/log/openaps/pump-loop.log` -* Check Nightscout to see if it is updating with your information +* A very basic test to see if the pump communication works is to issue a `openaps use pump model`. That should return your pump model. If it displays an error or an empty string your rig can't communicate with your pump. +* Check Nightscout to see if it is updating with your information. Note: that if Nightscout is not showing your loop is running, it might be running but unable to communicate with Nightscout. In those cases check the pump-loop.log on your rig. * Run commands manually (check out the [openaps toolkit basics here](http://openaps.readthedocs.io/en/latest/docs/openaps-guide/core/medtronic.html#openaps-use-pump)) ## It's not working yet: +Make sure to check through the following list before asking on Gitter if your setup is not working (yet). Remember if you just ran oref0-setup.sh, wait a good ~20 minutes as mentioned above before seeking help. Time, and the below list of steps, resolves 99% of problems. Also check out [this blog post for tips if asking for help online](https://diyps.org/2017/03/19/tips-for-troubleshooting-diy-diabetes-devices-openaps-or-otherwise/). + * Check to make sure that your pump is in absolute and not % mode for temp basals. * Did you put in the right SN for the pump? Should be numbers only... * Check to make sure your carelink and/or radio stick is plugged in. -* A reboot may be required after running oref0-setup if the Carelink is unable to communicate with the pump (e.g. you see "Attempting to use a port that is not open" errors in pump-loop.log). Additional Carelink troubleshooting steps can be found in [Dealing with the CareLink USB Stick](http://openaps.readthedocs.io/en/latest/docs/Resources/troubleshooting.html#dealing-with-the-carelink-usb-stick). * Check to make sure your receiver is plugged in, if you're plugging a receiver in. -* Don't have data in Nightscout? Make sure there is no trailing slash `/` on the URL that you are entering and that the API secret is correct. -* Check and make sure your receiver is >50% charged (if battery low, it may drain the Pi and prevent it from operating). -* Check and make sure your pump is in range of the radio stick. +* Don't have data in Nightscout? Make sure there is no trailing slash `/` on the URL that you are entering and that the API secret is correct. Check your Nightscout URL, too - it's one of the most common errors to mistype that. (And FWIW, you shouldn't be typing things like that in the first place: that's what copy and paste are for.) +* Check and make sure your receiver is >50% charged (if battery low, it may drain the rig battery and prevent it from operating). +* Check and make sure your pump is near your rig. Closer is better, e.g. check if it works when the pump and rig are at most 20 inches (50 cm) apart. +* Check that your pump battery is not empty. * Check and make sure your pump is not suspended or stuck in rewind or prime screens. If it's a test pump, you don't even have to fill a reservoir, but put your pinky finger or eraser-end of a pencil in for slight pressure when priming so the pump will "sense" it and stop. Make sure to back out of the prime screen. -* 512 users - make sure that you have created your static json files as outlined in https://openaps.readthedocs.io/en/dev/docs/walkthrough/phase-0/hardware/pump.html for raw-pump/settings.json, raw-pump/bg-targets-raw.json, and raw-pump/selected-basal-profile.json. You will also have to remove the calls for them from the your get-settings alias. +* Check to make sure you have a carb ratio set manually in your Medtronic insulin pump, if it is not done, the follwoing display will appear in your pump.log: Could not parse input data: [SyntaxError: /root/myopenaps/monitor/iob.json: Unexpected end of input] +* A reboot may be required after running oref0-setup if the Carelink is unable to communicate with the pump (e.g. you see "Attempting to use a port that is not open" errors in pump-loop.log). Additional Carelink troubleshooting steps can be found in [Dealing with the CareLink USB Stick](http://openaps.readthedocs.io/en/latest/docs/Resources/troubleshooting.html#dealing-with-the-carelink-usb-stick). +* 512 users - make sure that you have created your static json files as outlined [here](https://openaps.readthedocs.io/en/dev/docs/walkthrough/phase-0/hardware/pump.html) for raw-pump/settings.json, raw-pump/bg-targets-raw.json, and raw-pump/selected-basal-profile.json. You will also have to remove the calls for them from the your get-settings alias. To do this: ``` + killall -g openaps + openaps alias remove get-settings + openaps alias add get-settings "report invoke settings/model.json settings/bg_targets.json settings/insulin_sensitivities_raw.json settings/insulin_sensitivities.json settings/carb_ratios.json settings/profile.json" + ``` + The 512 also does not have the ability to report bolusing so the “gather” alias also has to be adjusted. + + ``` + killall -g openaps + openaps alias remove gather + openaps alias add gather '! bash -c "(openaps monitor-pump || openaps monitor-pump) 2>/dev/null >/dev/null && echo refreshed pumphistory || (echo unable to refresh pumphistory; exit 1) 2>/dev/null"' + ``` + +## Running commands manually to see what's not working from an oref0-setup.sh setup process + +You've probably run into an error in your setup where someone has recommended "running commands manually" to drill down on an error. What to do? Some of the following: + + * Start by killing anything that's currently running. ` killall -g openaps` + * Look and see what's running in your cron. `crontab -l` + * If you want to do more than one command of debugging, it's best to disable your cronjobs, use `/etc/init.d/cron stop`. Don't forget to start the cronjobs afterwards or reboot your rig to make sure the cronjobs will be running. + * Run whichever alias is failing to see what commands it is running. I.e. if the pump loop is failing, it's `openaps pump-loop`, which you can run to show what's inside it by `openaps alias show pump-loop`. + * Run each of those commands next individually, and that should give you a better idea of where it's failing or getting stuck. Do this, and share back (if needed) with your troubleshooter about where you think it's getting stuck. If that still doesn't give you or your troubleshooter enough info, keep drilling down further: + * **For example**, if your pump-loop.log always shows `Error, retrying` after `Old pumphistory:`, then you'd want to run `openaps refresh-old-pumphistory` manually to reproduce the problem and see if you can get more error details. + * If necessary, you can drill down further. So in this example, you might want to run `openaps alias show refresh-old-pumphistory` to see what *that* alias does, and then `openaps gather` to drill down further. + * Don't use `2>/dev/null` or `>/dev/null ` parts of commands, because they will hide output of commands + * If a command does not return output, check with `echo $?` if the exit code returns `0`. That means OK (no error). If it returns non-zero (e.g. `1`) then the command failed and you need to drill down further. + * You can keep drilling down until you get through all the aliases to the actual reports, which can be run manually using a command like `openaps report invoke monitor/status.json` to see the raw unfiltered output with full error details. + * Still no luck? Try the [Troubleshooting](http://openaps.readthedocs.io/en/master/docs/Resources/troubleshooting.html) page or ask for help. + +### 512 users / 712 users / x12 users + +If you have one of the x12 model pumps, you need to do the following: +* Add pump settings files manually. Certain commands like Re.ad Settings, BG Targets and certain Read Basal Profile are not available, and requires creating a static json for needed info missing to successfully run the loop. Create raw-pump/settings.json, raw-pump/bg-targets-raw.json, and raw-pump/selected-basal-profile.json See this example: https://gist.github.com/amazaheri/033b85760156054dd858 +* Adapt the aliases as following so it doesn't call for non-existing pump files: + +First, do these: + ``` + killall -g openaps openaps alias remove get-settings openaps alias add get-settings "report invoke settings/model.json settings/bg_targets.json settings/insulin_sensitivities_raw.json settings/insulin_sensitivities.json settings/carb_ratios.json settings/profile.json" ``` The 512 also does not have the ability to report bolusing so the “gather” alias also has to be adjusted. + So also do these: ``` + killall -g openaps openaps alias remove gather - openaps alias add gather '! bash -c "(openaps monitor-pump || openaps monitor-pump) 2>/dev/null >/dev/null && echo refreshed pumphistory || (echo unable to refresh pumphistory; exit 1) 2>/dev/null”' + openaps alias add gather '! bash -c "(openaps monitor-pump || openaps monitor-pump) 2>/dev/null >/dev/null && echo refreshed pumphistory || (echo unable to refresh pumphistory; exit 1) 2>/dev/null"' ``` + There may be at least another step missing. If you figure out a missing step from the above for x12, PLEASE PUT IN A PR AND DOCUMENT WHAT THIS IS! diff --git a/docs/docs/walkthrough/phase-2/update-your-rig.md b/docs/docs/walkthrough/phase-2/update-your-rig.md new file mode 100644 index 000000000..a1a11b442 --- /dev/null +++ b/docs/docs/walkthrough/phase-2/update-your-rig.md @@ -0,0 +1,22 @@ +# How to update your OpenAPS rig in the future + +You've probably heard about all kinds of cool new features that you want to try. If they're part of the master branch already, you just need to go enable them (usually by [re-running the oref0-setup script](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/oref0-setup.html#re-running-the-setup-script)). + +However, if it's a brand-new feature that's being tested or is recently added to master, you'll need to install the new version of `oref0` first. By the way, if you want to check which version of oref0 you are currently running, `npm list -g oref0` and if you want to check which branch `cd ~/src/oref0` and then `git branch`. + +## Step 1: Install the new version + +#### Recommended: To get the new stuff from the newest released master version of oref0 + +1. `cd ~/src/oref0 && git checkout master && git pull && sudo npm install -g oref0` + +#### Optional: To get on "dev" branch to test even more recently added new stuff + +Or, if the feature you want hasn't been released yet, and you want to test the latest untested development version of `oref0`, run: + +1. `cd ~/src/oref0 && git checkout dev && git pull` +2. `npm run global-install` + +## Step 2: Re-run oref0-setup + +Now that you've updated your `oref0` version, you can [re-run the oref0-setup script](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-2/oref0-setup.html#re-running-the-setup-script) to use it. diff --git a/docs/docs/walkthrough/phase-3/Understand-determine-basal.md b/docs/docs/walkthrough/phase-3/Understand-determine-basal.md index 723afc055..b792d714c 100644 --- a/docs/docs/walkthrough/phase-3/Understand-determine-basal.md +++ b/docs/docs/walkthrough/phase-3/Understand-determine-basal.md @@ -1,51 +1,68 @@ -# Understanding the output of oref0-determine-basal +# Understanding the determine-basal logic -The key logic behind any oref0 implementation of OpenAPS lies in the oref0-determine-basal.js code, which is what takes all of the inputs you've collected and makes a temp basal recommendation you can then enact if appropriate. As such, it is important to understand how determine-basal makes its decisions, and how to interpret its output, so you can decide for yourself whether the recommendations it is making are appropriate for your situation, or if further adjustments are required before closing the loop or letting it run unattended. +The core, lowest level logic behind any oref0 implementation of OpenAPS can be found in [`oref0/lib/determine-basal/determine-basal.js`](https://github.com/openaps/oref0/blob/master/lib/determine-basal/determine-basal.js). That code pulls together the required inputs (namely, recent CGM readings; current pump settings,including insulin on board and carbohydrates consumed; and your profile settings) and performs the calculations to make the recommeneded changes in temp basal rates that OpenAPS could/will enact. -The recommendation is to run for several days in "low glucose management" loop mode, watching the output, in order to decide what your "max basal" setting should be. Based on how often you disagreed or counteracted what the loop was recommending, this might influence how you set your max basal. +Short of reading the actual code, one way to start to understand the key `determine-basal` logic is to understand the inputs passed into the script/program and how to interpret the outputs from the script/program. ## Summary of inputs -The determine-basal algorithm requires a number of inputs, which are passed in JSON files such as iob.json, currenttemp.json, glucose.json, profile.json, and optionally meal.json. When running oref0-determine-basal.js with the appropriate inputs, the first thing you'll see is a summary of all the provided inputs, which might look something like this: +The `determine-basal` algorithm requires 4 input files: +* iob.json +* currenttemp.json +* glucose.json +* profile.json + +In addition, the algorithm can accept 2 optional input files: +* meal.json +* autosens.json + +When running `oref0-determine-basal.js`, the first thing you'll see is a summary of all the inputs, which might look something like this: ``` {"carbs":0,"boluses":0} -{"delta":-2,"glucose":110,"avgdelta":-2.5} +{"delta":5,"glucose":161,"short_avgdelta":4.5,"long_avgdelta":3.92} {"duration":0,"rate":0,"temp":"absolute"} -{"iob":0,"activity":0,"bolussnooze":0,"basaliob":0} +{"iob":0,"activity":0,"bolussnooze":0,"basaliob":0,"netbasalinsulin":0,"hightempinsulin":0,"time":"2017-03-17T00:34:51.000Z"} {"carbs_hr":28,"max_iob":1,"dia":3,"type":"current","current_basal":1.1,"max_daily_basal":1.3,"max_basal":3,"max_bg":120,"min_bg":115,"carbratio":10,"sens":40} ``` * meal.json = `{"carbs":0,"boluses":0}` - * If provided, allows determine-basal to decide when it is appropriate to enable Meal Assist. - * carbs = # of carbs consumed - * boluses = amount of insulin delivered - * This data comes from what is entered by user into pump/nightscout -* glucose.json = `{"delta":-2,"glucose":110,"avgdelta":-2.5}` - * delta = change from the previous BG (usually 5 minutes earlier) - * glucose = most recent BG - * avgdelta = average change since 3 data points earlier (usually 15 minutes earlier) - * This data comes from your connected cgm or from nightscout + * `carbs` = # of carbs consumed + * `boluses` = amount of bolus insulin delivered + + Those data come from what you entered into your pump or Nightscout web app. If provided, allows determine-basal to decide when it is appropriate to enable Meal Assist. +* glucose.json = `{"delta":5,"glucose":161,"short_avgdelta":4.5,"long_avgdelta":3.92}` + * `delta` = change in BG between `glucose` (most recent BG) and an average of BG value from between 2.5 and 7.5 minutes ago (usually just a single BG value from 5 minutes ago) + * `glucose` = most recent BG + * `short_avgdelta` = change in BG between `glucose` (most recent BG) and an average of BG values from between 2.5 and 17.5 minutes ago (that average represents what BG levels were approximately 10 minutes ago) + * `long_avgdelta` = change in BG between `glucose` (most recent BG) and an average of BG values from between 17.5 and 42.5 minutes ago (that average represents what BG levels were approximately 30 minutes ago) + + Those data come from your connected CGM or from your Nightscout web app. * temp_basal.json = `{"duration":0,"rate":0,"temp":"absolute"}` - * duration = length of time temp basal will run. A duration of 0 indicates none is running - * rate = Units/hr basal rate is set to - * temp = type of temporary basal rate in use. OpenAPS uses absolute basal rates only - * This data comes from the pump -* iob.json = `{"iob":0,"activity":0,"bolussnooze":0,"basaliob":0,"netbasalinsulin":0,"hightempinsulin":0,"time":"2016-10-26T20:07:37.000Z"}` - * iob = net insulin on board compared to preprogrammed pump basal rates. This takes all basal, temp basal, and bolus information into account - * activity = the amount that BG "should" be rising or falling based on iob. - Insulin activity is used (by multiplying activity * ISF) to determine BGI (blood glucose impact), the amount that BG "should" be rising or falling based on insulin activity alone. - * bolussnooze = used to determine how long to avoid low-temping after a bolus while waiting for carbs to kick in - * basaliob = insulin on board attributed to basal rate, excluding the IOB effect of boluses - * netbasalinsulin = net of basal insulin compared to preprogrammed pump basal rate - * time = current time - * This data calculated based on information received from your pump + + * `duration` = Length of time temp basal will run. A duration of 0 indicates none is running. + * `rate` = Units/hr basal rate is set to + * `temp` = Type of temporary basal rate in use. OpenAPS uses `absolute` basal rates only. + + Those data come from your pump. +* iob.json = `{"iob":0,"activity":0,"bolussnooze":0,"basaliob":0,"netbasalinsulin":0,"hightempinsulin":0,"time":"2017-03-17T00:34:51.000Z"}` + * `iob` = Units of Insulin on Board (IOB), ***net*** of your pre-programmed basal rates. Net IOB takes all pre-programmed basal, OpenAPS temp basal, and bolus insulin into account. Note: `iob` can be negative when OpenAPS temp basal rate is below your pre-programmed basal rate (referred to as "low-temping"). + * `activity` = Units of insulin active in the previous minute. Approximately equal to (net IOB, 1 minute ago) - (net IOB, now). + * `bolussnooze` = Units of bolus IOB, if duration of insulin activity (dia) was half what you specified in your pump settings. (`dia_bolussnooze_divisor` in profile.json is set by default to equal 2, but you may adjust this if you'd like OpenAPS to activate a low-temp sooner or later after bolusing.) `bolussnooze` is used in *oref0-determine-basal.js* to determine how long to avoid low-temping after a bolus while waiting for carbs to kick in. + * `basaliob` = Units of ***net*** basal Insulin on Board (iob). This value does not include the IOB effects of boluses; just the difference between OpenAPS temp basal rates and your pre-programmed basal rates. As such, this value can be negative when OpenAPS has set a low-temp basal rate. Note: `max_iob` (described below) provides a constraint on how high this value can be. The `determine-basal` logic will not recommend a temp basal rate that will result in `basaliob` being greater than `max_iob`. + * `netbasalinsulin` = this variable isn't used in OpenAPS logic anymore, but hasn't been removed from iob.json yet. + * `hightempinsulin` = this variable isn't used in OpenAPS logic anymore, but hasn't been removed from iob.json yet. + * `time` = current time + + Those data are calculated based on information received from your pump. * preferences.json = `{"carbs_hr":28,"max_iob":1,"dia":3,"type":"current","current_basal":1.1,"max_daily_basal":1.3,"max_basal":3,"max_bg":120,"min_bg":115,"carbratio":10,"sens":40}` * Contains all of the user’s relevant pump settings - * max_iob = maximum allowed insulin on board. This is an important safety measure and integral part of the OpenAPS design. - * This data is set during the openAPS setup script (or modified by you directly) and based on information received from your pump -## Output + * max_iob = maximum amount of net IOB that OpenAPS will ever allow when setting a high-temp basal rate. **This is an important safety measure and integral part of the OpenAPS design.** You should set this value based on your current basal rates and insulin sensitivy factor (ISF, or `sens` in the OpenAPS code) and after studying how the OpenAPS algorithm performs in low-glucose suspend mode for (at least) several days. + + Those data are set during the openAPS setup script (or modified by you directly) and based on information received from your pump. + +## Summary of outputs After displaying the summary of all input data, oref0-determine-basal outputs a recommended temp basal JSON (stored in suggested.json), which includes an explanation of why it's recommending that. It might look something like this: @@ -78,8 +95,10 @@ For each different situation, the determine-basal output will be slightly differ If after reading through the code you are still unclear as to why determine-basal made a given decision (or think it may be the wrong decision for the situation), please join the #intend-to-bolus channel on Gitter, paste your output and any other context, and we'll be happy to discuss with you what it was doing and why, and whether that's the best thing to do in that and similar situations. -## Note about Square Boluses and Dual Wave Boluses +## Note about Square Boluses, Dual Wave Boluses, and Basal Pump Settings of Zero Due to the way the Medtronic Pumps operate, it should be known that temp basals can only be set when there is no bolus running, including extended (square) / dual wave boluses. Thus it should be noted that if you use an extended bolus for carb heavy meals (e.g. Pizza), which may still be the optimal approach for you, OpenAPS will not be able to provide temp basals during the extended bolus. + +If you have periods in the day where your pump normally has basal settings of zero - your loop will not work! You can resolve this by setting the lowest possible basal setting your pump will permit. OpenAPS will then issue temp basals of zero, as needed. diff --git a/docs/docs/walkthrough/phase-3/beyond-low-glucose-suspend.md b/docs/docs/walkthrough/phase-3/beyond-low-glucose-suspend.md index 8efdf8067..e91445c89 100644 --- a/docs/docs/walkthrough/phase-3/beyond-low-glucose-suspend.md +++ b/docs/docs/walkthrough/phase-3/beyond-low-glucose-suspend.md @@ -4,11 +4,11 @@ You may have noticed that in the previous phase, in observing low glucose suspen Once you have spent several days observing the loop in the previous mode and made sure your basals and bolus strategies are in good shape, you may consider moving to the next step. -This means adjusting your max iob amount in your preferences.json file. +This means adjusting your max_iob amount in your preferences.json file. Keep in mind this is one of the key safety features of OpenAPS. You do NOT want this to be a super large amount. The point of this setting is to ensure that the loop can not excessively high temp you; if you need high temps consistently to get you to this amount, your baseline basals are off OR you missed a meal bolus OR you are sick OR there is some other extenuating circumstance; but in all of these cases, they should require manual intervention and you should not expect the loop to solve for this. -A good rule of thumb is for max iob to be no more than 3 times your highest basal rate. Keep in mind you can start conservatively and change this number over time as you evaluate further how the system works for you. +A good rule of thumb is for max_iob to be no more than 3 times your highest basal rate. Keep in mind you can start conservatively and change this number over time as you evaluate further how the system works for you. (This means it should be approximate to your other settings; not an absolute amount that you set without thinking about it.) @@ -18,22 +18,33 @@ All of the settings specific to OpenAPS (that can't be read from the pump) are i Note: the “max basal” rate is the one safety setting that you set in your pump. It should not be confused with “max daily” or “max current” as described below. The system will use whichever of these three values is the lowest as the ceiling for the temps it will set. So, if your pump’s max basal is 1.0u, but your 3x and 4x multipliers would be higher, the system will not set any temps higher than 1.0u, even if it thinks you need more insulin. On the flip side, if your 4x current multiplier says you can have max 1.6u/hr and your max basal is 2u/hr; the maximum set temp at that time will be 1.6u/hr. +``` { "max_iob": 0, - "type": "current", "max_daily_safety_multiplier": 3, "current_basal_safety_multiplier": 4, "autosens_max": 1.2, "autosens_min": 0.7, "autosens_adjust_targets": true, + "maxCOB": 120 "override_high_target_with_low": false, "skip_neutral_temps": false, "bolussnooze_dia_divisor": 2, "min_5m_carbimpact": 3, "carbratio_adjustmentratio": 1 + "autotune_isf_adjustmentFraction": 0.5, + // WARNING: the following are advanced oref1 features; do not enable until you've run oref0 (basic setup) for a while + // also, do not blindly turn all of these on; only enable specifics if you know what each one does + "remainingCarbsCap": 0, + "remainingCarbsFraction": 0.7 + "enableUAM": false, + "enableSMB_with_bolus": false, + "enableSMB_with_COB": false, + "enableSMB_with_temptarget": false } +``` -#### Max IOB: +#### max_iob: This will default to zero. After several days or weeks, depending on your comfort level, you may choose to adjust this number. (Remember in the future if you re-run the setup scripts, it will default back to zero so you will come in here to adjust the max iob, as it is an OpenAPS-specific setting). @@ -57,6 +68,10 @@ The other side of the autosens safety limits, putting a cap on how low autosens This is used to allow autosens to adjust BG targets, in addition to ISF and basals. +#### maxCOB: + +This defaults maxCOB to 120 because that's the most a typical body can absorb over 4 hours. (If someone enters more carbs or stacks more; OpenAPS will just truncate dosing based on 120. Essentially, this just limits AMA as a safety cap against weird COB calculations due to fluky data.) + #### override_high_target_with_low: Defaults to false, but can be turned on if you have a situation where you want someone (a school caregiver, for example) to use the bolus wizard for meal boluses. If set to “True”, then the bolus wizard will calculate boluses with the high end of the BG target, but OpenAPS will target the low end of that range. So if you have a target range of 100-120; and set this to true; bolus wizard will adjust to 120 and the loop will target 100. If you have this on, you probably also want a wide range target, rather than a narrow (i.e. 100-100) target. @@ -77,6 +92,33 @@ This is a setting for default carb absorption impact per 5 minutes. The default This is another safety setting that may be useful for those with secondary caregivers who aren’t dedicated to looking up net IOB and being aware of the status of the closed loop system. The default is 1 (i.e. do not adjust the carb ratio; off). However, in the secondary caregiver situation you may want to set a higher carb ratio to reduce the size of a manual bolus given at any time. With this ratio set to 1.1, for example, the loop would multiple the carb inputs by 10%, and use that number to calculate additional insulin. This can also be used by OpenAPS users who rely on the bolus wizard to calculate their meal bolus, but who want to only bolus for a fraction of the meal, and allow advanced meal assist to high-temp for the rest. +#### autotune_isf_adjustmentFraction + +This keeps autotune ISF closer to pump ISF via a weighted average of fullNewISF and pumpISF. 1.0 allows full adjustment (the previous default), 0 is no adjustment from pump ISF. + +#### remainingCarbsCap + +This is the amount of the maximum number of carbs we'll assume will absorb over 4h if we don't yet see carb absorption. + +#### remainingCarbsFraction + +This is the fraction of carbs we'll assume will absorb over 4h if we don't yet see carb absorption. Most people won't need to change this - leave at the default (0.7). + +#### enableUAM + +This enables detection of unannounced meal (UAM) carb absorption. + +#### enableSMB_with_bolus + +This enables supermicrobolus for DIA hours after a manual bolus. + +#### enableSMB_with_COB + +This enables supermicrobolus (SMB) while carbs on board (COB) is positive. + +#### enableSMB_with_temptarget + +This enables supermicrobolus (SMB) with eating soon or lower temp targets. For example, if your target is usually 100mg/dL, a temp target of 99 (or 80, the typical eating soon target) will enable SMB. ## Editing your preferences.json diff --git a/docs/docs/walkthrough/phase-3/troubleshooting-loop.md b/docs/docs/walkthrough/phase-3/troubleshooting-loop.md index c82d0ccf8..4fc19f036 100644 --- a/docs/docs/walkthrough/phase-3/troubleshooting-loop.md +++ b/docs/docs/walkthrough/phase-3/troubleshooting-loop.md @@ -12,6 +12,8 @@ It may be tempting on day one to set your targets to mirror your traditional BG Don't try to do everything the first week: think long term. You should start setting your glucose target range higher and wider, i.e. 130-150 mg/dL (7.2-8.3 mmol/L). However, do not set your range wider than about 20 mg/dL, as this often causes confusions for new loopers. Once you can reproducibly get your sugars in a wider and higher band without going low, you can then *slowly* reduce the target range to your ideal target range. +Target BG target is set on your pump. Navigate to Bolus -> Bolus Wizard Setup -> Edit Settings -> BG Target + Try to remember to set your Nightscout profile to match your pump as you make changes, to also limit confusion. Update target BG, basal rates, ISF and carb ratios to stay the same as on your pump. Data from the pump not Nightscout is used to drive the closed loop; having Nightscout display different targets and incorrect settings may be confusing. ## What should pump settings be? diff --git a/docs/docs/walkthrough/phase-4/Usability-considerations.md b/docs/docs/walkthrough/phase-4/Usability-considerations.md index 7eaef3c54..b4e68aac8 100644 --- a/docs/docs/walkthrough/phase-4/Usability-considerations.md +++ b/docs/docs/walkthrough/phase-4/Usability-considerations.md @@ -5,6 +5,11 @@ Now that you've closed the loop, you probably have a lot of new "first" experien ## **What do you do with the loop in airport security when you travel**
The loop is off the shelf hardware - it's no different than your phone or other small gadgets, so leave it in your carry-on bag when going through security. (Dana note: I have traveled [well](https://twitter.com/danamlewis/status/811682733445496833) over 100 times with my loop, and in some cases with 3-4 Pis and batteries and related accessories, and have never had issues going through security because of my loop.) + +## **What do you do with your loop when you travel across timezones? How do you update devices for a time zone change?** +
You have a couple of options. If you are traveling briefly, or only across a couple of timezones, and would not normally feel the need to adjust the timing of your basals, then you may choose to simply leave your pump, receiver, and Pi/Edison on your home timezone. But, if you would like to adjust to the new timezone (perhaps for a longer trip or a move), you can adjust your rig's timezone using `sudo dpkg-reconfigure tzdata` and then either run `killall -g openaps; oref0-set-device-clocks` to set the devices to match, or just change your pump and receiver time manually. Make sure to test in your new location to make sure everything is working! We also recommend planning to do this when you have some extra time for troubleshooting, in case you have issues. Also, it's worth noting that your body only changes about an hour or so of timezone a day, so even if you go abroad, there's not a rush to change timezones/the time on your devices - you can wait until 2-3 days into your trip to make the swap, at a time when you have some room to update your rigs.
+
After the timezone change OpenAPS sometimes gets confused about the BG and/or pump data being "in the future". The pump and CGM data are not timestamped in UTC, so being unsynchronized with the OpenAPS can cause incorrect behavior. When the BG or pump data is "in the future" the software may stop pulling current information from the pump, and stop functioning (until the current time in the system reaches the time when the monitor data is no longer "in the future"). It often makes sense to remove all files from OpenAPS monitor folder after changing the timezone. However, this is sometimes insufficient, as the devices will still have records that are "in the future" from the perspective of your new timezone. As a result, you should expect Nightscout uploads to fail until the system time catches up to the previous device time, particularly when traveling west.
+ ## **What do you do with the loop when you shower?**
Because the pumps aren't really waterproof, most of us choose to suspend and disconnect our pumps before we shower. You'll do the same thing even after you're looping. One trick, though, is to cancel any running temp basal rate and set a temp basal for 30 minutes with a rate of 0.0, and then suspend the pump. This will help OpenAPS accurately track your netIOB while you are off your pump. When you get out of the shower and are ready to reconnect your pump, do so. Make sure to unsuspend it. You can then either manually cancel the zero temp basal; or let OpenAPS read and decide what temp basal to issue next. @@ -12,11 +17,39 @@ Now that you've closed the loop, you probably have a lot of new "first" experien
This varies from person to person, and depends on the type and length of activity. Here's a few tidbits from [Dana](http://twitter.com/danamlewis) on how she does various activities. (Other loopers, PR into this page with your additional tips and how-to's.)
* **Hiking** - Definitely take the loop with! Think about setting a temporary target (you can enter it in Nightscout if you have connectivity) higher for the duration of the exercise. If you're offline, just change your targets in your pump. The loop will read the adjusted targets and begin looping toward that target. When you're done with the activity, change your targets back. In this scenario, I might change my loop target from 100 (normal day or nighttime) to 130 or 140 as a target. - * **Swimming, Snorkeling, Scuba Diving, etc. (water sports)** - You can't loop while you're in the water, because the pump is not waterproof. (Unless you're sitting in a hot tub and have your pump safely above water, along with your CGM sensor being above water so it can transmit to the receiver, which is also not waterproof.) You can try having your sensor on your arm and keeping it above water so it can read every now and then if the receiver is in range. That being said, again, pump is NOT waterproof so you'll need to apply shower methodology (temp to zero, suspend, take pump off) to best track your netIOB. Some people observe having the CGM, once it gets back into range and reads data after the sensor has been submerged, read falsely high. It's not a big deal for the loop (because it's looking at trends, and doses using temp basals in a conservative way), but you'll likely want to fingerstick and/or wait a while before you'll be really happy with your CGM results again. + * **Swimming, Snorkeling, Scuba Diving, etc. (water sports)** - You can't loop while you're in the water, because the pump is not waterproof. (Unless you're sitting in a hot tub and have your pump safely above water, along with your CGM sensor being above water so it can transmit to the receiver, which is also not waterproof.) You can try having your sensor on your arm and keeping it above water so it can read every now and then if the receiver is in range. That being said, again, pump is NOT waterproof so you'll need to apply shower methodology (temp to zero, suspend, take pump off) to best track your netIOB. Some people observe having the CGM, once it gets back into range and reads data after the sensor has been submerged, read falsely high. It's not a big deal for the loop (because it's looking at trends, and doses using temp basals in a conservative way), but you'll likely want to fingerstick and/or wait a while before you'll be really happy with your CGM results again. See below for another strategy that could work as well if you're much more active than usual. * **Running** - If it is a short run, (<30 minutes), I may not take the loop with me because any adjustments it would make are going to impact me after the run is done. For longer runs, I often now take my small, Edison based rig which can slip into the pocket of my hand-held running drink bottle that holds Gatorade. Before any length run, I try to make sure I don't have much positive netIOB on board (that's the biggest key to success). I also turn on activity mode (essentially a temp target of 120-140 or changing my pump targets to 120-140) an hour or so before a run and during the run; especially if I am carrying the loop during the run. For any exercise or activity or time period, if you do not choose to take your loop (or if you forget it), the loop will pick up again once you get back into range and resume. (This is why it's important to temp then suspend so it can track the amount of insulin you haven't been getting.) + +## **What do you do if you want to be off the pump for long periods during a day when you're really active? Like for the beach or water park or sporting activity or similar?** + +Let's face it. There are some days when you just don't want to be attached to a pump. It's not uncommon for kids at diabetes camp to take a "pump holiday" where they revert to insulin injections in order to be unencumbered by the pump as they run and play and swim. Unfortunately this means a trade off - giving up the safety of closed loop control. Some have employed a strategy to be off the pump while active for extended periods but still have the advantages of closed loop assistance during less active periods of the day and overnight by using a combination of long acting basal injections in conjunction with the closed loop, in a manner similar to the following. Note that this will only work on days that you're really, really active (and as such will have significant reductions in your overall basal requirements). + + * **First -** Look at your pump and determine your 24 hour basal insulin dose. + + * **Second -** Create an alternate basal profile (Profile A or B) on your pump with settings for each time period that are half of your normal settings (we'll call this a "Half Basal" profile). You'll also want to make a "Half Basal" profile in Nightscout with the new settings, and consider establishing target glucose ranges for the entire 24 hour period that are higher than you might normally use (use values similar to what you would use for activity). For children a reasonable choice might be 140-180 but yours may be different. + + * **Third -** On the morning of the active day, record the time and give an injection of long acting basal insulin at HALF THE USUAL DOSE of your usual 24-hour basal requirement (which you determined above). At the same time switch your pump to the "Half Basal" profile you created. You'll get half the usual basal dose from the injection, and half from your pump. You should also change your blood sugar targets on your pump to whatever you decided on when you set up your alternate profile above (don't forget to change them back later). Use the + icon on Nightscout (upper right corner) and choose event Profile Switch to Half Basal (or whatever you called it) in order to assure appropriate visualization of the basal settings via Nightscout when you have connectivity. + + * **Fourth -** During periods when you're going to be very active, disconnect your pump and set an extended temp basal manually of 0.0 (choose a duration of several hours, or as long as you think you might be off the pump), and then suspend. This will allow the APS to track the negative IOB. Obviously since you're going to be off the pump (and if in the water, potentially without the benefit of CGM data as well) you'll want to remember to test more frequently. + + * **Fifth -** Hook back up to the pump for meals to bolus and/or correct for hyperglycemia, and for periods where you'll be less active during the day. Don't forget to reset a temp basal of 0.0 when you suspend again in order to track negative IOB + + * **Sixth -** At the end of the day, hook up to the pump, cancel your temp basal of 0.0 and start looping again. If you've been in the water, recognize it may take some time before your CGM data regains full accuracy, so you may still want to check more frequently. Check and make sure your pump is setting temp targets appropriately and check Nightscout to make sure all is going as you expect. You should still be on the "Half Basal" profile. + + * **Overnight -** The loop will titrate your basal up or down in response to your CGM data. The caveat is, of course, that even if it lowers your temporary basal to 0.0 you will still be subject to the effects of the dose of long acting subcutaneous insulin you took in the morning. This will render the loop somewhat less effective at avoiding hypoglycemic events, and is in part the reason that higher than usual targets for blood glucose would be appropriate. Recognize also that after intense periods of physicial activity it is likely you will be more insulin sensitive, which could exacerbate the potential for hypoglycemia. Better to be safe and run slightly higher than normal. + + * **The Next Morning -** Around 24 hours after the time you took your long acting insulin dose, switch your pump back to the normal profile, and readjust your glucose targets to your normal values on your pump. Use Profile Switch in Nightscout to switch back to your usual profile. Continue to monitor yourself somewhat more frequently until you're sure things are completely back to normal and all of the effects of the long acting insulin bolus from the prior day have resolved. Alternatively, if you're going to have several days of similar activities in a row, you could take another long acting basal dose and go at it again. Use your experience from the prior day to adjust that dose up or down slightly depending on how things went with your first day's glucose readings. + + ## **What if I want to turn off the loop for a while?**
One easy way to "turn off" the loop for a period of time so to use temp targets in your Nightscout website. You can set an wide range from -1000 to 1000 as a temp target for a period of time and it will effectively turn off the loop. What is great about this is that it is easy to do and allows you to schedule the time when you want the loop turned off (going swimming, showering, exercising, etc). You do not have to power down your device or mess with cron commands. You can also choose to leave it at home if you are going out and do not want to be looping during that time. It will start looping again when you get back into range and it can successfully read your pump and CGM data again.
+ + +## **How can you make adjustments to insulin delivery while on the go? - Optimizing with Temporary Targets:** +
The use of Temporary Targets can provide additional fine tuning of insulin control on the go, or remotely for parents monitoring children when they are at school or away from home. As described elsewhere in this documentation, an Eating Soon-type (lower than normal) Temporary Target can be used in advance of a meal or activity. Lower Temporary Targets can also be used to force the OpenAPS system to be somewhat more aggressive in correcting a rising blood sugar. Similarly, a higher temporary target can soften a blood sugar drop and help avoid a low, or help limit stacking of insulin that is likely to peak during activity. Temp targets can be set a number of ways, from using IFTTT so you can set them easily from your watch or phone; or by entering them in Nightscout Care Portal. + +Temporary Targets can be set in advance by setting a future date/time stamp in Nightscout when you set them. For example, a parent may wish to set a week's worth of Eating Soon or Activity Modes in advance of a regular school week. This may be particularly helpful for meals or activity (i.e. gym class) which are regularly scheduled but for which you may have difficulty remembering to trigger the Temporary Target at the right time. Scheduled or remotely activated Temporary Targets can also be very useful in supporting children in optimal management at school or other locations where there may not be an adult who is in a position to set the Temporary Target each time it is needed. It's also helpful even for adult PWDs when traveling; a loved one at home in a different time zone can set temp targets as needed to help direct the rig's activity while the PWD might be asleep or otherwise occupied.
diff --git a/docs/docs/walkthrough/phase-4/advanced-features.md b/docs/docs/walkthrough/phase-4/advanced-features.md index b334f7e73..553456d54 100644 --- a/docs/docs/walkthrough/phase-4/advanced-features.md +++ b/docs/docs/walkthrough/phase-4/advanced-features.md @@ -8,8 +8,7 @@ If you choose to enable the optional advanced meal-assist feature, then after yo Like all features and steps, you'll want to carefully enable, test, and observe the outcomes of this feature. To turn this feature on, run the setup script from phase 2 and choose advanced features. -With AMA, once you enable forecast display in your Nightscout configuration (see the Nightscout documentation for the correct variables to set) you will have 3 purple line predictions in Nightscout. (Unless you have NO carbs onboard, then you will have only one purple line.) - +With AMA, once you enable forecast display in your Nightscout configuration, you will be able to see multiple purple line predictions. To do this, click the three dots next to your timeframe horizon (3HR, 6HR, 12HR, 24HR) and then enable "Show OpenAPS Forecasts". Once enabled, you will have 3 purple line predictions in Nightscout. (Unless you have NO carbs onboard, then you will have only one purple line.) * (Usually) Top line == assumes 10 mg/dL/5m carb (0.6 mmol/L/5m) absorption @@ -20,9 +19,9 @@ With AMA, once you enable forecast display in your Nightscout configuration (see ## Auto-sensitivity mode -Wouldn't it be great if the system knew when you were running sensitive or resistant? That's what we thought, so we created "auto-sensitivity mode". If you explicitly configure this additional feature (again by enabling it through advanced features in setup script), it will allow the system to analyze historical data on the go and make adjustments if it recognizes that you are reacting more sensitively (or conversely, more resistant) to insulin than usual. It will then make micro adjustments to your basals. +Wouldn't it be great if the system knew when you were running sensitive or resistant? That's what we thought, so we created "auto-sensitivity mode". If you explicitly configure this additional feature (again by enabling it through advanced features in setup script), it will allow the system to analyze historical data on the go and make adjustments if it recognizes that you are reacting more sensitively (or conversely, more resistant) to insulin than usual. It will then make temporary adjustments to the basal, ISF, and targets used for calculating temp basals, in order to keep BG closer to your configured target. -When you watch your loop run and Autosens is going to be detected, you might see something like this: +When you watch your loop run in the logs and sensitivity changes is going to be detected, you might see something like this: `-+>>>>>>>>>>>>+++->->+++>++>>+>>>>>>>>++-+>>>>>>>-+++-+--+>>>>>>>>>>>>>>>>>>>>>>>>>++-++++++--++>>>++>>++-++->++-+++++++>+>>>>>>>>>>>>>>>>>++-+-+-+--++-+--+++>>>>>>++---++----+---++-+++++>>>++------>>>++---->>+++++--+++-++++++++--+--+------++++++++++>>>>++--+->>>>>>>>>>++++-+-+---++++ 34% of non-meal deviations negative (target 45%-50%) Excess insulin resistance detected: ISF adjusted from 100 to 73.52941176470588` @@ -37,6 +36,13 @@ Here's what each symbol above means: "=" : BGI is doing what we expect +### Notes about autosensitivity: + +* "Autosens" works by reviewing the last 24 hours of data (so it's a rolling calculation with a moving window of 24 hours) and assessing deviations to determine if you are more sensitive or resistant than expected. If a pattern of such deviations is detected, it will calculate the adjustment that would've been required to bring deviations back to normal. +* Autosens does NOT take into account meal/carb deviations; it only is able to assess the impact of insulin, and thus will adjust ISF, basals, and targets to help compensate for changes in sensitivity. +* Most users will notice the changed ISF numbers in their OpenAPS pill, along with changed targets. Note that a temp target will override the autosens-adjusted target. If you do not want autosens to adjust targets, that can be turned off via a setting in preferences.json +* The reason for autosens automatically adjusting targets is because the other adjustments it makes can't be fully applied without creating a feedback loop, so automatically adjusting the target it thinks it's shooting for lets autosens get BG closer to your actual target most of the time. When autosens needs to adjust basal and ISF, it can very straightforwardly use that for adjusting the temp basal it's about to set, by assuming a higher or low neutral temp basal to start from, and by calculating a bigger or smaller expected impact of current IOB. What it can't do is calculate IOB in a way that reflects the adjusted basals and ISF, because doing so would change the autosens result, which would require recalculating IOB again, which would further change the result, in an unpredictable feedback loop. So instead, we simply acknowledge that the IOB calculation doesn't reflect sensitivity or resistance, and instead adjust the target to compensate. +* Autosens is limited by the safety multipliers in preferences.json. We do not recommend widening these multipliers; but an easy way to turn "off" autosens after you've enabled it is so adjust the safety multipliers to 1. However, note that this will also disable autotune adjustments if you are running autotune. ## Eating Soon and Activity Mode (Temporary Targets) diff --git a/docs/docs/walkthrough/phase-4/autotune-ns.md b/docs/docs/walkthrough/phase-4/autotune-ns.md deleted file mode 100644 index 0de9a519b..000000000 --- a/docs/docs/walkthrough/phase-4/autotune-ns.md +++ /dev/null @@ -1,66 +0,0 @@ -# Using Autotune without OpenAPS - -[Autotune](autotune.md) is a feature created in late December 2016 and is currently in beta (early testing) mode in the oref0 dev branch. You can also see issue [#261](https://github.com/openaps/oref0/issues/261) and [#99](https://github.com/openaps/oref0/issues/99) and pull request [#313](https://github.com/openaps/oref0/pull/313) for background reading. - - -This page is currently a stub, copied from the main [Autotune](autotune.md) page. Please update it with the steps required to spin up a new cloud VM, install oref0 there, create a profile (documented below), and run autotune on retrospective data from NS. - - - -#### Phase A (Current): Running Autotune in “manual” mode on the command line - -Autotune is currently being tested by a few users on the command line. There has been some additional work to make it easier to export to Excel for review. - -How to run it: - -Run `oref0-autotune <--dir=myopenaps_directory> <--ns-host=https://mynightscout.azurewebsites.net> [--start-date=YYYY-MM-DD] [--end-date=YYYY-MM-DD] [--runs=number_of_runs] [--xlsx=autotune.xlsx]` - -If you're running this on a computer that doesn't have a myopenaps_directory, you can point it at a directory with a settings/pumpprofile.json file. An example of a too-sensitive one would be: -``` -{ - "max_iob": 4, - "type": "current", - "max_daily_safety_multiplier": 4, - "current_basal_safety_multiplier": 4, - "autosens_max": 1.2, - "autosens_min": 0.7, - "autosens_adjust_targets": true, - "override_high_target_with_low": false, - "bolussnooze_dia_divisor": 2, - "min_5m_carbimpact": 3, - "carbratio_adjustmentratio": 1, - "dia": 3, - "model": {}, - "current_basal": 1, - "basalprofile": [ - { - "i": 0, - "start": "00:00:00", - "rate": 0.1, - "minutes": 0 - } - ], - "max_daily_basal": 0.1, - "max_basal": 4, - "min_bg": 100, - "max_bg": 100, - "sens": 100, - "isfProfile": { - "units": "mg/dL", - "sensitivities": [ - { - "i": 0, - "start": "00:00:00", - "sensitivity": 100, - "offset": 0, - "x": 0, - "endOffset": 1440 - } - ], - "first": 1 - }, - "carb_ratio": 1000 -} -``` - -If you have issues running it, questions about reviewing the data, or want to provide input for direction of the feature, please comment on [this issue in Github](https://github.com/openaps/oref0/issues/261). diff --git a/docs/docs/walkthrough/phase-4/autotune.md b/docs/docs/walkthrough/phase-4/autotune.md index 1dc9b52b8..8ef25b31f 100644 --- a/docs/docs/walkthrough/phase-4/autotune.md +++ b/docs/docs/walkthrough/phase-4/autotune.md @@ -1,16 +1,16 @@ -# WIP Autotune Feature +# Autotune -Autotune is a feature created in late December 2016 and is currently in beta (early testing) mode in the oref0 dev branch. You can also see issue [#261](https://github.com/openaps/oref0/issues/261) and [#99](https://github.com/openaps/oref0/issues/99) and pull request [#313](https://github.com/openaps/oref0/pull/313) for background reading. +Autotune is a feature/tool created in late December 2016 and is currently being tested within the community. You can also see issue [#261](https://github.com/openaps/oref0/issues/261) and [#99](https://github.com/openaps/oref0/issues/99) and pull request [#313](https://github.com/openaps/oref0/pull/313) for background reading. Want to pay it forward and help improve autotune? You can see [the identified issues that are known to need volunteers to help tackle here](https://github.com/openaps/oref0/projects/1). Those who are not running autotune in a closed-loop setting should use the "Phase C" instructions below. ## The difference between autotune and autosens: -Autosensitivity/resistance mode (aka “autosens”) is an advanced feature you can enable that looks at 24 hours of data and makes adjustments to ISF and targets based on the resulting sensitivity calculations. If you have a dying pump site, or have been sick and are resistant, your ISF is likely to be calculated down by autosens and then used in OpenAPS calculations accordingly. The opposite for being more sensitive is true as well. (Here’s a blog post describing autosensitivity during sick days.) +Autosensitivity/resistance mode (aka “autosens”) is an advanced feature you can enable that looks at 24 hours of data and makes adjustments to ISF and targets based on the resulting sensitivity calculations. If you have a dying pump site, or have been sick and are resistant, your ISF is likely to be calculated down by autosens and then used in OpenAPS calculations accordingly. The opposite for being more sensitive is true as well. [(Here’s a blog post describing autosensitivity during sick days.)](https://diyps.org/2016/12/01/sick-days-with-a-diy-closed-loop-openaps/) -Auto"tune", by contrast, is designed to iteratively adjust basals, ISF, and carb ratio over the course of weeks. Because it makes changes more slowly than autosens, autotune ends up drawing on a larger pool of data, and is therefore able to differentiate whether and how basals and/or ISF need to be adjusted, and also whether carb ratio needs to be changed. Whereas we don’t recommend changing basals or ISF based on the output of autosens (because it’s only looking at 24h of data, and can't tell apart the effects of basals vs. the effect of ISF), autotune is intended to be used to help guide basal, ISF, *and* carb ratio changes because it’s tracking trends over a large period of time. See below for how it can be used as a manual one-off calculation or in a closed loop setting, along with notes about the safety caps designed to go with it. +Autotune, by contrast, is designed to iteratively adjust basals, ISF, and carb ratio over the course of weeks. Because it makes changes more slowly than autosens, autotune ends up drawing on a larger pool of data, and is therefore able to differentiate whether and how basals and/or ISF need to be adjusted, and also whether carb ratio needs to be changed. Whereas we don’t recommend changing basals or ISF based on the output of autosens (because it’s only looking at 24h of data, and can't tell apart the effects of basals vs. the effect of ISF), autotune is intended to be used to help guide basal, ISF, *and* carb ratio changes because it’s tracking trends over a large period of time. See below for how it can be used as a manual one-off calculation or in a closed loop setting, along with notes about the safety caps designed to go with it. ## How Autotune works -There are two key pieces: oref0-autotune-prep and oref0-autotune-core +There are two key pieces: oref0-autotune-prep and oref0-autotune-core. (For more autotune code, you can see [oref0-autotune-(multiple files) listed in oref0/bin here](https://github.com/openaps/oref0/tree/dev/bin) - and there are also some autotune files in [oref0/lib](https://github.com/openaps/oref0/tree/dev/lib). **1. oref0-autotune-prep:** @@ -28,149 +28,167 @@ There are two key pieces: oref0-autotune-prep and oref0-autotune-core * For basals, it divides the day into hour long increments. It calculates the total deviations for that hour increment and calculates what change in basal would be required to adjust those deviations to 0. It then applies 20% of that change needed to the three hours prior (because of insulin impact time). If increasing basal, it increases each of the 3 hour increments by the same amount. If decreasing basal, it does so proportionally, so the biggest basal is reduced the most. * For ISF, it calculates the 50th percentile (median) deviation for the entire day and determines how much ISF would need to change to get that deviation to 0. It applies 10% of that as an adjustment to ISF. * For CSF, it calculates the total deviations over all of the day's mealtimes and compares to the deviations that are expected based on existing CSF and the known amount of carbs entered, and applies 10% of that adjustment to CSF. -* Autotune applies a 20% limit on how much a given basal, or ISF or CSF, can vary from what is in the existing pump profile, so that if it's running as part of your loop, autotune can't get too far off without a chance for a human to review the changes. -* (FUTURE TODO: Instead of 20% hardcoded safety cap, use autosens min and max ratios.) +* Autotune limits how far it can adjust (or recommend adjustment, if running autotune outside oref0 closed loop) basal, or ISF or CSF, from what is in the existing pump profile. Autotune uses the same autosens_max and autosens_min multipliers found in your preferences.json for oref0. So if autotune is running as part of your loop, autotune can't get too far off without a chance for a human to review the changes. ### Different ways to utilize Autotune -#### Phase A (Current): Running Autotune in “manual” mode on the command line +#### Phase A: Running Autotune in “manual” mode on the command line -Autotune is currently being tested by a few users on the command line. There has been some additional work to make it easier to export to Excel for review. +If you have an OpenAPS rig and want to test autoune manually, you can do so manually on the command line. There has been some additional work to make it easier to export to Excel for review. -How to run it: +How to run it as a one-off: +* First, make sure you have the latest version of oref0: `npm list -g oref0 | egrep oref0@0.4.[0-9] || (echo Installing latest oref0 package && sudo npm install -g oref0)` +* Install jq: `sudo apt-get install jq` +* Make two copies of your profile.json, one to be the starting point for autotune, and one to provide the pump baseline for enforcing the min/max limits: `cd ~/myopenaps/settings/ && cp profile.json autotune.json && cp profile.json pumpprofile.json` +* Run `oref0-autotune --dir=~/myopenaps --ns-host=https://mynightscout.azurewebsites.net --start-date=YYYY-MM-DD` (obviously, sub in your NS url and the start date you want to start with. Try 1 day first before moving on to 1 week and 1 month to better troubleshoot). -Run `oref0-autotune <--dir=myopenaps_directory> <--ns-host=https://mynightscout.azurewebsites.net> [--start-date=YYYY-MM-DD] [--end-date=YYYY-MM-DD] [--xlsx=autotune.xlsx]` +If you have issues running it, questions about reviewing the data, or want to provide input for direction of the feature, please comment on [this issue in Github](https://github.com/openaps/oref0/issues/261). -If you're running this on a computer that doesn't have a myopenaps_directory, you can point it at a directory with a settings/pumpprofile.json file. An example of one (note: do NOT use this as-is; put your actual settings in) would be: -#### Example profile.json +#### Phase B: Running Autotune in OpenAPS closed loop system -``` -{ - "max_iob": 4, - "type": "current", - "max_daily_safety_multiplier": 4, - "current_basal_safety_multiplier": 4, - "autosens_max": 1.2, - "autosens_min": 0.7, - "autosens_adjust_targets": true, - "override_high_target_with_low": false, - "bolussnooze_dia_divisor": 2, - "min_5m_carbimpact": 3, - "carbratio_adjustmentratio": 1, - "dia": 3, - "model": {}, - "current_basal": 1, - "basalprofile": [ - { - "i": 0, - "start": "00:00:00", - "rate": 0.1, - "minutes": 0 - } - ], - "max_daily_basal": 0.1, - "max_basal": 4, - "min_bg": 100, - "max_bg": 100, - "isfProfile": { - "units": "mg/dL", - "sensitivities": [ - { - "i": 0, - "start": "00:00:00", - "sensitivity": 100, - "offset": 0, - "x": 0, - "endOffset": 1440 - } - ], - "first": 1 - }, - "carb_ratio": 1000 -} -``` +You can also test running autotune every night as part of a closed loop. This means that autotune would be iteratively running (as described in [#261](https://github.com/openaps/oref0/issues/261)) and making changes to the underlying basals, ISF, and carb ratio being used by the loop. However, there are safety caps (your autosens_max and autosens_min) in place to limit the amount of tuning that can be done at any time compared to the underlying pump profile. The autotune_recommendations will be tracked against the current pump profile, and if over time the tuning constantly is recommending changes beyond the caps, people can use this to inform whether they may want to tune the basals and ratios in those directions. -If you have issues running it, questions about reviewing the data, or want to provide input for direction of the feature, please comment on [this issue in Github](https://github.com/openaps/oref0/issues/261). +You can choose to set up autotune as part of the oref0-setup script, and have it run nightly and adjust a new autotune profile. It is important to realize that when autotune is enabled in your loop to run automatically, changes to your basal profile within the pump during the middle of the day will NOT cause an immediate change to the basal profile the loop is using. The loop will continue to use your autotune-generated profile until a new one is updated just after midnight each night. Each autotune nightly run will pull the current pump profile as its baseline for being able to make adjustments. If you have reason to want a want a mid-day change to your basal program immediately (e.g., steroid medication started), you may have to temporarily suspend autotune to allow loop to use your pump's adjusted basal program. +As with all new and advanced features, this is a friendly reminder that this is DIY, not approved anywhere by anyone, and bears watching to see what it does with your numbers and to decide whether you want to keep running this feature over time, vs. running it as a one-off as needed to check tuning. -#### Phase B: Running Autotune in OpenAPS closed loop system +#### Phase C: Running Autotune more easily as an average user or as a "one-off" -Autotune is in the dev branch of OpenAPS, to test running autotune every night as part of a closed loop. This means that autotune would be iteratively running (as described in 261) and making changes to the underlying basals, ISF, and carb ratio being used by the loop. However, there are safety caps in place to limit the amount of tuning that can be done at any time – by 20%, compared to the underlying pump profile. It will be tracked against the pump profile, and if over time the tuning constantly is recommending 20% (or more) than what’s on the pump, people can use this to inform whether they may want to tune the basals and ratios in those directions. +If you are not running autotune as part of a closed loop, you can still run it as a "one-off". We are actively working to make it easier for people to run autotune as a one-off analysis. Ideally, someone can run this report before their endo appointment and take these numbers in along with their other diabetes data to discuss any needed changes to basal rates, ISF, and potentially carb ratio. With the instructions below, you should be able to run this, even if you do not have a closed loop or regardless of what type of DIY closed loop you have. (OpenAPS/existing oref0 users may want to use the above instructions instead, however, from phase A or phase B on this page.) For more about autotune, you can read [Dana's autotune blog post for some background/additional detail](http://bit.ly/2jKvzQl) and scroll up in the page to see more details about how autotune works. -If you're running dev branch, you can set up autotune as part of the setup scripts, and have it run nightly and adjust a new autotune profile. +**Requirements**: You should have Nightscout BG and treatment data. If you do not regularly enter carbs (meals) into Nightscout (this happens automatically when you use the "Bolus Wizard" on the Medtronic pump and should not be manually added to Nightscout if you use the Bolus Wizard), autotune will try to raise basals at those times of days to compensate. However, you could still look at overnight basal recommendations and probably even ISF recommendations overall, though. [Read this page for more details on what you should/not pay attention to with missing data.](./understanding-autotune.md) -As with all new and advanced features, this is a friendly reminder that this is DIY, not approved anywhere by anyone, and bears watching to see what it does with your numbers and to decide whether you want to keep running this feature over time, vs. running it as a one-off as needed to check tuning. +**Note**: this is currently based on *one* ISF and carb ratio throughout the day at the moment. Here is the [issue](https://github.com/openaps/oref0/issues/326) if you want to keep track of the work to make autotune work with multiple ISF or carb ratios. + +**Feedback**: Please note autotune is brand new, and still a work in progress (WIP). Please provide feedback along the way, or after you run it. You can share your thoughts in [Gitter](https://gitter.im/openaps/autotune), or via this short [Google form](https://goo.gl/forms/Cxbkt9H2z05F93Mg2). -#### Phase C (future/current WIP): Running Autotune more easily as an average user +**Paying it forward**: Want to pay it forward and help improve autotune? You can see [the identified issues that are known to need volunteers to help tackle here](https://github.com/openaps/oref0/projects/1). You can also create a pull request to help edit and improve this documentation. (See a "[my first PR guide](http://openaps.readthedocs.io/en/latest/docs/Resources/my-first-pr.html)" here if you haven't done a pull request before.) -We are actively working to make it easier for people to run autotune as a one-off analysis. Ideally, someone would run this report before their endo appointment and take these numbers in along with their other diabetes data to discuss any needed changes to basal rates, ISF, and potentially carb ratio. With the instructions below, you should be able to run this, even if you do not have a closed loop or regardless of what type of DIY closed loop you have. (OpenAPS/existing oref0 users may want to use the above instructions instead, however, from phase A or phase B on this page.) For more about autotune, you can read [Dana's autotune blog post for some background/additional detail](http://bit.ly/2jKvzQl). +**Step 0: Decide where to run Autotune** +* The easiest way to run autotune from a Windows machine if you are unfamiliar with programming will be to create a Linux VM. If you don't already have access to a physical or virtual machine running Linux, you can either create a Linux VM locally using software like [VirtualBox](https://www.virtualbox.org/wiki/Downloads), or in the cloud with your favorite cloud service. +* Mac users may simply run Autotune locally on their Mac, by skipping down to Step 1b below. -Requirements: You should have Nightscout BG and treatment data. If you do not regularly enter carbs (meals) into Nightscout, autotune will try to raise basals at those times of days to compensate. However, you could still look at overnight bassal recommendations and probably even ISF recommendations overall, though. +**Step 1a: Create a Linux VM** + * To run a Linux VM on a cloud server, free options include [AWS](https://aws.amazon.com/free/) (free for 1 year) and [Google Cloud](https://cloud.google.com/free-trial/) (free trial for a year; about $5/mo after that). If you're willing to pay up front, Digital Ocean is $5/mo and very fast to set up. AWS may take a day to spin up your account, so if you're in a hurry, one of the others might be a better option. + * We recommend some form of Debian distro (Ubuntu is the most common) for consistency with the Raspbian and jubilinux environments we use on the Pi and Edison for OpenAPS + * If you have no experience an easy way to start is the VirtualBox as VM and Ubuntu as Linux OS. Step-by-step setup instructions can be found here: https://www.youtube.com/watch?v=ncA85gRAJxk + * Make sure your VM is using the same timezone as your pump. You can change timezone using `sudo dpkg-reconfigure tzdata` + * If your VM is outside the US, particularly in a country that uses `,` as a decimal separator, make sure your system locale is set to `en_US.utf8` or another locale that uses `.` as the decimal separator. + * If you're interacting with your VM via its graphical interface, make sure you have installed a browser at your VM (i.e. Firefox) then open the currect page from your VM. You may think that copying from your Windows/iOS and pasting in your Linux terminal would work but is not as simple .. and yes, there is lots of copying / pasting! To make copying and pasting simpler, it is often better to `ssh` directly to your VM, rather than using its graphical interface (or the cloud provider's console interface). + * Now do this: `curl -s https://raw.githubusercontent.com/openaps/docs/master/scripts/quick-packages.sh | bash -`. If the install was successful, the last line will say something like: `openaps 0.1.5 (although the version number may have been incremented)`. If you do not see this or see error messages, try running it multiple times. It will not hurt to run this multiple times. -Note: this is currently based on *one* ISF and carb ratio throughout the day at the moment. Here is the [issue](https://github.com/openaps/oref0/issues/326) if you want to keep track of the work to make autotune work with multiple ISF or carb ratios. +**Step 1b: Prep your Mac** +* MAC USERS: Follow these steps instead of 1a above if you want to run autotune on your Mac. (Mac users can instead do the above instructions if they prefer to create a Linux virtual machine to run it on): +* To run AutoTune using a Mac you will use the Terminal application. Open the Terminal application on your Mac (it is located in the Utilities application folder on your Mac). For more information about using Terminal see: http://openaps.readthedocs.io/en/latest/docs/introduction/understand-this-guide.html#before-you-get-started +* After you open a Terminal window, copy and paste the command for each of the Mac install command steps below, and then hit the return key after you paste each command, which will execute it. If you are asked for a password, enter the password for your Mac. +* Tip for New Mac Users: If you typically use a Windows machine and you keep trying to do a control-c (copy) and control-v (paste), remember, on a Mac use command-c (copy) and command-v (paste) instead. +* For example, the first step is to install Homebrew on your Mac. To do this you need to copy and paste the following command from step 1.) of the Mac install commands below and then hit the return key: `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"` -**Step 1: Create VM** -* You'll need a Linux VM for now, until Autotune is updated to [support Mac OS X](https://github.com/openaps/oref0/issues/327) or Windows. You can either create a Linux VM locally using software like [VirtualBox](https://www.virtualbox.org/wiki/Downloads), or in the cloud with your favorite cloud service. -* For cloud servers, free options include [AWS](https://aws.amazon.com/free/) (free for 1 year) and [Google Cloud](https://cloud.google.com/free-trial/) (free trial for a year; about $5/mo after that). If you're willing to pay up front, Digital Ocean is $5/mo and very fast to set up. AWS may take a day to spin up your account, so if you're in a hurry, one of the others might be a better option. -* We recommend some form of Debian distro (Ubuntu is the most common) for consistency with the Raspbian and jubilinux environments we use on the Pi and Edison for OpenAPS +Mac install commands: -**Step 2: Install oref0 on the cloud VM** -* After VM setup, do this: `curl -s https://raw.githubusercontent.com/openaps/docs/master/scripts/quick-packages.sh | bash -`. If the install was successful, the last line will say something like: `openaps 0.1.5 (although the version number may have been incremented)`. If you do not see this or see error messages, try running it multiple times. It will not hurt to run this multiple times. -* Install the jq package: `sudo apt-get install jq` -* Install the latest dev version of oref0 by running: `sudo pip install git+https://github.com/openaps/openaps.git@dev` -* If that works, move on to Step 3. If that doesn't work: - * Pull/clone the latest oref0 dev branch by running: `mkdir -p ~/src; cd ~/src && git clone -bdev git://github.com/openaps/oref0.git || (cd oref0 && git checkout dev && git pull); cd` - * And manually install the oref0 dev branch. at this stage `cd ~/src/oref0` and `git checkout dev` and `sudo npm run global-install` might be the easiest way to do that. (Copy and paste and run those three commands) + * 1.) Install Homebrew: `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"` + * 2.) Install Coreutils: `brew install coreutils` + * 3.) Install Node for (NPM): `brew install node` + * 4.) Install JQ from Homebrew: `brew install jq` + +**Step 2: Install oref0** +* Install the latest version of oref0: `npm list -g oref0 | egrep oref0@0.4.[0-9] || (echo Installing latest oref0 package && sudo npm install -g oref0)` **Step 3: Create a profile.json with your settings** -* A. Create a myopenaps and settings directory. `mkdir -p myopenaps/settings` -* B. Change into that directory: `cd myopenaps/settings`. -* C. Create a profile file by typing `nano profile.json`. Copy and paste the example below, but input your information from your pump. +* A. Create a myopenaps and settings directory. `mkdir -p ~/myopenaps/settings` +* B. Change into that directory: `cd ~/myopenaps/settings`. +* C. Create a profile file by typing `nano profile.json`. Copy and paste the example below, but input your information from your pump. Change the basal profile times to match yours (update the minutes to match your basal start time; the minutes are number of minutes from midnight to the start of basal, e.g., a basal starting at 5:00am will have a minutes entry of 5 x 60 = 300 minutes and a basal starting at 7:30am will have a minutes entry of 7.5 x 60 = 450 minutes), and add more entries if needed. It's very common for first-time users to have problems that result from mistakes introduced into this file. Some common ones to check: + * Be sure that all of the } lines in basalprofile have a comma after them, *except* the last one. + * You need to use a 0 before any entries with a decimal point, such as a basal rate of `0.35`; without the 0 before the decimal point, your autotune will have an error. + * If you don't like editing in the terminal, you can edit the profile files in a text editor. However be aware that TextEdit will replace normal quotes (") with curly quotes (“) if you have "smartquotes" enabled in preferences, and this difference will make autotune fail. You can download BBEdit (https://www.barebones.com/products/bbedit/) if you want a simple text editor that works well. The trial version is sufficient, you won't be using advanced featues. + +Every comma, quote mark, and bracket matter on this file, so please double-check carefully. + +* Make sure to adjust these settings to match yours: + * dia - Duration of Insulin Action (DIA), in hours (e.g., 4.5, or 3). Usually determined by the type of insulin and its effectiveness on you. + * basal profile - you need at least one basal rate in here. You can create multiple of these for all of your basal rates, which will give you an easier visual comparing your current basals to what autotune recommends (see visual example), but at a minimum you just need one here for autotune to run. But we recommend putting all or most of your basals in, in order for autotune to appropriately cap at the safety limits (and compare to 20% above or below your existing basals). If you do not put your full basal profile in, it will not compare to those with the safety cap because it does not know about it. + * "sensitivity" should be your iSF - in mg/dL/U (if using mmol/L/U multiply by 18) + * "carb_ratio" at the end should be your carb ratio + +* Make sure to exit the profile.json when done editing this file - Control-X and hit yes to save. ``` { -"min_5m_carbimpact": 3, -"dia": 4.5, -"basalprofile": [ -{ -"i": 0, -"start": "00:00:00", -"rate": 0.5, -"minutes": 0 -} -], -"isfProfile": { -"sensitivities": [ -{ -"i": 0, -"start": "00:00:00", -"sensitivity": 43, -"offset": 0, -"x": 0, -"endOffset": 1440 + "min_5m_carbimpact": 3, + "dia": your_dia, + "basalprofile": [ + { + "start": "00:00:00", + "minutes": 0, + "rate": your_basal + }, + { + "start": "08:00:00", + "minutes": 480, + "rate": your_basal + }, + { + "start": "13:00:00", + "minutes": 780, + "rate": your_basal + }, + { + "start": "21:00:00", + "minutes": 1260, + "rate": your_basal + } + ], + "isfProfile": { + "sensitivities": [ + { + "i": 0, + "start": "00:00:00", + "sensitivity": your_isf, + "offset": 0, + "x": 0, + "endOffset": 1440 + } + ] + }, + "carb_ratio": your_ic_ratio, + "autosens_max": 1.2, + "autosens_min": 0.7 } -] -}, -"carb_ratio": 14 -} ``` -Make sure to adjust these settings to match yours: - * DIA - * basal profile - you need at least one basal rate in here. You can create multiple of these for all of your basal rates, which will give you an easier visual comparing your current basals to what autotune recommends (see visual example), but at a minimum you just need one here for autotune to run. But we recommend putting all or most of your basals in, in order for autotune to appropriately cap at the safety limits (and compare to 20% above or below your existing basals). If you do not put your full basal profile in, it will not compare to those with the safety cap because it does not know about it. - * "sensitivity" should be your iSF - * "carb_ratio" at the end should be your carb ratio - -* Make sure to exit the profile.json when done editing this file - Control-X and hit yes to save. -* D. Create a pumpprofile.json that is the same as your settings.json. On the command line run: `cp profile.json pumpprofile.json` -* E. Do a third file from the command line: `cp profile.json autotune.json` + +* D. Verify your profile.json is valid json by running `jq . profile.json` - if it prints a colorful version of your profile.json, you're good to proceed. If not, go back and edit your profile.json to fix the error. +* E. Create a pumpprofile.json that is the same as your profile.json. On the command line run: `cp profile.json pumpprofile.json` +* F. Create a third file from the command line by running: `cp profile.json autotune.json` **Step 4: Run autotune on retrospective data from Nightscout** * Run `oref0-autotune --dir=~/myopenaps --ns-host=https://mynightscout.azurewebsites.net --start-date=YYYY-MM-DD` * ^ Sub in your Nightscout URL. * Start with one day to confirm that it works, first. Then run it for one week, and then one month. Compare results and see if the numbers are consistent or changing, and see how that aligns with your gut feeling on whether your basals, ISF, and carb ratio was correct. +* If you want to run dates in the past, add the following: --end-date=YYYY-MM-DD (otherwise, it will just default to ending yesterday). * Remember, this is currently based on *one* ISF and carb ratio throughout the day at the moment. Here is the [issue](https://github.com/openaps/oref0/issues/326) if you want to keep track of the work to make autotune work with multiple ISF or carb ratios. -[Click here to see an example output file from autotune](https://diyps.org/wp-content/uploads/2017/01/OpenAPS-autotune-example-by-@DanaMLewis.png). +#### Why Isn't It Working At All? + +(First - breathe, and have patience! Remember this is a brand new tool that's in EARLY testing phases. Thanks for being an early tester...but don't panic if it doesn't work on your first try.) Here are some things to check: + +* Does your Nightscout have data? It definitely needs BG data, but you may also get odd results if you do not have treatment (carb, bolus) data logged. See [this page](./understanding-autotune.md) with what output you should get and pay attention to depending on data input. +* Did you pull too much data? Start with one day, and make sure it's a day where you had data in Nightscout. Work your way up to 1 week or 1 month of data. If you run into errors on a longer data pull, there may be something funky in Nightscout that's messing up the data format file and you'll want to exclude that date by picking a batch that does not include that particular date. +* Make sure when you sub in your Nightscout URL you do not include a "/" at the end of the URL +* Check your profile.json and make sure it really matches the example - chances are there's a stray character in there. +* Also check your pumpprofile.json and autotune.json - if it worked once or twice but then stopped working, it may have a bad file copy. If needed, follow Steps 3-E and 3-F again to re-copy a good profile.json to pumpprofile.json and autotune.json again. +* If VM is already set up, and you are returning to your VM for another session of autotune, double-check that your VM timezone matches your pump: `sudo dpkg-reconfigure tzdata` +* Invalid calculations may be due to the locale settings of your VM (correct settings are `en_US.utf-8` or another locale that uses `.` as the decimal separator). An easy way to overcome such a problem is to add `env LANG=en_US.UTF-8` in front of your command for running autotune, it should look like this: `env LANG=en_US.UTF-8 oref0-autotune --dir=~/myopenaps --ns-host=https://mynightscout.azurewebsites.net --start-date=YYYY-MM-DD` +* Did you turn on Nightscout authentication with the setting `AUTH_DEFAULT_ROLES`? Currently Autotune will only work with the `readable` setting. See [issue #397](https://github.com/openaps/oref0/issues/397) in Github. +* Still not working? Post a question in [Gitter](https://gitter.im/openaps/autotune). To best help you troubleshoot: Specify if you're on MDI or using a pump. Specify if you're using xDrip as a data source, or if you are otherwise logging data into Nightscout in a way that's not through Care Portal app directly, etc. + +#### What does this output from autotune mean? +Go here to read more about [understanding the output, to see an example visual of what the output might look like, and scenarios when you may want to disregard portions of the output based on the data you provide it](./understanding-autotune.md). + +Remember, autotune is still a work in progress (WIP). Please provide feedback along the way, or after you run it. You can share your thoughts in [Gitter](https://gitter.im/openaps/autotune), or via this short [Google form](https://goo.gl/forms/Cxbkt9H2z05F93Mg2). (If you have issues running it, questions about reviewing the data, or want to provide input for direction of the feature, please comment on [this issue in Github](https://github.com/openaps/oref0/issues/261).) + +#### Yay, It Worked! This is Cool! + +Great! We'd love to hear if it worked well, plus any additional feedback - please also provide input via this short [Google form](https://goo.gl/forms/Cxbkt9H2z05F93Mg2) and/or comment on [this issue in Github](https://github.com/openaps/oref0/issues/261) for more detailed feedback about the tool. You can also help us tackle some of the known issues and feature requests listed [here](./understanding-autotune.md). diff --git a/docs/docs/walkthrough/phase-4/bluetooth-tethering-edison.md b/docs/docs/walkthrough/phase-4/bluetooth-tethering-edison.md new file mode 100644 index 000000000..45824f454 --- /dev/null +++ b/docs/docs/walkthrough/phase-4/bluetooth-tethering-edison.md @@ -0,0 +1,199 @@ +# Bluetooth tethering on Edison (optional) + +Your cell phone can act as a mobile "hotspot" to allow your rig to access the internet. This is an important part of keeping your rig looping, if you don't have offline BG data setup, as you move around areas without known wifi networks. + +A few things to know about using your phone's hotspot feature: + +1. Hotspot is a feature of your phone AND cell phone provider. Please check with your cell phone provider and your service contract to confirm that hotspot feature is enabled and BT tethering is enabled. +2. Hotspot, when activated, uses your cell phone's data. Know what your cell phone plan data limits are and consider if you want to change/update based on your frequency of hotspot use. You can get an estimate of cell data use by resetting your cell data use, at the beginning of the day, within your phone. +3. A device (like your rig) can be connected to your phone's hotspot in one of three ways; wifi connection, BT tether, or USB plug: + + * **wifi connection**: You need to set up your wpa_supplicant list to include your hotspot information; network name and password. The wifi signal for the hotspot is not constantly broadcast by your phone, however. So when you want to use the wifi connection to your hotspot (for example, you are leaving your home wifi network and traveling), you will need to manually toggle your hotspot on so that the phone will broadcast a wifi signal for the rig to connect to. The other consideration is that since this is a wifi connection, the rig will not automatically disconnect when you come into one of your other known wifi networks. You will have to remember to manually disconnect (toggle hotspot off), if you do not wish to continue using cell data when you are home. Hotspot done by wifi connections also use more phone battery than a BT tether connection. + + * **BT tether**: BT tethering (also known as BT PAN *Personal Area Network*) requires your phone and rig to be BT-paired before they can connect (that's what this section of the docs is specifically about). The advantage of connecting to your hotspot via BT tether is that it will happen automatically. You do not have to remember to toggle hotspot. Simply leave your hotspot toggled on as usual, leave the house, and within a few minutes (or sooner) your rig will BT tether to the hotspot. (Screenshot below shows what you'll see in your network logs as you move from known wifi network to BT tether. Oref0-online will automatically find BT tether and connect.) Your rig will then use your cell phone as its internet connection. When your rig comes back into a known wifi network, it will automatically drop the BT tether and connect with the wifi network. + + * **USB plug**: You can plug devices into your cell phone to use hotspot. However, the phone would pull battery power from your rig and would drain your battery fairly quickly. This is not a recommended connection method for openaps use. + +### Pros and Cons (and usability) of Wifi Hotspot vs. BT Tethering Hotspot + +* If you choose **wifi hotspot**, you must manually turn it on; wait for the rig to connect; and when you get home, you must manually turn it off or your rig might not switch to your home wifi (depending on your settings in wpa_supplicant.conf). This option also consumes more battery on the phone. +* If you choose to enable **BT tethering**, it takes more work to set it up, but it will automatically pick up when your rig loses wifi (i.e. walking out the door) without you even having to pull your phone out of your pocket; it automatically allows the rig to pick back up on wifi when it finds a known wifi network; and it consumes less battery on the phone compared to your wifi hotspot. + +![Bluetooth papertrail oref0 online switch](../../Images/BT_papertrail.PNG) + +### Phone selection for BT Tethering + +* Certain phones don't work well using bluetooth tethering with OpenAPS. Various users have experimented, and the list below shows those that have been found to work okay, those that don't and those with variable effectiveness. If you have something that is not on the list, please feel free to add it. + + +
CellphoneWorks with Bluetooth Tethering?Issues/Experiences with BTUse with xDrip/xDripAPS and Dexcom G5 +
LG Nexus 5X with Android 7YesSupports tethering to both Wifi and Cellular network. No issues switching.Works well with Dexcom G5 and xDrip. No issues with compatibility. 90%+ capture rate. +
Google Pixel with Android 7YesSupports tethering to both Wifi and Cellular network. No issues switching.Works well with Dexcom G5 and xDrip. No issues with compatibility. 90%+ capture rate. +
Sony Xperia Z5 Compact with Android 7YesWorks with tethering for network access. It regularly disconnects from the rig (which doesn't seem to affect data flow) and roughly every 24-36 hours this results in complete loss of connectivity and requires a full reboot of the rig and the phone. Doesn't work well with phone swapping between Wifi and mobile - causes BT dropouts that require a reboot of the rig.No issues running xDrip/xDripAPS alongside the tethered connection. Achieves 90%+ packet collection from Dexcom G5. +
Xiaomi Redmi 4 with MIUI 8 (Android 6)NoTethering can be set up, but it drops regularly requiring rig reboots. When phone switches between Wifi and cellular signal requires rig to be rebooted.Significant packet drops and data becomes almost unusable. +
Xiaomi Redmi 3 with MIUI 6 (Android 5)YesNo issues seen when tethered to cellular network. Doesn't allow tethering to wifi.Works fine with Dexcom G5 - 90% collection rate. +
Samsung Galaxy S6 (Android 7)YesTethering to rig and cellular works okay. No data on swapping between cellular and wifi connections.Use with Dexcom G5 and rig not effective. Significant packet loss. +
Samsung Galaxy JuniorYesPhone tethering switching between wifi and mobile not elegant and causes some issuesDifficulties found when using xDrip with the OpenAPS tethering. Packet loss occurs. +
iPhoneYesUsers have experienced various levels of success with the iPhone bluetooth tethering and when the rig switches between wifi and BTNot Applicable. Experimental version of Loop to do something similar doesn't yet have feedback. +
Acer PhoneNoMany data drops on the bluetooth connection for rig. Recommended to avoid.xDrip compatibility is poor - numerous drops throughout the day. +
Samsumg Galaxy S7 Edge (G935F) Android 7.0YesExcellent BT tether using apps 'Bt AutoTether' and 'BT Tether'xDrip+ with G5 > 95% capture. +
+ +## Configure Bluetooth tethering on Edison running Jubilinux [optional] + +### Install dependencies + +You will need to get the MAC address from your phone or whatever device you are using. +* On Android, go to Settings/About Phone/ Status; you will find your Bluetooth address looking like AA:BB:CC:DD:EE:FF +* On iPhone, go to Settings/General/About; it will be under Bluetooth and will look like AA:BB:CC:DD:EE:FF + +Now we need to re-run oref0-setup with the Bluetooth option, replacing AA:BB:CC:DD:EE:FF with what you found above. If you have the "To run again with these same options" command-line from the last time you ran oref0-setup, you can simply run that and append `--btmac=AA:BB:CC:DD:EE:FF` to the end. If not, you can run it interactively using: + +`cd && ~/src/oref0/bin/oref0-setup.sh --btmac=AA:BB:CC:DD:EE:FF` + +NOTE: Make sure the MAC address is in ALL CAPS. + +Copy and paste the "To run again with these same options" command into your notes for the next time you need to run oref0-setup. + +The first time running the script will take quite a bit longer as it is installing Bluez on your edison. +The oref0-setup script may fail after installing Bluez. If so, just reboot your edison and run the setup command you copied to your notes. + +You can confirm that Bluez has installed properly by using `bluetoothd --version`. If Bluez installed properly, a version number of `5.37` or greater will be returned. If it did not install properly, you will likely see `5.28`. The procedures below will not work with the outdated version, so make sure you get version `5.37` or greater installed before continuing. + +``` +root@edisonhost:~# bluetoothd --version +5.37 +``` + +### Bluetooth setup + +* Restart the Bluetooth daemon to start up the bluetooth services. (This is normally done automatically by oref0-online once everything is set up, but we want to do things manually this first time): + +`sudo killall bluetoothd` + +* Wait a few seconds, and run it again, until you get `bluetoothd: no process found` returned. Then start it back up again: + +`sudo /usr/local/bin/bluetoothd --experimental &` + +As shown in the "success" section below, you should see a single line returned with a short string of numbers and then be returned to a clean prompt. If you instead see messages about D-bus Setup failed (as shown in the "Failure" part of screenshot), or otherwise see that you don't have a clean prompt returned in order to enter the next command...go back to the `sudo killall bluetoothd` and try again. +![Bluetooth sudo commands](../../Images/BT_sudos.png) +* Wait at least 10 seconds, and then run: +`sudo hciconfig hci0 name $HOSTNAME` + +* If you get a `Can't change local name on hci0: Network is down (100)` error, start over with `sudo killall bluetoothd` and wait longer between steps. + +* Now launch the Bluetooth control program: `bluetoothctl` + +* and type each of the following: + +``` +power off + +power on + +discoverable on + +scan on + +agent on + +default-agent +``` +![Bluetooth pairing](../../Images/BT_pairing.png) + +For Android +******************************** +The adapter is now discoverable for three minutes. Search for bluetooth devices on your phone and initiate pairing. The process varies depending on the phone and the dongle in use. The phone may provide a random PIN and bluetoothctl may ask you to confirm it. Enter 'yes'. Then click 'pair' on the phone. + +Remember you need to enable the sharing of your phones internet connection via Bluetooth go to Settings -> More -->Tethering & portable hotspot -> Bluetooth tethering [enable] + +For iPhone +******************************** +Your iPhone must be on the Settings/Bluetooth screen, and then you use the Edison to initiate pairing: +``` +pair AA:BB:CC:DD:EE:FF +``` +******************************** +If successful, you will see on the Edison: + +`Request confirmation +[agent] Confirm passkey 123456 (yes/no): yes` + +* (WARNING: You must type in **yes** not just **y** to pair) + +* On your phone, tap the pair button that popped up. + +Troubleshooting note: If after the `pair AA:BB:CC:DD:EE:FF` command you get a response of `Failed to pair: org.bluez.Error.AlreadyExists`, that means you likely have already tried to pair previously...but have run into problems getting it to run properly. Double-check that your cell provider allows for personal hotspots and bluetooth tethering. Make sure you have enabled those for your device. If you have confirmed those, you can `remove AA:BB:CC:DD:EE:FF` and start at the sudo commands again to attempt a fresh pairing. + +* Execute the `paired-devices` command to list the paired devices - + +Your paired phone should be listed (in this example, a Samsung Galaxy S7): +``` +paired-devices +Device AA:BB:CC:DD:EE:FF Samsung S7 +``` + +* Now trust the mobile device + + `trust AA:BB:CC:DD:EE:FF` + +* Quit bluetoothctl by typing `quit` and then enter. + + +****************************** + +### Testing to make sure it works after you successfully did the above + +* Before testing your connection, first restart the Bluetooth daemon again: + + `sudo killall bluetoothd` + +* Wait a few seconds, and run it again, until you get `bluetoothd: no process found` returned. Then start it back up again: + + `sudo /usr/local/bin/bluetoothd --experimental &` + +* Wait at least 10 seconds, and then run: `sudo hciconfig hci0 name $HOSTNAME` + +* If you get a `Can't change local name on hci0: Network is down (100)` error, start over with `killall` and wait longer between steps. + +* Make sure your phone's hotspot is enabled (but don't let anything connect via wifi). + +* Now, try to establish a Bluetooth Network connection with your phone: + + `sudo bt-pan client AA:BB:CC:DD:EE:FF` + +* You should see an indicator on your phone (a blue bar on iPhone) that your Bluetooth network connection has established. + +* Next, to test your Internet connectivity, you'll need to get an IP address: + + `sudo dhclient bnep0` + +* If that succeeds, you should be able to run `ifconfig bnep0` and see something like: +``` +bnep0 Link encap:Ethernet HWaddr 98:4f:ee:03:a6:91 + inet addr:172.20.10.4 Bcast:172.20.10.15 Mask:255.255.255.240 +``` +(for iPhone, the inet addr will always start with 172.20.10. - Android will likely be different) + +* To disconnect the connection, you can run: + + `sudo bt-pan client -d AA:BB:CC:DD:EE:FF` + +* Next, to test that Bluetooth starts up automatically, you can shut down your wifi for 2-3 minutes by running: + + `iwconfig wlan0 txpower off; sleep 120; iwconfig wlan0 txpower auto` + +* About 1 min later, your rig should connect to your phone with Bluetooth (blue bar will pop up on the iPhone). If it doesn't, you should be able to wait 3 minutes and your terminal session should automatically reconnect. If that doesn't connect, you'll either need to reboot it or use a serial console connection to your Edison to troubleshoot further. + +* About a minute after wifi comes back on (terminal session restores), your Edison should automatically disconnect the Bluetooth connection. + +Finally, it's time to take a walk. About a minute after walking out of range of your home wifi, you should see that a device is connected to your phone via Bluetooth. Shortly after that you should see things update on Nightscout. About a minute afer you come home, it should reconnect to wifi and automatically disconnect Bluetooth. + +### Additional App requirement on Android to enable automatic BT Tethering reconnects + +On Android, the Bluetooth tether will shutdown if there is no tethering request within 3 minutes. Installing the application "BTAutoTethering" on your phone from the Play store will resolve this issue and allow the rig to switch to your phone when out of wifi range with no manual intervention. + +This app has been used by numerous OpenAPS users, and found to work. It can be found here: https://play.google.com/store/apps/details?id=nu.mine.qos.btautotethering&hl=en Other Auto Tethering apps are available if you prefer something different. + + diff --git a/docs/docs/walkthrough/phase-4/data-commons-data-donation.md b/docs/docs/walkthrough/phase-4/data-commons-data-donation.md new file mode 100644 index 000000000..8c5eb22dc --- /dev/null +++ b/docs/docs/walkthrough/phase-4/data-commons-data-donation.md @@ -0,0 +1,57 @@ +# How to donate your data to research with the OpenAPS Data Commons in OpenHumans + +## About the OpenAPS Data Commons and OpenHumans + +Members of the OpenAPS community have frequently expressed the desire to donate their DIY closed loop data for scientific research; or to perform research themselves. The OpenAPS Data Commons was created to enable a simple way to share data sets from the community, both with traditional researchers who will create traditional research studies, and with groups or individuals from the community who want to review data as part of their own research projects. The OpenAPS Data Commons uses the “[Open Humans](https://www.openhumans.org/about/)” platform to enable people to easily upload and share their data. + +For more background, see [the OpenAPS.org Data Commons page](https://openaps.org/outcomes/data-commons/). + +![screenshot from the OpenAPS Data Commons on Open Humans](../../Images/OpenAPS_Data_Commons.png) + +(Tip: you may want to right click and open any links from this page in new windows.) + +## How to upload your data to the OpenAPS Data Commons + + +* **A**. Create a profile on Open Humans. Keep in mind that your name/username can be public; so you may want to choose a non-name related username. + * Make sure to verify your profile (see Open Humans email confirmation). +* **B**. (Optional, but recommended method for getting your data into OpenHumans). Use the Nightscout Data Transfer app to upload your data into + * **1**. Go to the [Nightscout Data Transfer App webpage](https://www.openhumans.org/activity/nightscout-data-transfer/) + * **2**. Scroll down to the bottom of the page and click "Connect Nightscout Data Transfer". (Log in to your OH account first if you haven't already). + * **3**. It will take you to a page and ask for your Nightscout URL. Note the app DOES NOT store your URL but will just use it to fetch the data from Nightscout. Select the date range you want it to fetch data from. Tip: Start with two days or so of data to test that it works; you can then re-upload with a longer time frame of data. + * Warning: if you want to upload ALL of your data (yay!), then don't put a start date. However, this will take a while, so don't expect it to be done in minutes, but may take upward of half an hour to an hour depending on how much Nightscout data you have - this is normal. + * It will say "queued" on the page. You can refresh, and it should soon say "initiated". It may take several minutes to pull even a few days worth of data, so keep refreshing the page or come back later. Once done, it should show you a list of files that it has pulled, and provide download buttons if you want to download a local copy or open it to check that it correctly pulled data. Your screen should look like this: + + ![example of OpenHumans screen in the Nightscout Data Transfer app](../../Images/Example_screen_from_NightscoutDataTransfer_app_while_data_upload_in_progress.png) + + When completed, after refreshing the status bar should turn green and look something like this: + ![successful data transfer complete from Nightscout to OpenHumans](../../Images/Successful_data_transfer_complete_screen_in_OpenHumans.png) + + * You can always go back to the [Nightscout Data Transfer app](https://www.openhumans.org/activity/nightscout-data-transfer/) and see what data it has uploaded for you. It should look something like this: + +![example of data sources in the Nightscout Data Transfer app](../../Images/How_data_looks_in_NightscoutDataTransferApp_OpenHumans.png) + +* **C**. Now that you have data in Open Humans, next [click here to go directly to the OpenAPS Data Commons project](https://www.openhumans.org/activity/openaps-data-commons/). + * **1**. Scroll down and click "join". Carefully read the terms & consent to make sure you understand how your data is going to be used. You can also read the OpenAPS Data Commons research criteria here to better understand what criteria research projects are held to before they may be granted access to the data commons data. Note: the data will not be publicly available; it will only be shared privately and securely with individuals or research groups that meet this criteria and are vetted by a volunteer group from our community. + * **2**. Agree to share your data with the OpenAPS Data Commons. + * **3**. You will then be redirected to a survey to also provide basic data to be added to the data you uploaded – please also fill out this survey information. (This data will be tied to your OpenHumansdata shared with the Data Commons, which should prevent having to answer the same questions (i.e. how long you have had diabetes) on any future research studies that have questionnaires.) + * **4**. Hooray! You’ve just added data to the OpenAPS Data Commons.Thank you for contributing your data! + * Please note: + * We may contact you in the future (we will not see your email address) to request to upload a new batch of data or fill out a survey for another research study that is accessing the Data Commons data. + * Per the Terms and Conditions, you can *always* choose to delete and remove your data from Open Humans, or pull it from the OpenAPS Data Commons. Some data may have already been shared with individual research studies. However, if you contact dana@openaps.org, we will also do our best to remove it from any active/ongoing research studies. + +## Notes about OpenHumans and other data + +You can also donate your data to places like the Nightscout Data Commons (once it is finished), or any other research project you find interesting on Open Humans. Make sure to read the terms and conditions clearly for each of the research studies you donate your data to, and in particular look for what types of data they may be asking you to share. In addition to Nightscout data, you can upload things like Fitbit or Moves data, etc. to Open Humans. + +## Frequently Asked Questions + +* **I filled out the survey. What next?**
+You're all done! (For now. In the future, studies accessing the OpenAPS Data Commons may choose to send additional surveys to collect things like various QOL metrics, which you can choose to participate in or not.) Thanks for donating your data! + +* **How much data should I donate?**
+You can donate as much as you want, or as little as you want. However, many of the studies are interested in looking at before/after looping - so at a minimum, I'd suggest a month or two before you started looping. If you don't have any reason to limit what you share, I'd suggest sharing all of your Nightscout data to make it the most useful to all potential researchers. (This means don't bother to put a start or end date in the Nightscout Data Transfer tool; just put in your URL and hit upload.) + +* **Who is accessing the data?**
+Any project from OpenHumans accessing the OpenAPS Data Commons should be listed on the page. We'll also keep a list going (probably here, on the [OpenAPS.org Data Commons page](https://openaps.org/outcomes/data-commons/)) to reflect the different studies using the data. + diff --git a/docs/docs/walkthrough/phase-4/ifttt-integration.md b/docs/docs/walkthrough/phase-4/ifttt-integration.md index 391ab8db6..e61e44e74 100644 --- a/docs/docs/walkthrough/phase-4/ifttt-integration.md +++ b/docs/docs/walkthrough/phase-4/ifttt-integration.md @@ -1,36 +1,104 @@ # IFTTT Integration -Want to be able to set or cancel temp targets from your Pebble, Alexa, or anything supports IFTT? You need an IFTTT.com and Maker account. Check it the YouTube Video below to see some sample integrations: +Want to be able to set or cancel temp targets from your phone, Pebble, Alexa, or anything that supports If This, Then That (IFTTT)? Check out the YouTube Video below to see some sample integrations (click on the watchface photo to start video): Pebble and OpenAps -## Prerequisites +## IFTTT Setup for phones -* Get an IFTTT.com account -* Make sure you have a [Maker account](https://ifttt.com/maker) -* Find out what your NS hashed secret key is by running the command to find out: `nightscout hash-api-secret ` -* Or, open a console window in your browser while viewing your Nightscout site, hit refresh, and your hashed secret key will be shown as "apisecrethash: "xxxxxxxxxx..."" -* Get the app ThisButton for your Pebble +* First we need to gather one thing called your "hashed API Secret". This is basically your Nightscout site's API secret, but scrambled into a confusing long string for safety. Find out what your NS hashed secret key is by running the command to find out: `nightscout hash-api-secret ` while logged into your rig +---OR---- +* In your internet browser, open a console window while viewing your Nightscout site. Make sure you have "authenticated" your site by using your API secret in the Nightscout settings area (hint: if you see a little padlock in the upper left corner of the site, you haven't authenticated it). Refresh the site and your hashed secret key will be shown as "apisecrethash: "xxxxxxxxxx..."" For Safari users on Mac, you can open the console window by selecting "Develop" from the Safari top menu, and then "Show Page Source" (if you do not see "Develop" in the top menu, activate it by going to Safari > Preferences... > Advanced, and checking the "Show Develop menu in menu bar" option). If you're having problems seeing the apisecrethash, click the little grey triangle next to the "status isAuthenticated" line and the objects below it will display (see screenshot). Your hashed API secret can be copied and pasted from that line, as shown below. Save that somewhere easy to get to again, because you will be using it later. -## Putting it all together +![IFTTT sign up](../../Images/hashed_API.png) -* Log in to IFTTT.com. -* Select "My Applets" -> "New Applet" -> click the large "+This" -> search for Maker. -* Click "receive a web request" for step 2. -* Trigger aka Event Name: eating_soon (Maker requests must be lowercase and use underscores and not spaces) -* Now select "+That" and search for Maker again. -* Click "Make web request" for step 4. -* Action: https://your_url_hereish.azurewebsites.net/api/v1/treatments.json <- Only change your url, don't modify what comes after it -* Method: Post -* Content Type: application/json -* Body: +* Get an [IFTTT account](https://ifttt.com/join) + +![IFTTT sign up](../../Images/IFTTT_signup.png) + +* Login to your IFTTT.com account and select the "New Applet" button. + +![IFTTT new applet](../../Images/IFTTT_newapplet.png) + +* In the screen that appears, click on the blue "+this" part of the screen + +![IFTTT this](../../Images/IFTTT_this.png) + +* In the next screen, type "button" in the search field and then click on the red box labelled "ButtonWidget" + +![IFTTT button widget](../../Images/IFTTT_button.png) + +* Connect the buttonwidget by clicking on the large red "connect" button + +![IFTTT button connect](../../Images/IFTTT_connect1.png) + +* Click on the large red "button press" box + +![IFTTT button press](../../Images/IFTTT_buttonpress.png) + +* Click on the blue "+that" text + +![IFTTT then](../../Images/IFTTT_that.png) + +* Enter "maker" in the search field and click on the Maker Webhooks app + +![IFTTT maker](../../Images/IFTTT_maker.png) + +* Connect the Maker app + +![IFTTT maker connect](../../Images/IFTTT_connect2.png) + +* Select the green "Make a Web Request" box + +![IFTTT web request](../../Images/IFTTT_webrequest.png) + +* Now you will have a blank web request template to complete. + +![IFTTT action fields](../../Images/IFTTT_actionfields.png) + +The following info should be filled in: + +URL: https://yoursite.herokuapp.com/api/v1/treatments.json (change the "yoursite" part to your NS info) + +Method: POST + +Content Type: application/json + +Body: The content of the body will depend on the action that you would like this particular button press to perform. You can only do ONE of the actions per button. Some sample content: + +### Example IFTTT trigger conent + +Eating soon +``` + {"enteredBy": "IFTTT-button", "eventType": "Temporary Target", "reason": "Eating Soon", "targetTop": 80, "targetBottom": 80, "duration": 60, "secret": "your_hashed_api_goes_here!!!"} +``` +Activity +``` + {"enteredBy": "IFTTT-button", "eventType": "Temporary Target", "reason": "Activity", "targetTop": 140, "targetBottom": 120, "duration": 120, "secret": "your_hashed_api_goes_here!!!"} +``` +Cancel Temp Target +``` +{"enteredBy": "IFTTT-button", "eventType": "Temporary Target", "duration": 0, "secret": "your_hashed_api_goes_here!!!"} +``` +Low Treatment (change carb amount to match your typical low treatment) ``` - {"enteredBy": "ThisButton-Maker", "eventType": "Temporary Target", "reason": "Eating Soon", "targetTop": 80, "targetBottom": 80, "duration": 60, "secret": "a_totally_hashed_password_goes_here!!!"} +{"enteredBy": "IFTTT-button", "reason": "low treatment", "carbs": 10, "secret": "your_hashed_api_goes_here!!!"} +``` +Low Treatment with a 60 min high target to help recovery +``` +{"enteredBy": "IFTTT-button", "eventType": "Temporary Target", "reason": "low treatment", "carbs": 5, "targetTop": 120, "targetBottom": 120, "duration": 60, "secret": "your_hashed_api_goes_here!!!"} +``` +Pump Site Change +``` +{"enteredBy": "IFTTT-button", "eventType": "Site Change", "duration": 0, "secret": "your_hashed_api_goes_here!!!"} +``` +CGM Sensor Start +``` +{"enteredBy": "IFTTT-button", "eventType": "Sensor Start", "duration": 0, "secret": "your_hashed_api_goes_here!!!"} ``` -![Maker Request](../../Images/maker_request.png) -## Understanding the JSON in the Body: +### Understanding the JSON in the Body: * enteredBy: Will show up on the NS website this way - enter what you want * eventType: defines what we are doing - leave as is @@ -39,55 +107,80 @@ Want to be able to set or cancel temp targets from your Pebble, Alexa, or anythi * duration: you can make them as long or as short as you want - enter what you want * secret: your hashed API secret key -## Test your Maker request by going here: +* Click the "Create Action" button on the bottom of the screen when you finish. -* [https://ifttt.com/maker](https://ifttt.com/maker) -* Go to the settings and copy-paste the url into a new window -* Replace the {event} with one of the event like: eating_soon -* Should look like: https://maker.ifttt.com/trigger/eating_soon/with/key/{of_course_this_is_the_actual_maker_key_here_xalsdjflaksjdflakjsdf} -* Select "Test it" - * Mine shows in about 5 seconds - * Some folks have a bug where they need to refresh the browser. Wait at least 30 seconds before trying this, though. -## Create more events / requests! +* Now is your chance to change the title of your Applet now to something meaningful. You can turn on notifications, too, using the slider shown. If you turn on the notifications, you will get an alert on your phone and pebble watch when the button press has been successfully deployed. Finish the IFTTT button by clicking on the Finish button that appears. -* To do a carb entry into NS via this method (such as to inform it that you are correcting for a low with 15 carbs). Create a +15 carb button. The JSON body would be (again the "entered by" and "reason" fields are just for tracking purposes) -``` -{"enteredBy": "IFTTT-15carbs", "reason": "15 carbs", "carbs": 15, "secret": "a_totally_hashed_password_goes_here!!!"} -``` -* activity_mode would be 140 for an hour...or whatever you want - just change the high and low targets and durations from the above example. -* You definitely want to create a cancel_temp_target as well. It would look like this: -``` -{"enteredBy": "Alexa-Maker", "eventType": "Temporary Target", "duration": 0, "secret": "a_totally_hashed_password_goes_here!!!"} -``` +![IFTTT finish](../../Images/IFTTT_finish.png) + +* Repeat the setup for New Applets for as many automated actions as you would like to setup. + +![IFTTT applets](../../Images/IFTTT_applets.png) + +## Enable IFTTT in your Nightscout site + +* Find your Maker Key by going to your IFTTT account, Services and then clicking on Maker, then Maker settings. + +![IFTTT services account](../../Images/IFTTT_services.png) + +![IFTTT services2](../../Images/IFTTT_services2.png) + +* You will see your Maker Key as the last part of the URL; copy and paste that last part (the red underlined part as shown) -## Hook it up with ThisButton for the Pebble Watch - pictured at the very top of this page +![IFTTT markerkey](../../Images/IFTTT_makerkey.png) -* You need to enter / get your Maker API key in the Settings for ThisButton on your phone when you go into the Pebble App - * Your API can be found at the top of your MAKER settings (Note: There is a settings page for IFTTT and for Maker, you must be on the maker page to access Maker settings) - * For some _absurd_ reason, the API is shown in a sans-serif font, so it's best to copy and paste the key into a document and change to a serif font (like Times New Roman) - Otherwise you can't tell the difference between an upper case i and a lower case L. +* Login to your Nightscout site host (azure or heroku) and (1) add your Maker Key to the MAKER_KEY line and (2) add "maker" to your ENABLE line. + +![IFTTT NS marker key](../../Images/IFTTT_NSkey.png) + +![IFTTT NS enable](../../Images/IFTTT_enable.png) + +## Install IFTTT app on your iPhone/Android + +* Download the IFTTT app on your phone and log in. + +* You can add homescreen quick buttons. Click on your IFTTT app and login, click on My Applets in the bottom right corner, and then click on the applet that you'd like to work with. From the the middle of the applet, click on the Widget Settings, and then click on the Add button for the Homescreen Icon. + +![IFTTT homescreen](../../Images/IFTTT_homescreen.png) + +* For iPhone users, if you downswipe from the top of your iPhone screen, you will have the Today view or Notifications showing. They are separate pages; Today view is on the left, Notifications is on the right. You can left/right swipe to go between them. Go into the Today view and scroll to the bottom, click "edit". This should show a list of existing widgets, followed by a list of "more widgets" with green + signs. Click on the IFTTT's green circle and the widget will be moved to the top, active widgets area. You can hold your finger on the three left lines of the IFTTT widget row to drag it to the top of your widget panel, if you prefer to have it as the top-most widget. + +![IFTTT Today View](../../Images/IFTTT_today.png) + +If you end up with more than four IFTTT applets, they will appear in reverse-order of when they were created...which may not be the same as you'd prefer them to appear on your widget bar. If you'd like to reorder them: + + * go into your iPhone's IFTTT app + * click on My Applets + * click on the gear icon in upper left of screen + * click on Widgets + * click on the pencil icon in upper right of screen + * click and hold the three lines that appear on the right side of the widget that you want to move. Drag the widget to the order in the list that you'd like it to appear in your widget quickscreen. + +![IFTTT Today View](../../Images/IFTTT_reorder.png) + +## ThisButton for the Pebble Watch - pictured at the very top of this page + +* Load the ThisButton app from the Pebble Store. +* You need to enter your Maker key in the Settings for ThisButton on your phone when you go into the Pebble App * Under Events, there are two fields * Name: what shows up on your watch * Event: the name of the Maker event to fire. It will have underscores in it like: `eating_soon`. -* Enter all the different events you created here and Submit them. +* Enter all the different events you created here and submit them. * Fire up the ThisButton app on your Pebble and try setting a new temp target. * You can also add the ThisButton app as a short cut on your Pebble. If you don’t have shortcuts already, press and hold either the up, down, or middle button and follow the prompts. If you have both shortcuts programmed and want to change one, go to menu > settings> quick launch and follow prompts. -## Using the DoButton +Note: ThisButton does not work on Pebble Round watches. You can search for IFTTT apps in the pebble store and choose one that is similar, however. The concept of setting up the events is similar. -* You can hook it up and use it with the DoButton app that supports IFTTT calls...it has been tested and works using the information in 1 above. You might need to email yourself the JSON so you can copy and paste it easily. I permanently deleted this email afterwards since it has my secret key in it. +## Alexa integration +* Since you have IFTTT/Maker requests working, you can get it to work with anything that supports IFTTT, including Alexa. You will need to add "alexa" to your ENABLE line in your Nightscout host settings (azure) or config vars (heroku). And then repeat the steps above, but instead of using "ButtonWidget" service we started with earlier (the "+if" part of the setup)...you will use the "AmazonAlexa" service. -* Since you have IFTTT / Maker requests working, you can get it to work with anything that supports IFTTT, including Alexa. ![Maker Request](../../Images/alexa_maker.png) * Alexa requests do not need underscores, FYI. + +## Google Calendar integration -## Add to the "Today" widget on your iPhone - - ![IFTTT Today Widget with #OpenAPS related commands](../../Images/Example_IFTTT_Today_widget_for_OpenAPS_usage.PNG) - - -* Make sure you have the IFTTT app on your phone and that you are logged in. -* Go into the "Today" (downswipe from top of phone) and scroll to the bottom - you should see 1 new widget available; otherwise click "edit". This should show a list of available widgets to add to your screen. Select IFTTT. -* It should pull in any existing applets from your IFTTT account that are set to be run by "DoButton". This means if you only added applets/recipes to work with ThisButton on Pebble, you'll need to set additional recipes up. Do similar to the above steps to add new applets; the only difference is to start with If (DoButton) Then (Maker event), aka select "DoButton" for the first tool integration, rather than Maker in both places. -* All of the same steps apply for the Maker information for the "Then that" part - insert your URL, select POST, Content Type: application/json, etc. You'll probably want to copy and paste from your other applets, but make sure to edit the text to show that these will be entered by "DoButton" rather than "ThisButton_Maker" or similar. -* Once you've saved, these applets should show up in your Today widget for IFTTT! +* Using the Google Calendar Applet with IFTTT is useful to trigger temp targets that may occur on a recurring schedule, although you can also schedule a one-time event in advance as well. If you already have IFTTT/Maker requests working it's easy to add. Follow the directions for Setup for Phones above, but rather than choosing "Button Widget" type "Google Calendar" in the search field and then click on the box labeled "Google Calendar". +* You will need make sure to allow the Google Calendar Applet access to your Google Calendar. When you do this it will ask which calendar you want to connect. You can use your main calendar, or a calendar you've set up especially for IFTTT events. You'll need to do this ahead of time using the administrative functions of Google Calendar. To do this click on the gear icon at the upper right of Google Calendar (google.com/calendar, not the Applet in IFTTT), choose settings, choose the calendar tab (upper left) and then click the button to make a new calendar. Call it whatever you want and set permissions as appropriate. +* Once you've connected the appropriate calendar, continue your setup in IFTTT and choose "Event from search starts". Type a phrase that you'll use on the Google Calendar to denote a temp target (or other event). For example "Eating Soon" or "Activity" and then click the button that says create trigger. Click on the blue "+that" text and continue to follow the directions as above from Setup for Phones above to connect the Maker app and make the appropriate Web request. +* Now on your Google Calendar (make sure you create the event on whichever calendar you've connected to the Google Calendar IFTTT applet) you can create recurring events or one-time events to trigger temp targets. Use the same phrase that you used to create the trigger (Eating Soon, Activity, etc). For example, if you get up every day and eat at the same time during the week, schedule Eating Soon on those days at the appropriate time. If you know you're going to take a day off work or school just remember to delete the event ahead of that date, or change as appropriate. Gym class for a child or sports practice only some days of a month? Sit down and schedule Activity Mode for those dates well in advance so you don't have to remember at the time and they'll trigger automatically. diff --git a/docs/docs/walkthrough/phase-4/index.rst b/docs/docs/walkthrough/phase-4/index.rst index 6f40ac7fc..ae6ddb4f2 100644 --- a/docs/docs/walkthrough/phase-4/index.rst +++ b/docs/docs/walkthrough/phase-4/index.rst @@ -10,10 +10,11 @@ Phase 4: Iterate and Improve the Closed Loop Usability-considerations keeping-up-to-date advanced-features + bluetooth-tethering-edison ifttt-integration ifttt-google-assistant autotune - autotune-ns - - + understanding-autotune + oref1-features + data-commons-data-donation diff --git a/docs/docs/walkthrough/phase-4/oref1-features.md b/docs/docs/walkthrough/phase-4/oref1-features.md new file mode 100644 index 000000000..b8a6b31f1 --- /dev/null +++ b/docs/docs/walkthrough/phase-4/oref1-features.md @@ -0,0 +1,100 @@ +# oref1 (super advanced features) + +NOTE OF CAUTION: +* oref1 is different than oref0, the baseline "traditional" OpenAPS implementation that only uses temporary basal rates. +* As of June 1, oref1-related features are still being tested in the "dev" branch. + +## Only run oref1 with the following caveats in mind: + +* Remember that you are choosing to test a still-in-development future. Do so at your own risk & with due diligence to keep yourself safe. +* You should have run oref0 for more than two weeks, and be very aware of all the types of situations in which your rig might fail +* **We are making a STRONG recommendation that you also have run autotune prior to enabling SMB.** Why? Because if you have wonky ISF settings, for example, you may be more likely to go low or high with SMB. It will help a lot to have run autotune and be aware if the algorithm is recommending changes to ISF, basal, and/or carb ratio. You are not required to run autotune automatically/nightly as part of your loop with SMB; but you should at least run it manually and get an idea for how confident you are in your settings being right or not; and keep that in mind when evaluating SMB outcomes for yourself. +* You should have basals of > 0.5 U/hr. (SMB is *not* advisable for those with very small basals; since .1U is the smallest increment that can be bolused by SMB. We are also adding a basal check to diable SMB when basals are < 0.3 U/hr.) +* Read the following: + * A. The updated reference design ([https://openaps.org/reference-design/](https://openaps.org/reference-design/)) that explains the differences between oref0 and oref1 + * B. The following two posts for background on oref1: + * [https://diyps.org/2017/04/30/introducing-oref1-and-super-microboluses-smb-and-what-it-means-compared-to-oref0-the-original-openaps-algorithm/](https://diyps.org/2017/04/30/introducing-oref1-and-super-microboluses-smb-and-what-it-means-compared-to-oref0-the-original-openaps-algorithm/) + * [https://diyps.org/2017/05/08/choose-one-what-would-you-give-up-if-you-could-with-openaps-maybe-you-can-oref1-includes-unannounced-meals-or-uam/](https://diyps.org/2017/05/08/choose-one-what-would-you-give-up-if-you-could-with-openaps-maybe-you-can-oref1-includes-unannounced-meals-or-uam/) +* Make sure you understand what SMB & UAM stand for (**read the above posts, we know you skipped them**!) +* Plan to have a learning curve. You will interact with oref1 differently when on SMB and UAM than how you were interacting with oref0. In particular: **do not do correction boluses**; use temp targets to give the rig a "nudge". You are very likely to overshoot if you try to do things manually on top of what SMB has already done! +* SMB may not be for everyone. Like everything else, plan to test it, fall back to previous methods of diabetes treatment if needed, and give yourself a time period for deciding whether or not it works well for you. + +## Understanding SMB + +SMB, like all things in OpenAPS, is designed with safety in mind. (Did you skip reading the updated reference design? Go read that first!) SMB is designed to give you reasonably SAFE amounts of bolus needed upfront and use reduced temporary basal rates to safely balance out the peak insulin timing. You are likely to see many long low or zero temps (upwards of 120 minutes long) with SMB turned on, while oref1 is administering SMBs or waiting until it's safe to do so. + +Single SMB amounts are limited by several factors. The largest a single SMB bolus can be is the SMALLEST value of: + +* 30 minutes of the current regular basal rate, or +* 1/3 of the Insulin Required amount, or +* the remaining portion of your maxIOB setting in preferences + +(History of SMB development: https://github.com/openaps/oref0/issues/262) + +## Understanding UAM + +UAM will be triggered if the preference is toggled on and there is carb activity detected based on positive deviations. + +(History of UAM development: https://github.com/openaps/oref0/issues/297) + +## How to turn on SMB/UAM + +1. As of May 16, 2017, SMB/UAM and other oref1 features are in the dev branch of OpenAPS. You should be comfortable updating your rig to the dev branch. + +2. To test SMB, you'll need to run oref0-setup with a "microbolus" enable flag to configure it to use SMB in oref0-pump-loop, and also enable the appropriate enableSMB settings in preferences.json. I would enable them one at a time, in your preferred order, and then closely observe the behavior (via both Nightscout and pump-loop.log) in the enabled situation. In addition to testing it in "normal" situations, pay special attention to how it behaves in more extreme situations, such as with rescue carbs (announced or not), post-meal activity, etc. + +**(If you cannot read the code to figure out how to interpret the first sentence in number 2; you may not be ready for SMB.)** + +There are multiple preference toggles for SMB/UAM. Check out the [preferences page](http://openaps.readthedocs.io/en/latest/docs/walkthrough/phase-3/beyond-low-glucose-suspend.html) for more details on all the settings, but the short version is: + +* enableSMB_with_bolus means SMB will be enabled DIA hours after a manual bolus +* enableSMB_with_COB means SMB will be enabled when you've entered carbs +* enableSMB_with_temptarget means SMB will be enabled with eating soon or lower temp targets. For example, if your target is usually 100mg/dL, a temp target of 99 (or 80, the typical eating soon target) will enable SMB. Conversely, a higher temp target (101 if your target is 100) will disable SMB. + +3. Another optional feature that might help your SMB (or AMA) deal with entered meal carbs is to set an appropriate "remainingCarbsCap". That should be set to no larger than a typical large meal, and no larger than the number of carbs you'd typically be able to absorb over 4 hours. There is a hard-coded maximum of 90 grams, so don't bother setting anything higher than that. If remainingCarbsCap is set to something above zero, then in situations where carbs have been entered but carb absorption has not yet begun, oref1 will assume that 2/3 of those carbs will be absorbed evenly over the next 4 hours. As a result, oref1 can begin SMB'ing (or AMA high-temping) more so than it otherwise would immediately after entering carbs. If carbs are entered early, this can also act more aggressively than "eating soon", based on trusting that you really will eat (most of) the entered carbs at some point before all the insulin kicks in. + +In other words: If it is set to zero, the SMB will be "less aggressive" than if it is set to a non-zero number approximating a large meal. A non-zero number allows the algorithm to deliver insulin earlier even if not seeing a rise in the CGM value. The higher the value the more aggressive it will be. + +4. To test UAM, you'll need to enableUAM in preferences.json. UAM can be enabled without SMB, but it won't be very effective without enableSMB_with_bolus. You'll probably also want to make sure your nightscout is updated to the latest version to make sure that you can take advantage of UAM prediction lines. To test UAM, you'll first want to be familiar with SMB's "normal" behavior, and then test, with a small meal, giving an up-front bolus (of more than 30m worth of basal, so it can be distinguished from an SMB) and not entering carbs. You'll probably also want to do an "eating soon mode" temporary target or bolus beforehand. You can then observe, by watching the NS purple line predictions and the pump-loop.log, whether your OpenAPS rig is SMB'ing appropriately when it starts to see UAM carb impact. + +## Troubleshooting + +1. Make sure you read the above, especially the "only enable oref1 if..." section. SMB will behave differently than oref0 would. Watch carefully, and use your common sense and do what's right for you & your diabetes. +2. Common errors include: +* Not including the enable flag and just changing preferences. You should see "Starting supermicrobolus pump-loop at..." in pump-loop.log if you have successfully enabled everything. +* Pump clock being >1 minute off. This means 60 seconds. Not 61 seconds; 68 seconds; 90 seconds. Needs to be less than 60 seconds apart. `"Checking pump clock: "2017-05-16T15:46:32-04:00" is within 1m of current time: Tue May 16 15:47:40 EDT 2017` is an example of a >60 second gap that needs fixing before it will work properly. We are adding code to automatically attempt to fix this, but until that is merged you'll need to do so manually. + +## Pushover, SMB, and OpenAPS + +_This is for OpenAPS-specific pushovers related to oref1 features about insulin required (insulinReq) and carbs required (carbsReq). Pushover is a way to easily send messages to your phone from another device with simple messages. If you have Pushover set up for Nightscout, you still need to tell your OpenAPS rig your Pushover information to get these rig-driven alerts._ + +If enabled (under advanced features in oref0-setup.sh), and you have oref1 enabled, you can get Pushover alerts in the following situations: + +* When OpenAPS thinks carbs are needed to bring eventual BG up, and a 30m low temp won't be enough to do it + +![Pushover example of carbs needed](../../Images/Pushover_carbs_needed.PNG) + +* When SMB is active and hitting maxBolus. This is intended to alert you when SMB is going "all out", and will tell you the total amount of insulin OpenAPS thinks you require (insulinReq) if current BG trends continue. **DO NOT just blindly bolus for the amount of insulinReq.** You will also see that the pushover alert lists the amount it is attempting to SMB. You should use this notification as a reminder to tell the rig about anything you know it doesn't (like "oh yea, I want to enter my carbs for this meal", or "oh, hold on, I need an activity mode, becuase I'm gonna go for a walk in a few minutes"). You can also decide if a manual meal bolus is appropriate, or if you'd like to manually bolus part of the insulinReq. **If you're just using insulinReq and not doing a normal meal bolus, you should NOT do the full insulinReq as a manual bolus**, as oref1 is already attempting to deliver part of it as a SMB. SMB is designed to administer the insulinReq a little at a time, in order to be able to safely react if the BG rise slows or stops, so in cases where you might otherwise consider a correction bolus, it'll often be best to not do anything at all and let SMB safely handle the increased need for insulin. If you do choose to do a small manual correction bolus for a portion of the insulinReq, be sure to subtract out the SMB oref1 is already delivering, and round down for safety. + +![(Pushover example of insulinReq](../../Images/Pushover_insulinReq_SMB.PNG) + +Cautions: +1. You are likely to cause yourself a low if you manually administer too much insulin. Be very careful about doing manual boluses based on Pushover alerts; see above about not doubling up on a microbolus that's just been delivered. +2. If the rig attempts to deliver a microbolus AND you have the bolus wizard menu open, it may cause the pump to error (and maybe reset). **Recommendation**: If you are getting Pushover alerts and decide to manually bolus in addition to the SMBs, you may want to use the "easy bolus" (up button arrow) method for bolusing, which is less likely to cause the pump to receive this error. When using the easy bolus, you may not be able to deliver the easy bolus if the rig has sent an SMB underneath. In that case, you'll have to hit escape, wait for the SMB to finish delivering, and then perform your manual bolus (adjusting for the insulin just delivered). + +### If you are new to Pushover: + +Pushover is a way to easily send messages to your phone from another device with simple messages. (kind of like getting a text message from your OpenAPS rig), but to use this you must first have Pushover installed on your iPhone or Android (download from your OS's store). + + - Log into https://pushover.net/. From this page you will see your User Key. + - At the bottom of the page you will see "Your Applications (Create an Application/API Token)". You must first create an API Token: + - Click on the link provided. You must supply a Name for your application, such as "OpenAPS", and change the type to _Script_ + - Then Check the box _"By checking this box, you agree that you have read our Terms of Service and our Guide to Being Friendly to our API"_ +- This will give you a pushover token. + +To put these in your setup you must add them to the oref0-setup.sh parameters, either by saying "Yes" to advanced features in the oref0-setup.sh script and entering the info there, or by running the following on the command line from your rig: + +- `cd && ~/src/oref0/bin/oref0-setup.sh --pushover_token=yourpushovertolken --pushover_user=yourpushoverkey` + +(_note you will still need to add the correct nomenclature for oref1 in order to use oref1 and pushover_) + diff --git a/docs/docs/walkthrough/phase-4/understanding-autotune.md b/docs/docs/walkthrough/phase-4/understanding-autotune.md new file mode 100644 index 000000000..b07449390 --- /dev/null +++ b/docs/docs/walkthrough/phase-4/understanding-autotune.md @@ -0,0 +1,40 @@ +# Understanding autotune + +## Safety reminders + +Autotune is a WIP (work in progress) tool. Do not blindly make changes to your pump settings without careful consideration. You may want to print the output of this tool and discuss any particular changes with your care team. Make note that you probably do not want to make long-term changes based on short term (i.e. 24 hour) data. Most people will choose to make long term changes after reviewing carefully autotune output of 3-4 weeks worth of data. + +## Example output from autotune + +![Example output from autotune](https://diyps.org/wp-content/uploads/2017/01/OpenAPS-autotune-example-by-@DanaMLewis.png) + +## What you'll see in autotune inputs and outputs + +* You might wonder what CSF in the autotune results refers to: Carb Sensitivity Factor is the amount your blood sugar will rise for a given quantity of carbs consumed. And initial value for CSF is calculated from your ISF and carb:insulin ratio (CR), i.e., CSF = ISF / CR (e.g., for an ISF of 42mgDL/U and CR of 14g/U, CSF is 3mgDL/g.) Subsequent autotune estimates for CSF are adjusted for the actual observed post-meal BG rise (relative to what would be expected based on insulin activity) compared to the number of carbs eaten. +* You might wonder what min_5m_carbimpact in profile.json refers to: It tells autotune how fast to decay carbs when your BG isn't rising. The default value means to assume 3mg/dL per 5m of carb absorption, even when your BG is falling or rising less than that. +* If you only input one basal rate in the profile.json, it will only show one basal in the left hand column, and tune the day around that basal. You can go back and edit the profile.json (and cp again to make all files the same) with your multiple basal rates if you want to appropriately tune and most easily compare the output suggested against what your existing basal schedule is. + +## If you are DIY closed looping and looking at autotune: + +#### With carbs logged in Nightscout +...you can look at everything that autotune outputs + +#### Without carb information in Nightscout +...you should only look at overnight basals, daytime basals that are not around typical meal times, and (with caution) ISF. Ignore carb ratio. + + +## If you are not DIY closed looping and are looking at autotune: + +#### With all boluses and carb treatments (even rescue, or low carbs) in Nightscout +...you can look at everything that autotune outputs + +#### Without boluses and carb treatments in Nightscout +...don't use autotune until you log this data. + +#### If you don't have Nightscout + +...it's probably easiest to set up [Nightscout](http://nightscout.info) and log some data in order to use autotune. This may change in the future (and let us know if you want to work on ways to bring other data types into autotune). + + + + diff --git a/docs/index.rst b/docs/index.rst index 357c1c7ff..36f0de6cf 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,37 +1,102 @@ Welcome to OpenAPS's documentation! ============================================== -This documentation support a self-driven Do-It-Yourself (DIY) implementation of an artificial pancreas based on the OpenAPS reference design. By proceeding to use these tools or any piece within, you agree to the copyright (see LICENSE.txt for more information; and the full README here: https://github.com/openaps/docs/blob/master/README.md ) and release any contributors from liability, and assume full responsibility for all of your actions and outcomes related to usage of these tools or ideas. +This documentation support a self-driven Do-It-Yourself (DIY) implementation of an artificial pancreas based on the OpenAPS reference design. By proceeding to use these tools or any piece within, you agree to `the copyright `_ for more information; and `the full README here `_ and release any contributors from liability, and assume full responsibility for all of your actions and outcomes related to usage of these tools or ideas. -*A Note on DIY and the "Open" Part of OpenAPS* +.. WARNING:: +Note: *We do not recommend using a PDF version of this guide. The docs are updated continuously, and with a PDF, you will not get the freshest real-time edits. Be aware if you download a PDF that when you have internet connectivity, we recommend instead having the docs pulled up in an Internet browser so you can refresh. This is especially true if you are working on a setup over the course of multiple days.* -This is a set of development tools to support a self-driven DIY implementation. Any person choosing to use these tools is solely responsible for testing and implementing these tools independently or together as a system. - -The DIY part of OpenAPS is important. While formal training or experience as an engineer or a developer is not a prerequisite, a growth mindset is required to learn to work with the "building blocks" that will help you develop your OpenAPS instance. Remember as you consider this project that this is not a "set and forget" system; an OpenAPS implementation requires diligent and consistent testing and monitoring to ensure each piece of the system is monitoring, predicting, and controlling as desired. The performance and quality of your system lies solely with you. - -This community of contributors believes in "paying it forward," and individuals who are implementing these tools are asked to contribute by asking questions, helping improve documentation, and contributing in other ways. +.. note:: + **A Note on DIY and the "Open" Part of OpenAPS** + + This is a set of development tools to support a self-driven DIY implementation. Any person choosing to use these tools is solely responsible for testing and implementing these tools independently or together as a system. + + The DIY part of OpenAPS is important. While formal training or experience as an engineer or a developer is not a prerequisite, a growth mindset is required to learn to work with the "building blocks" that will help you develop your OpenAPS instance. Remember as you consider this project that this is not a "set and forget" system; an OpenAPS implementation requires diligent and consistent testing and monitoring to ensure each piece of the system is monitoring, predicting, and controlling as desired. The performance and quality of your system lies solely with you. + + This community of contributors believes in "paying it forward," and individuals who are implementing these tools are asked to contribute by asking questions, helping improve documentation, and contributing in other ways. Have questions? Hop into `Gitter `_ and ask anytime! +.. toctree:: + :maxdepth: 2 + :glob: + :caption: Before You Begin + # docs/introduction/index + Understanding this guide (read me first!) + docs/introduction/contribute + docs/introduction/communication-support-channels + +.. toctree:: + :maxdepth: 2 + :glob: + :caption: General Setup + + # docs/walkthrough/phase-0/index + docs/walkthrough/phase-0/setup + docs/walkthrough/phase-0/baseline-data + docs/walkthrough/phase-0/hardware/hardware + Compatible Pumps + Compatible CGMs + docs/walkthrough/phase-0/hardware/edison + Understanding the Explorer Board "rig" + docs/walkthrough/phase-0/setup-edison + FOR MAC: Edison/Explorer Board Setup + FOR WINDOWS: Edison/Explorer Board Setup + Make Your First PR + + +.. toctree:: + :maxdepth: 2 + :glob: + :caption: Visualizing & Monitoring + + # docs/walkthrough/phase-1/index + Setting up Nightscout (recommended) + Offline Looping/Monitoring Offline + Papertrail (optional) + Handy shortcuts to add + +.. toctree:: + :maxdepth: 2 + :glob: + :caption: Creating your DIY Closed Loop + + # docs/walkthrough/phase-2/index + --Setup Script-- + Troubleshooting setup script + docs/walkthrough/phase-2/accessing-your-rig + Add other wifi on the go + Update your rig + .. toctree:: - :maxdepth: 3 + :maxdepth: 2 :glob: + :caption: Understanding Your Loop and Tweaking Settings + + # docs/walkthrough/phase-3/index + Understand what your rig is doing & why + Updating preferences & more - docs/introduction/index - docs/walkthrough/index - docs/openaps-guide/index +.. toctree:: + :maxdepth: 2 + :glob: + :caption: Advanced Features + + # docs/walkthrough/phase-4/index + Usability: Tips & Tricks + Tell us you're looping! + Advanced Features (AMA, etc.) + docs/walkthrough/phase-4/bluetooth-tethering-edison + docs/walkthrough/phase-4/ifttt-integration + docs/walkthrough/phase-4/autotune + oref1 + docs/walkthrough/phase-4/data-commons-data-donation +.. toctree:: + :maxdepth: 2 + :glob: + :caption: Resources/Reference + Resources reference/index - - - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/license.txt b/license.txt new file mode 100644 index 000000000..28637adf1 --- /dev/null +++ b/license.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2015-2017 the #OpenAPS community + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/reference-design.md b/reference-design.md index 30b16fa6a..7698ef955 100644 --- a/reference-design.md +++ b/reference-design.md @@ -1,76 +1,84 @@ -(Last updated Oct. 8, 2015) +(Last updated April 29, 2017) -# OpenAPS Reference Design +# Principles of an Open Artificial Pancreas System (OpenAPS) -The Open Artificial Pancreas System (OpenAPS) is a simplified Artificial Pancreas System (APS) designed to automatically adjust an insulin pump’s basal insulin delivery to keep blood glucose (BG) in a safe range overnight and between meals. It does this by communicating with an insulin pump to obtain details of all recent insulin dosing (basal and boluses), by communicating with a Continuous Glucose Monitor (CGM) to obtain current and recent BG estimates, and by issuing commands to the insulin pump to adjust temporary basal rates as needed. - -OpenAPS differs from other APS systems currently in clinical trials in two significant ways. +The Open Source Artificial Pancreas System (OpenAPS) is a safe but powerful, advanced but easily understandable, Artificial Pancreas System (APS) designed to automatically adjust an insulin pump’s insulin delivery to keep blood glucose (BG) in a safe range at all times. It does this by communicating with an insulin pump to obtain details of all recent insulin dosing (basal and boluses), by communicating with a Continuous Glucose Monitor (CGM) to obtain current and recent BG estimates, and by issuing commands to the insulin pump to adjust insulin dosing as needed. +OpenAPS differs from other APS currently in clinical trials in two significant ways. + First, it is designed to use existing approved medical devices, commodity hardware, and open source software. + + Secondly, it is designed primarily for safety, understandability, and interoperability with existing treatment approaches and existing devices. - Secondly, it is designed primarily for safety, simplicity, and interoperability with existing treatment approaches as well as existing devices. +By taking this approach, OpenAPS has been demonstrated to be both safer and more effective than current state-of-the-art standalone insulin pump therapy, and more effective than the insulin-only hybrid closed loop and APS systems that have been in clinical trials for years and are just starting to receive FDA approval and come to market. -By taking this approach, we believe that OpenAPS can be demonstrated to be both safer and more effective than current state-of-the-art standalone insulin pump therapy, and that this can be demonstrated far more easily than for the completely novel therapy approach employed by the full APS systems that have been in clinical trials for years and are still years away from FDA approval. +OpenAPS is designed to work with interoperable insulin pumps and CGMs from any manufacturer. Current implementations use older Medtronic or SOOIL (`DANA*R`, available in Europe) insulin pumps with either Dexcom or Medtronic CGMs. The same design would also work with insulin pumps from any manufacturer who provides a way to issue temporary basal commands to the pump, and with any CGMs whose data can be retrieved in real time. Until and unless companies elect to provide such access, the open source community will continue reverse engineering additional insulin pumps wherever possible to make APS technology as widely available as possible until all individuals living with Type 1 Diabetes have the opportunity to sleep safely every night. -OpenAPS is designed to work with interoperable insulin pumps and CGMs from any manufacturer. Initial prototype implementations use Medtronic insulin pumps with either Dexcom or Medtronic CGMs, but the same design will also work with insulin pumps from any manufacturer who provides a way to issue temporary basal commands to the pump, and with any CGMs whose data can be retrieved in real time. If an OpenAPS reference design and implementation can one day be FDA approved, they will also be made available to any medical device manufacturer who wishes to create their own implementation with their own devices and/or the devices of any of their partners. +## Designing OpenAPS for maximum safety -## Design Constraints for OpenAPS +OpenAPS is designed, first and foremost, for safety. This means that, for every single decision it makes to dose insulin (or refrain from doing so), the OpenAPS dosing algorithm must ensure that the decision it makes is the safest one possible, given the information available at the time. Because OpenAPS is running on external hardware and not as an algorithm built into an insulin pump, the safest way to do so is to set temporary basal rates such that running the temporary basal to completion and then resuming normally scheduled basal will maximize the user’s chance of keeping their blood sugar inside a safe target range, even without any further intervention on the part of OpenAPS or the user (via eating carbohydrates, for example). If new information indicates that finishing the current temporary basal would result in an overcorrection in either direction, OpenAPS will immediately cancel the temporary basal or make other adjustments to insulin dosing as needed. -1. In order to accomplish these goals, the first design constraint of OpenAPS is that OpenAPS cannot issue insulin boluses. This is a key safety feature, because insulin pumps, while they have limits on the maximum size of bolus they will administer, have effectively no limit on how frequently boluses may be administered. (Some pumps implement the maximum bolus size as the maximum amount of insulin that can be bolused over a certain period of time, but as the maximum bolus amount is generally set very high by default, this is insufficient to prevent severe hypoglycemia if the full bolus amount is administered inappropriately.) As a result, any system that is capable of issuing bolus commands would be capable of administering, if it erroneously issued bolus commands repeatedly, a potentially lethal quantity of insulin. To completely avoid this issue, OpenAPS instead relies solely on temporary basal commands. Repeatedly reissuing the same temporary basal command does not change the rate at which the pump infuses insulin; it simply extends the temporary basal rate slightly. In addition, insulin pumps are configured with a maximum allowed temporary basal rate, and will simply ignore any commands that instruct the pump to use a higher rate than allowed. -2. This maximum allowed temporary basal rate is the second design constraint: OpenAPS is designed to be incapable of administering insulin any faster than can be easily counteracted with fast-acting carbohydrates. This means that OpenAPS cannot be used to substitute for mealtime insulin boluses, but more importantly it means that, even if OpenAPS were to malfunction in the worst possible way, the patient can completely prevent any adverse outcome by simply consuming additional carbs as needed, as they already have to do with standard diabetes treatment every day or two for any number of other reasons. -3. The third design constraint is also related to the use of maximum temporary basal rates: because any adjustments to insulin dosing are performed by issuing 30-minute temporary basal rate adjustments, OpenAPS does not place undue, excess reliance on any single glucose measurement. Because new CGM measurements are received every 5 minutes, OpenAPS can continually recalculate the temporary basal rate required to bring BG back to the target range. If the CGM provides erroneous data, such as from a dying sensor or a compression event (where the patient is lying directly on the sensor and restricting blood flow), OpenAPS will respond by initiating a temporary basal rate. If 5, 10, or 15 minutes later the new data from the CGM indicates that the temporary basal rate it set is no longer appropriate, OpenAPS can simply cancel the temporary basal and return to the normally scheduled basal rate, or set a different temporary basal if necessary. -4. The fourth design constraint is that OpenAPS must be completely fault-tolerant. Because of the inherent unreliability of RF communication between the insulin pump, OpenAPS, and the CGM sensor, OpenAPS must assume that at any moment it will lose communication. To deal with this, OpenAPS algorithms are designed to set temporary basal rates such that running the temporary basal to completion and then resuming normally scheduled basal is the safest thing to do given what it knows at the time. If new information indicates that finishing the current temporary basal would result in an overcorrection in either direction, OpenAPS will immediately cancel the temporary basal or replace it with a more appropriate one. -5. OpenAPS is designed to rely, as much as possible, on the same parameters and dosing algorithms used by the patient (at the instruction of their diabetes care team) in deciding the appropriate rate of insulin in any situation. This means using the basal rates, insulin sensitivity factor (ISF, also known as correction factor), duration of insulin action (DIA, also known as insulin lifetime), and optionally the insulin to carb (IC) ratio the patient is already using to drive their existing pump therapy. It also means using the exact same simple calculations the pump’s bolus calculator (or the patient) already use in calculating correction boluses. OpenAPS does not have any complicated machine learning algorithms, 17-parameter insulin response models, or differential equations. As such, OpenAPS system is open and transparent in how it works, and understandable not just by experts, but also by clinicians and end users (patients). -6. OpenAPS is designed to simply and safely fall back to the patient’s pre-programmed basal therapy whenever it receives conflicting information about what the appropriate course of action is (or when required information is missing). For example, if BG is predicted to eventually go low but is actually rising at the moment, OpenAPS will cancel any temporary basals and wait to see whether BG continues rising or begins to fall, and only then begin issuing the appropriate temporary basal commands. Additionally, OpenAPS further ensures safety by falling back to “low glucose suspend” behavior when current BG is below a configured threshold and not currently rising. This ensures that insulin infusion is completely suspended while BG remains low for any reason, until it starts to recover, which maximizes the patient’s ability to recover from hypoglycemia. -7. OpenAPS generally defers to the patient when they choose to issue their own boluses, either for corrections or for meals. In such a situation, OpenAPS makes an estimate of how long the (bolus-wizard inputted or assumed) meal is expected to take to digest (or how long the BG excursion is expected to continue, if it’s something other than a meal). It then continues to monitor BG, but avoids issuing any temporary basal rates until that is clearly required again. -8. OpenAPS is designed to operate completely autonomously, without requiring any interaction from the patient, and to upload CGM and pump data in real time whenever Internet connectivity is available. The patient simply continues to use the pump per their usual therapy, and OpenAPS simply works in the background to temporarily override the underlying basal rates so that the patient rarely has to take corrective action for hyper- or hypoglycemia. The uploaded data can be made available to the patient and their caregivers / loved ones, allowing them to keep an eye on their BGs, and make sure OpenAPS is continuing to work properly, at all times. As demonstrated by the >15,000 members of the CGM in the Cloud Facebook group and the >3,000 active users of Nightscout, this kind of remote visibility for BGs is life-changing for people with type 1 diabetes, and will be even more so when coupled with OpenAPS technology. This data upload also allows for the development of real-time and retrospective reporting tools to help the clinical care team optimize the patient’s long-term diabetes care, which has the promise to revolutionize the clinical treatment of type 1 diabetes. +While they have improved markedly over the last few years, CGM sensors are not perfect. To safely dose insulin based on data from a CGM, OpenAPS does not place undue, excess reliance on any single glucose measurement. Because new CGM measurements are received every 5 minutes, OpenAPS can continually recalculate the insulin dosing adjustments required to bring BG back to the target range. If the CGM provides erroneous data, such as from a dying sensor or a compression event (where someone is lying directly on the sensor and restricting blood flow), OpenAPS will react conservatively by withholding or slightly increasing insulin dosing. If 5, 10, or 15 minutes later the new data from the CGM indicates that the temporary basal rate currently running is no longer appropriate, OpenAPS can simply cancel the temporary basal and return to the normally scheduled basal rate, or make other dosing adjustments if necessary. By ensuring that all available information, including BG level and trend information and insulin dosing history, is used in determining all insulin dosing decisions, OpenAPS can safely mitigate high blood sugar levels while minimizing hypoglycemia risk. -## OpenAPS Design Details -### Hardware +In addition, OpenAPS is designed to simply and safely fall back to the patient’s pre-programmed basal therapy whenever it receives conflicting information about what the appropriate course of action is (or when required information is missing). For example, if BG is predicted to eventually go low but is actually rising at that moment, OpenAPS can cancel any temporary basals and wait to see whether BG continues rising or begins to fall, and only then begin issuing the appropriate temporary basal commands. Additionally, OpenAPS further ensures safety by falling back to traditional “low glucose suspend” behavior when current BG is below a configured threshold and falling or not rising fast enough. This ensures that insulin infusion is completely withheld while BG remains low for any reason, until it starts to recover, which maximizes the ability to recover from hypoglycemia. -OpenAPS consists of: +Another key element of safety is ensuring that users know what to expect from the system, and can fully inspect what it is doing and why, and adapt it as needed to properly treat their own diabetes. Therefore, OpenAPS is designed to rely, as much as possible, on the same parameters and dosing algorithms used by the patient (at the instruction of their diabetes care team) in deciding the appropriate rate of insulin in any situation. This means using the basal rates, insulin sensitivity factor (ISF, also known as correction factor), duration of insulin action (DIA, also known as insulin lifetime), and optionally the insulin to carb (IC) ratio the patient is already using to drive their existing pump therapy. It also means using the exact same simple insulin dosing calculations the pump’s bolus calculator (or the patient) already uses. OpenAPS does not have any complicated machine learning algorithms, 17-parameter insulin response models, or differential equations. As such, **OpenAPS system is open and transparent in how it works**, and understandable not just by experts, but also by clinicians and end users (patients). - a centralized controller operating on commodity hardware (such as an Android phone or Raspberry Pi mini-computer) that has USB and wireless communication abilities, - a USB or Bluetooth connection capable of reading from a Continuous Glucose Monitor (CGM), - a wireless connection capable of reading from and issuing temporary basal commands to an insulin pump, and - (Optional) a wireless Internet connection (i.e. cellular data or Wi-Fi) capable of uploading BG, pump, and operational data. +## Safety design constraints in oref0, the original OpenAPS algorithm -### Medical device communication +The original OpenAPS algorithm, called oref0 (short for OpenAPS Reference Design Zero), was designed with several additional design constraints to ensure safety. This ensured that, even though OpenAPS was a new and untested system still under active development, it would be safe to use without adding significant risk of dangerous blood sugar outcomes in the event of an interruption in communications, or even a bug or design flaw that resulted in repeatedly issuing the same command over and over. + +While the oref0 software is far more mature than when it was first designed, we have found that these constraints also make the system extremely robust to incorrect pump settings (basals, ISF, DIA, and CR), bad CGM data, or other potential problems. Therefore, we believe that for anyone building their first Artificial Pancreas System, these design constraints are still the safest, most conservative way to ensure that OpenAPS always makes living with diabetes safer than it would be without APS assistance. Therefore, these design constraints will likely remain a core part of oref0 indefinitely, and oref0 will remain the system of choice for anyone building OpenAPS. New users can continue using oref0 as long as they’d like, but should do so at least until they have demonstrated its safety to their own satisfaction. -OpenAPS periodically (i.e. every 5 minutes) reads new data from the CGM as it becomes available. In order to take action, OpenAPS needs at least a current CGM reading (received within the last 10-15 minutes), and a previous CGM reading (5-10 minutes before that). +1. The first such oref0 design constraint is that **OpenAPS oref0 cannot issue insulin boluses**. This is a key safety feature, because insulin pumps, while they have limits on the maximum size of bolus they will administer, generally have no effective limit on how frequently boluses may be administered. As a result, any system that is capable of issuing bolus commands would be capable of administering, if it erroneously issued bolus commands repeatedly, a potentially lethal quantity of insulin. To completely avoid this issue, oref0 instead relies solely on temporary basal commands. Repeatedly reissuing the same temporary basal command does not change the rate at which the pump infuses insulin; it simply extends the temporary basal rate slightly. In addition, insulin pumps are configured with a maximum allowed temporary basal rate, and will simply ignore any commands that instruct the pump to use a higher rate than allowed. -OpenAPS periodically (every few minutes) queries the insulin pump for current settings and recent activity, such as current (scheduled or temporary) and maximum basal rates, recent boluses, IOB (if available), ISF, DIA, IC ratio, BG target/range, etc. (If appropriate, settings such as max basal rate, ISF, DIA, IC ratio, BG targets, etc. can be queried less frequently.) If that query is successful, OpenAPS updates its bolus wizard calculations (detailed below) and determines whether any action is required (canceling or issuing a temporary basal). +2. This **maximum allowed temporary basal rate** is the second design constraint: OpenAPS oref0 is designed to be incapable of administering insulin any faster than can be easily counteracted with fast-acting carbohydrates. This means that oref0 cannot be used to substitute for mealtime insulin boluses, but more importantly it means that, even if OpenAPS were to malfunction in the worst possible way, the patient can completely prevent any adverse outcome by simply consuming additional carbs as needed, as they already must do with standard diabetes treatment every day or two for any number of other reasons. -If action is required, OpenAPS issues the appropriate temporary basal command to the pump, confirms that it was received and acknowledged by the pump, and then performs another query for recent activity to make sure the new temporary basal successfully took effect. +3. OpenAPS oref0 generally **defers to the patient when they choose to issue their own boluses, either for corrections or for meals**. In such a situation, oref0 makes an estimate of how long the (bolus-wizard inputted or assumed) meal is expected to take to digest (or how long the BG excursion is expected to continue, if it’s something other than a meal). It then continues to monitor BG, but avoids issuing any temporary basal rates until that is clearly required again. + +4. **OpenAPS oref0 is designed to operate completely autonomously, without requiring any specific interaction from the patient**, and to upload CGM and pump data in real time whenever Internet connectivity is available for remote monitoring. The patient simply uses the pump per their usual therapy for mealtime dosing, and OpenAPS works in the background to temporarily override the underlying basal rates so that the patient rarely needs to take corrective action for hyper- or hypoglycemia. The uploaded data can be made available via remote monitoring for the patient and their caregivers / loved ones, allowing them to keep an eye on their BGs, and make sure OpenAPS is continuing to work properly, at all times. + +## OpenAPS Design Details + +### Medical device communication + +OpenAPS periodically (i.e. every 5 minutes) reads new data from the CGM as it becomes available. It also periodically (every few minutes) queries the insulin pump for current settings and recent activity, such as current (scheduled or temporary) and maximum basal rates, recent boluses, IOB (if available), ISF, DIA, carb ratio, BG target/range, etc. If that query is successful, OpenAPS updates its bolus wizard calculations (detailed below) and determines whether any action is required (canceling or issuing a temporary basal). + +If action is required, OpenAPS issues the appropriate insulin dosing command to the pump, confirms that it was received and acknowledged by the pump, and then performs another query for recent activity to make sure any new temporary basal successfully took effect. ### Algorithms -#### Basic overnight operation -OpenAPS uses the pump’s bolus and temporary basal history, combined with the pump’s DIA and published IOB curves, to calculate current net IOB. (Currently, pumps only include boluses when calculating IOB: a more correct and useful IOB calculation includes the net impact of temporary basals vs. normally scheduled basal rates.) If no boluses have been administered recently (see “Bolus Snooze” below), OpenAPS can then use the current CGM glucose reading to calculate an eventual BG estimate using simple bolus calculator math: current BG – (ISF * IOB) = eventual BG. +#### Basic overnight operation (oref0) + +OpenAPS uses the pump’s bolus and temporary basal history, combined with the pump’s DIA and published IOB curves, to calculate current net IOB (net insulin on board or active in the body). (Currently, pumps only include boluses when calculating IOB: a more correct and useful IOB calculation includes the net impact of temporary basals vs. normally scheduled basal rates.) If no boluses have been administered recently (see “Bolus Snooze” below), OpenAPS can then use the current CGM glucose reading to calculate an eventual BG estimate using simple bolus calculator math: current BG – (ISF * IOB) = eventual BG. If current BG is below a configured threshold (defaulting to 30mg/dL below the target range), OpenAPS enters low glucose suspend mode, and simply continues to issue 30-minute temp basals to zero as long as BG is not rising. Otherwise, OpenAPS determines whether the eventual BG is projected to be above or below the target range, and makes note of whether the CGM glucose readings are currently rising or falling more than expected. It then decides on the appropriate course of action as follows: +``` if BG is rising but eventual BG is below target, cancel any temp basals. else, if BG is falling but eventual BG is above target, cancel any temp basals. else, if eventual BG is above target: calculate 30m temp required to get eventual BG down to target if required temp is > existing basal, issue the new high temp basal - else, if eventual BG is below target: - calculate 30m temp required to get eventual BG up to target - if required temp is < existing basal, issue the new low temp basal - if >30m @ 0 required, extend zero temp to 30m + else, if BG is below target: + calculate 30m temp required to get projected BG up to target + if required temp is < existing basal, issue the new low temp basal + if >30m @ 0 required, extend zero temp to 30m +``` The maximum temp basal rate is set on the pump, but for safety purposes OpenAPS will set a lower maximum temp basal rate if necessary, as the minimum of: - The pump’s maximum temp basal rate - 3x the maximum daily scheduled basal rate - 4x the current scheduled basal rate +``` +The pump’s maximum temp basal rate +3x the maximum daily scheduled basal rate +4x the current scheduled basal rate +``` -This helps ensure that the patient will always be able to recover from any excessive insulin delivered by OpenAPS simply by eating fast-acting carbs. +This helps ensure that the patient will always be able to recover from any excessive insulin simply by eating fast-acting carbs. #### Adjusting for unexpected BG deviation -The algorithm above is sufficient for a simple and safe OpenAPS implementation, and has been successfully tested by several users over several months of combined use. However, in situations where BG is rising or falling unexpectedly, or remaining stubbornly high, we discovered that it is also useful to take into account how much the Blood Glucose rise/fall rate is deviating from what would be expected based on insulin activity. This allows more advanced OpenAPS implementations to respond more quickly when BG starts to rise or fall more than expected, and allows it to continue high temp basals when BG is stubbornly high and mostly flat (falling far less than expected). +The algorithm above is sufficient for a simple and safe OpenAPS implementation, and has been successfully tested by hundreds of users over years of combined use. However, in situations where BG is rising or falling unexpectedly, or remaining stubbornly high, we discovered that it is also useful to take into account how much the Blood Glucose rise/fall rate is deviating from what would be expected based on insulin activity. This allows more advanced OpenAPS implementations to respond more quickly when BG starts to rise or fall more than expected, and allows it to continue high temp basals when BG is stubbornly high and mostly flat (falling far less than expected). To calculate this deviation, OpenAPS first calculates a term we call “BG Impact” or BGI, which is simply the current insulin activity (first derivative of IOB) * insulin sensitivity. When expressed in units of mg/dL/5m, this represents the degree to which BG “should” be rising or falling, and can be directly compared to the delta between the current and last CGM reading, or an average delta over the last 15m or so. To calculate the deviation, OpenAPS does exactly this comparison, between the 15m average delta in CGM readings and the predicted BGI. It then applies that deviation as an adjustment to the eventual BG prediction. This is based on the simple assumption that if BG is rising or falling more than expected over the last 15 minutes, that trend is likely to continue over the next 15-30 minutes, and the magnitude of the projected deviation is approximately equal to what was seen over the last 15 minutes. In future OpenAPS implementations it may be possible to come up with better predictive algorithms of this sort, but this simple algorithm has worked quite well over many months of real-life use so far. @@ -78,19 +86,47 @@ In addition to adjusting the eventual BG predictions, the BGI calculation above #### Bolus snooze -By adjusting for BG deviations as described above, advanced OpenAPS implementations can avoid issuing low temp basals when BG is rising or remaining high after a meal, even without being informed about the fact that a meal has been consumed, or being provided a carbohydrate count. However, it is also useful for OpenAPS to avoid issuing low temp basals that counteract a meal bolus or pre-bolus when BG has not yet started to rise. To accomplish this, advanced OpenAPS implementations apply a “bolus snooze”, which causes OpenAPS to effectively go “hands off” as soon as a user executes a bolus, and only take action again if/when BG drops below the low glucose suspend threshold, rises more than expected or fails to come down after the mealtime rise, or starts to drop faster than expected. As a result, users can simply bolus appropriately for their meal, and then OpenAPS will wait and take over basal adjustment as necessary to bring BGs back into range after any mealtime excursions. +By adjusting for BG deviations as described above, OpenAPS can avoid issuing low temp basals when BG is rising or remaining high after a meal, even without being informed about the fact that a meal has been consumed, or being provided a carbohydrate count. However, it is also useful for OpenAPS to avoid issuing low temp basals that counteract a meal bolus or prebolus when BG has not yet started to rise. To accomplish this, OpenAPS applies a “bolus snooze”, which causes OpenAPS to effectively go “hands off” as soon as a user executes a bolus, and only take action again if/when BG drops below the low glucose suspend threshold, rises more than expected or fails to come down after the mealtime rise, or starts to drop faster than expected. As a result, users can simply bolus appropriately for their meal, and then OpenAPS will wait and take over basal adjustment as necessary to bring BGs back into range after any mealtime excursions. The bolus snooze is currently implemented in advanced OpenAPS implementations by tracking bolus IOB (with an accelerated decay based on half the user’s normal DIA) separately from net IOB, and re-adding the BG impact of the bolus IOB (plus a small multiple) when deciding whether to set a low temporary basal. If the resulting “snooze BG” term is higher than the BG target, then OpenAPS will not set a low temporary basal, even if the eventual BG (based solely on net IOB) is much lower than target. This results in OpenAPS effectively widening the target BG range immediately after a bolus, and then gradually narrowing it over the next hour or two and gradually returning to normal behavior. -As most insulin pumps do not calculate net IOB, and use bolus-only IOB in the bolus calculator, it is necessary to take an additional precaution to help prevent the patient from manually administering an excessive bolus by following the bolus calculator. This is accomplished through a “maximum IOB” setting, which instructs OpenAPS to never set high temp basals that would allow the net IOB to exceed the bolus IOB by more than a user-configured amount. Unless configured otherwise by the user setting up OpenAPS implementation, this maximum IOB defaults to zero, which means that OpenAPS will act only as a predictive low glucose suspend system, and will high-temp after BG starts to recover if IOB is negative, but will not issue high temp basals if BG is high. +As most insulin pumps do not calculate net IOB, and use bolus-only IOB in the bolus calculator, it is necessary to take an additional precaution to help prevent the patient from manually administering an excessive bolus by following the bolus calculator. This is accomplished through a “maximum IOB” setting, which instructs OpenAPS to never set high temp basals that would allow the net IOB to exceed the bolus IOB by more than a user-configured amount. Unless configured otherwise by the user setting up OpenAPS implementation, this maximum net IOB defaults to zero, which means that OpenAPS will act only as a predictive low glucose suspend system, and will high-temp after BG starts to recover if IOB is negative, but will not issue high temp basals if BG is high. + +#### Beyond oref0 + +Over the last two years, OpenAPS has evolved from an idea, and a bare-bones toolkit used only by its cofounders, into an open-source software package used by hundreds of individuals of all skill levels to build their own DIY closed loop artificial pancreas systems. As this DIY community has steadily accrued over a million hours of experience using such systems in real-world situations, we have shared with each other what we’ve learned, and gradually made many improvements to the basic “fits-on-a-postcard” oref0 algorithm (described above) that still forms the core of all OpenAPS systems. + +One notable improvement was the addition of the “Advanced Meal Assist” feature, commonly referred to inside the OpenAPS community as AMA. AMA provides a highly adaptable algorithm for safely dosing insulin after meals, despite widely varying meal types, and the high variance in digestion speed between individuals. While AMA can deal very effectively with meal variations, it still requires the user to count and enter their carbs, and administer a meal bolus when the meal is eaten. This is mostly due to the relatively slow speed of action of even “fast-acting” insulin, which takes over an hour to reach peak insulin activity, and therefore requires very careful dosing to preempt post-meal blood sugar spikes while avoiding hypoglycemia in the event that carbohydrate absorption slows or stops suddenly (for example, due to walking home from a restaurant). + +Despite these limitations, AMA is apparently still the most advanced postprandial insulin dosing algorithm in widespread human use, so there has been a lot of interest in seeing whether it could be extended to further reduce the burden on patients using it, and more completely automate insulin dosing in all situations. + +### Introducing oref1 and supermicroboluses + +To move in that direction, we have developed an extension of the oref0 AMA algorithm, which we are calling oref1. The notable difference between the oref0 and oref1 algorithms is that oref1 makes use of small “supermicroboluses” (SMB) of insulin at mealtimes to more quickly (but safely) administer the insulin required to respond to blood sugar rises due to carb absorption. + +The microboluses administered by oref1 are called “super” because they use a miniature version of the “super bolus” technique to safely dose mealtime insulin more rapidly. This SMB technique involves first setting a temp basal rate of zero (0) U/hr, of sufficient duration to ensure that BG levels will return to a safe range with no further action even if carb absorption slows suddenly (for example, due to post-meal activity or GI upset) or stops completely (for example due to an interrupted meal or a carb estimate that turns out to be too high). As with oref0, the oref1 algorithm continuously recalculates the insulin required every 5 minutes based on CGM data and previous dosing, which means that oref1 will continually issue new supermicroboluses every 5 minutes, increasing or reducing their size as needed as long as CGM data indicates that blood glucose levels are rising (or not falling) relative to what would be expected from insulin alone. If BG levels start falling, there is generally already a long zero temp basal running, which means that excess IOB is quickly reduced as needed, until BG levels stabilize and more insulin is warranted. + +#### Safety considerations introduced by oref1 + +Automatically administering boluses safely is of course the key challenge with such an algorithm, as we must find another way to avoid the issues highlighted in the oref0 design constraints. In oref1, this is accomplished by using several new safety checks (as outlined here), and verifying all output, before the system can administer a SMB. + +At the core of the oref1 SMB safety checks is the concept that OpenAPS must verify, via multiple redundant methods, that it knows about all insulin that has been delivered by the pump, and that the pump is not currently in the process of delivering a bolus, before it can safely do so. In addition, it must calculate the length of zero temp required to eventually bring BG levels back in range even with no further carb absorption, set that temporary basal rate if needed, and verify that the correct temporary basal rate is running for the proper duration before administering a SMB. + +To verify that it knows about all recent insulin dosing and that no bolus is currently being administered, oref1 first checks the pump’s reservoir level, then performs a full query of the pump’s treatment history, calculates the required insulin dose (noting the reservoir level the pump should be at when the dose is administered) and then checks the pump’s bolusing status and reservoir level again immediately before dosing. These checks guard against dosing based on a stale recommendation that might otherwise be administered more than once, or the possibility that one OpenAPS rig might administer a bolus just as another rig is about to do so. In addition, all SMBs are limited to 1/3 of the insulin known to be required based on current information, such that even in the race condition where two rigs nearly simultaneously issue boluses, no more than 2/3 of the required insulin is delivered, and future SMBs can be adjusted to ensure that oref1 never delivers more insulin than it can safely withhold via a zero temp basal. + +In some situations, a lack of BG or intermittent pump communications can prevent SMBs from being delivered promptly. In such cases, oref1 attempts to fall back to oref0 + AMA behavior and set an appropriate high temp basal. However, if it is unable to do so, manual boluses are sometimes required to finish dosing for the recently consumed meal and prevent BG from rising too high. As a result, oref1’s SMB features are only enabled as long as carb impact is still present: after a few hours (after carbs all decay), all such features are disabled, and oref1-enabled OpenAPS instances return to oref0 behavior while the user is asleep or otherwise not engaging with the system. + +In addition to these safety status checks, the oref1 algorithm’s design helps ensure safety. As already noted, setting a long-duration temporary basal rate of zero while super-microbolusing provides good protection against hypoglycemia, and very strong protection against severe hypoglycemia, by ensuring that insulin delivery is zero when BG levels start to drop, even if the OpenAPS rig loses communication with the pump, and that such a suspension is long enough to eventually bring BG levels back up to the target range, even if no manual corrective action is taken (for example, during sleep). Because of these design features, oref1 may even represent an improvement over oref0 w/ AMA in terms of avoiding post-meal hypoglycemia. + +In real world testing, oref1 has thus far proven at least as safe as oref0 w/ AMA with regard to hypoglycemia, and better able to prevent post-meal hyperglycemia when SMBs are active. -### Discussion +### Conclusion -As a result of the principles, design constraints, and overall approach taken in designing and implementing OpenAPS, we believe that OpenAPS and similar designs represent the safest, fastest way to make Artificial Pancreas technology available to all type 1 diabetes patients, and do so at the most affordable price point possible. +Because of the principles, design constraints, and overall approach taken in designing and implementing OpenAPS, we believe that OpenAPS and similar designs represent the safest, fastest way to make Artificial Pancreas technology available today to people with type 1 diabetes. -In order to extend this vision from multiple DIY implementations to all T1D patients, we would ideally like to: +To extend this vision to all T1D patients, we would ideally like to: +* Work with medical device manufacturers willing to interoperate with OpenAPS. +* We would like device manufacturers to provide interoperable communication protocols to allow full interoperability between all diabetes devices. +* Work with clinical researchers to design and implement open clinical trials in the open source diabetes community. +* Work with visionary clinicians who would like to advance the state of the art of type 1 diabetes therapy to design clinically useful reporting, alerting and management tools. -* Work with medical device manufacturers willing to interoperate with OpenAPS, initially on an IDE basis where necessary, and later by providing interoperable communication protocols to allow full interoperability between all of a patient’s devices. -* Work with clinical researchers to design and implement open clinical trials of the OpenAPS reference implementation. -* Work with regulatory agencies to determine and begin the process of obtaining approval for an Open APS reference design and implementation, which could then be implemented by any manufacturer or other appropriate entity that wants to do so. -* Work with visionary clinicians who would like to advance the state of the art of type 1 diabetes therapy, by setting up their patients with their own OpenAPS implementations, and working with us to design clinically useful reporting and alerting tools. These would allow clinicians to be made aware of which patients need clinical follow-up, and allow them to engage with patients on the basis of full knowledge of their diabetes situation, and with actionable recommendations that will make a difference in the patient’s treatment. diff --git a/scripts/quick-packages.sh b/scripts/quick-packages.sh index 33e6ff1b9..f6ad8d320 100644 --- a/scripts/quick-packages.sh +++ b/scripts/quick-packages.sh @@ -1,7 +1,8 @@ #!/bin/bash +apt-get install -y sudo sudo apt-get update && sudo apt-get -y upgrade -sudo apt-get install -y git python python-dev python-software-properties python-numpy python-pip nodejs-legacy npm watchdog && \ +sudo apt-get install -y git python python-dev python-software-properties python-numpy python-pip nodejs-legacy npm watchdog strace tcpdump screen acpid vim locate jq lm-sensors && \ sudo pip install -U openaps && \ sudo pip install -U openaps-contrib && \ sudo openaps-install-udev-rules && \ diff --git a/scripts/quick-src.sh b/scripts/quick-src.sh index e7b73ba80..85753e17c 100644 --- a/scripts/quick-src.sh +++ b/scripts/quick-src.sh @@ -1,7 +1,8 @@ #!/bin/bash +apt-get install -y sudo sudo apt-get update -sudo apt-get install -y git python python-dev python-software-properties python-numpy python-pip nodejs-legacy npm watchdog && \ +sudo apt-get install -y git python python-dev python-software-properties python-numpy python-pip nodejs-legacy npm watchdog strace tcpdump screen acpid vim locate jq lm-sensors && \ ( curl -s https://bootstrap.pypa.io/ez_setup.py | sudo python ) && \ sudo npm install -g json && \ sudo easy_install -ZU setuptools && \