Uploaded July 2022 | Updated September 2026, 27 minutes ago
A Python script that automates control of a Kinesis® K-Cube® motor controller and a power meter is written using Visual Studio® Code. The program acquires optical power measurements from the power meter as the rotation mount's angle sweeps through 180°, which is required to characterize a variable optical attenuator. Since this code uses libraries developed using the .NET framework, running this code requires Python.NET to be installed.
This tutorial implements the code specific to the K-Cube motor controller first, followed by the code for the power meter. The packages and classes required by both devices are identified, and the steps required to initialize and complete shutdown for both devices are shown. In addition, an approach is described for acquiring power readings and checking controller status while the motor is moving. The Python script is executed once after the K-Cube section of the code is complete, and a second time after the program is finished.
The K-Cube motor controller and power meter were automated in order to characterize the optical power transmitted through a pair of fixed, crossed linear polarizers when a rotating half-wave plate is located between them. As the half-wave plate rotates, the polarization orientation of the light transmitted by the output polarizer remains constant, while the transmitted power varies sinusoidally. Measurements of this transmitted optical power, as well as the corresponding rotation angles of the mount in which the half-wave plate is secured, are provided by the program.
The Python code demonstrated during this video can be downloaded from Thorlabs' official GitHub account: github.com/Thorlabs/Motion_Control_Examples/tree/main/Python/KCube
00:00 Introduction
00:35 Variable Optical Attenuator Overview
01:45 Brief Discussion of Project Setup
02:21 Packages and Classes for K-Cube
03:51 Initialize K-Cube Motor Controller
07:20 Home the Rotation Mount
07:46 Move the Rotation Mount
09:38 Controller Shutdown
10:00 Test Run of Rotation Mount Code
10:28 Packages and Classes for Power Meter
11:50 Initialize Power Meter
14:10 Acquire and Display Power Readings
16:37 Execute Complete Program
Components used in this demonstration include:
- Thorlabs' software download page: thorlabs.com/software_pages/ViewSoftwarePage.cfm?Code=Motion_Control&YVI=24
- KDC101 K-Cube Brushed DC Servo Motor Controller: thorlabs.com/newgrouppage9.cfm?objectgroup_id=2419&pn=KDC101&YVI=24
- PRM1Z8 Motorized Rotation Stage: thorlabs.com/newgrouppage9.cfm?objectgroup_id=2875&pn=PRM1Z8&YVI=24
- PL202 Compact Laser Module: thorlabs.com/newgrouppage9.cfm?objectgroup_id=12994&pn=PL202&YVI=24
- AD11F Adapter (Laser to Mount): thorlabs.com/newgrouppage9.cfm?objectgroup_id=219&pn=AD11F&YVI=24
- KM100T Threaded Kinematic Mount: thorlabs.com/newgrouppage9.cfm?objectgroup_id=1492&pn=KM100T&YVI=24
- PRM1 Manual Rotation Mount: thorlabs.com/newgrouppage9.cfm?objectgroup_id=990&pn=PRM1&YVI=24
- Linear Polarizers: thorlabs.com/navigation.cfm?guide_id=2459&YVI=24
- Wave Plates: thorlabs.com/navigation.cfm?guide_id=23&YVI=24
- S121C Photodiode Power Sensor: thorlabs.com/newgrouppage9.cfm?objectgroup_id=3328&pn=S121C&YVI=24
- PM400 Optical Power Meter: thorlabs.com/newgrouppage9.cfm?objectgroup_id=10562&pn=PM400&YVI=24
- 1" Diameter Lens Tubes: thorlabs.com/newgrouppage9.cfm?objectgroup_id=3307&YVI=24
- SM1RC Slip-Ring Mount for SM1 Lens Tubes: thorlabs.com/newgrouppage9.cfm?objectgroup_id=1533&pn=SM1RC&YVI=24
- BA2 Mounting Base: thorlabs.com/newgrouppage9.cfm?objectgroup_id=47&pn=BA2&YVI=24
- FSR3 Fiber Storage Reel: thorlabs.com/newgrouppage9.cfm?objectgroup_id=2685&pn=FSR3&YVI=24
For more photonics how-to videos, visit thorlabs.com/newgrouppage9.cfm?objectgroup_id=14062&YVI=24
A Python script that automates control of a Kinesis® K-Cube® motor controller and a power meter is written using Visual Studio® Code. The program acquires optical power measurements from the power meter as the rotation mount's angle sweeps through 180°, which is required to characterize a variable optical attenuator. Since this code uses libraries developed using the .NET framework, running this code requires Python.NET to be installed.
This tutorial implements the code specific to the K-Cube motor controller first, followed by the code for the power meter. The packages and classes required by both devices are identified, and the steps required to initialize and complete shutdown for both devices are shown. In addition, an approach is described for acquiring power readings and checking controller status while the motor is moving. The Python script is executed once after the K-Cube section of the code is complete, and a second time after the program is finished.
The K-Cube motor controller and power meter were automated in order to characterize the optical power transmitted through a pair of fixed, crossed linear polarizers when a rotating half-wave plate is located between them. As the half-wave plate rotates, the polarization orientation of the light transmitted by the output polarizer remains constant, while the transmitted power varies sinusoidally. Measurements of this transmitted optical power, as well as the corresponding rotation angles of the mount in which the half-wave plate is secured, are provided by the program.
The Python code demonstrated during this video can be downloaded from Thorlabs' official GitHub account: github.com/Thorlabs/Motion_Control_Examples/tree/main/Python/KCube
00:00 Introduction
00:35 Variable Optical Attenuator Overview
01:45 Brief Discussion of Project Setup
02:21 Packages and Classes for K-Cube
03:51 Initialize K-Cube Motor Controller
07:20 Home the Rotation Mount
07:46 Move the Rotation Mount
09:38 Controller Shutdown
10:00 Test Run of Rotation Mount Code
10:28 Packages and Classes for Power Meter
11:50 Initialize Power Meter
14:10 Acquire and Display Power Readings
16:37 Execute Complete Program
Components used in this demonstration include:
- Thorlabs' software download page: thorlabs.com/software_pages/ViewSoftwarePage.cfm?Code=Motion_Control&YVI=24
- KDC101 K-Cube Brushed DC Servo Motor Controller: thorlabs.com/newgrouppage9.cfm?objectgroup_id=2419&pn=KDC101&YVI=24
- PRM1Z8 Motorized Rotation Stage: thorlabs.com/newgrouppage9.cfm?objectgroup_id=2875&pn=PRM1Z8&YVI=24
- PL202 Compact Laser Module: thorlabs.com/newgrouppage9.cfm?objectgroup_id=12994&pn=PL202&YVI=24
- AD11F Adapter (Laser to Mount): thorlabs.com/newgrouppage9.cfm?objectgroup_id=219&pn=AD11F&YVI=24
- KM100T Threaded Kinematic Mount: thorlabs.com/newgrouppage9.cfm?objectgroup_id=1492&pn=KM100T&YVI=24
- PRM1 Manual Rotation Mount: thorlabs.com/newgrouppage9.cfm?objectgroup_id=990&pn=PRM1&YVI=24
- Linear Polarizers: thorlabs.com/navigation.cfm?guide_id=2459&YVI=24
- Wave Plates: thorlabs.com/navigation.cfm?guide_id=23&YVI=24
- S121C Photodiode Power Sensor: thorlabs.com/newgrouppage9.cfm?objectgroup_id=3328&pn=S121C&YVI=24
- PM400 Optical Power Meter: thorlabs.com/newgrouppage9.cfm?objectgroup_id=10562&pn=PM400&YVI=24
- 1" Diameter Lens Tubes: thorlabs.com/newgrouppage9.cfm?objectgroup_id=3307&YVI=24
- SM1RC Slip-Ring Mount for SM1 Lens Tubes: thorlabs.com/newgrouppage9.cfm?objectgroup_id=1533&pn=SM1RC&YVI=24
- BA2 Mounting Base: thorlabs.com/newgrouppage9.cfm?objectgroup_id=47&pn=BA2&YVI=24
- FSR3 Fiber Storage Reel: thorlabs.com/newgrouppage9.cfm?objectgroup_id=2685&pn=FSR3&YVI=24
For more photonics how-to videos, visit thorlabs.com/newgrouppage9.cfm?objectgroup_id=14062&YVI=24







