Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
Soku3D committed May 31, 2024
1 parent eafbe4b commit 8d48934
Show file tree
Hide file tree
Showing 12 changed files with 844 additions and 36 deletions.
10 changes: 6 additions & 4 deletions App/keithleyApp_1_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from PyQt6 import QtCore, QtGui, QtWidgets
from PyQt6.QtWidgets import QApplication, QMainWindow
from PyQt6.QtCore import QTimer, Qt
from PyQt6.QtCore import QTimer, Qt, QThread, pyqtSignal
from PyQt6.QtGui import QPalette, QIcon, QPixmap, QPainter, QColor
from ctypes.wintypes import HANDLE, HICON
from ctypes import windll
Expand Down Expand Up @@ -362,8 +362,10 @@ def keithleyConnect(self,deviceName, address):

try:
self.device2635b = rm.open_resource(f'GPIB::{address}::INSTR')
self.IsConnected_2635b.setStyleSheet('color: black;')
self.IsConnected_2635b.setStyleSheet('color: green;')
self.IsConnected_2635b.setText(f"Connected to {address}")
time.sleep(1)
self.IsConnected_2635b.setText("")
self.device2420.write('smua.source.func = smua.OUTPUT_DCV')# 전압 source mode
self.device2420.write('smua.measure.func = smua.FUNC_DCI') # 전류 measure mode
self.device2635b.write(f'smua.source.limiti = {self.CurrentLimit_2635b.value()}') # 전류 한계 설정
Expand All @@ -378,8 +380,8 @@ def keithleyConnect(self,deviceName, address):

try:
self.device2420 = rm.open_resource(f'GPIB::{address}::INSTR')
self.IsConnected_2420.setStyleSheet('color: black;')
self.IsConnected_2420.setText(f"Connected to {address}")
self.IsConnected_2420.setStyleSheet('color: green;')
self.IsConnected_2420.setText(f"Connected to {address}")
print(self.device2420.query('*IDN?'))

self.device2420.write(':SOUR:FUNC VOLT')# 전압 source mode
Expand Down
99 changes: 73 additions & 26 deletions Samples/2420Test.ipynb

Large diffs are not rendered by default.

