These python scripts are for the BK XLN Series High Power Programmable DC Power Supplies
Models: XLN3640, XLN6024, XLN8018, XLN10014, XLN15010, XLN30052, XLN60026
XLN Power Supply Manual: Series Manual
XLN Power Supply Data Sheet: Series Data Sheet
Serial-to-USB Bridge: CP1202
BK 8600 Electronic Load Programming Manual: Programming Manual
The XLN power supplies have the following configuration:
bk.baudrate=57600
bk.bytesize=8
bk.parity='N'
bk.stopbits=1
bk.xonxoff=False
bk.rtscts=False
bk.dsrdtr=False
The above settings are the default settings for the pyserial
module, except the baudrate, which is 9600baud
. You have to use 57600baud
with the XLN power supplies.
The following steps must be done before using these scripts:
- Identify the serial port name of your instrument. On Windows, this is a
COMxx
port name. On MacOS, this is/dev/tty.usbserial-{sernum}
, where{sernum}
is the serial number of the XLN power supply. You can use the script list_ports.py to list all serial port devices in your system, and identify the correct Silicon Labs CP1202 USB Bridge device port to use. - Set the
portname
variable to your instrument serial port name. - Change the
model_id
variable to your XLN power supply model.
import serial
import time
script_ver = "v1.0.0"
model_id = b'XLN3640' # change the model_id to your XLN model
portname = '/dev/tty.usbserial-275K22178' # change the device port name for your device name!
# on windows use 'COMxx'
- The XLN power supplies use an internal serial-to-USB bridge chip (CP1202), that is bus-powered by the USB cable. This means that even when the power supply is unpowered, or when the internal processor is unresponsive, the serial port will be normally enumerated and opened. This requires another level of authentication before starting sending commands to the XLN power supply. We verify that the MODEL string returned by the instrument matches the expected
model_id
string, and issue and error when it fails to return the correct model string.
- xln_id.py — retrieves ID info of the connected XLN power supply
- xln_clr_pgm.py — clears all internal stored programs
- xln_gen_pgm.py — generates a staircase waveform in PROG1
- xln_gen_pgm_sine.py — generates a sinewave burst waveform in PROG1
- xln_run_pgm.py — executes the program stored at PROG1
- xln_wave.py — generate a staircase waveform and display realtime voltage and current
- list_ports.py – lists all USB serial ports (USB CDC) in the system. Use to find your serial port. The XLN series has a Silicon Labs CP1202 Serial to USB bridge.
The SCPI commands that you can send via serial port to the XLN Power Supply are detailed in the XLN Series Manual, at pages 1-60 to 1-74. These commands are used as exemplified in the scripts. The following python code snippet sets the power supply output to 12Vdc:
import serial
...
bk = serial.Serial() # obtain 'bk' serial port object
... # configure port, verify XLN is responding
bk.write("SOUR:VOLT 12.0\r\n".encode()) # set output voltage to 12Vdc
bk.write("OUTP ON\r\n".encode()) # turn output voltage ON
...
bk.close() # close serial port
Whenever a remote command is received from the serial port, the XLN power supply enters REMOTE MODE, and the front display indicates RMT in the lower-right corner.
The frontal keyboard is LOCKED in RMT mode, and the user cannot access any local function.
To restore local control, you need to press the decimal point key [.]
which unlocks the keypad.