The SPD series of power supplies feature remote programming capabilities and can be controlled via USB or LAN connection.
In this note, we will use Python and PyVISA to create a program that will connect to an SPD, enable the output, delay, and then disable the output.
There are two areas that differ from some other instrumentation:
- The SPD requires “\n” termination only. Additional characters will cause a failure.
NOTE: SPDs will make an audible “beep” if there is a remote communications error
- Delays, here using the Python “time.sleep” command, are helpful in sequencing and allow the instrument time to respond. 10-100 ms should do for most commands.
Here is a zipped download Python PyVISA SPD Example
#Python 3.7 32 bit
import time # for sleep
rm = visa.ResourceManager()
instadd = ‘USB0::0x0483::0x7540::SPD3XGB4150080::INSTR’
inst = rm.open_resource(instadd)
inst.write_termination=” #Modify default termination character
inst.write(‘OUTP CH1,ON’) #Enable output
inst.write(‘OUTP CH1,OFF’) #Disable output
if __name__ == ‘__main__’: