A python module to interface lab equipment that communicate with the Thorlab APT protocol
The package is for now on test_pypi it will be moved on pypi in times !
The package is based on the library pyftdi which uses libusb 1.x
as a native dependency and thus should be installed.
apt-get install libusb-1.0
Udev rules need to be created to communicate with devices without using administrator privilege.
A special rule 11-ftdi.rules
is available in the rules
directory (it might be necessary to adapt it if you want to use different devices than mine), you can copy it to /etc/udev/rules.d
and run the following command as root :
udevadm control --reload-rules
udevadm trigger
The easiest way is to install zadig (it will detect ftdi device automatically)
- Start up the Zadig utility
- Select
Options/List All Devices
, then select the FTDI devices you want to communicate with. Its names depends on your hardware, i.e. the name stored in the FTDI EEPROM.
- With FTDI devices with multiple channels, such as FT2232 (2 channels) and FT4232 (4 channels), you must install the driver for the composite parent, not for the individual interfaces. If you install the driver for each interface, each interface will be presented as a unique FTDI device and you may have difficulties to select a specific FTDI device port once the installation is completed. To make the composite parents to appear in the device list, uncheck the
Options/Ignore Hubs or Composite Parents
menu item. - Be sure to select the parent device, i.e. the device name should not end with (Interface N), where N is the channel number.
- for example Dual RS232-HS represents the composite parent, while Dual RS232-HS (Interface 0) represents a single channel of the FTDI device. Always select the former.
- Select
libusb-win32
(notWinUSB
) in the driver list. - Click on
Replace Driver
Finally, run the following command to install my package (only in test.pypi for now).
pip install --extra-index-url https://test.pypi.org/simple/ apt-interface
#pip install apt-interface
The package is composed for now of 4 differents files and modules:
device.py
with classDevice
a low level communication class with APT devicesKPZ101.py
with classKPZ101
andKPZ101Config
a module with multiple function to control KPZ101 devicesKSG101.py
with classKSG101
andKSG101Config
a module with multiple function to control KSG101 devicesscan.py
with classScan
andScanConfig
a module to generate coordinates and follow them with a KPZ101 device
Here is a simple configuration for a KPZ device
name: X_axis_controller
serial_nm: "29501986"
baudrate: 115200
mode: open_loop
voltage_limit: 75
from apt_interface.KPZ101 import KPZ101
with KPZ101(config_file="config_KPZ.yaml") as kpz:
print(kpz.conf)
print(kpz.get_info())
kpz.identify() # Should make the screen of the specified KPZ blink
print("Warning High Voltage")
kpz.enable_output()
kpz.set_output_voltage(20) # The KPZ needs to be configured in open_loop for voltage control
The full documentation is available here (not finished yet and only in french for now)
Feel free to create pull requests and add support for other devices, i will try my best to review the code and merge changes in time! You can as well add issues for any problem you encounter with implemented functions. The documentation for APT protocol is available here.