![Distinguish the Fast and Slow Axes of a Quarter-Wave Plate | Thorlabs Insights
A wave plate has two axes, and light polarized parallel to the slow axis is delayed more than light polarized parallel to the orthogonal fast axis. The wave plates retardance determines the delay difference. A couple of crossed polarizers can be used to locate an axis (https://youtu.be/P0asuzX4x-Q) but cannot identify the axis as fast or slow. However, by including a mirror in the setup and comparing optical power measurements with calculated values, it is possible to distinguish between the fast and slow axes of a quarter-wave plate. Note that this technique cannot be used to distinguish the fast and slow axes of a half-wave plate.
The video includes an overview of the measurement setup and discussion of the conventions used to align and orient the optical components. The accurate interpretation of the results depends on these details, including whether the transmission axes of the generating and analyzing polarizers are parallel or orthogonal (crossed). Crossed polarizers are used in this demonstration, in contrast to a paper [1] that also describes the technique.
The fast and slow axes of the quarter-wave plate are identified by comparing measurements of the power transmitted through the system to a pair of theoretical curves. The Fresnel reflection equations, as well as other equations, needed to compute these curves are provided. The refractive index of the reflective surface is required to generate these curves. Be aware that complex refractive indices can be written with a positive or a negative sign before the imaginary part, depending on the preferred convention. While either option is compatible with this approach, the chosen sign affects the interpretation of the curves. In this demonstration, the positive-sign convention was chosen.
[1] Petre Cătălin Logofătu, Simple method for determining the fast axis of a wave plate, Opt. Eng. 44, 3316-3318 (2002).
00:00 - Introduction
01:04 - Circular Polarization and Handedness Conventions
03:14 - Experimental Set Up
05:50 -Overview of the System and its Model Equations
07:01 - Power Measurements Acquired
07:31 - Fast Axis Distinguished from Slow Axis
Components used in this demonstration include:
- HeNe Laser: https://www.thorlabs.com/navigation.cfm?guide_id=125&YVI=14
- Optical Isolator: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_ID=2996&YVI=14
- Linear Polarizers: https://www.thorlabs.com/navigation.cfm?guide_id=2459&YVI=14
- PRM1 Rotation Mount: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=990&pn=PRM1&YVI=14
- Wave Plates: https://www.thorlabs.com/navigation.cfm?guide_id=23&YVI=14
- WPMQ05M-633 Quarter-Wave Plate: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=713&pn=WPMQ05M-633&YVI=14
- PF10-03-M03 Unprotected Gold Mirror: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=8851&pn=PF10-03-M03&YVI=14
- KM100 Mirror Mount: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=1492&pn=KM100&YVI=14
- SM1D12D Iris: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=1479&pn=SM1D12D&YVI=14
- SM1L20 Lens Tube: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=3307&pn=SM1L20&YVI=14
- SM1QA Quick-Release Lens Tube Adapter:
https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=3758&pn=SM1QA&YVI=14
- S130C Power Sensor: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=3328&pn=S130C&YVI=14
- PM400 Power Meter: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=10562&pn=PM400&YVI=14
For more photonics how-to videos, visit https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=14062&YVI=14 Distinguish the Fast and Slow Axes of a Quarter-Wave Plate | Thorlabs Insights](https://i.ytimg.com/vi/XQwiPm5OtSk/mqdefault.jpg)


