Knobby scheduler

CaptureA new Scanbox panel allows users to define arbitrary changes in (x,y,z) position over time (frames) which are then executed by Knobby (version 2 only) while imaging.

Each entry define changes in x, y and z (in micrometers) relative to the present position and the frame number at which they will take place.

The “mem” column allows one to specify one of the stored absolute coordinates instead (memory locations are coded A=1, B=2, C=3).  If a memory location is defined the other entries are ignored and the position in the referenced memory is used instead.

This mechanism extends the z-stack functionality to include the ability to tile a sample and brings back the control window to one of the panels in Scanbox (as opposed to being controlled in Knobby’s screen).  The Knobby table is also saved in the info.knobby_table variable.

Paths can be computed offline and stored in a Matlab file that can be loaded.  The example below shows knobby moving the sample along a circular path.

Update [ 7/3/17]: You will now note an additional checkbox in the Knobby Scheduler panel called “Return”. When you arm knobby scheduler and check this box the microscope will automatically return to the initial position after imaging is done.  This feature uses the Store/Recall C function for functionality.  Anything stored previously in C is going to be erased if you use this feature.

How to update Scanbox?

Installing updates is not very difficult.  Here is a step-by-step guide.

  • Download the latest Scanbox distribution from GitHub (download ZIP file — don’t clone).
  • Uncompress the zip file in Documents/MATLAB/<new scanbox directory>.  Keep your old distribution intact, in case something does not work and you want to restore the old version.
  • Start Matlab
  • Type “edit scanbox_config” in the Matlab window to edit the scanbox_config.m from the old version.
  • Use pathtool in Matlab to add all the subdirectories in the new distribution to the path.
  • Type “edit scanbox_config” to edit the new configuration file.  You should now have both the old and new config files on the Matlab editor. Copy the required settings form the old file to the new one.
  • To update the firmware in Scanbox do the following:
    1. Open the Cypress Bootloader Host (seearch for Bootloader if you can’t find it)
    2. For the file entry in the Bootloader Host, select the file <newdir>/drivers/DarioBox.cyacd
    3. In the Matlab command window type “scanbox_config; sb_open; sb_reset; sb_close”
    4. In the ports panel of the Bootloader host you will see a USB Human Interface Device listed immediately.  Select the device and click the Download button at the top left of the Bootloader Host Window (it is the one with an arrow pointing down). Note: you ave 20 seconds to upload the new firmware (from the time you issued the Matlab commands), otherwise Scanbox will continue booting normally. The Log panel in the Bootloader host will show if the programming of the box was successful.  You can now quit the Bootloader host.
    5. The new firmware version should now show up on the Scanbox LCD display.
  • Now we need to update Knobby.  To do so, simply go to the Matlab window and type “knobby_update”.  Wait for Knobby to update.
  • Now we need to update the firmware in the motor box.  To do so follow the instructions here
  • Close Matlab.
  • Run the vc_redist.x64.exe file in the scanbox/core/ directory.
  • Make sure you have the latest nVidia drivers and download/install any updates from here.
  • Open a command window and type “conda install pyserial”.  This will update the python serial library and any dependent components.  Reply [yes] when asked to proceed with the update.

That’s all.  Restart Matlab and launch Scanbox.  You have been upgraded!

If something goes wrong it will likely happen during startup and you will get a corresponding error message (in the form of red text in the Matlab window).  Send me the message and I will help.

Important enhancements in Scanbox 3.3 firmware

Good news!

The latest Scanbox version in Github includes a few important improvements and fixes:

  1. The new firmware substantially decreases line jitter producing even shaper images.
  2. It removes the artifactual horizontal lines from the mean of bidirectional scanning acquisitions.
  3. It fixes a bug in the phase of the camera trigger signal.
  4. It checks for cases where no cameras are present (which produced an error on startup before).
  5. It fixes a bug where the objective moved by a small amount (~10′ of arc) after being zeroed.
  6. It increases the velocities of the x/y stages in Knobby’s velocity mode.

Scanbox firmware must be updated to run this release.  There are no changes to the Motor Box or Knobby firmware.

As always, remember to keep a copy of your latest version.


Updating the trinamic firmware

Some updates to Scanbox/Knobby require the update of the firmware in the Trinamic TMCM-6110 card inside the motor controller.  To update the firmware do the following:

  1. Run the program yeti/drivers/TMCL.exe
  2. Select Setup->Options from the menu.
  3. In the connection tab, select the COM port that corresponds to the card (it is typically labeled “Stepper”), and Click Ok.
  4. Select File->Open from the menu.
  5. Navigate to yeti/scanknob/ and select scanknob.tmc.  You will see the window below:tmcl
  6. Finally, click on the Download button shown by the red arrow.  The program will compile and download the code to the card.
  7. Close the program.  You are done.

After updating the motor box you are ready to start Scanbox again.  Make sure you also keep Knobby up to date by updating it with the firmware in each release.

Knobby updates

