Create an Account  |   Log In

View All »Matching Part Numbers


Your Shopping Cart is Empty
         

Kinesis® with LabVIEW


Kinesis® with LabVIEW
  • Use Kinesis with LabVIEW
  • Download Example Virtual Instruments

KDC101 WinForm User Interface in LabVIEW

MAX301 3-Axis Flexure Stage with a Stepper Motor, Thumbscrew, and Differential Actuator Attached to the X, Y, and Z Axes, Respectively

KDC101

DC Servo Motor Controller

MTS50-Z8

50 mm DC Servo Translation Stage



Please Wait

LabVIEW is a graphical programming interface which can be used to communicate with any Thorlabs Kinesis®-compatible controller through the use of component Kinesis .NET controls. These .NET controls are a part of the Kinesis Motion Control software package.

This tutorial contains annotated LabVIEW VI examples for interfacing with Thorlabs’ Kinesis software. These examples make use of the Controls.dll file included with the Kinesis software installation package. This dynamic link library (DLL) assembly includes a collection of WinForms controls that hosts the Kinesis User Interface elements and underlying device functionality. These controls provide a straightforward way to start working with Thorlabs’ Kinesis software in LabVIEW.

Section Tab Contents:

  • LabVIEW: Overview of Basic Information to Consider When Using Kinesis with LabVIEW
  • Getting Started: Instructions on Software Installation Prior to Using the Example VIs
  • Example VIs: Sample Code for a Selection of Thorlabs Controllers
  • DLLs: Information on Loading Additional DLLs for Increased Functionality
  • Other Programs: Tutorial and Sample Code for Interfacing Kinesis with C#

A comprehensive guide to using Kinesis with LabVIEW can be downloaded here or by clicking the button to the right. It provides step-by-step instructions to create a custom Kinesis .NET control VI in LabVIEW.

LabVIEW GUI
Click to Enlarge

Figure 1: A Kinesis Device Panel UI ‘View’ Can Be Hosted in the LabVIEW Front Panel
LabVIEW GUI
Click to Enlarge

Figure 2: A Basic Block Diagram VI for Initializing and Closing Communication with a 
Kinesis Compatible Device
LabVIEW GUI
Click to Enlarge

Figure 3: For Multi-Channel Device Types, the ‘Channel Number’ Property Must Be 
Assigned in the Block Diagram to Correctly Initialize Each Device Channel

LabVIEW

LabVIEW can be used to communicate with any Thorlabs Kinesis® compatible controller via Kinesis .NET dlls. Of the numerous dynamic link libraries (.dlls) included, the ‘Controls.dll’ provides a collection of .NET WinForms User Controls which can host the device user interface (UI) elements and provide access to the device methods and properties.

For example, the Kinesis graphical user interface (GUI) for the KDC101 K-Cube DC Servo controller is shown in Figure 1. This ‘View’ (UI), as seen in the Kinesis.exe application, can be hosted in the LabVIEW front panel, while providing the user access to back-end Kinesis .NET methods and properties in the LabVIEW block diagram.

By inserting the .NET ‘Controls.dll’ into the LabVIEW front panel, the user will be able to load a user interface for any Kinesis compatible device. Considering the example of a KDC101 K-Cube DC Servo controller, this device UI can be initialized by providing the serial number of the device and selecting CreateDevice(), as illustrated in Figure 2. This will create the device connection and display the UI seen in Figure 1.

Controllers that have a multi-channel architecture, such as the BSC202 Benchtop Controller and the MPZ601 Rack Module Controller, must also have the Channel Number specified. In the example shown in Figure 3, two separate UI panels are created (one for each channel) which can be operated independently of one another.

A range of downloadable, annotated example VIs can be found in the Example Vis tab. The examples provided are related to specific controllers and are organized by hardware type (i.e. Motor, Piezo and Piezo Motor, and Strain Gauge Reader). A Simulator VI is also provided which will enable connection to the Kinesis Simulator Application. The examples are saved as LabVIEW 2012 compatible examples.

