Skip to content

Commit fc6eed4

Browse files
authored
add zadig tutorial for VSpin (#340)
1 parent 5a24d81 commit fc6eed4

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

docs/user_guide/centrifuge.md

+105
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,108 @@ The VSpin centrifuge is controlled by the {class}`~pylabrobot.centrifuge.vspin.V
4444
from pylabrobot.centrifuge import Centrifuge, VSpin
4545
cf = Centrifuge(name = 'centrifuge', backend = VSpin(bucket_1_position=0), size_x= 1, size_y=1, size_z=1)
4646
```
47+
48+
### Installation
49+
50+
The VSpin centrifuge connects to your system via a COM port. Integrating it with `pylabrobot` library requires some setup. Follow this guide to get started.
51+
52+
#### 1. Preparing Your Environment
53+
54+
- Windows:
55+
56+
##### Find Your Python Directory
57+
58+
To use the necessary FTDI `.dll` files, you need to locate your Python environment:
59+
60+
1. Open Python in your terminal:
61+
```python
62+
python
63+
>>> import sys
64+
>>> sys.executable
65+
```
66+
2. This will print a path, e.g., `C:\Python39\python.exe`.
67+
3. Navigate to the `Scripts` folder in the same directory as `python.exe`.
68+
69+
##### **Download FTDI DLLs**
70+
71+
Download the required `.dll` files from the following link:
72+
[FTDI Development Kit](https://sourceforge.net/projects/picusb/files/libftdi1-1.5_devkit_x86_x64_19July2020.zip/download) (link will start download).
73+
74+
1. Extract the downloaded zip file.
75+
2. Locate the `bin64` folder.
76+
3. Copy the files named:
77+
- `libftdi1.dll`
78+
- `libusb-1.0.dll`
79+
80+
##### Place DLLs in Python Scripts Folder
81+
82+
Paste the copied `.dll` files into the `Scripts` folder of your Python environment. This enables Python to communicate with FTDI devices.
83+
84+
- macOS:
85+
86+
Install libftdi using [Homebrew](https://brew.sh/):
87+
88+
```bash
89+
brew install libftdi
90+
```
91+
92+
- Linux:
93+
94+
Debian (rpi) / Ubuntu etc:
95+
96+
```bash
97+
sudo apt-get install libftdi-dev
98+
```
99+
100+
Other distros may have similar packages.
101+
102+
#### 2. Configuring the Driver with Zadig
103+
104+
- **This step is only required on Windows.**
105+
106+
Use Zadig to replace the default driver of the VSpin device with `libusbk`:
107+
108+
1. **Identify the VSpin Device**
109+
110+
- Open Zadig.
111+
- To confirm the VSpin device, disconnect the RS232 port from the centrifuge while monitoring the Zadig device list.
112+
- The device that disappears is your VSpin, likely titled "USB Serial Converter."
113+
114+
2. **Replace the Driver**
115+
- Select the identified VSpin device in Zadig.
116+
- Replace its driver with `libusbk`.
117+
- Optionally, rename the device to "VSpin" for easy identification.
118+
119+
> **Note:** If you need to revert to the original driver for tools like the Agilent Centrifuge Config Tool, go to **Device Manager** and uninstall the `libusbk` driver. The default driver will reinstall automatically.
120+
121+
#### 3. Finding the FTDI ID
122+
123+
To interact with the centrifuge programmatically, you need its FTDI device ID. Use the following steps to find it:
124+
125+
1. Open a terminal and run:
126+
```bash
127+
python -m pylibftdi.examples.list_devices
128+
```
129+
2. This will output something like:
130+
```
131+
FTDI:USB Serial Converter:FTE0RJ5T
132+
```
133+
3. Copy the ID (`FTE0RJ5T` or your equivalent).
134+
135+
#### **4. Setting Up the Centrifuge**
136+
137+
Use the following code to configure the centrifuge in Python:
138+
139+
```python
140+
from pylabrobot import Centrifuge
141+
from pylabrobot.backends.vspin import VSpin
142+
143+
# Replace with your specific FTDI device ID and bucket position for profile in Agilent Centrifuge Config Tool.
144+
backend = VSpin(bucket_1_position=6969, device_id="XXXXXXXX")
145+
centrifuge = Centrifuge(backend=backend)
146+
147+
# Initialize the centrifuge.
148+
await centrifuge.setup()
149+
```
150+
151+
You’re now ready to use your VSpin centrifuge with `pylabrobot`!

0 commit comments

Comments
 (0)