Software Instructions for Spring 2020

You are not logged in.

Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.

PLEASE NOTE: WE SUGGEST USING TWO LAPTOP COMPUTERS IN LAB, ONE FOR UPDATING THE THE CONTROL SOFTWARE (AND THEREFORE CONNECTED TO THE LONGER TEENSY 3.6 MICROCONTROLLER), AND A SECOND LAPTOP FOR MONITORING IN REAL TIME (AND THEREFORE CONNECTED TO THE SHORTER TEENSY 3.2 WHICH HANDLES COMMUNICATION). YOU CAN USE ONE COMPUTER FOR BOTH, AS LONG AS YOU ARE CAREFUL NOT TO UPDATE THE WRONG MICROCONTROLLER.

MAKE SURE YOU FOLLOW THE INSTALLATION INSTRUCTIONS FOR BOTH COMPUTERS.

Creating a directory with 6.302 software (BOTH LAPTOPS)
  1. Download 6302_20_software.zip (here ) to your Desktop.
  2. Open a shell window (a "terminal" window for linux or OSX, a powershell window on microsoft), change to the Desktop directory or folder, find the downloaded zip file, and extract its contents to the subdirectory 6302_20_software.
  3. Change to the 6302_20_software subdirectory, and type "ls" followed by a return to list the files. You should see two files and two folders: gui.html, server.py, 6302_USB_Repeater, and src.
Installing the Arduino and Teensyduino software (BOTH LAPTOPS)

Please download and install the Ardunio software version 1.8.10, and then download and install the Teensyduino 1.4.8 add-on. There are versions of both packages for linux, macosx and microsoft windows. Please DO NOT TRY TO USE AN earlier version of either software package.

A guide to installing the Arduino software is here: https://www.arduino.cc/en/Guide/HomePage (DO NOT USE THE PORTABLE OR ON-LINE VERSIONS of ARDUINO!).