For tips on building your own VIs with Thorlabs Motion Control Hardware, please see our comprehensive Kinesis LabVIEW Guide.

For any questions or comments about these examples, please contact Tech Support.

 

LabVIEW GUI
Click to Enlarge

Figure 6: The Device ‘View’ Hosted in the Front Panel
LabVIEW GUI
Click to Enlarge

Figure 5: Select the .NET Control Based on the 
Device Type You Are Using
LabVIEW GUI
Click to Enlarge

Figure 4: Insert the
.NET Container into the
LabVIEW Front Panel

Inserting a .NET Control

  1. Right-click on the front panel, then select '.NET container' and place the container on the front panel (Figure 4).
  2. Right-click on the .NET container and select 'Insert .NET control...'.
  3. In the 'Select .NET Control' window, click 'Browse...'.
  4. Browse for and select 'Thorlabs.MotionControl.Controls.dll', located in the user's LabVIEW project folder.
  5. In the 'Controls' list, select the controller that will be used (Figure 5).
  6. The LabVIEW front panel will now display the Kinesis device's user interface (Figure 6). The device methods and properties can now be accessed via the block diagram. Please note that the device UI will appear as ‘Disconnected’ until the VI is running and the control has been initialized.

 

LabVIEW GUI
Click to Enlarge

Figure 9: Insert Properties and
Methods via the Functions Palette

Accessing a Property or Method

The Control reference node provides access to the Control methods and properties, such as CreateDevice() and CloseDevice(). Right-clicking the node will enable you to initialize or close communications with the device. CloseDevice() will close communications, shut down the .NET library, and reset the UI when the session terminates.

The Device methods and properties can be accessed through the Device property reference, as shown in Figure 7. In the case of T-cube and K-cube type devices, this property is 'Device'. In the case of Rack Module and Benchtop type hardware, device properties and methods can be accessed from the device type specific property label, i.e. 'ModularPiezo' or 'BenchtopStepperMotor', as shown in Figure 8.

Alternatively, LabVIEW .NET connectivity functions allow you to create and interact with the Kinesis .NET SDK. Through the Functions Palette, select "Connectivity > .NET" to access all functions used to interact with .NET objects (Figure 9).

For more information on LabVIEW .NET connectivity, please refer to the Kinesis LabVIEW guide.

LabVIEW GUI
Click to Enlarge

Figure 7: Access Properties and Methods via the Device Property
Reference
LabVIEW GUI
Click to Enlarge

Figure 8: Accessing Properties and Methods from K-Cube,
Modular Rack and Benchtop Device Formats

 

LabVIEW GUI
Figure 10: Register Events Such as MotorStateUpdate in the Front Panel

Working with Events

An Event Callback VI is created using the Register Event Callback Function in LabVIEW. This will cause a VI to be called under specified conditions. Some basic events include Motor Status Updates (Figure 10), Connection Change Events, Settings Update Events, or Error Update Events. These events are detailed further in the Kinesis .NET API. An example of this is provided in the KDC101 Motor Status Changed tutorial where a programmed response appears when the Motor State changes.

LabVIEW GUI
The Kinesis DLLs (such as those contained in the partial list above) must be copied into your LabVIEW project folder.

Getting Started

Complete the following steps before using the example virtual instruments in the Example VIs tab:

  1. Install the Kinesis software. Ensure that the version of Kinesis/component DLLs is of the correct bit type, depending on the version of LabVIEW and the operating system. The included examples were built using Thorlabs' Motion Control Software v1.14.12.
  2. For the example VIs to run successfully, manually copy the component DLLs from the Kinesis install folder to the “Kinesis LabVIEW Examples” folder. The Controls.dll will typically require all Kinesis DLLs to be copied into the project folder.
  3. Open the VI through the 'LabVIEW Project Explorer' to correctly load the User Interface from the Thorlabs.MotionControl.Controls.dll.

 

