Este código fue creado para hacer que la fuente de alimentación programable se use en tareas de automatización. Siglent proporciona software nativo, pero tiene muchas dependencias y es engorroso de usar. ¡También el código Python permite controlar el instrumento desde computadoras de una sola placa como Raspberry Pi!
Enlace del fabricante

Este es el archivo API principal para interactuar con el instrumento de fuente de alimentación Siglent. Probado con SPD3303X . Proporciona una forma pitonista simple de operar el instrumento de forma remota y automatizar algunas mediciones.
A pesar del hecho de que Siglent fabrica instrumentos asequibles, hay algunos problemas. No puedo hablar de otras fuentes de alimentación, pero SPD3303X tiene fallas enumeradas a continuación:
Este código demuestra simplicidad de uso.
import siglent_psu_api as siglent
s = siglent.SIGLENT_PSU("192.168.0.22")
# read instrument identification string
i = s.identify()
print(i)
# read instrument status
sys = s.system()
print(sys)
# Set output mode
#s.track(siglent.TRACK.INDEPENDENT)
# switch on CH1
s.output(siglent.CHANNEL.CH1, siglent.STATE.ON)
# set CH1 voltage to 2V
s.set(siglent.CHANNEL.CH1, siglent.PARAMETER.VOLTAGE, 2.0)
# read voltage
r = s.measure(ch = siglent.CHANNEL.CH1, parameter = siglent.PARAMETER.VOLTAGE)
print(r)
Resultados
{'manufacturer': 'Siglent Technologies', 'model': 'SPD3303X', 'sn': 'SPD3XHBX2R****', 'firmware_ver': '1.01.01.02.05', 'hadrware_ver': 'V3.0'}
{'ch1_mode': <MODE.CC: 2>, 'ch2_mode': <MODE.CC: 2>, 'mode': <TRACK.INDEPENDENT: 0>, 'ch1': <STATE.ON: 1>, 'ch2': <STATE.OFF: 0>}
2.001
import siglent_psu_api as siglent
import numpy as np
s = siglent.SIGLENT_PSU("192.168.0.22")
# read instrument identification string
i = s.identify()
print(i)
# read instrument status
sys = s.system()
print(sys)
# switch on CH1
s.output(siglent.CHANNEL.CH1, siglent.STATE.ON)
# sweep specified range
range_min = 1
range_max = 5
range_step = 0.1
ra = np.arange(range_min, range_max, range_step)
for i in ra:
s.set(siglent.CHANNEL.CH1, siglent.PARAMETER.VOLTAGE, i)
r = s.measure(ch = siglent.CHANNEL.CH1, parameter = siglent.PARAMETER.POWER)
print(r)
Resultados
{'manufacturer': 'Siglent Technologies', 'model': 'SPD3303X', 'sn': 'SPD3XHBX2R****', 'firmware_ver': '1.01.01.02.05', 'hadrware_ver': 'V3.0'}
{'ch1_mode': <MODE.CC: 2>, 'ch2_mode': <MODE.CC: 2>, 'mode': <TRACK.INDEPENDENT: 0>, 'ch1': <STATE.ON: 1>, 'ch2': <STATE.OFF: 0>}
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.672
0.698
0.652
0.632
0.527
0.629
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0
0.0