157 changes: 157 additions & 0 deletions Samples/2420Test2.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2400 device\n",
"\n",
"2400 device는 drain/source voltage를 인가하고, 이에 따른 transistor device에 흐르는 전류를 측정한다."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"KEITHLEY INSTRUMENTS INC.,MODEL 2420,4051227,C32 Oct 4 2010 14:20:11/A02 /J/L\n",
"\n",
"Voltage: 0 V, Current: -1.382756E-09\n",
" A\n",
"Voltage: 1 V, Current: -2.017378E-10\n",
" A\n",
"Voltage: 2 V, Current: -1.951761E-10\n",
" A\n",
"Voltage: 3 V, Current: -1.815496E-10\n",
" A\n",
"Voltage: 4 V, Current: -1.860914E-10\n",
" A\n",
"Voltage: 5 V, Current: -1.850819E-10\n",
" A\n",
"Voltage: 6 V, Current: -1.775108E-10\n",
" A\n",
"Voltage: 7 V, Current: -1.840714E-10\n",
" A\n",
"Voltage: 8 V, Current: -1.724632E-10\n",
" A\n",
"Voltage: 9 V, Current: -1.734720E-10\n",
" A\n",
"Voltage: 10 V, Current: -1.765009E-10\n",
" A\n",
"Measurements complete.\n",
"Voltage: 0 V, Current: -1.382756E-09\n",
" A\n",
"Voltage: 1 V, Current: -2.017378E-10\n",
" A\n",
"Voltage: 2 V, Current: -1.951761E-10\n",
" A\n",
"Voltage: 3 V, Current: -1.815496E-10\n",
" A\n",
"Voltage: 4 V, Current: -1.860914E-10\n",
" A\n",
"Voltage: 5 V, Current: -1.850819E-10\n",
" A\n",
"Voltage: 6 V, Current: -1.775108E-10\n",
" A\n",
"Voltage: 7 V, Current: -1.840714E-10\n",
" A\n",
"Voltage: 8 V, Current: -1.724632E-10\n",
" A\n",
"Voltage: 9 V, Current: -1.734720E-10\n",
" A\n",
"Voltage: 10 V, Current: -1.765009E-10\n",
" A\n"
]
}
],
"source": [
"import pyvisa\n",
"import time\n",
"\n",
"# VISA 리소스 매니저 생성\n",
"rm = pyvisa.ResourceManager()\n",
"\n",
"# Keithley 2420 계측기에 연결 (VISA 주소를 적절히 변경)\n",
"keithley = rm.open_resource('GPIB0::24::INSTR')\n",
"\n",
"# 장치 ID 확인 (선택사항)\n",
"print(keithley.query('*IDN?'))\n",
"\n",
"# 초기 설정\n",
"keithley.write('*RST') # 장치 리셋\n",
"keithley.write(':SENS:FUNC \"CURR\"') # 전류 측정 모드 설정\n",
"keithley.write(':SOUR:FUNC VOLT') # 전압 소스 모드 설정\n",
"keithley.write(':FORM:ELEM CURR') # 전류만 읽기\n",
"keithley.write(':SENS:CURR:PROT 0.1')\n",
"# 전압 및 전류 측정 설정\n",
"start_voltage = 0\n",
"end_voltage = 10\n",
"step_voltage = 1\n",
"measurement_time = 1 # 초\n",
"\n",
"# 결과 저장을 위한 리스트\n",
"voltages = []\n",
"currents = []\n",
"\n",
"# 측정 루프\n",
"try:\n",
" for voltage in range(start_voltage, end_voltage + step_voltage, step_voltage):\n",
" # 전압 설정\n",
" keithley.write(f':SOUR:VOLT {voltage}')\n",
" keithley.write(':OUTP ON') # 출력 켜기\n",
"\n",
" # 안정화 시간 대기\n",
" time.sleep(0.5)\n",
"\n",
" # 전류 측정\n",
" current = keithley.query(':READ?')\n",
" # 측정값 저장\n",
" voltages.append(voltage)\n",
" currents.append(current)\n",
"\n",
" # 측정 시간 대기\n",
" time.sleep(measurement_time)\n",
"\n",
" # 출력 끄기 (선택사항)\n",
" keithley.write(':OUTP OFF')\n",
"\n",
" print(f'Voltage: {voltage} V, Current: {current} A')\n",
"\n",
"finally:\n",
" # 장치 리셋 및 연결 해제\n",
" keithley.write('*RST')\n",
" keithley.close()\n",
"\n",
"# 결과 출력\n",
"print(\"Measurements complete.\")\n",
"for v, c in zip(voltages, currents):\n",
" print(f\"Voltage: {v} V, Current: {c} A\")\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
15 changes: 9 additions & 6 deletions Samples/2600bTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,23 @@
"import pyvisa\n",
"\n",
"rm = pyvisa.ResourceManager()\n",
"device26 = rm.open_resource('GPIB::26::INSTR')\n",
"keithley = rm.open_resource('GPIB::26::INSTR')\n",
"\n",
"#Check DeviceID\n",
"print(device26.query('*IDN?'))\n",
"print(keithley.query('*IDN?'))\n",
"\n",
"\n",
"#Turns on SMU channel A source output.\n",
"device26.write('smua.source.output = smua.OUTPUT_ON')\n",
"\n",
"minRange = -60\n",
"maxRange = 60\n",
"\n",
"volt = 1\n",
"currentLimit26 = 100\n",
"device26.write(f':SOUR:FUNC VOLT')\n",
"currentLimit26 = 0.1\n",
"keithley.write('smua.source.func = smua.OUTPUT_DCVOLTS ')\n",
"\n",
"#Turns on SMU channel A source output.\n",
"keithley.write('smua.source.output = smua.OUTPUT_ON')\n",
"\n",
"for volt in range(minRange, maxRange+1):\n",
" #\n",
" \n",
Expand Down
Loading

0 comments on commit 8d48934

Please sign in to comment.