Example VIs - Front Panel Overview

A LabVIEW VI contains two windows for building applications; a Front Panel and Block Diagram. The LabVIEW Front Panel contains the front end User Interface components of the VI. The Front Panel of each Example VI has been formatted to contain instructions and features which make these VIs easy-to-use. An overview of these features along with some of the key interface features of the LabVIEW Front Panel are outlined below.

Legend:

  1. LabVIEW Toolbar, Where the VI is Run
  2. Name of Device the Example Utilizes, Along with Webpage Link
  3. Introduction and Step-by-Step Instructions for the Example VI
  4. Functioning Front Panel Controls and Indicators (Please note that the device UI will appear as ‘Disconnected’ until the your VI is running and the control has been initialized.)
  5. Tips to Consider When Running the Example VI

LabVIEW GUI

LabVIEW Sample VIs


Click here or on the button to the left to download the Kinesis LabVIEW example VIs. The examples are saved as LabVIEW 2012 compatible VIs.

Please note: The Kinesis LabVIEW VI examples are intended to be used to rapidly connect and control key Thorlabs devices. They are not intended to be a demonstration of good programming practices. Many programming techniques are omitted for the sake of simplicity, such as setting directories and error handling.

Example VIs
Item #, Type Example Name Description
Motor Controllers
KDC101
K-Cube, Brushed DC Servo
Build Device List The example VIs require you to enter the serial number of your device manually. This VI, however, will build a list of connected devices and wait until the user has selected the serialized device to control.
Connect Demonstrates how to initialize communication with and then disconnect from the KDC101 in order to control DC brushed stages and actuators.
Get Position Get Position will poll the device position through the GetPositionCounter() method which will output the stage position in device units. This can be converted from device units (encoder counts) to real world units (mm) by considering encoder counts per revolution of the motor, gearbox ratios and leadscrew pitch.
Motor Status Changed This VI enables you to make use of motor events. These events include motor status updates, connection change events, settings update events, and error update events. This VI utilizes the motor status update. An event callback sub-VI is built using the register event callback function in LabVIEW.
Move Absolute This VI will allow you to home the device and move it to a chosen position.
No Front Panel This VI shows how to communicate with Thorlabs Motion Control devices outside of the provided WinForms UI controls contained in the Thorlabs.MotionControl.Controls.dll. This VI focuses on the wider range of generic and device-specific component DLLs included with your Kinesis installation.
KBD101
K-Cube, Brushless DC Servo
Get Status Bits This VI will poll status bits through use of the GetStatusBits method.
Set Trigger Parameters Enables exploration of the trigger parameters available to all Thorlabs K-Cube devices.
Set Velocity Parameters This VI monitors and sets the current velocity parameters of the connected device.
BBD202
Benchtop, Brushless DC Servo
Two-Axis Scan This VI will perform a 2D square raster scan, moving in a forward direction from a user defined start position. The user can set the number of steps and step size, as well as how long the stage rests at a scanned position.
KST101
K-Cube, Stepper
Move Relative This VI allows homing of the device and moving forward (clockwise) or backward (counterclockwise) at any valid distance from the homing position.
Piezo / Piezo Motor Controllers
KPZ101
K-Cube, Piezo Controller
Connect Demonstrates how to connect with and disconnect from the KPZ101 Piezo Controller.
Waveform LUT Enables use of the LUTWave functionality available to piezo-actuated devices not included within the Controls.dll. Taking advantage of the built-in Sine Waveform.VI of LabVIEW, the device can output a sine waveform with a scalable amplitude. Details of this functionality are outlined in the LUTWaveParams() structure within the .NET API.
KPZ101 w/ KSG101
K-Cube, Piezo Controller and Strain Gauge Reader
Set Position Demonstrates open- and closed-loop operation of the KPZ101 Piezo controller when used with the KSG101 Strain Gauge controller. When in open-loop mode, the user can adjust the voltage of the piezo stack. When in closed-loop mode, the position can be set by using the SetPercentageTravel() function.
BPC301
Benchtop, 1 Channel Piezo Controller
Connect Demonstrates how to connect with and then disconnect from the BPC301 controller.
Waveform LUT Enables use of the LUTWave functionality available to piezo-actuated devices not included within the Controls.dll. Taking advantage of the built-in Sine Waveform.VI of LabVIEW, the device can output a sine waveform with a scalable amplitude. Details of this functionality are outlined in the LUTWaveParams() structure within the .NET API.
BPC303
Benchtop, 3 Channel Piezo Controller
Two-Axis Scan Perform a 2D square raster scan for pre-selected channels on a BPC303 unit. This VI also includes the error handling cluster, which prints error messages and their corresponding codes.
MPZ601
Rack, Modular 2 Channel Piezo Controller
Connect Demonstrates how to connect to and safely disconnect from the MPZ601 controller.
PPC001, PPC102a
Benchtop, Precision Piezo Controller
Continuous Scan This VI will enable you to connect to devices and linearly increment the piezo position at a user specified delay and step size. This VI will step the stage forward 5000 steps, and then backward 5000 steps. This example applies to the PFM450E, and LPS710Ea.
KIM101
K-Cube, Inertial Piezo Controller
Set Jog Set Jog enables the user to set Jog parameters and toggle the Jog mode, as well as assert control over a particular channel of the KIM101 controller.
Strain Gauge Reader
KSG101
K-Cube, Strain Gauge Reader
Get Max Travel Range This VI enables the user to retrieve the maximum travel for the connected strain gauge controller.
Get Reading Get Reading sets the current display mode to either position, force, or voltage mode, and acquires a reading based on the selected mode.
Nanotrak® Auto-Alignment Controllers
KNA-VIS, KNA-IR
K-Cube, Nanotrak Controller
Latch Trak This VI enables the user to set the operating mode to track or latch.
Set Circle Diameter This VI enables the user to set the scan circle diameter in the range of 0 to 10 NT units.
Set Loop Gain This VI enables the user to set and get the loop gain. This can be set between 0 and 32767.
Set Phase Component This VI enables the user to set the H- and V-components of the phase compensation or angle of the circle path.
BNT001/IR
Benchtop, Nanotrak Controller
Connect Demonstrates connecting to and safely disconnecting from a BNT001 device.
Set Circle Home Position This VI enables the user to set the scanning circle home position, through the GetCircleHomePosition() method.
MNA601 w/ MST602
Rack, Nanotrak Controller with Stepper Motor Controller
Two-Axis Scan Demonstrates connecting to an MNA601 and an MST602 conroller for an automated fiber alignment setup. When paired with a stepper actuated flexure stage, such as the MAX381, this system provides users with automated fiber alignment control. This VI will initiate a simple 2D raster scan of the MPZ601 piezo outputs. This will stop once the MNA601 has detected a sufficient photocurrent.
Two-Axis Revector Demonstrates connecting to an MNA601 and an MST602 conroller for an automated fiber alignment setup. When paired with a stepper actuated flexure stage, such as the MAX381, this system provides users with automated fiber alignment control. This VI will initiate a simple 2D raster scan of the MPZ601 piezo outputs. This will stop once the MNA601 has detected a sufficient photocurrent.
MNA601 w/ MPZ601
Rack, Nanotrak Controller
Two-Axis Scan Demonstrates connecting to an MNA601 and an MST602 conroller for an automated fiber alignment setup. When paired with a stepper actuated flexure stage, such as the MAX381, this system provides users with automated fiber alignment control. This VI will initiate a simple 2D raster scan of the MPZ601 piezo outputs. This will stop once the MNA601 has detected a sufficient photocurrent.
Solenoid Controller
KSC101
K-Cube, Solenoid Controller
Set Operating Mode This VI will set the device to 'Auto' mode. In this mode, the solenoid will open and close continuously after the top panel wheel is moved up (primed). You are able to alter the settings of this mode by using the 'Set Operating Mode' button. The progam will poll for updates to the 'Set Operating Mode' button controlling a case structure in the block diagram. If initiated, the parameters of 'Auto' mode entered into the below controls will cause the device settings to be updated accordingly.
Laser Sources
KLS635KLS1550
K-Cube, Laser Sources
Set Power Demonstrates setting the laser output On/Off, as well as setting the output power of the laser source.
Simulator
Simulated Hardware
- This simulation enables you to insert a VI and make use of simulated hardware via the Kinesis simulator application.
  • These controllers are included with our PFM450E Objective Scanner and LPS710E(/M) Z-Axis Translation Stage.

