07-14-2023 03:54 AM
Hello guys, I hope you all are doing good.
I am a beginner at using KEITHLEY 2636A. First, I want to test our instrument. I have connected BJT (Bipolar junction transistor) BC 337 (NPN) to the Keithley source to conduct device under test (DUT) both in DC and pulse. I wrote the below mentioned code in python to communicate between PC and KEITHLEY. In case of DC sweep, When I run the code, it shows me expected result as shown in figure 1 (DC sweep IN curve). But for pulse measurement case, when I run the code, the KEITHLEY screen (SMU) display shows an ERROR CODE -350 (Queue full error) during the measurement as shown in the below picture. Although it measures the expected result/plot as shown in Figure 2.
What does this error mean and how we can resolve this error? Your experience and guidance will be appreciated. Thanks
Even it shows me result at the end, but still I saw ERROR CODE -350 (Queue full error) on the KEITHLEY screen during the measurements.
here are the two codes for the said measurement.
Code 1 for DC Sweep
import pyvisa
import numpy as np
import time
import matplotlib.pyplot as plt
import os
# set up the instrument
rm = pyvisa.ResourceManager()
keithley = rm.open_resource("GPIB0::26::INSTR") # Replace with your instrument address
keithley.write("smua.reset()")
keithley.write("smua.source.func = smua.OUTPUT_DCVOLTS")
keithley.write("smub.source.func = smub.OUTPUT_DCAMPS")
keithley.write("smua.source.autorangev = smua.AUTORANGE_ON")
keithley.write("smub.source.autorangei = smub.AUTORANGE_ON")
keithley.write("smub.measure.autorangev = smub.AUTORANGE_ON")
keithley.write("smua.source.limiti = 10e-3") # Set current compliance to 10 mA
keithley.write("smub.source.limitv = 10") # Set voltage compliance to 10V
keithley.write("smua.measure.autorangei = smua.AUTORANGE_ON")
keithley.write("smua.measure.autorangev = smua.AUTORANGE_ON")
# set up the sweep parameters
start_voltage = 0
stop_voltage = 1
num_points = 51
sweep_time = 1e-3
current_limit = 10e-3
base_current = 40e-6
# generate the voltage values
voltage_values = np.linspace(start_voltage, stop_voltage, num_points)
# set the initial voltage and base current
keithley.write("smua.source.levelv = {}".format(start_voltage))
keithley.write("smua.source.output = smua.OUTPUT_ON")
keithley.write("smub.source.leveli = {}".format(base_current))
keithley.write("smub.source.output = smub.OUTPUT_ON")
time.sleep(0.01) # Wait for output to settle
# sweep the voltage and measure the current
collector_current_values = np.empty_like(voltage_values)
base_current_values = np.empty_like(voltage_values)
time.sleep(0.5) # Wait for the instrument to settle
for i, voltage in enumerate(voltage_values):
keithley.write("smua.source.levelv = {}".format(voltage))
time.sleep(sweep_time/num_points) # Wait for next data point
collector_current = float(keithley.query("print(smua.measure.i())\n"))
base_current = float(keithley.query("print(smub.measure.i())\n"))
collector_current_values[i] = collector_current
base_current_values[i] = base_current
print(f"Voltage: {voltage} V\tCollector Current: {collector_current} A\tBase Current: {base_current} A")
time.sleep(0.01) # Wait for instrument to settle
# turn off the output
keithley.write("smua.source.output = smua.OUTPUT_OFF")
keithley.write("smub.source.output = smub.OUTPUT_OFF")
# save the plot to desktop
desktop_path = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
filename_plot = os.path.join(desktop_path, ' BJT_BC337_IV.png')
plt.plot(voltage_values, collector_current_values, label='Collector Current')
plt.xlabel("Voltage (V)")
plt.ylabel("Current (A)")
plt.title("BJT BC337 I-V Curve")
plt.savefig(filename_plot)
# save the output data as a column array in text format
filename_data = os.path.join(desktop_path, 'BJT_BC337_IV.txt')
np.savetxt(filename_data, np.column_stack((voltage_values, collector_current_values)), header="Voltage (V)\tCurrent (A)", delimiter="\t")
plt.show()
Code 2 for pulse measurment
import pyvisa
import numpy as np
import time
import matplotlib.pyplot as plt
import os
# Set up the instrument
rm = pyvisa.ResourceManager()
keithley = rm.open_resource("GPIB0::26::INSTR") # Replace with your instrument address
keithley.write("smua.reset()")
keithley.write("smua.source.func = smua.OUTPUT_DCVOLTS")
keithley.write("smub.source.func = smub.OUTPUT_DCAMPS")
keithley.write("smua.source.autorangev = smua.AUTORANGE_ON")
keithley.write("smub.source.autorangei = smub.AUTORANGE_ON")
keithley.write("smub.measure.autorangev = smub.AUTORANGE_ON")
keithley.write("smua.source.limiti = 10e-3") # Set current compliance to 10 mA
keithley.write("smub.source.limitv = 10") # Set voltage compliance to 10V
keithley.write("smua.measure.autorangei = smua.AUTORANGE_ON")
keithley.write("smua.measure.autorangev = smua.AUTORANGE_ON")
# Set up the pulse mode parameters
pulse_width = 300e-6 # 600 microseconds pulse width
pulse_period = 5e-3 # 5 milliseconds pulse period
num_pulses = 10 # Number of pulses
# Configure pulse mode sweep
keithley.write("smua.trigger.endpulse.action = smua.SOURCE_IDLE")
# Enable the source action
keithley.write("smua.trigger.source.action = smua.ENABLE")
# Configure pulse width and period timers
keithley.write("smua.trigger.timer[1].reset()")
keithley.write("smua.trigger.timer[1].name = 'Pulse Width'")
keithley.write("smua.trigger.timer[1].delay = 0")
keithley.write("smua.trigger.timer[1].width = {}".format(pulse_width))
keithley.write("smua.trigger.timer[2].reset()")
keithley.write("smua.trigger.timer[2].name = 'Pulse Period'")
keithley.write("smua.trigger.timer[2].delay = {}".format(pulse_width))
keithley.write("smua.trigger.timer[2].width = {}".format(pulse_period))
# Configure the pulse sweep
keithley.write("smua.trigger.count = {}".format(num_pulses))
keithley.write("smua.trigger.arm.count = 1")
keithley.write("smua.trigger.source.stimulus = smua.trigger.timer[1].EVENT_ID")
keithley.write("smua.trigger.endpulse.stimulus = smua.trigger.timer[2].EVENT_ID")
keithley.write("smua.trigger.measure.stimulus = smua.trigger.timer[2].EVENT_ID")
# Set up the sweep parameters
start_voltage = 0
stop_voltage = 1
num_points = 51
sweep_time = 1e-3
current_limit = 10e-3
base_current = 40e-6
# Generate the voltage values
voltage_values = np.linspace(start_voltage, stop_voltage, num_points)
# Set the initial voltage and base current
keithley.write("smua.source.levelv = {}".format(start_voltage))
keithley.write("smua.source.output = smua.OUTPUT_ON")
keithley.write("smub.source.leveli = {}".format(base_current))
keithley.write("smub.source.output = smub.OUTPUT_ON")
time.sleep(0.01) # Wait for output to settle
# Perform the pulsed measurement
collector_current_values = []
for voltage in voltage_values:
keithley.write("smua.source.levelv = {}".format(voltage))
time.sleep(0.1) # Wait for voltage to settle
collector_current = float(keithley.query("print(smua.measure.i())\n"))
collector_current_values.append(collector_current)
time.sleep(0.1) # Wait for current to settle
# Turn off the output
keithley.write("smua.source.output = smua.OUTPUT_OFF")
keithley.write("smub.source.output = smub.OUTPUT_OFF")
# Plot the pulsed measured IV curve
plt.vlines(voltage_values, 0, collector_current_values, colors='blue', linewidth=1)
plt.xlabel("Voltage (V)")
plt.ylabel("Current (A)")
plt.title("Pulsed Measured IV Curve")
plt.grid(True)
# Save the plot to the desktop
desktop_path = os.path.join(os.path.join(os.environ['USERPROFILE']), 'Desktop')
filename_data = os.path.join(desktop_path, 'Pulsed_BJT_BC337_IV.txt')
np.savetxt(filename_data, np.column_stack((voltage_values, collector_current_values)), header="Voltage (V)\tCurrent (A)", delimiter="\t")
filename_plot = os.path.join(desktop_path, 'Pulsed_BJT_BC337_IV.png')
plt.savefig(filename_plot)
plt.show()
12-01-2023 11:38 AM
Hello Lamboo,
I am facing the exact same error. Have you eventually found a solution? It would really help me!