Step-by-step instructions

  1. Install Arduino 1.8.10 ( https://www.arduino.cc/en/Main/OldSoftwareReleases#previous )
  2. Open the Arduino 1.8.10 IDE application with the "6302_USB_Repeater" sketch. That is, use the Arduino IDE to open the 6302_USB_Repeater.ino file in the 6302_USB_Repeater subdirectory of the 6302_20_software directory. An Arduino "sketch" is a program (in a c-like language) that you cross-compile and download to, and run on, the Teensy.
  3. In the upper left-hand corner of the Arduino IDE, there is a click-circle with a check-mark. If you click on this circle, the 6302_USB_Repeater sketch will be compiled, but no downloading will be attempted. Since the sketch is written for the Teensy 3.2, and you haven't installed the Teensy 3.2 add-on yet, you should see lots of error messages.
  4. Quit Arduino 1.8.10.
  5. DO NOT TRY TO INSTALL THE TEENSYDUINO SOFTWARE WITHOUT RUNNING THE ARDUINO IDE AT LEAST ONCE!!!
  6. Install Teensyduino 1.48 ( https://www.pjrc.com/teensy/td_148/ ) using the installation instructions at https://www.pjrc.com/teensy/td_download.html
Connecting the monitor laptop.
  1. Connect the Teensy 3.2 on your controller PC board (the smaller microcontroller) to the monitor laptop with a USB-to-MicroUSB cable. Then, start the arduino IDE on the monitor laptop, click the IDE's "tools" tab, and examine the tools tab's associated dropdown list. Make sure that next to the dropdown tag "board", the Teensy 3.2/1 indicated, and that next to the tag labeled "port", the text "Teensy 3.2" appears. If not, click on either board or port, and select the Teensy 3.2 related option.
  2. If it is not already open, then open the "6302_USB_Repeater" sketch in the Arduino IDE, and try to download it on to the Teensy 3.2 (by clicking the click-circle with the right-pointing arrow on the top left of the Arduino IDE). If there are no errors, and the IDE reports a successful upload, then the installation is correct.
Connecting the control laptop.
  1. Connect a control laptop to the control Teensy (the larger microcontroller on your PC board, a Teensy 3.6). Open the Arduino IDE on the control laptop, and make sure the dropdown tags "board" and "port" both indicate the Teensy 3.6 (or click on the board or port and select the Teensy 3.6 related option). Then open the 6302_P_control sketch, and try to compile and download it on to the Teensy 3.6. If the compile completes with no errors, and the IDE reports a successful upload, you have installed the control software correctly.
  2. If you get an error message indicating the arduino application is damaged, and a recommending that you delete it, please do so. Then try the above instructions again, but this time REALLY open a sketch with the Arduino IDE before installing the Teensy duino.
  3. IF YOU HAVE A PROBLEM WITH UPLOADS OR DOWNLOADS, TRY DISABLING ANY BLUETOOTH DEVICES, SUCH A BLUETOOTH MICE OR KEYBOARDS.
Verifying and possibly updating python (monitor laptop only)
  1. On the monitor laptop, open a shell window (terminal on Linux or Mac, powershell on microsoft).
  2. Change to the subdirectory with the unzipped 6302_20_software files.
  3. In the shell window, type "python" followed by return, then you should see a line of output indicating the python version. If you are using a version of python that is 3.7 or higher, you do not need to update python. If you are running python 2.7, or if the python command is not recognized at all, or you'd just prefer the newest python, see the instructions at the bottom of this page.
  4. In the shell window, type "python -m pip install pyserial" followed by a return. If you already have an up-to-date pyserial, the message "Requirement already satisfied...." will appear. Otherwise, pip will start downloading and installing.
  5. Then type "python -m pip install websockets" followed by a return. If you already have an up-to-date websockets, the message "Requirement already satisfied...." will appear. Otherwise, pip will start downloading and installing.
Running the monitor.

If you have not already done so, on the monitor laptop, download the serial repeater sketch to the Teensy 3.2, and on the control laptop, download the pid control sketch to the Teensy 3.6.

On the monitor laptop (connected to the Teensy 3.2), use Chrome or Firefox to open the gui.html file in the 6302_20_software directory (Safari and Explorer browsers might work, but have not been tested). Then open a shell window on the monitor laptop (a terminal on Linux or Mac, powershell on microsoft), change to the 6302_20_software directory, and type "python server.py" followed a return. Finally, click the "reconnect" button in the browser window. You should see sliders and plots!

Installing Python if you need to.

You can install anaconda (which has python 3.7). If you decide to use Anaconda, be sure you are installing the 64-bit version, and if you are on Windows, be sure that you click on the "Add Python to the PATH" box even though Anaconda recommends against it.

Or you can install python 3.8 from python.org. If you are installing on Windows, be sure to download the ***x84-64 executable installer***. Execute the installer, AND ON THE VERY NEXT POP-UP BOX CLICK ON "Add Python 3.8 to the PATH". Then click on CUSTOM installation. In the next "Optional Features" POP-UP Box, click on EVERY feature in (particularly pip!!!). Click on Next, and in the next "Advanced Options" POP-UP Box, be sure that the "Install for all users" and "Add Python to environment variables" boxes are checked. Then click NEXT and then click YES.

If you are trying to use only one laptop (NOT RECOMMENDED)

If you are trying to use one laptop to do both the control and the monitoring, which we DO NOT RECOMMEND, and you have followed all the above steps (that is, you have installed all the software for both monitor and control), then try the following sequence of steps.

  1. Plug in ONLY the Teensy 3.2 (the smaller microcontroller) in to a usb point on your laptop. Be sure to UNPLUG the 3.6.
  2. Open 6302_USB_Repeater.ino with Arduino (the version with the Teensyduino addon installed).
  3. Use the Arduino tools menu to set the board and the port to Teensy 3.2.
  4. Upload 6302_USB_Repeater.ino on to the 3.2.
  5. QUIT ARDUINO!!!!!!!
  6. UNPLUG THE Teensy 3.2 and PLUG IN ONLY ONLY ONLY the 3.6 into a usb port.
  7. Open the 6302_P_Control.ino file with Arduino.
  8. Use the tools menu to set the board and the port to Teensy 3.6.
  9. Upload 6302_P_Control.ino onto the Teensy 3.6.
  10. Plug in the Teensy 3.2 into a second usb port.
  11. Open gui.html in Chrome.
  12. In the directory with server.py, open a shell window (a terminal on nix or MAC, powershell on microsoft), and use it to run the server software with python 3.8 (make sure updated pySerial and websockets have been installed, i.e. using pip). That is, at the powershell command prompt type "python server.py"
  13. Wait a few seconds and the plots should show up in the browser window.