While the focus of this tutorial is using the WinForms User Controls library (Controls.dll) as a straightforward way to load a UI panel and utilize Thorlabs' Kinesis hardware, it is possible to access the more advanced functionality contained within other .NET DLLs included with the Kinesis software installation. This functionality is outlined in detail within the Kinesis .NET API help file.

The following examples from the Example Vis tab make use of functionality outside of the Controls.dll library:

  • KDC101 - No Front Panel
  • BPC301 - Waveform LUT
  • KPZ101 - Waveform LUT
  • KPZ101 w/ KSG101 - Set Position
LabVIEW GUI
The BuildDeviceList method can be accessed by dropping in a DeviceManagerCLI Constructor Node.
LabVIEW GUI
Accessing Methods within the "KCube.DCServo.dll" Directly

Thorlabs' Kinesis® software features .NET controls which can be used by 3rd party developers working in the C#, Visual Basic, LabVIEW™, or .NET compatible languages to create custom applications. This software supports our new line of Kinesis devices, as well as our APT™ products. All Kinesis controllers are supported by unified graphical user interfaces (GUIs) and programming APIs that enable the creation of custom applications. The included USB connectivity provides easy 'Plug-and-Play' PC-controlled operation, making it easy to link multiple units together to realize a multi-axis motion control solution.

