Nightscout and Medtronic 640g

25 Feb
Guides > Setup Guides > Nightscout and Medtronic 640g

Nightscout and the Medtronic 640g


Direct Nightscout access is now available in a Beta Release Android application!

Please visit Lennart Goedhart’s page for up-to-date information on this evolving Nightscout solution. Please read all of the instructions and warnings carefully before deciding whether to proceed with this Beta release. Once a stable, full release candidate is available, full instructions will be posted here.

While not as flexible or easy to setup as the Android version, the earlier method (utilizing CareLink) may suit the needs of some, particularly for overnight monitoring, and also provides a convenient method of getting additional pump information (e.g. bolus wizard entries and pump alarms) up to Nightscout. Instructions for this installation remain below.

Thanks for waiting patiently
The 640g Nightscout Support Team –
Lennart Goedhart
Matt Guy
David Wright
Tom Collins


Alternate to Android Uploader Setup

The following information can be used to help connect a Medtronic 640g to a Nightscout site. Note: there are multiple options for setting up the 640g with Nightscout using CareLink. For more information, visit the Little D blog.

Setup Nightscout

Please consult the step-by-step directions for setting up a Nightscout site. In setting up Nightscout, you need to do the following steps:
  • Create a mlab account and database.
  • Create a Github account and a copy of the CGM-Remote-Monitor.
  • Create an Azure or Heroku site.
  • Configure your site’s connection strings (mongo information).
  • Configure the API SECRET in Azure or Heroku.
  • Configure the ENABLE variable with the value careportal (and any other plugins you wish to use; see example in note below).
  • Deploy your site using the Github repository.
Directions for setting up the Nightscout site, beginning with the creation of the mlab database, appear here. Note: complete each step listed above. Once you have successfully created a Nightscout site (e.g., you see a black site showing time and dashes when viewing your site in a browser), return here to move forward.
Note: you do need to enable CarePortal to allow additional pump data, such as basal rates and bolus events, to reach Nightscout. I have my enable connection string set to enable careportal basal rawbg iob cage bwp.

You do not need to enter the Dexcom settings.

You do not need to enable the Medtronic Connect plugin.

Setup CareLink

Getting CareLink all set essentially means making sure everything works manually
Follow Medtronic’s instructions precisely when first attempting a pump upload.
Install Java if prompted and complete any system confirmation requests to enable.
Make sure you can manually upload data from the pump to CareLink.
Make sure you can manually select a CSV Report and download it.

Create Core Folders

Open File Explorer in Windows and double click on the SD Card (probably the D: or E: drive).
Click on the New Folder icon and type AutoCSV. (This is where we’ll throw the data around before uploading to Nightscout.)
640g_sd_new_folder
Click on the New Folder icon again and type data. (This is where we’ll ask Firefox to download the CareLink CSV file initially.)

Download the Github files

From your browser, go to my mmcsv640g repository and click Download Zip.
640g_sd_download_zip
Extract the zip file to your SD Card (creating a folder called “mmcsv-mmcsv640g” and subfolders).

Install Git-Bash

Download Git SCM via https://git-for-windows.github.io/.
Install, accepting all defaults until you get to select terminal emulator. Select Use Windows’ default Console Window
640g_GitTerminalOption
Complete the installation and close the installer.

Create Local Copies

From the mmcsv-mmcsv640g folder, copy the config.sh file to the root directory of the SD Card (e.g. D: or E:). Making a copy means that when you next update the mmcsv repository you still have your local settings retained.
config.sh contains default file locations and parameters, such as upload frequency, for use by the bash script. Assuming your SD Card is mounted as the D: drive it should read as shown below. You need to check/update the parameters in the copy of this file. The “api_secret_hash” below is the SHA-1 Hash of your API-Secret string. To generate this, simply type in your API-Secret key into a converter, such as this one. Please note and review the additional parameters towards the end of the file, compared to the older (<0.82) versions.

Install nodejs

Download and install nodejs (select the latest stable version).
Open a bash terminal window: 
Start, All Apps, Git Bash
Change to the directory where you’ve downloaded mmcsv640g, e.g. by typing:
cd /d/mmcsv-mmcsv640g
(NB forward slash and drive letter d/…… to get things going in the bash shell)
Once you’re sure you’re in the correct directory, type:
npm install
You only need to do this ONCE, on installation, not for every run of the application.
If you get an error along the lines of can’t find npm or nodejs, type: 
export PATH=$PATH:’/c/Program Files/nodejs’
You might get a couple of lines of grumbling / advisories, but you shouldn’t get a stream of warnings or errors.

Running the Application

Open a bash terminal window:  Start, All Apps, Git Bash
Change to the directory where you’ve downloaded mmcsv640g, e.g. by typing:

cd /d/mmcsv-mmcsv640g 


Then type: 
./mmcsv640g.sh “/d”

where /d is the root directory of the sd card, where you popped the updated config.sh file.

That’s it.



Want to go back to Firefox and Selenium?
The initial setup was really designed as a proof of principal and to deliver a very specific need for us as a family with a little one on the 640g. To see dozens of other 640g users take the step to their pumps connected to Nightscout has been amazing. I would recommend all users (old and new) try the updated solution. But if you really want to go back to Firefox and Selenium you can – just change uploader=0 in the config.sh file and follow the original instructions here.

Getting Support

If you have questions about the 640g setup, the Nightscout Medtronic group at Facebook is a great place to ask questions.