py4200A 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py4200a-0.1.0/LICENSE +21 -0
- py4200a-0.1.0/PKG-INFO +282 -0
- py4200a-0.1.0/README.md +231 -0
- py4200a-0.1.0/__init__.py +15 -0
- py4200a-0.1.0/py4200A.egg-info/PKG-INFO +282 -0
- py4200a-0.1.0/py4200A.egg-info/SOURCES.txt +31 -0
- py4200a-0.1.0/py4200A.egg-info/dependency_links.txt +1 -0
- py4200a-0.1.0/py4200A.egg-info/requires.txt +6 -0
- py4200a-0.1.0/py4200A.egg-info/top_level.txt +1 -0
- py4200a-0.1.0/pyproject.toml +56 -0
- py4200a-0.1.0/setup.cfg +4 -0
- py4200a-0.1.0/src/KI4200A.py +379 -0
- py4200a-0.1.0/src/__init__.py +0 -0
- py4200a-0.1.0/src/boards/Board.py +115 -0
- py4200a-0.1.0/src/boards/CVU.py +49 -0
- py4200a-0.1.0/src/boards/PMU_RPM.py +55 -0
- py4200a-0.1.0/src/boards/SMU.py +581 -0
- py4200a-0.1.0/src/boards/__init__.py +6 -0
- py4200a-0.1.0/src/consts.py +78 -0
- py4200a-0.1.0/src/error/KXCIConsoleError.py +23 -0
- py4200a-0.1.0/src/error/KXCILimitationError.py +23 -0
- py4200a-0.1.0/src/error/__init__.py +4 -0
- py4200a-0.1.0/src/instrcomms.py +207 -0
- py4200a-0.1.0/src/realtime/RT_KI4200A.py +139 -0
- py4200a-0.1.0/src/realtime/RT_PMU_RPM.py +47 -0
- py4200a-0.1.0/src/realtime/RT_SMU.py +166 -0
- py4200a-0.1.0/src/realtime/__init__.py +6 -0
- py4200a-0.1.0/src/realtime/consts.py +60 -0
- py4200a-0.1.0/src/results/BlobDependent.py +149 -0
- py4200a-0.1.0/src/results/Display.py +79 -0
- py4200a-0.1.0/src/results/Measurement.py +171 -0
- py4200a-0.1.0/src/results/__init__.py +5 -0
py4200a-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Roucool_PvP
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
py4200a-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py4200A
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python interface for the Keithley 4200A Semiconductor Characterization System
|
|
5
|
+
Author: Lucas LE DUDAL
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Roucool_PvP
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/Cava3/PyKI4200A-SCS
|
|
29
|
+
Project-URL: Repository, https://github.com/Cava3/PyKI4200A-SCS
|
|
30
|
+
Project-URL: Issues, https://github.com/Cava3/PyKI4200A-SCS/issues
|
|
31
|
+
Keywords: keithley,4200A,SCS,GPIB,KXCI,semiconductor,instrument,measurement
|
|
32
|
+
Classifier: Development Status :: 3 - Alpha
|
|
33
|
+
Classifier: Intended Audience :: Science/Research
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Topic :: Scientific/Engineering
|
|
41
|
+
Classifier: Topic :: System :: Hardware :: Hardware Drivers
|
|
42
|
+
Requires-Python: >=3.9
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
License-File: LICENSE
|
|
45
|
+
Requires-Dist: pyvisa>=1.11.0
|
|
46
|
+
Requires-Dist: pyvisa-py>=0.5.0
|
|
47
|
+
Requires-Dist: numpy>=1.20.0
|
|
48
|
+
Provides-Extra: plot
|
|
49
|
+
Requires-Dist: matplotlib>=3.5.0; extra == "plot"
|
|
50
|
+
Dynamic: license-file
|
|
51
|
+
|
|
52
|
+
# Py4200A
|
|
53
|
+
|
|
54
|
+
> [!NOTE]
|
|
55
|
+
> This project is not complete yet, work in progress.
|
|
56
|
+
> Basic SMU controlling is already supported, but no pulse mode available (PMU/RPM not existing yet)
|
|
57
|
+
|
|
58
|
+
py4200A is a python library that provides support for controlling the Keithley Instrument 4200A SCS.
|
|
59
|
+
The library is object oriented, to make it easy to use. It translates settings to instructions for KXCI.
|
|
60
|
+
Made in collaboration with the USAL (University of SALamanca) in Salamanca, Spain.
|
|
61
|
+
|
|
62
|
+
## Install
|
|
63
|
+
|
|
64
|
+
For now, you will have to manually add the code from this git repo to either your project, or to your python lib folder.
|
|
65
|
+
Better installation instructions/executable will come later.
|
|
66
|
+
|
|
67
|
+
### Requirements
|
|
68
|
+
- **PyVISA**
|
|
69
|
+
- **PyVISA-py** (mandatory for now, support for @ivi as system default coming soon<sup>tm</sup>)
|
|
70
|
+
- **linux-gpib**
|
|
71
|
+
|
|
72
|
+
> [!IMPORTANT]
|
|
73
|
+
> You will need a GPIB backend if you want to use GPIB. I would recommend doing a proper [linux-gpib](https://github.com/coolshou/linux-gpib)
|
|
74
|
+
> installation beforehand. Make sure your installation of 'linux-gpib' works before opening an issue.
|
|
75
|
+
> You can use the `ibtest` tool installed with 'linux-gpib' to test GPIB connection (run as sudo)
|
|
76
|
+
|
|
77
|
+
### In your project
|
|
78
|
+
1. Navigate to your project's folder (`cd /path/to/your/project/`);
|
|
79
|
+
2. Download the library using `git clone git@github.com:Cava3/PyKI4200A-SCS.git` or the ZIP download button;
|
|
80
|
+
3. If using ZIP, extract in your project folder. You should see a 'Py4200A' folder appear;
|
|
81
|
+
4. Import the library in your program `import Py4200A` or `from Py4200A import *`
|
|
82
|
+
|
|
83
|
+
### As a library
|
|
84
|
+
1. Navigate to your python virtual env (or global) lib folder (`cd /path/to/your/python/venv/lib`);
|
|
85
|
+
2. Download the library using `git clone git@github.com:Cava3/PyKI4200A-SCS.git` or the ZIP download button;
|
|
86
|
+
3. If using ZIP, extract in your library folder. You should see a 'Py4200A' folder appear;
|
|
87
|
+
4. Import the library in your program `import Py4200A` or `from Py4200A import *`
|
|
88
|
+
|
|
89
|
+
## How to use
|
|
90
|
+
### KI 4200A Configuration
|
|
91
|
+
KXCI takes full controll of the intrument. This means it cannot run alongside other programs like Clarius on the Keithley.
|
|
92
|
+
1. Power on the Keithley 4200A SCS
|
|
93
|
+
2. Close Clarius, or any other software that is open
|
|
94
|
+
3. Open KCon -> KXCI Config
|
|
95
|
+
4. Choose your string delimiter, connection mode (GPIB or TCPIP), GPIB port, etc.
|
|
96
|
+
5. Close KCon
|
|
97
|
+
6. Start KXCI
|
|
98
|
+
|
|
99
|
+
### Wiring
|
|
100
|
+
#### GPIB
|
|
101
|
+
Using a GPIB to USB National Instrument cable (worth 1.5k€), you can just connect your computer to the Keithley. Your computer will make a new virtual GPIB interface you can use.
|
|
102
|
+
#### TCPIP
|
|
103
|
+
The Keithley documentation specifies that the TCPIP communcation for the 4200A cannot work by just wiring you PC's eth to the Keithley's. It is said that both devices have to be on the same network, equipped with a router of some kind.
|
|
104
|
+
I have yet to confirm if the real requirement would just be to have a DHCP server on the PC, or maybe set a static IP. But I'm pretty sure this is not a real limitation.
|
|
105
|
+
|
|
106
|
+
> [!WARNING]
|
|
107
|
+
> In the Keithley's network settings, make sure that the connected network is in "Private" mode and not "Public" mode. In public mode, the Keithley will not accept incoming packets nor pings. You will need admin access though.
|
|
108
|
+
|
|
109
|
+
### Code
|
|
110
|
+
In Python, import the lib to use it. You can choose to either manually control the device in real time, or pre-programm it to run with settings.
|
|
111
|
+
Using pre-programmed (normal) mode, performance is way better than realtime manual control. The below examples are doing the exact same gate test on a MOSFET type component :
|
|
112
|
+
- Component : HEF4007UBP
|
|
113
|
+
- Ground : pin 7 (Vss)
|
|
114
|
+
- Gate : pin 6 (G)
|
|
115
|
+
- Source : pin 8 (D)
|
|
116
|
+
|
|
117
|
+
Results :
|
|
118
|
+
- Normal mode : 101.2s
|
|
119
|
+
- Realtime mode : 408.9s
|
|
120
|
+
|
|
121
|
+
Normal mode is ~4 times faster for this test.
|
|
122
|
+
|
|
123
|
+
> [!WARNING]
|
|
124
|
+
> This script must be run with root privilege to be able to access the GPIB0 interface
|
|
125
|
+
|
|
126
|
+
#### Normal (pre-programmed)
|
|
127
|
+
```py
|
|
128
|
+
import py4200A
|
|
129
|
+
from py4200A import KI4200A
|
|
130
|
+
import time
|
|
131
|
+
|
|
132
|
+
#> Connecting to the Keithley
|
|
133
|
+
# INST_RESOURCE_STR = "TCPIP0::192.0.2.0::1225::SOCKET"
|
|
134
|
+
INST_RESOURCE_STR = "GPIB0::17::INSTR"
|
|
135
|
+
|
|
136
|
+
ki4200: KI4200A = KI4200A(INST_RESOURCE_STR)
|
|
137
|
+
ki4200.reset()
|
|
138
|
+
|
|
139
|
+
#> Getting the SMUs
|
|
140
|
+
source = ki4200.getSMU(3)
|
|
141
|
+
gate = ki4200.getSMU(2)
|
|
142
|
+
unused = ki4200.getSMU(1)
|
|
143
|
+
unused.deactivate()
|
|
144
|
+
|
|
145
|
+
#> Configure the SMUs
|
|
146
|
+
gate.setupSMU("VGT", "IGT", py4200A.consts.SourceType.VOLT, py4200A.consts.SourceFunction.STEP)
|
|
147
|
+
gate.setStepFunction(start=0, stop=5, step=1, compliance=0.1)
|
|
148
|
+
|
|
149
|
+
source.setupSMU("VSRC", "ISRC", py4200A.consts.SourceType.VOLT, py4200A.consts.SourceFunction.SWEEP)
|
|
150
|
+
source.setSweepFunction(py4200A.consts.SweepType.LINEAR, start=0, stop=15, step=0.1, compliance=0.05)
|
|
151
|
+
|
|
152
|
+
#> Configure the display
|
|
153
|
+
ki4200.display.displayGraph(x=source.voltage_measurement, y1=source.current_measurement) # x= time, y1 = gateV, y2 = srcV
|
|
154
|
+
|
|
155
|
+
#> Run and wait for test
|
|
156
|
+
print("Starting test.")
|
|
157
|
+
t_start = time.time()
|
|
158
|
+
ki4200.runSmuTest()
|
|
159
|
+
ki4200.waitForDataReady()
|
|
160
|
+
|
|
161
|
+
#> Collect results as a BlobDependent
|
|
162
|
+
result: py4200A.results.BlobDependent = ki4200.makeDependentFrom(
|
|
163
|
+
data=source.current_measurement,
|
|
164
|
+
params=[source.voltage_measurement, gate.voltage_measurement],
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
print(f"Done. ({time.time() - t_start:.1f}s)")
|
|
168
|
+
|
|
169
|
+
ki4200.disconnect()
|
|
170
|
+
```
|
|
171
|
+
You can display (plot) the graph on your computer by adding these few lines :
|
|
172
|
+
```py
|
|
173
|
+
import matplotlib
|
|
174
|
+
matplotlib.use('TkAgg')
|
|
175
|
+
import matplotlib.pyplot as plt
|
|
176
|
+
|
|
177
|
+
#> Plot ISRC vs VSRC, one curve per VGT value
|
|
178
|
+
colors: list[str] = ["red", "green", "blue", "magenta", "yellow", "cyan"]
|
|
179
|
+
vgt_values = result.parameters["VGT"]
|
|
180
|
+
vsrc_values = result.parameters["VSRC"]
|
|
181
|
+
|
|
182
|
+
fig, ax = plt.subplots()
|
|
183
|
+
for i, vgt in enumerate(vgt_values):
|
|
184
|
+
ax.plot(vsrc_values, result.value[i, :], color=colors[i % len(colors)], label=f"Gate = {vgt:.2f} V")
|
|
185
|
+
|
|
186
|
+
ax.set_xlabel("Vsource (V)")
|
|
187
|
+
ax.set_ylabel("Isource (A)")
|
|
188
|
+
ax.legend()
|
|
189
|
+
plt.tight_layout()
|
|
190
|
+
plt.show()
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
#### Realtime
|
|
194
|
+
```py
|
|
195
|
+
from py4200A import realtime
|
|
196
|
+
import numpy as np
|
|
197
|
+
import time
|
|
198
|
+
|
|
199
|
+
#> Connecting to the Keithley
|
|
200
|
+
# INST_RESOURCE_STR = "TCPIP0::192.0.2.0::1225::SOCKET"
|
|
201
|
+
INST_RESOURCE_STR = "GPIB0::17::INSTR"
|
|
202
|
+
|
|
203
|
+
rt: realtime.RT_KI4200A = realtime.RT_KI4200A(INST_RESOURCE_STR)
|
|
204
|
+
|
|
205
|
+
#> Getting the SMUs
|
|
206
|
+
source = rt.getSMU(3)
|
|
207
|
+
gate = rt.getSMU(2)
|
|
208
|
+
unused = rt.getSMU(1)
|
|
209
|
+
unused.deactivate()
|
|
210
|
+
rt.userMode()
|
|
211
|
+
|
|
212
|
+
#> Define sweep ranges
|
|
213
|
+
vgt_values = np.linspace(0, 5, 6) # 0, 1, 2, 3, 4, 5 V
|
|
214
|
+
vsrc_values = np.linspace(0, 15, 151) # 0 to 15 V, step 0.1 V
|
|
215
|
+
results = np.zeros((len(vgt_values), len(vsrc_values)))
|
|
216
|
+
|
|
217
|
+
#> Run the sweep
|
|
218
|
+
print("Starting test.")
|
|
219
|
+
t_start = time.time()
|
|
220
|
+
for i, vgt in enumerate(vgt_values):
|
|
221
|
+
gate.setVoltageOutput(float(vgt), compliance=0.1)
|
|
222
|
+
for j, vsrc in enumerate(vsrc_values):
|
|
223
|
+
source.setVoltageOutput(float(vsrc), compliance=0.05)
|
|
224
|
+
results[i, j] = source.measure_current()
|
|
225
|
+
print(f"Done. ({time.time() - t_start:.1f}s)")
|
|
226
|
+
|
|
227
|
+
rt.disconnect()
|
|
228
|
+
```
|
|
229
|
+
You can display (plot) the graph on your computer by adding these few lines :
|
|
230
|
+
```py
|
|
231
|
+
import matplotlib
|
|
232
|
+
matplotlib.use('TkAgg')
|
|
233
|
+
import matplotlib.pyplot as plt
|
|
234
|
+
|
|
235
|
+
#> Plot ISRC vs VSRC, one curve per VGT value
|
|
236
|
+
colors: list[str] = ["red", "green", "blue", "magenta", "yellow", "cyan"]
|
|
237
|
+
|
|
238
|
+
fig, ax = plt.subplots()
|
|
239
|
+
for i, vgt in enumerate(vgt_values):
|
|
240
|
+
ax.plot(vsrc_values, results[i, :], color=colors[i % len(colors)], label=f"Gate = {vgt:.2f} V")
|
|
241
|
+
|
|
242
|
+
ax.set_xlabel("Vsource (V)")
|
|
243
|
+
ax.set_ylabel("Isource (A)")
|
|
244
|
+
ax.legend()
|
|
245
|
+
plt.tight_layout()
|
|
246
|
+
plt.show()
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Roadmap
|
|
251
|
+
- [x] Connection to KI4200A-SCS through PCIB or TCPIP
|
|
252
|
+
- [x] Perform basic instruction to get Model and SN from KXCI
|
|
253
|
+
- [x] Listing of all the boards available
|
|
254
|
+
- [x] Correctly type the boards
|
|
255
|
+
- [x] Send basic setting instructions to SMUs
|
|
256
|
+
- [x] Allow test execution
|
|
257
|
+
- [x] Basic result retrieval
|
|
258
|
+
- [x] Analysis and plotting
|
|
259
|
+
- [ ] PMU RMP commands
|
|
260
|
+
- [ ] Publish on PyPi
|
|
261
|
+
- [ ] Matlab wrapper
|
|
262
|
+
- [ ] Util to export results to CSV, txt, raw binary
|
|
263
|
+
- [ ] Util to save/export and load/import settings profiles
|
|
264
|
+
- [ ] Export to XLSX
|
|
265
|
+
- [ ] Full instruction dictionnary capabilities
|
|
266
|
+
|
|
267
|
+
## Contribute
|
|
268
|
+
If you are not a developer, or do not wish to publish code, feel free to open an issue. I will review
|
|
269
|
+
and get to work on it as soon as possible. Please understand that it may take some time though, as I
|
|
270
|
+
am currently the only maintainer and have other things to do in life.
|
|
271
|
+
Feel free to open pull request. I will review each one, making sure it is properly documented, properly
|
|
272
|
+
commented, and really brings something to the table. Check existing file for documentation example.
|
|
273
|
+
Typing and using PyLint in "strict" mode will also be required
|
|
274
|
+
Garbage AI-generated spaghetti code (also know as "*vibe coding*") will be rejected. I have nothing against
|
|
275
|
+
good and proper usage of AI tools though. Simply keep your code relevant and readable.
|
|
276
|
+
|
|
277
|
+
## See also
|
|
278
|
+
[instrcom.py](./src/instrcomms.py) - Sample file from Tektronix under [a very permissive license](https://www.tek.com/sample-license)
|
|
279
|
+
[linux-gpib](https://github.com/coolshou/linux-gpib) - GPIB driver I'm using on my Linux (Ubuntu) laptop.
|
|
280
|
+
[PyVISA](https://pyvisa.readthedocs.io/en/latest/) - Python library to communicate with a device via most interfaces through VISA
|
|
281
|
+
[PyVISA-py](https://pypi.org/project/PyVISA-py/) - Replaces proprietary VISA libraries with a python implementation
|
|
282
|
+
[USAL](https://usal.es/) - The university that works on this project
|
py4200a-0.1.0/README.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Py4200A
|
|
2
|
+
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This project is not complete yet, work in progress.
|
|
5
|
+
> Basic SMU controlling is already supported, but no pulse mode available (PMU/RPM not existing yet)
|
|
6
|
+
|
|
7
|
+
py4200A is a python library that provides support for controlling the Keithley Instrument 4200A SCS.
|
|
8
|
+
The library is object oriented, to make it easy to use. It translates settings to instructions for KXCI.
|
|
9
|
+
Made in collaboration with the USAL (University of SALamanca) in Salamanca, Spain.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
For now, you will have to manually add the code from this git repo to either your project, or to your python lib folder.
|
|
14
|
+
Better installation instructions/executable will come later.
|
|
15
|
+
|
|
16
|
+
### Requirements
|
|
17
|
+
- **PyVISA**
|
|
18
|
+
- **PyVISA-py** (mandatory for now, support for @ivi as system default coming soon<sup>tm</sup>)
|
|
19
|
+
- **linux-gpib**
|
|
20
|
+
|
|
21
|
+
> [!IMPORTANT]
|
|
22
|
+
> You will need a GPIB backend if you want to use GPIB. I would recommend doing a proper [linux-gpib](https://github.com/coolshou/linux-gpib)
|
|
23
|
+
> installation beforehand. Make sure your installation of 'linux-gpib' works before opening an issue.
|
|
24
|
+
> You can use the `ibtest` tool installed with 'linux-gpib' to test GPIB connection (run as sudo)
|
|
25
|
+
|
|
26
|
+
### In your project
|
|
27
|
+
1. Navigate to your project's folder (`cd /path/to/your/project/`);
|
|
28
|
+
2. Download the library using `git clone git@github.com:Cava3/PyKI4200A-SCS.git` or the ZIP download button;
|
|
29
|
+
3. If using ZIP, extract in your project folder. You should see a 'Py4200A' folder appear;
|
|
30
|
+
4. Import the library in your program `import Py4200A` or `from Py4200A import *`
|
|
31
|
+
|
|
32
|
+
### As a library
|
|
33
|
+
1. Navigate to your python virtual env (or global) lib folder (`cd /path/to/your/python/venv/lib`);
|
|
34
|
+
2. Download the library using `git clone git@github.com:Cava3/PyKI4200A-SCS.git` or the ZIP download button;
|
|
35
|
+
3. If using ZIP, extract in your library folder. You should see a 'Py4200A' folder appear;
|
|
36
|
+
4. Import the library in your program `import Py4200A` or `from Py4200A import *`
|
|
37
|
+
|
|
38
|
+
## How to use
|
|
39
|
+
### KI 4200A Configuration
|
|
40
|
+
KXCI takes full controll of the intrument. This means it cannot run alongside other programs like Clarius on the Keithley.
|
|
41
|
+
1. Power on the Keithley 4200A SCS
|
|
42
|
+
2. Close Clarius, or any other software that is open
|
|
43
|
+
3. Open KCon -> KXCI Config
|
|
44
|
+
4. Choose your string delimiter, connection mode (GPIB or TCPIP), GPIB port, etc.
|
|
45
|
+
5. Close KCon
|
|
46
|
+
6. Start KXCI
|
|
47
|
+
|
|
48
|
+
### Wiring
|
|
49
|
+
#### GPIB
|
|
50
|
+
Using a GPIB to USB National Instrument cable (worth 1.5k€), you can just connect your computer to the Keithley. Your computer will make a new virtual GPIB interface you can use.
|
|
51
|
+
#### TCPIP
|
|
52
|
+
The Keithley documentation specifies that the TCPIP communcation for the 4200A cannot work by just wiring you PC's eth to the Keithley's. It is said that both devices have to be on the same network, equipped with a router of some kind.
|
|
53
|
+
I have yet to confirm if the real requirement would just be to have a DHCP server on the PC, or maybe set a static IP. But I'm pretty sure this is not a real limitation.
|
|
54
|
+
|
|
55
|
+
> [!WARNING]
|
|
56
|
+
> In the Keithley's network settings, make sure that the connected network is in "Private" mode and not "Public" mode. In public mode, the Keithley will not accept incoming packets nor pings. You will need admin access though.
|
|
57
|
+
|
|
58
|
+
### Code
|
|
59
|
+
In Python, import the lib to use it. You can choose to either manually control the device in real time, or pre-programm it to run with settings.
|
|
60
|
+
Using pre-programmed (normal) mode, performance is way better than realtime manual control. The below examples are doing the exact same gate test on a MOSFET type component :
|
|
61
|
+
- Component : HEF4007UBP
|
|
62
|
+
- Ground : pin 7 (Vss)
|
|
63
|
+
- Gate : pin 6 (G)
|
|
64
|
+
- Source : pin 8 (D)
|
|
65
|
+
|
|
66
|
+
Results :
|
|
67
|
+
- Normal mode : 101.2s
|
|
68
|
+
- Realtime mode : 408.9s
|
|
69
|
+
|
|
70
|
+
Normal mode is ~4 times faster for this test.
|
|
71
|
+
|
|
72
|
+
> [!WARNING]
|
|
73
|
+
> This script must be run with root privilege to be able to access the GPIB0 interface
|
|
74
|
+
|
|
75
|
+
#### Normal (pre-programmed)
|
|
76
|
+
```py
|
|
77
|
+
import py4200A
|
|
78
|
+
from py4200A import KI4200A
|
|
79
|
+
import time
|
|
80
|
+
|
|
81
|
+
#> Connecting to the Keithley
|
|
82
|
+
# INST_RESOURCE_STR = "TCPIP0::192.0.2.0::1225::SOCKET"
|
|
83
|
+
INST_RESOURCE_STR = "GPIB0::17::INSTR"
|
|
84
|
+
|
|
85
|
+
ki4200: KI4200A = KI4200A(INST_RESOURCE_STR)
|
|
86
|
+
ki4200.reset()
|
|
87
|
+
|
|
88
|
+
#> Getting the SMUs
|
|
89
|
+
source = ki4200.getSMU(3)
|
|
90
|
+
gate = ki4200.getSMU(2)
|
|
91
|
+
unused = ki4200.getSMU(1)
|
|
92
|
+
unused.deactivate()
|
|
93
|
+
|
|
94
|
+
#> Configure the SMUs
|
|
95
|
+
gate.setupSMU("VGT", "IGT", py4200A.consts.SourceType.VOLT, py4200A.consts.SourceFunction.STEP)
|
|
96
|
+
gate.setStepFunction(start=0, stop=5, step=1, compliance=0.1)
|
|
97
|
+
|
|
98
|
+
source.setupSMU("VSRC", "ISRC", py4200A.consts.SourceType.VOLT, py4200A.consts.SourceFunction.SWEEP)
|
|
99
|
+
source.setSweepFunction(py4200A.consts.SweepType.LINEAR, start=0, stop=15, step=0.1, compliance=0.05)
|
|
100
|
+
|
|
101
|
+
#> Configure the display
|
|
102
|
+
ki4200.display.displayGraph(x=source.voltage_measurement, y1=source.current_measurement) # x= time, y1 = gateV, y2 = srcV
|
|
103
|
+
|
|
104
|
+
#> Run and wait for test
|
|
105
|
+
print("Starting test.")
|
|
106
|
+
t_start = time.time()
|
|
107
|
+
ki4200.runSmuTest()
|
|
108
|
+
ki4200.waitForDataReady()
|
|
109
|
+
|
|
110
|
+
#> Collect results as a BlobDependent
|
|
111
|
+
result: py4200A.results.BlobDependent = ki4200.makeDependentFrom(
|
|
112
|
+
data=source.current_measurement,
|
|
113
|
+
params=[source.voltage_measurement, gate.voltage_measurement],
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
print(f"Done. ({time.time() - t_start:.1f}s)")
|
|
117
|
+
|
|
118
|
+
ki4200.disconnect()
|
|
119
|
+
```
|
|
120
|
+
You can display (plot) the graph on your computer by adding these few lines :
|
|
121
|
+
```py
|
|
122
|
+
import matplotlib
|
|
123
|
+
matplotlib.use('TkAgg')
|
|
124
|
+
import matplotlib.pyplot as plt
|
|
125
|
+
|
|
126
|
+
#> Plot ISRC vs VSRC, one curve per VGT value
|
|
127
|
+
colors: list[str] = ["red", "green", "blue", "magenta", "yellow", "cyan"]
|
|
128
|
+
vgt_values = result.parameters["VGT"]
|
|
129
|
+
vsrc_values = result.parameters["VSRC"]
|
|
130
|
+
|
|
131
|
+
fig, ax = plt.subplots()
|
|
132
|
+
for i, vgt in enumerate(vgt_values):
|
|
133
|
+
ax.plot(vsrc_values, result.value[i, :], color=colors[i % len(colors)], label=f"Gate = {vgt:.2f} V")
|
|
134
|
+
|
|
135
|
+
ax.set_xlabel("Vsource (V)")
|
|
136
|
+
ax.set_ylabel("Isource (A)")
|
|
137
|
+
ax.legend()
|
|
138
|
+
plt.tight_layout()
|
|
139
|
+
plt.show()
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Realtime
|
|
143
|
+
```py
|
|
144
|
+
from py4200A import realtime
|
|
145
|
+
import numpy as np
|
|
146
|
+
import time
|
|
147
|
+
|
|
148
|
+
#> Connecting to the Keithley
|
|
149
|
+
# INST_RESOURCE_STR = "TCPIP0::192.0.2.0::1225::SOCKET"
|
|
150
|
+
INST_RESOURCE_STR = "GPIB0::17::INSTR"
|
|
151
|
+
|
|
152
|
+
rt: realtime.RT_KI4200A = realtime.RT_KI4200A(INST_RESOURCE_STR)
|
|
153
|
+
|
|
154
|
+
#> Getting the SMUs
|
|
155
|
+
source = rt.getSMU(3)
|
|
156
|
+
gate = rt.getSMU(2)
|
|
157
|
+
unused = rt.getSMU(1)
|
|
158
|
+
unused.deactivate()
|
|
159
|
+
rt.userMode()
|
|
160
|
+
|
|
161
|
+
#> Define sweep ranges
|
|
162
|
+
vgt_values = np.linspace(0, 5, 6) # 0, 1, 2, 3, 4, 5 V
|
|
163
|
+
vsrc_values = np.linspace(0, 15, 151) # 0 to 15 V, step 0.1 V
|
|
164
|
+
results = np.zeros((len(vgt_values), len(vsrc_values)))
|
|
165
|
+
|
|
166
|
+
#> Run the sweep
|
|
167
|
+
print("Starting test.")
|
|
168
|
+
t_start = time.time()
|
|
169
|
+
for i, vgt in enumerate(vgt_values):
|
|
170
|
+
gate.setVoltageOutput(float(vgt), compliance=0.1)
|
|
171
|
+
for j, vsrc in enumerate(vsrc_values):
|
|
172
|
+
source.setVoltageOutput(float(vsrc), compliance=0.05)
|
|
173
|
+
results[i, j] = source.measure_current()
|
|
174
|
+
print(f"Done. ({time.time() - t_start:.1f}s)")
|
|
175
|
+
|
|
176
|
+
rt.disconnect()
|
|
177
|
+
```
|
|
178
|
+
You can display (plot) the graph on your computer by adding these few lines :
|
|
179
|
+
```py
|
|
180
|
+
import matplotlib
|
|
181
|
+
matplotlib.use('TkAgg')
|
|
182
|
+
import matplotlib.pyplot as plt
|
|
183
|
+
|
|
184
|
+
#> Plot ISRC vs VSRC, one curve per VGT value
|
|
185
|
+
colors: list[str] = ["red", "green", "blue", "magenta", "yellow", "cyan"]
|
|
186
|
+
|
|
187
|
+
fig, ax = plt.subplots()
|
|
188
|
+
for i, vgt in enumerate(vgt_values):
|
|
189
|
+
ax.plot(vsrc_values, results[i, :], color=colors[i % len(colors)], label=f"Gate = {vgt:.2f} V")
|
|
190
|
+
|
|
191
|
+
ax.set_xlabel("Vsource (V)")
|
|
192
|
+
ax.set_ylabel("Isource (A)")
|
|
193
|
+
ax.legend()
|
|
194
|
+
plt.tight_layout()
|
|
195
|
+
plt.show()
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Roadmap
|
|
200
|
+
- [x] Connection to KI4200A-SCS through PCIB or TCPIP
|
|
201
|
+
- [x] Perform basic instruction to get Model and SN from KXCI
|
|
202
|
+
- [x] Listing of all the boards available
|
|
203
|
+
- [x] Correctly type the boards
|
|
204
|
+
- [x] Send basic setting instructions to SMUs
|
|
205
|
+
- [x] Allow test execution
|
|
206
|
+
- [x] Basic result retrieval
|
|
207
|
+
- [x] Analysis and plotting
|
|
208
|
+
- [ ] PMU RMP commands
|
|
209
|
+
- [ ] Publish on PyPi
|
|
210
|
+
- [ ] Matlab wrapper
|
|
211
|
+
- [ ] Util to export results to CSV, txt, raw binary
|
|
212
|
+
- [ ] Util to save/export and load/import settings profiles
|
|
213
|
+
- [ ] Export to XLSX
|
|
214
|
+
- [ ] Full instruction dictionnary capabilities
|
|
215
|
+
|
|
216
|
+
## Contribute
|
|
217
|
+
If you are not a developer, or do not wish to publish code, feel free to open an issue. I will review
|
|
218
|
+
and get to work on it as soon as possible. Please understand that it may take some time though, as I
|
|
219
|
+
am currently the only maintainer and have other things to do in life.
|
|
220
|
+
Feel free to open pull request. I will review each one, making sure it is properly documented, properly
|
|
221
|
+
commented, and really brings something to the table. Check existing file for documentation example.
|
|
222
|
+
Typing and using PyLint in "strict" mode will also be required
|
|
223
|
+
Garbage AI-generated spaghetti code (also know as "*vibe coding*") will be rejected. I have nothing against
|
|
224
|
+
good and proper usage of AI tools though. Simply keep your code relevant and readable.
|
|
225
|
+
|
|
226
|
+
## See also
|
|
227
|
+
[instrcom.py](./src/instrcomms.py) - Sample file from Tektronix under [a very permissive license](https://www.tek.com/sample-license)
|
|
228
|
+
[linux-gpib](https://github.com/coolshou/linux-gpib) - GPIB driver I'm using on my Linux (Ubuntu) laptop.
|
|
229
|
+
[PyVISA](https://pyvisa.readthedocs.io/en/latest/) - Python library to communicate with a device via most interfaces through VISA
|
|
230
|
+
[PyVISA-py](https://pypi.org/project/PyVISA-py/) - Replaces proprietary VISA libraries with a python implementation
|
|
231
|
+
[USAL](https://usal.es/) - The university that works on this project
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
pyKI4200A - Python interface for Keithley 4200A Semiconductor Characterization System
|
|
3
|
+
Author: Lucas LE DUDAL
|
|
4
|
+
|
|
5
|
+
This library provides a high-level interface to control and communicate with the Keithley 4200A system,
|
|
6
|
+
allowing users to perform measurements, set up test configurations, and retrieve data in a user-friendly manner.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from .src.KI4200A import KI4200A
|
|
10
|
+
from .src import consts
|
|
11
|
+
from .src import boards
|
|
12
|
+
from .src import results
|
|
13
|
+
from .src import realtime
|
|
14
|
+
|
|
15
|
+
__all__ = ["KI4200A", "consts", "boards", "results", "realtime"]
|