Examples that utilize C# to communicate with Thorlabs' Kinesis software are found below.

Tutorials

C#
This programming language is designed to allow multiple programming paradigms, or languages, to be used, thus allowing for complex problems to be solved in a simple or efficient manner. It encompasses typing, imperative, declarative, functional, generic, object-oriented, and component-oriented programming. By providing functionality with this common software platform, Thorlabs has ensured that users can easily mix and match any of the Kinesis controllers in a single application, while only requiring knowledge of a single set of software tools. In this way, it is feasible to combine any of the controllers from the low-powered, single-axis to the high-powered, multi-axis systems and control all from a single, PC-based unified software interface.

The Kinesis System Software allows two methods of usage: graphical user interface (GUI) utilities for direct interaction and control of the controllers 'out of the box', and a set of programming interfaces that allow custom-integrated positioning and alignment solutions to be easily programmed in the development language of choice.

For a collection of example projects that can be compiled and run to demonstrate the different ways in which developers can build on the Kinesis motion control libraries, click on the links below. Please note that a separate integrated development environment (IDE) (e.g., Microsoft Visual Studio) is required to execute the Quick Start examples. The C# example projects can be executed using the included .NET controls in the Kinesis software package (see the Kinesis Software tab for details).

C Sharp Icon Click Here for C# Example Projects
Click Here for Quick Start Device Control Examples
C Sharp Icon

Posted Comments:
No Comments Posted
Log In  |   My Account  |   Contact Us  |   Careers  |   Privacy Policy  |   Home  |   FAQ  |   Site Index
Regional Websites: West Coast US | Europe | Asia | China | Japan
Copyright 1999-2019 Thorlabs, Inc.
Sales: 1-973-300-3000
Technical Support: 1-973-300-3000


High Quality Thorlabs Logo 1000px:Save this Image