position control

Tiling with Knobby

Knobby scheduler allows the user to move the microscope by specifying a list of relative changes in position at given frame numbers.  One quick way to fill up the table is provided by a set of text fields in the knobby panel.  This allows one to perform (x,y,z) tiling with a given range and step size.


The first row of entries correspond to the range (in um) to be covered in the x, y and z axes respectively.  The second row specifies the step size in each case.  The last entry at the bottom tells Knobby how many frames to sample at each location.

In the example above, Knobby will perform a z-stack with 40um range and 20 um steps (that is, a total of 3 locations), on an (x,y) grid of 3×3 with 200um horizontal and vertical range and steps of 100um.

As you input the desired values the table will update automatically.

Once ready, click the “Arm” checkbox (and the “Return” checkbox if you want knobby to go back to its initial position at the end) and start your acquisition.

Here is the resulting scan for the example above:

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.

Installing knobby tablet

Before you start you will need an android tablet and a wireless router in the Lab.

I have a Samsung Galaxy Tab E and an Airport Express, but other tablets and routers should work as well.

To install knobby tablet follow the following steps:

  1. Download knobby tablet from the Google Play store.
  2. Download and install the latest version of Scanbox (as always keep a copy of previous version).
  3. Download and install PyOSC.  To install, open a terminal, go to the directory where you uncompressed PyOSC, and type “python setup.py install”.
  4. Copy over the settings in the scanbox_config.m file.
  5. Connect the computer running Scanbox to your local wireless router
  6. Open a terminal window and check the IP assigned to the computer by typing ifconfig.
  7. Set the tri_knob configuration variable in scanbox_config.m to a string that contains the IP address, for example, ‘’.
  8. Start Scanbox.  You should also get a command window with the knobby tablet console.  We will check if commands from the tablet are received there.
  9. Open knobby tablet on your Android.  You will likely get a message saying that the default IP is invalid.  Click Ok.
  10. Click on the IP number button.  A keyboard will show up.  Enter the IP number you found above.  However, make sure that every section has 3 digits (use zeros if necessary).  Thus, in the example above, one would type
  11. If the tablet cannot connect, you will see an “Invalid IP” message.  Otherwise, you should be ready to go.  The IP gets stored in the tablet, so launching knobby tablet later will retrieve it.
  12. Remove the objective from the microscope (just in case).
  13. Make sure the scope is roughly in the middle of its travel for all axes.
  14. Click the “Normal” button on the tablet.  Do you see a message printed on the knobby console?  If so, communication is working Ok.  If not, something is wrong.  Contact me.
  15. Stand close to the motor box so you can quickly power it off if something does not work as expected.
  16.  Now touch the button corresponding to the Z axis on the red region.  The z-axis will begin to move so long as you keep touching it.  The speed of movement will be faster the farther away you are from the center.  Slide your finger left and right, the speed will change and it should reverse if you move over to the blue side.
  17. Test the other axes.screenshot_20161112-150708
  18. Touch “Velocity” to switch to velocity mode.
  19. Warning: the microscope will move fast now…  Touch the red or blue areas of each button.  The microscope will move at a fast/fixed speed so long as you keep touching the area.  It will stop when you release.
  20. Store/Recall buttons work as before
  21. Go back and try the Fine and Super-Fine modes.
  22. Play with it for a while and install the objective back after you familiarize yourself with the tablet interface and everything seems to be working Ok.
  23. You can minimize the knobby console once testing is done (I will do this automatically in future versions).
  24. The green buttons on the side lock the button area (bottom) or knob area (top).  So if you are acquiring data and don’t want to have a situation where people touch the tablet by mistake and move the microscope you can use the buttons to lock them.  Touching them again will unlock.
  25. Make sure you open knobby on your tablet  after you start Scanbox.

If you run into problems don’t hesitate to write.



Knobby tablet is on the Google Play Store

You can download it on any Android tablet and give it a try. I will explain how to set things up in detail after I return from SfN.

In the Lab, your tablet will need to be on the same wireless network as the desktop computer running Scanbox.  If that computer does not have a wireless card, I recommend getting this USB adapter.  That’s all you need.

I have had no problem running on Samsung Galaxy Tab or the Acer Iconia, but have not tested others.


Installing knobby

Many of you will be receiving Knobby in the mail soon.

Installing it is easy.  Just follow these steps:

  1. Connect knobby to a USB port
  2. Open the Device Manager and check which COM port # knobby was assigned to (it is the one displaying an Arduino Due board).
  3. Open Matlab, edit scanbox_config.m and set the tri_knob variable to the corresponding COM port.  Save.
  4. Start Scanbox.


As Scanbox starts up you will see a welcome message on the screen and Knobby will be initialized.  Test that all axes work properly. Finally, uninstall the 3Dconnexion software and reboot your machine.  You are done!

Let me know if you have questions…

Meet Knobby

Knobby is finally here!

Knobby provides an alternative to the 3D mouse interface for controlling the position of the microscope.

Knobby offers simultaneous control of all axes of the microscope by independent knobs (X, Y, Z and objective angle, A) and is very responsive to the user movements producing nice, smooth motion.

The position control interface appears now on a touch-screen that replaces the panel within Scanbox (which will be grayed out if you use Knobby instead of the 3D mouse).

As the layout and functionality of the touch-screen is identical to that of the Scanbox panel, users should find it very easy to make the transition.


The position of the microscope is displayed in real-time on Knobby’s screen as the knobs are turned (compared to updates at the end of each movement with the 3D mouse), so now one can easily adjust the position with sub micrometer precision in a smooth fashion.

A lock/unlock feature prevents accidentally moving the microscope by touching the knobs.

Knobby is uses a USB port to allow for communication with Scanbox and firmware upgrades.

Knobby also makes Scanbox faster by offloading position control to an external device, instead of having to handle it within the Scanbox main loop.

As mentioned earlier, Scanbox will continue to support the 3D mouse interface.

If interested in Knobby, please contact Josh.

Leaked pictures show knobby is almost ready

Leaked pictures surfaced on-line this past Friday indicating that the much anticipated release of Knobby is expected very soon.

One Scanbox user that preferred not to give his name welcomed the news: “Finally, as someone trained in patch clamp, I never liked the 3D mouse.  Turning heavy knobs that move smoothly… yes, that feels different!”

The new device features a beautiful 2.8″ capacitive touchscreen for user interaction and independent and simultaneous control of all four axes of the microscope.

The same features previously available in the 3D mouse are implemented in Knobby as well: position memory, zeroing of axes and vertical alignment of the objective, different movement movement modes (coarse/fine/super-fine).  These features are all available via the direct interaction with the unit’s touchscreen.

One advantage of Knobby is that it allows simultaneous movement along all axes and is extremely responsive to the knobs’ movements while still keeping a nice, smooth motion.

The 3D mouse interface will still be available.  A configuration variable will allow the users to select between input from the 3D mouse or Knobby.

Scanbox users that prefer the type of interaction Knobby offers rather than working with the 3D mouse should let us know (send an email to Josh) so we know so we can estimate the number of units we need.