-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPerformance_LED.py
182 lines (154 loc) · 6.19 KB
/
Performance_LED.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
"""
Performance_LED program was written to measure current depends on the voltage on Channel A and measure current on Channel B.
Also, programm calculated the L (cd/m^2), EQE (%), LE (cd/A), PE (lm/W) of the device.
The data will save in the CSV-file and the graphic of the data will save in the PDF-file.
written by: Sergey Dayneko
website: www.dayneko.org
last modified: 2021-10-04
"""
from Keithley2612B import SMU2612B
import matplotlib.pyplot as plt
import datetime
import csv
import time
""" ******* Connect to the Sourcemeter ******** """
# initialize the Sourcemeter and connect to it
# you may need to change the IP address depending on which sourcemeter you are using
sm = SMU2612B('USB0::0x05E6::0x2612::4439973::INSTR')
# get one channel of the Sourcemeter (we only need one for this measurement)
smu_A = sm.get_channel(sm.CHANNEL_A)
smu_B = sm.get_channel(sm.CHANNEL_B)
""" ******* Configure the SMU Channel A ******** """
# reset to default settings
smu_A.reset()
# setup the operation mode
smu_A.set_mode_voltage_source()
# set the voltage and current parameters
smu_A.set_voltage_range(10)
smu_A.set_voltage_limit(10)
smu_A.set_voltage(0)
smu_A.set_current(0)
smu_A.enable_current_autorange
smu_A.display_current()
smu_A.set_sense_2wire()
smu_A.set_measurement_speed_normal()
""" ******* Configure the SMU Channel B ******** """
# reset to default settings
smu_B.reset()
smu_B.display_current()
smu_B.set_voltage_range(0.2)
smu_B.set_voltage_limit(0.2)
smu_B.enable_current_autorange
smu_B.set_sense_2wire()
smu_B.set_measurement_speed_normal()
""" ****** Parametres to calculate performance **** """
""" CONCTANT """
q = 1.6e-19 #Elementary charge (C)
hc = 1.98e-25 #Planck constant * c (J * m)
phi_0 = 683 #maximum spectral efficacy lm/W
pi = 3.14 #pi
""" AREA OF DEVICE """
pin_area = 4e-6 # pinhole area m^2
dev_area = 4e-6 # dev area m^2
""" Integral DATA """
ksi = 1 #
eye_el = 1 #
lambda_EQE = 1 #
alpha = (phi_0 * eye_el) / (pi * pin_area * ksi)
alpha_eye = (phi_0 * eye_el) #alpha for Luminous Power Efficiency
""" ******* For saving the data ******** """
# Create unique filenames for saving the data
time_for_name = datetime.datetime.now().strftime("%Y_%m_%d")
filename_csv = 'test-' + time_for_name +'-scan1.csv'
filename_pdf = 'test-' + time_for_name +'-scan1.pdf'
# Header for
with open(filename_csv, 'a') as csvfile:
writer = csv.writer(csvfile, delimiter=',', lineterminator='\n')
writer.writerow(["Voltage (V)", "Current (mA)", "Current_pd (mA)", "Current (mA/cm^2)", "L (cd/m^2)", "EQE (%)", "LE (cd/A)", "PE (lm/W)"])
""" ******* Make a voltage-sweep and do some measurements ******** """
# define sweep parameters
sweep_start = -2
sweep_end = 10
sweep_step = 0.1
delay_time = 10e-3 # 10 ms
steps = int((sweep_end - sweep_start) / sweep_step) + 1
# define variables we store the measurement in
data_current = []
data_current_cm = []
data_voltage = []
data_current_pd_a = []
data_L = []
# enable the output
smu_A.enable_output()
smu_B.enable_output()
time_start = time.time()
# step through the voltages and get the values from the device
for nr in range(steps):
time.sleep(delay_time)
# calculate the new voltage we want to set
voltage_to_set = sweep_start + (sweep_step * nr)
# set the new voltage to the SMU
smu_A.set_voltage(voltage_to_set)
# get current and voltage from the SMU and append it to the list so we can plot it later
[current, voltage] = smu_A.measure_current_and_voltage()
if abs(current) >= 0.09 and abs(current) <= 0.19:
smu_A.set_current_range(0.2)
smu_A.set_current_limit(0.2)
if abs(current) > 0.19 and abs(current) <= 0.29:
smu_A.set_current_range(0.4) #400mA
smu_A.set_current_limit(0.4) #400mA
if abs(current) > 0.29 and abs(current) <= 0.4:
smu_A.set_current_range(0.7) #700mA
smu_A.set_current_limit(0.7) #700mA
if abs(current) > 0.69 and abs(current) <= 1:
smu_A.set_current_range(1.5) #1.5A
smu_A.set_current_limit(1.5) #1.5A
current_pd_a = smu_B.measure_current()
data_voltage.append(voltage)
data_current.append(current * 1000)
data_current_cm.append((current*1000)/(dev_area*1e4))
data_current_pd_a.append(current_pd_a * (-1000))
data_L.append(alpha*(current_pd_a*(-1))) #L (cd/m^2) for graphics
print('Voltage: '+str(voltage)+'V; Current:'+str(current * 1000)+'mA; J: '+str((1000*current)/(dev_area*1e4))+'mA/cm^2; Current_PD: '+str(current_pd_a*(-1000))+'mA; L:'+str(alpha*(current_pd_a*(-1)))+'cd/m^2')
time_finish = time.time()
print('time: '+str(time_finish-time_start)+' sec.')
# Write the data in a csv
f = open(filename_csv, 'a')
for i in range(steps):
f.write(str(data_voltage[i])) #Voltage (V)
f.write(',')
f.write(str(data_current[i])) #Current (mA)
f.write(',')
f.write(str(data_current_pd_a[i])) #Current PD (mA)
f.write(',')
f.write(str(data_current[i]/(dev_area*1e4))) #Current (mA/cm^2)
f.write(',')
f.write(str((alpha*(data_current_pd_a[i]/1000)))) # L (cd/m^2)
f.write(',')
f.write(str(((q/hc) * (lambda_EQE / ksi) * ((data_current_pd_a[i]/pin_area) / (data_current[i]/dev_area))) * 100)) #EQE (%)
f.write(',')
f.write(str((alpha*(data_current_pd_a[i]/1000))/((data_current[i]/1000)/dev_area))) # LE (cd/A)
f.write(',')
f.write(str((alpha_eye / ksi) * ((data_current_pd_a[i]/pin_area) / ((data_current[i]/dev_area) * data_voltage[i])))) # PE (lm/W)
f.write('\n')
f.close()
# disable the output
smu_A.disable_output()
smu_B.disable_output()
# properly disconnect from the device
sm.disconnect()
""" ******* Plot the Data we obtained ******** """
fig, ax1 = plt.subplots()
color = 'tab:blue'
ax1.set_xlabel('Voltage (V)')
ax1.set_ylabel('Current (mA/cm^2)', color = color)
ax1.plot(data_voltage, data_current_cm, color = color)
ax1.tick_params(axis='y', labelcolor = color)
ax2 = ax1.twinx()
color = 'tab:red'
ax2.set_ylabel('L (cd/m^2)', color = color)
ax2.plot(data_voltage, data_L, color = color)
ax2.tick_params(axis = 'y', labelcolor = color)
ax2.set_yscale("log")
plt.savefig(filename_pdf)
plt.show()