The last release of Scanbox provides a mechanism to update the firmware in Knobby and provides a few fixes to the existing version.  We will be using this mechanism to deploy future improvements.

The present version fixes a bug that incorrectly moved the objective to its original position when the X, Y, or Z axes where moved right after a Zero with vertical alignment was performed.  It also provides a way to cancel a Zero/Store/Recall function if they were triggered by mistake.  To cancel you simply have to touch the same button once again.

The new version also adjusts the hit areas on the touchscreen for the Lock/Unlock button and the XYZ menu selection for the Zero command, which were slightly off causing some unnecessary frustration.

To update Knobby’s firmware proceed as follows.

After downloading the latest Scanbox versions use pathtool in Matlab to ensure all the sub-directories within the distribution are added to the path.  Then within Matlab, type “knobby_update”.  If everything look Ok you will see something like the output below.  Your Knobby will reboot and you can then start Scanbox and start using it.

>> knobby_update
Knobby Firmware Update (dlr - 5/6/2016)
Reset Arduino Due...
Atmel SMART device 0x285e0a60 found
Device : ATSAM3X8
Chip ID : 285e0a60
Version : v1.1 Dec 15 2010 19:25:04
Address : 524288
Pages : 2048
Page Size : 256 bytes
Total Size : 512KB
Planes : 2
Lock Regions : 32
Locked : none
Security : false
Boot Flash : false
Erase flash
done in 0.030 seconds

Write 54480 bytes to flash (213 pages)

[ ] 0% (0/213 pages)
[== ] 9% (21/213 pages)
[===== ] 19% (42/213 pages)
[======== ] 29% (63/213 pages)
[=========== ] 39% (84/213 pages)
[============== ] 49% (105/213 pages)
[================= ] 59% (126/213 pages)
[==================== ] 69% (147/213 pages)
[======================= ] 78% (168/213 pages)
[========================== ] 88% (189/213 pages)
[============================= ] 98% (210/213 pages)
[==============================] 100% (213/213 pages)
done in 11.410 seconds

Verify 54480 bytes of flash

[ ] 0% (0/213 pages)
[== ] 9% (21/213 pages)
[===== ] 19% (42/213 pages)
[======== ] 29% (63/213 pages)
[=========== ] 39% (84/213 pages)
[============== ] 49% (105/213 pages)
[================= ] 59% (126/213 pages)
[==================== ] 69% (147/213 pages)
[======================= ] 78% (168/213 pages)
[========================== ] 88% (189/213 pages)
[============================= ] 98% (210/213 pages)
[==============================] 100% (213/213 pages)
Verify successful
done in 10.177 seconds
Set boot flash true
CPU reset.


New features in latest Scanbox firmware

To take advantage of the new features in the latest release of the Yeti firmware you should start by getting rid of the half-wave plate control of the laser power. To do so start by removing the motor and half-wave plate from the optical path feeding the laser beam directly into the Pockels cell as shown in the picture below.  Make use of a detector card and/or power meter to check for alignment.


Make sure the Pockels cell is aligned so that there is minimum transmission when the reading in the front panel is zero.  The power of the laser in this new arrangement is controlled by a slider in the Chameleon panel, which provides control from 0% to 100% of the power.


The software takes into account the fact that at 920nm the relationship between power and control voltage is non-linear, so you should get an approximate linear control of the power using the slider.  This new feature provides for an absolute control of the power across experiments (as compared to the the relative position of the wave-plate in the original design).  You should also get increased power, as the new setup avoid loses via multiple reflections.

Using the new firmware you also have control over the size of the dead-band at the edges of the scanning.  A new variable in  the configuration file, sbconfig.deadband, can be changed by the user.  The two numbers of the vector reflect the size of the dead-band at the left and right margins of the scan in percent of the total number of samples before spatial correction.

The reason for this changes is that this new setup also allows the software to rapidly change the power, a feature that will be needed when the Optotune lens is incorporated for fast z-scanning in the near future.  If you plan to use the optotune, you should be upgrading to this new firmware as soon as possible.

Updating the firmware

The lastest firmware is located in the Scanbox/drivers/ subdirectory.

To update the driver start the Bootloader Host application (look under the Cypress Programs Folder).

Select the new Firmware file you want to upload (the one in the drivers/ directory), power cycle Scanbox to get it into boot loader mode.  Once you turn the box on you will have 20 sec to upload the new firmware (once the time elapses Scanbox will start running the existing firmware).

Select the USB Human Interface Device that will appear in the ports panel, and click the download button (the one highlighted in blue).

If everything works you will get a message that the firmware was successfully uploaded (it should take 3-4 seconds to complete).  Once the new software is uploaded Scanbox should be ready to use.


If you have trouble with the  firmware updating process just let me know…

Note: You can download the PSoC suite from here but make sure you select “Custom” installation (instead of “Typical”) and select  the “bootloader host” only for installation (otherwise you will be installing the whole suite and it will take a very large amount of time/space).