The Thorlabs KST101 KCube Stepper Motor Controller can be controlled via USB communication.
Please download and install the Thorlabs Kinesis Software, which installs .dll files necessary to communicate with the inertial motor. This means you'll also need a computer running on Windows OS. Make sure to choose the right 32-bit or 64-bit version.
Below, we provide an example showing you how to communicate with your stepper motor controller. The API is implemented as a wrapper on top of Thorlabs .dll.
import time
from tlkst101 import TLKST101
def main():
dll_path = "path/to/your/dll/file" # Replace with the path to your DLL file.
serial_number = "28000322" # Replace with your KST101's serial number
kst101 = TLKST101(serial_number, dll_path)
# Connect to the device
kst101.connect()
print(f"Connected to KST101 with serial number: {serial_number}")
# Home the device
kst101.home()
print("Homed KST101")
# Move the device to an absolute position in real-world units
position = 10
kst101.move_to_position_real_units(position)
print(f"Moved KST101 to position {position}")
# Wait for 2 seconds
time.sleep(2)
# Get the current position
current_position = kst101.get_position()
print(f"Current position of KST101: {current_position}")
# Disconnect from the device
kst101.disconnect()
print(f"Disconnected from KST101 with serial number: {serial_number}")
if __name__ == "__main__":
main()
This example code does the following:
Make sure to replace the dll_path variable with the correct path to your DLL file and serial_number with your KST101's serial number. Typically, the dll files are located in C:\Program Files\Thorlabs\Kinesis
.